* [PATCH 5/10] ide: add hwif_register_devices() helper
@ 2007-09-11 21:38 Bartlomiej Zolnierkiewicz
2007-10-04 16:19 ` Sergei Shtylyov
0 siblings, 1 reply; 2+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2007-09-11 21:38 UTC (permalink / raw)
To: linux-ide
Add hwif_register_devices() helper to fix code duplication between
probe_hwif_init_with_fixup() and ideprobe_init(). Also remove stale
comment while at it.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-probe.c | 51 +++++++++++++++++++++---------------------------
1 file changed, 23 insertions(+), 28 deletions(-)
Index: b/drivers/ide/ide-probe.c
===================================================================
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -859,6 +859,7 @@ static void probe_hwif(ide_hwif_t *hwif,
}
static int hwif_init(ide_hwif_t *hwif);
+static void hwif_register_devices(ide_hwif_t *hwif);
int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif))
{
@@ -870,24 +871,9 @@ int probe_hwif_init_with_fixup(ide_hwif_
return -1;
}
- if (hwif->present) {
- u16 unit = 0;
- int ret;
-
- for (unit = 0; unit < MAX_DRIVES; ++unit) {
- ide_drive_t *drive = &hwif->drives[unit];
- /* For now don't attach absent drives, we may
- want them on default or a new "empty" class
- for hotplug reprobing ? */
- if (drive->present) {
- ret = device_register(&drive->gendev);
- if (ret < 0)
- printk(KERN_WARNING "IDE: %s: "
- "device_register error: %d\n",
- __FUNCTION__, ret);
- }
- }
- }
+ if (hwif->present)
+ hwif_register_devices(hwif);
+
return 0;
}
@@ -1379,6 +1365,24 @@ out:
return 0;
}
+static void hwif_register_devices(ide_hwif_t *hwif)
+{
+ unsigned int i;
+
+ for (i = 0; i < MAX_DRIVES; i++) {
+ ide_drive_t *drive = &hwif->drives[i];
+
+ if (drive->present) {
+ int ret = device_register(&drive->gendev);
+
+ if (ret < 0)
+ printk(KERN_WARNING "IDE: %s: "
+ "device_register error: %d\n",
+ __FUNCTION__, ret);
+ }
+ }
+}
+
int ideprobe_init (void)
{
unsigned int index;
@@ -1397,20 +1401,11 @@ int ideprobe_init (void)
for (index = 0; index < MAX_HWIFS; ++index) {
if (probe[index]) {
ide_hwif_t *hwif = &ide_hwifs[index];
- int unit;
if (!hwif->present)
continue;
if (hwif->chipset == ide_unknown || hwif->chipset == ide_forced)
hwif->chipset = ide_generic;
- for (unit = 0; unit < MAX_DRIVES; ++unit)
- if (hwif->drives[unit].present) {
- int ret = device_register(
- &hwif->drives[unit].gendev);
- if (ret < 0)
- printk(KERN_WARNING "IDE: %s: "
- "device_register error: %d\n",
- __FUNCTION__, ret);
- }
+ hwif_register_devices(hwif);
}
}
for (index = 0; index < MAX_HWIFS; ++index)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 5/10] ide: add hwif_register_devices() helper
2007-09-11 21:38 [PATCH 5/10] ide: add hwif_register_devices() helper Bartlomiej Zolnierkiewicz
@ 2007-10-04 16:19 ` Sergei Shtylyov
0 siblings, 0 replies; 2+ messages in thread
From: Sergei Shtylyov @ 2007-10-04 16:19 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide
Bartlomiej Zolnierkiewicz wrote:
> Add hwif_register_devices() helper to fix code duplication between
> probe_hwif_init_with_fixup() and ideprobe_init(). Also remove stale
> comment while at it.
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
MBR, Sergei
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-10-04 16:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-11 21:38 [PATCH 5/10] ide: add hwif_register_devices() helper Bartlomiej Zolnierkiewicz
2007-10-04 16:19 ` Sergei Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).