linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 14/21] ide: remove ideprobe_init()
@ 2007-11-18 22:25 Bartlomiej Zolnierkiewicz
  2007-12-14  9:09 ` [PATCH] Fix build break caused by "ide: remove ideprobe_init()" Olof Johansson
  0 siblings, 1 reply; 4+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2007-11-18 22:25 UTC (permalink / raw)
  To: linux-ide


* 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.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-generic.c |    8 +++++-
 drivers/ide/ide-probe.c   |   54 +++++++++++++---------------------------------
 include/linux/ide.h       |    3 --
 3 files changed, 24 insertions(+), 41 deletions(-)

Index: b/drivers/ide/ide-generic.c
===================================================================
--- a/drivers/ide/ide-generic.c
+++ 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 */
Index: b/drivers/ide/ide-probe.c
===================================================================
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1347,52 +1347,19 @@ static void hwif_register_devices(ide_hw
 	}
 }
 
-int ideprobe_init (void)
-{
-	unsigned int index;
-	int probe[MAX_HWIFS];
-
-	memset(probe, 0, MAX_HWIFS * sizeof(int));
-	for (index = 0; index < MAX_HWIFS; ++index)
-		probe[index] = !ide_hwifs[index].present;
-
-	for (index = 0; index < MAX_HWIFS; ++index)
-		if (probe[index])
-			probe_hwif(&ide_hwifs[index]);
-	for (index = 0; index < MAX_HWIFS; ++index)
-		if (probe[index])
-			hwif_init(&ide_hwifs[index]);
-	for (index = 0; index < MAX_HWIFS; ++index) {
-		if (probe[index]) {
-			ide_hwif_t *hwif = &ide_hwifs[index];
-			if (!hwif->present)
-				continue;
-			if (hwif->chipset == ide_unknown || hwif->chipset == ide_forced)
-				hwif->chipset = ide_generic;
-			hwif_register_devices(hwif);
-		}
-	}
-	for (index = 0; index < MAX_HWIFS; ++index)
-		if (probe[index])
-			ide_proc_register_port(&ide_hwifs[index]);
-	return 0;
-}
-
-EXPORT_SYMBOL_GPL(ideprobe_init);
-
-int ide_device_add(u8 idx[4])
+int ide_device_add_all(u8 idx[MAX_HWIFS])
 {
 	ide_hwif_t *hwif;
 	int i, rc = 0;
 
-	for (i = 0; i < 4; i++) {
+	for (i = 0; i < MAX_HWIFS; i++) {
 		if (idx[i] == 0xff)
 			continue;
 
 		probe_hwif(&ide_hwifs[idx[i]]);
 	}
 
-	for (i = 0; i < 4; i++) {
+	for (i = 0; i < MAX_HWIFS; i++) {
 		if (idx[i] == 0xff)
 			continue;
 
@@ -1406,7 +1373,7 @@ int ide_device_add(u8 idx[4])
 		}
 	}
 
-	for (i = 0; i < 4; i++) {
+	for (i = 0; i < MAX_HWIFS; i++) {
 		if (idx[i] == 0xff)
 			continue;
 
@@ -1420,12 +1387,23 @@ int ide_device_add(u8 idx[4])
 		}
 	}
 
-	for (i = 0; i < 4; i++) {
+	for (i = 0; i < MAX_HWIFS; i++) {
 		if (idx[i] != 0xff)
 			ide_proc_register_port(&ide_hwifs[idx[i]]);
 	}
 
 	return rc;
 }
+EXPORT_SYMBOL_GPL(ide_device_add_all);
 
+int ide_device_add(u8 idx[4])
+{
+	u8 idx_all[MAX_HWIFS];
+	int i;
+
+	for (i = 0; i < MAX_HWIFS; i++)
+		idx_all[i] = (i < 4) ? idx[i] : 0xff;
+
+	return ide_device_add_all(idx_all);
+}
 EXPORT_SYMBOL_GPL(ide_device_add);
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ 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)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] Fix build break caused by "ide: remove ideprobe_init()"
  2007-11-18 22:25 [PATCH 14/21] ide: remove ideprobe_init() Bartlomiej Zolnierkiewicz
@ 2007-12-14  9:09 ` Olof Johansson
  2007-12-17 20:53   ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 4+ messages in thread
From: Olof Johansson @ 2007-12-14  9:09 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, akpm, linuxppc-dev

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.


Signed-off-by: Olof Johansson <olof@lixom.net>

---

On Sun, Nov 18, 2007 at 11:25:09PM +0100, Bartlomiej Zolnierkiewicz wrote:
> 
> * 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:


Index: mm/drivers/ide/ide-probe.c
===================================================================
--- mm.orig/drivers/ide/ide-probe.c
+++ 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;
Index: mm/include/linux/ide.h
===================================================================
--- mm.orig/include/linux/ide.h
+++ 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)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix build break caused by "ide: remove ideprobe_init()"
  2007-12-14  9:09 ` [PATCH] Fix build break caused by "ide: remove ideprobe_init()" Olof Johansson
@ 2007-12-17 20:53   ` Bartlomiej Zolnierkiewicz
  2007-12-17 22:56     ` Olof Johansson
  0 siblings, 1 reply; 4+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2007-12-17 20:53 UTC (permalink / raw)
  To: Olof Johansson; +Cc: linux-ide, akpm, linuxppc-dev


Hi,

On Friday 14 December 2007, Olof Johansson wrote:
> Fix build break of powerpc holly_defconfig:

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

> 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.
> 
> 
> Signed-off-by: Olof Johansson <olof@lixom.net>

applied but...

> ---
> 
> On Sun, Nov 18, 2007 at 11:25:09PM +0100, Bartlomiej Zolnierkiewicz wrote:
> > 
> > * 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:
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

...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

> Index: mm/drivers/ide/ide-probe.c
> ===================================================================
> --- mm.orig/drivers/ide/ide-probe.c
> +++ 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;
> Index: mm/include/linux/ide.h
> ===================================================================
> --- mm.orig/include/linux/ide.h
> +++ 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)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix build break caused by "ide: remove ideprobe_init()"
  2007-12-17 20:53   ` Bartlomiej Zolnierkiewicz
@ 2007-12-17 22:56     ` Olof Johansson
  0 siblings, 0 replies; 4+ messages in thread
From: Olof Johansson @ 2007-12-17 22:56 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, akpm, linuxppc-dev

On Mon, Dec 17, 2007 at 09:53:31PM +0100, Bartlomiej Zolnierkiewicz wrote:
> 
> Hi,
> 
> applied but...
> 
> > ---
> > 
> > On Sun, Nov 18, 2007 at 11:25:09PM +0100, Bartlomiej Zolnierkiewicz wrote:
> > > 
> > > * 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:
>                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> ...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?

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-12-17 22:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-18 22:25 [PATCH 14/21] ide: remove ideprobe_init() Bartlomiej Zolnierkiewicz
2007-12-14  9:09 ` [PATCH] Fix build break caused by "ide: remove ideprobe_init()" Olof Johansson
2007-12-17 20:53   ` Bartlomiej Zolnierkiewicz
2007-12-17 22:56     ` Olof Johansson

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).