diff mbox series

[2/3] fdc: Inline fdctrl_connect_drives() into fdctrl_realize_common()

Message ID 20210125162402.1807394-3-armbru@redhat.com
State New
Headers show
Series Drop deprecated floppy config & bogus -drive if=T | expand

Commit Message

Markus Armbruster Jan. 25, 2021, 4:24 p.m. UTC
The previous commit rendered the name fdctrl_realize_common() somewhat
misleading.  Get rid of it by inlining the (now pretty simple)
function into its only caller.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/block/fdc.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

Comments

Kevin Wolf Jan. 25, 2021, 5:07 p.m. UTC | #1
Am 25.01.2021 um 17:24 hat Markus Armbruster geschrieben:
> The previous commit rendered the name fdctrl_realize_common() somewhat
> misleading.  Get rid of it by inlining the (now pretty simple)
> function into its only caller.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  hw/block/fdc.c | 23 ++++++++---------------
>  1 file changed, 8 insertions(+), 15 deletions(-)
> 
> diff --git a/hw/block/fdc.c b/hw/block/fdc.c
> index c6c9393e29..7fc547c62d 100644
> --- a/hw/block/fdc.c
> +++ b/hw/block/fdc.c
> @@ -2521,20 +2521,6 @@ void isa_fdc_init_drives(ISADevice *fdc, DriveInfo **fds)
>      fdctrl_init_drives(&ISA_FDC(fdc)->state.bus, fds);
>  }
>  
> -static void fdctrl_connect_drives(FDCtrl *fdctrl, DeviceState *fdc_dev,
> -                                  Error **errp)

The commit message talks about fdctrl_realize_common(). I assume it
really means fdctrl_connect_drives() then?

Kevin
Markus Armbruster Jan. 26, 2021, 7:14 a.m. UTC | #2
Kevin Wolf <kwolf@redhat.com> writes:

> Am 25.01.2021 um 17:24 hat Markus Armbruster geschrieben:
>> The previous commit rendered the name fdctrl_realize_common() somewhat
>> misleading.  Get rid of it by inlining the (now pretty simple)
>> function into its only caller.
>> 
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>>  hw/block/fdc.c | 23 ++++++++---------------
>>  1 file changed, 8 insertions(+), 15 deletions(-)
>> 
>> diff --git a/hw/block/fdc.c b/hw/block/fdc.c
>> index c6c9393e29..7fc547c62d 100644
>> --- a/hw/block/fdc.c
>> +++ b/hw/block/fdc.c
>> @@ -2521,20 +2521,6 @@ void isa_fdc_init_drives(ISADevice *fdc, DriveInfo **fds)
>>      fdctrl_init_drives(&ISA_FDC(fdc)->state.bus, fds);
>>  }
>>  
>> -static void fdctrl_connect_drives(FDCtrl *fdctrl, DeviceState *fdc_dev,
>> -                                  Error **errp)
>
> The commit message talks about fdctrl_realize_common(). I assume it
> really means fdctrl_connect_drives() then?

Yes.  dabbrev-expand accident.  Thanks for spotting it!
diff mbox series

Patch

diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index c6c9393e29..7fc547c62d 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -2521,20 +2521,6 @@  void isa_fdc_init_drives(ISADevice *fdc, DriveInfo **fds)
     fdctrl_init_drives(&ISA_FDC(fdc)->state.bus, fds);
 }
 
-static void fdctrl_connect_drives(FDCtrl *fdctrl, DeviceState *fdc_dev,
-                                  Error **errp)
-{
-    unsigned int i;
-    FDrive *drive;
-
-    for (i = 0; i < MAX_FD; i++) {
-        drive = &fdctrl->drives[i];
-        drive->fdctrl = fdctrl;
-        fd_init(drive);
-        fd_revalidate(drive);
-    }
-}
-
 void fdctrl_init_sysbus(qemu_irq irq, int dma_chann,
                         hwaddr mmio_base, DriveInfo **fds)
 {
@@ -2575,6 +2561,7 @@  static void fdctrl_realize_common(DeviceState *dev, FDCtrl *fdctrl,
                                   Error **errp)
 {
     int i, j;
+    FDrive *drive;
     static int command_tables_inited = 0;
 
     if (fdctrl->fallback == FLOPPY_DRIVE_TYPE_AUTO) {
@@ -2614,7 +2601,13 @@  static void fdctrl_realize_common(DeviceState *dev, FDCtrl *fdctrl,
     }
 
     floppy_bus_create(fdctrl, &fdctrl->bus, dev);
-    fdctrl_connect_drives(fdctrl, dev, errp);
+
+    for (i = 0; i < MAX_FD; i++) {
+        drive = &fdctrl->drives[i];
+        drive->fdctrl = fdctrl;
+        fd_init(drive);
+        fd_revalidate(drive);
+    }
 }
 
 static const MemoryRegionPortio fdc_portio_list[] = {