## All lines beginning with `## DP:' are a description of the patch. ## DP: Description: fix IDE modularisation ## DP: Patch author: Herbert Xu ## DP: Upstream status: rejected # diff -aurN a/drivers/ide/ide-generic.c b/drivers/ide/ide-generic.c --- a/drivers/ide/ide-generic.c 2005-06-06 11:22:29.000000000 -0400 +++ b/drivers/ide/ide-generic.c 2005-06-15 22:16:56.000000000 -0400 @@ -11,9 +11,14 @@ #include #include #include +#include static int __init ide_generic_init(void) { +#ifdef CONFIG_BLK_DEV_IDEPCI + ide_scan_pcibus(); +#endif + if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) ide_get_lock(NULL, NULL); /* for atari only */ diff -aurN a/drivers/ide/ide.c b/drivers/ide/ide.c --- a/drivers/ide/ide.c 2005-06-06 11:22:29.000000000 -0400 +++ b/drivers/ide/ide.c 2005-06-15 22:16:56.000000000 -0400 @@ -175,10 +175,11 @@ static int initializing; /* set while initializing built-in drivers */ DECLARE_MUTEX(ide_cfg_sem); +EXPORT_SYMBOL(ide_cfg_sem); __cacheline_aligned_in_smp DEFINE_SPINLOCK(ide_lock); #ifdef CONFIG_BLK_DEV_IDEPCI -static int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */ +int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */ #endif #ifdef CONFIG_IDEDMA_AUTO @@ -1418,6 +1419,8 @@ EXPORT_SYMBOL(generic_ide_ioctl); +EXPORT_SYMBOL(ide_add_generic_settings); + /* * stridx() returns the offset of c within s, * or -1 if c is '\0' or not found within s. @@ -1797,9 +1800,9 @@ */ static void __init probe_for_hwifs (void) { -#ifdef CONFIG_BLK_DEV_IDEPCI - ide_scan_pcibus(ide_scan_direction); -#endif /* CONFIG_BLK_DEV_IDEPCI */ +#if defined(CONFIG_BLK_DEV_IDEPCI) && !defined(MODULE) + ide_scan_pcibus(); +#endif /* CONFIG_BLK_DEV_IDEPCI && !MODULE */ #ifdef CONFIG_ETRAX_IDE { diff -aurN a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c --- a/drivers/ide/setup-pci.c 2005-06-06 11:22:29.000000000 -0400 +++ b/drivers/ide/setup-pci.c 2005-06-15 22:16:56.000000000 -0400 @@ -837,7 +837,7 @@ * boot up the pci layer takes over the job. */ -static int __init ide_scan_pcidev(struct pci_dev *dev) +static int ide_scan_pcidev(struct pci_dev *dev) { struct list_head *l; struct pci_driver *d; @@ -863,21 +863,23 @@ /** * ide_scan_pcibus - perform the initial IDE driver scan - * @scan_direction: set for reverse order scanning * * Perform the initial bus rather than driver ordered scan of the * PCI drivers. After this all IDE pci handling becomes standard * module ordering not traditionally ordered. */ -void __init ide_scan_pcibus (int scan_direction) +void ide_scan_pcibus(void) { struct pci_dev *dev = NULL; struct pci_driver *d; struct list_head *l, *n; + if (!pre_init) + return; + pre_init = 0; - if (!scan_direction) { + if (!ide_scan_direction) { while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { ide_scan_pcidev(dev); } @@ -899,3 +901,5 @@ pci_register_driver(d); } } + +EXPORT_SYMBOL_GPL(ide_scan_pcibus); diff -aurN a/include/linux/ide.h b/include/linux/ide.h --- a/include/linux/ide.h 2005-06-06 11:22:29.000000000 -0400 +++ b/include/linux/ide.h 2005-06-15 22:16:56.000000000 -0400 @@ -1115,6 +1115,7 @@ extern ide_hwif_t ide_hwifs[]; /* master data repository */ #endif extern int noautodma; +extern int ide_scan_direction; extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); extern int __ide_end_request (ide_drive_t *drive, struct request *rq, int uptodate, int nrsecs); @@ -1323,7 +1324,7 @@ extern int ideprobe_init(void); -extern void ide_scan_pcibus(int scan_direction) __init; +extern void ide_scan_pcibus(void); extern int ide_pci_register_driver(struct pci_driver *driver); extern void ide_pci_unregister_driver(struct pci_driver *driver); void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *);