Skip to contentSkip to conversation

ide: remove ideprobe_init()

PATCH In review Bartlomiej Zolnierkiewicz 2 participants 4 messages Nov 18, 2007 – Dec 17, 2007 libata

lore
Share & tools
lore
#0 lore raw

PATCH 14/21 ide: remove ideprobe_init()

* Rename ide_device_add() to ide_device_add_all() and make it accept 'u8 idx[MAX_HWIFS]' instead of 'u8 idx[4]' as an argument.

* Add ide_device_add() wrapper for ide_device_add_all().

* Convert ide_generic_init() to use ide_device_add_all().

* Remove no longer needed ideprobe_init().

There should be no functionality changes caused by this patch.

---
 drivers/ide/ide-generic.c |    8 +++++-
 drivers/ide/ide-probe.c   |   54 +++++++++++++---------------------------------
 include/linux/ide.h       |    3 --
 3 files changed, 24 insertions(+), 41 deletions(-)
drivers/ide/ide-generic.c +7 -1
Index: b/drivers/ide/ide-generic.c
===================================================================
@@ -14,10 +14,16 @@
 
 static int __init ide_generic_init(void)
 {
+	u8 idx[MAX_HWIFS];
+	int i;
+
 	if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET])
 		ide_get_lock(NULL, NULL); /* for atari only */
 
-	(void)ideprobe_init();
+	for (i = 0; i < MAX_HWIFS; i++)
+		idx[i] = ide_hwifs[i].present ? 0xff : i;
+
+	ide_device_add_all(idx);
 
 	if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET])
 		ide_release_lock();	/* for atari only */
drivers/ide/ide-probe.c +16 -38

87 lines not on this page · raw message

include/linux/ide.h +1 -2
Index: b/include/linux/ide.h
===================================================================
@@ -1011,8 +1011,6 @@ extern void do_ide_request(struct reques
 
 void ide_init_disk(struct gendisk *, ide_drive_t *);
 
-extern int ideprobe_init(void);
-
 #ifdef CONFIG_IDEPCI_PCIBUS_ORDER
 extern void ide_scan_pcibus(int scan_direction) __init;
 extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name);
@@ -1202,6 +1200,7 @@ void ide_unregister_region(struct gendis
 
 void ide_undecoded_slave(ide_drive_t *);
 
+int ide_device_add_all(u8 idx[MAX_HWIFS]);
 int ide_device_add(u8 idx[4]);
 
 static inline void *ide_get_hwifdata (ide_hwif_t * hwif)
#1 lore raw

PATCH 1/1 Fix build break caused by "ide: remove ideprobe_init()"

Fix build break of powerpc holly_defconfig:

In file included from arch/powerpc/platforms/embedded6xx/holly.c:24:
include/linux/ide.h:1206: error: 'CONFIG_IDE_MAX_HWIFS' undeclared here (not in a function)

There's no need to have a sized array in the prototype, might as well turn it into a pointer.

It could probably be argued that large parts of the include file can be covered under #ifdef CONFIG_IDE, but that's a larger undertaking.

---

Quoted 11 lines · Bartlomiej Zolnierkiewicz

* Rename ide_device_add() to ide_device_add_all() and make it accept 'u8 idx[MAX_HWIFS]' instead of 'u8 idx[4]' as an argument.

* Add ide_device_add() wrapper for ide_device_add_all().

* Convert ide_generic_init() to use ide_device_add_all().

* Remove no longer needed ideprobe_init().

There should be no functionality changes caused by this patch.

This patch broke builds of powerpc holly_defconfig in -mm. It has CONFIG_EMBEDDED=y, CONFIG_IDE=n but includes linux/ide.h:

drivers/ide/ide-probe.c +1 -1
Index: mm/drivers/ide/ide-probe.c
===================================================================
@@ -1335,7 +1335,7 @@ static void hwif_register_devices(ide_hw
 	}
 }
 
