diff mbox

smc91c111: qdevify reset

Message ID 1306860503-13248-1-git-send-email-peter.maydell@linaro.org
State Accepted
Commit 1e36f6a5b573009267160edc33cb216c9621abc0
Headers show

Commit Message

Peter Maydell May 31, 2011, 4:48 p.m. UTC
From: Juha Riihimäki <juha.riihimaki@nokia.com>

Register the smc91c111 reset function as a qdev reset function.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/smc91c111.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

Comments

Peter Maydell June 14, 2011, 5:11 p.m. UTC | #1
Ping?

On 31 May 2011 17:48, Peter Maydell <peter.maydell@linaro.org> wrote:
> From: Juha Riihimäki <juha.riihimaki@nokia.com>
>
> Register the smc91c111 reset function as a qdev reset function.
>
> Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  hw/smc91c111.c |    9 ++++-----
>  1 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/hw/smc91c111.c b/hw/smc91c111.c
> index dafea5c..701baaf 100644
> --- a/hw/smc91c111.c
> +++ b/hw/smc91c111.c
> @@ -252,8 +252,9 @@ static void smc91c111_queue_tx(smc91c111_state *s, int packet)
>     smc91c111_do_tx(s);
>  }
>
> -static void smc91c111_reset(smc91c111_state *s)
> +static void smc91c111_reset(DeviceState *dev)
>  {
> +    smc91c111_state *s = FROM_SYSBUS(smc91c111_state, sysbus_from_qdev(dev));
>     s->bank = 0;
>     s->tx_fifo_len = 0;
>     s->tx_fifo_done_len = 0;
> @@ -302,7 +303,7 @@ static void smc91c111_writeb(void *opaque, target_phys_addr_t offset,
>         case 5:
>             SET_HIGH(rcr, value);
>             if (s->rcr & RCR_SOFT_RST)
> -                smc91c111_reset(s);
> +                smc91c111_reset(&s->busdev.qdev);
>             return;
>         case 10: case 11: /* RPCR */
>             /* Ignored */
> @@ -753,9 +754,6 @@ static int smc91c111_init1(SysBusDevice *dev)
>     sysbus_init_mmio(dev, 16, s->mmio_index);
>     sysbus_init_irq(dev, &s->irq);
>     qemu_macaddr_default_if_unset(&s->conf.macaddr);
> -
> -    smc91c111_reset(s);
> -
>     s->nic = qemu_new_nic(&net_smc91c111_info, &s->conf,
>                           dev->qdev.info->name, dev->qdev.id, s);
>     qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
> @@ -768,6 +766,7 @@ static SysBusDeviceInfo smc91c111_info = {
>     .qdev.name  = "smc91c111",
>     .qdev.size  = sizeof(smc91c111_state),
>     .qdev.vmsd = &vmstate_smc91c111,
> +    .qdev.reset = smc91c111_reset,
>     .qdev.props = (Property[]) {
>         DEFINE_NIC_PROPERTIES(smc91c111_state, conf),
>         DEFINE_PROP_END_OF_LIST(),
> --
> 1.7.1
>
>
>
Blue Swirl June 15, 2011, 7:49 p.m. UTC | #2
On Tue, Jun 14, 2011 at 8:11 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> Ping?

Thanks, applied.

> On 31 May 2011 17:48, Peter Maydell <peter.maydell@linaro.org> wrote:
>> From: Juha Riihimäki <juha.riihimaki@nokia.com>
>>
>> Register the smc91c111 reset function as a qdev reset function.
>>
>> Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
>> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>> ---
>>  hw/smc91c111.c |    9 ++++-----
>>  1 files changed, 4 insertions(+), 5 deletions(-)
>>
>> diff --git a/hw/smc91c111.c b/hw/smc91c111.c
>> index dafea5c..701baaf 100644
>> --- a/hw/smc91c111.c
>> +++ b/hw/smc91c111.c
>> @@ -252,8 +252,9 @@ static void smc91c111_queue_tx(smc91c111_state *s, int packet)
>>     smc91c111_do_tx(s);
>>  }
>>
>> -static void smc91c111_reset(smc91c111_state *s)
>> +static void smc91c111_reset(DeviceState *dev)
>>  {
>> +    smc91c111_state *s = FROM_SYSBUS(smc91c111_state, sysbus_from_qdev(dev));
>>     s->bank = 0;
>>     s->tx_fifo_len = 0;
>>     s->tx_fifo_done_len = 0;
>> @@ -302,7 +303,7 @@ static void smc91c111_writeb(void *opaque, target_phys_addr_t offset,
>>         case 5:
>>             SET_HIGH(rcr, value);
>>             if (s->rcr & RCR_SOFT_RST)
>> -                smc91c111_reset(s);
>> +                smc91c111_reset(&s->busdev.qdev);
>>             return;
>>         case 10: case 11: /* RPCR */
>>             /* Ignored */
>> @@ -753,9 +754,6 @@ static int smc91c111_init1(SysBusDevice *dev)
>>     sysbus_init_mmio(dev, 16, s->mmio_index);
>>     sysbus_init_irq(dev, &s->irq);
>>     qemu_macaddr_default_if_unset(&s->conf.macaddr);
>> -
>> -    smc91c111_reset(s);
>> -
>>     s->nic = qemu_new_nic(&net_smc91c111_info, &s->conf,
>>                           dev->qdev.info->name, dev->qdev.id, s);
>>     qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
>> @@ -768,6 +766,7 @@ static SysBusDeviceInfo smc91c111_info = {
>>     .qdev.name  = "smc91c111",
>>     .qdev.size  = sizeof(smc91c111_state),
>>     .qdev.vmsd = &vmstate_smc91c111,
>> +    .qdev.reset = smc91c111_reset,
>>     .qdev.props = (Property[]) {
>>         DEFINE_NIC_PROPERTIES(smc91c111_state, conf),
>>         DEFINE_PROP_END_OF_LIST(),
>> --
>> 1.7.1
>>
>>
>>
>
>
>
> --
> 12345678901234567890123456789012345678901234567890123456789012345678901234567890
>          1         2         3         4         5         6         7         8
>
>
diff mbox

Patch

diff --git a/hw/smc91c111.c b/hw/smc91c111.c
index dafea5c..701baaf 100644
--- a/hw/smc91c111.c
+++ b/hw/smc91c111.c
@@ -252,8 +252,9 @@  static void smc91c111_queue_tx(smc91c111_state *s, int packet)
     smc91c111_do_tx(s);
 }
 
-static void smc91c111_reset(smc91c111_state *s)
+static void smc91c111_reset(DeviceState *dev)
 {
+    smc91c111_state *s = FROM_SYSBUS(smc91c111_state, sysbus_from_qdev(dev));
     s->bank = 0;
     s->tx_fifo_len = 0;
     s->tx_fifo_done_len = 0;
@@ -302,7 +303,7 @@  static void smc91c111_writeb(void *opaque, target_phys_addr_t offset,
         case 5:
             SET_HIGH(rcr, value);
             if (s->rcr & RCR_SOFT_RST)
-                smc91c111_reset(s);
+                smc91c111_reset(&s->busdev.qdev);
             return;
         case 10: case 11: /* RPCR */
             /* Ignored */
@@ -753,9 +754,6 @@  static int smc91c111_init1(SysBusDevice *dev)
     sysbus_init_mmio(dev, 16, s->mmio_index);
     sysbus_init_irq(dev, &s->irq);
     qemu_macaddr_default_if_unset(&s->conf.macaddr);
-
-    smc91c111_reset(s);
-
     s->nic = qemu_new_nic(&net_smc91c111_info, &s->conf,
                           dev->qdev.info->name, dev->qdev.id, s);
     qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
@@ -768,6 +766,7 @@  static SysBusDeviceInfo smc91c111_info = {
     .qdev.name  = "smc91c111",
     .qdev.size  = sizeof(smc91c111_state),
     .qdev.vmsd = &vmstate_smc91c111,
+    .qdev.reset = smc91c111_reset,
     .qdev.props = (Property[]) {
         DEFINE_NIC_PROPERTIES(smc91c111_state, conf),
         DEFINE_PROP_END_OF_LIST(),