-int ide_device_add_all(u8 idx[MAX_HWIFS])
+int ide_device_add_all(u8 *idx)
 {
 	ide_hwif_t *hwif;
 	int i, rc = 0;
include/linux/ide.h +1 -1
Index: mm/include/linux/ide.h
===================================================================
@@ -1203,7 +1203,7 @@ void ide_unregister_region(struct gendis
 
 void ide_undecoded_slave(ide_drive_t *);
 
-int ide_device_add_all(u8 idx[MAX_HWIFS]);
+int ide_device_add_all(u8 *idx);
 int ide_device_add(u8 idx[4]);
 
 static inline void *ide_get_hwifdata (ide_hwif_t * hwif)
#2 lore raw

Re: [PATCH] Fix build break caused by "ide: remove ideprobe_init()"

Hi,

Quoted 1 line · Olof Johansson

Fix build break of powerpc holly_defconfig:

Sorry for breaking the hol[l]y powerpc platform. ;)

Quoted 11 lines

In file included from arch/powerpc/platforms/embedded6xx/holly.c:24:
include/linux/ide.h:1206: error: 'CONFIG_IDE_MAX_HWIFS' undeclared here (not in a function)

There's no need to have a sized array in the prototype, might as well turn it into a pointer.

It could probably be argued that large parts of the include file can be covered under #ifdef CONFIG_IDE, but that's a larger undertaking.

applied but...

Quoted 9 lines

---

Quoted 6 lines · Bartlomiej Zolnierkiewicz

* Rename ide_device_add() to ide_device_add_all() and make it accept 'u8 idx[MAX_HWIFS]' instead of 'u8 idx[4]' as an argument.

* Add ide_device_add() wrapper for ide_device_add_all().

Quoted 8 lines
Quoted 5 lines

* Convert ide_generic_init() to use ide_device_add_all().

* Remove no longer needed ideprobe_init().

There should be no functionality changes caused by this patch.

This patch broke builds of powerpc holly_defconfig in -mm. It has CONFIG_EMBEDDED=y, CONFIG_IDE=n but includes linux/ide.h:

                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

...could you also fix the root source of the problem so the similar issue won't re-appear in the future?

<linux/ide.h> is IDE subsystem specific in the same way that <linux/libata.h> is libata specific, <linux/ata.h> is the place to put subsystem independent defines, inlines and co.

There are some powerpc abusers of the above rule but they should at least cover references to <linux/ide.h> and IDE subsystem specific code with #ifdef/#endif CONFIG_BLK_DEV_IDE.

In arch/powerpc/platforms/embedded6xx/holly.c case it seems that <linux/ide.h> include is actually not needed and may be just removed?

Bart

Quoted 26 lines

Index: mm/drivers/ide/ide-probe.c
===================================================================

drivers/ide/ide-probe.c +1 -1
@@ -1335,7 +1335,7 @@ static void hwif_register_devices(ide_hw
 	}
 }
 
-int ide_device_add_all(u8 idx[MAX_HWIFS])
+int ide_device_add_all(u8 *idx)
 {
 	ide_hwif_t *hwif;
 	int i, rc = 0;

Index: mm/include/linux/ide.h
===================================================================

include/linux/ide.h +1 -1
@@ -1203,7 +1203,7 @@ void ide_unregister_region(struct gendis
 
 void ide_undecoded_slave(ide_drive_t *);
 
-int ide_device_add_all(u8 idx[MAX_HWIFS]);
+int ide_device_add_all(u8 *idx);
 int ide_device_add(u8 idx[4]);
 
 static inline void *ide_get_hwifdata (ide_hwif_t * hwif)
#3 lore raw

Re: [PATCH] Fix build break caused by "ide: remove ideprobe_init()"

Quoted 31 lines · Bartlomiej Zolnierkiewicz

Hi,

applied but...

Quoted 9 lines

---

Quoted 6 lines · Bartlomiej Zolnierkiewicz

* Rename ide_device_add() to ide_device_add_all() and make it accept 'u8 idx[MAX_HWIFS]' instead of 'u8 idx[4]' as an argument.

* Add ide_device_add() wrapper for ide_device_add_all().

Quoted 8 lines
Quoted 5 lines

* Convert ide_generic_init() to use ide_device_add_all().

* Remove no longer needed ideprobe_init().

There should be no functionality changes caused by this patch.

This patch broke builds of powerpc holly_defconfig in -mm. It has CONFIG_EMBEDDED=y, CONFIG_IDE=n but includes linux/ide.h:

                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

...could you also fix the root source of the problem so the similar issue won't re-appear in the future?

<linux/ide.h> is IDE subsystem specific in the same way that <linux/libata.h> is libata specific, <linux/ata.h> is the place to put subsystem independent defines, inlines and co.

Quoted 6 lines

There are some powerpc abusers of the above rule but they should at least cover references to <linux/ide.h> and IDE subsystem specific code with #ifdef/#endif CONFIG_BLK_DEV_IDE.

In arch/powerpc/platforms/embedded6xx/holly.c case it seems that <linux/ide.h> include is actually not needed and may be just removed?

Yep, that was my original simple fix to the problem, but when I looked closer I wanted to get the include file fixed as well.

Turns out I never posted the powerpc patch :), I'll do so (and audit other platforms for the same).

Thanks,

-Olof