diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-01-26 14:13:09 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-01-26 14:13:09 -0500 |
commit | 9ac59226ca95889ad620b0e63c0f700679fee5dd (patch) | |
tree | 54771bd08c565fba88e1257482f7cfb32de747ef | |
parent | c99c92c58757985096e2d195dc1631246d99d686 (diff) |
ide: move CONFIG_IDEPCI_PCIBUS_ORDER code to ide-scan-pci.c
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | drivers/ide/ide-scan-pci.c | 110 | ||||
-rw-r--r-- | drivers/ide/setup-pci.c | 103 |
2 files changed, 110 insertions, 103 deletions
diff --git a/drivers/ide/ide-scan-pci.c b/drivers/ide/ide-scan-pci.c index 23015d89e735..7ffa332d77ce 100644 --- a/drivers/ide/ide-scan-pci.c +++ b/drivers/ide/ide-scan-pci.c | |||
@@ -1,8 +1,118 @@ | |||
1 | /* | ||
2 | * support for probing IDE PCI devices in the PCI bus order | ||
3 | * | ||
4 | * Copyright (c) 1998-2000 Andre Hedrick <andre@linux-ide.org> | ||
5 | * Copyright (c) 1995-1998 Mark Lord | ||
6 | * | ||
7 | * May be copied or modified under the terms of the GNU General Public License | ||
8 | */ | ||
9 | |||
1 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
2 | #include <linux/init.h> | 11 | #include <linux/init.h> |
3 | #include <linux/module.h> | 12 | #include <linux/module.h> |
4 | #include <linux/ide.h> | 13 | #include <linux/ide.h> |
5 | 14 | ||
15 | /* | ||
16 | * Module interfaces | ||
17 | */ | ||
18 | |||
19 | static int pre_init = 1; /* Before first ordered IDE scan */ | ||
20 | static LIST_HEAD(ide_pci_drivers); | ||
21 | |||
22 | /* | ||
23 | * __ide_pci_register_driver - attach IDE driver | ||
24 | * @driver: pci driver | ||
25 | * @module: owner module of the driver | ||
26 | * | ||
27 | * Registers a driver with the IDE layer. The IDE layer arranges that | ||
28 | * boot time setup is done in the expected device order and then | ||
29 | * hands the controllers off to the core PCI code to do the rest of | ||
30 | * the work. | ||
31 | * | ||
32 | * Returns are the same as for pci_register_driver | ||
33 | */ | ||
34 | |||
35 | int __ide_pci_register_driver(struct pci_driver *driver, struct module *module, | ||
36 | const char *mod_name) | ||
37 | { | ||
38 | if (!pre_init) | ||
39 | return __pci_register_driver(driver, module, mod_name); | ||
40 | driver->driver.owner = module; | ||
41 | list_add_tail(&driver->node, &ide_pci_drivers); | ||
42 | return 0; | ||
43 | } | ||
44 | EXPORT_SYMBOL_GPL(__ide_pci_register_driver); | ||
45 | |||
46 | /** | ||
47 | * ide_scan_pcidev - find an IDE driver for a device | ||
48 | * @dev: PCI device to check | ||
49 | * | ||
50 | * Look for an IDE driver to handle the device we are considering. | ||
51 | * This is only used during boot up to get the ordering correct. After | ||
52 | * boot up the pci layer takes over the job. | ||
53 | */ | ||
54 | |||
55 | static int __init ide_scan_pcidev(struct pci_dev *dev) | ||
56 | { | ||
57 | struct list_head *l; | ||
58 | struct pci_driver *d; | ||
59 | |||
60 | list_for_each(l, &ide_pci_drivers) { | ||
61 | d = list_entry(l, struct pci_driver, node); | ||
62 | if (d->id_table) { | ||
63 | const struct pci_device_id *id = | ||
64 | pci_match_id(d->id_table, dev); | ||
65 | |||
66 | if (id != NULL && d->probe(dev, id) >= 0) { | ||
67 | dev->driver = d; | ||
68 | pci_dev_get(dev); | ||
69 | return 1; | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | return 0; | ||
74 | } | ||
75 | |||
76 | /** | ||
77 | * ide_scan_pcibus - perform the initial IDE driver scan | ||
78 | * | ||
79 | * Perform the initial bus rather than driver ordered scan of the | ||
80 | * PCI drivers. After this all IDE pci handling becomes standard | ||
81 | * module ordering not traditionally ordered. | ||
82 | */ | ||
83 | |||
84 | int __init ide_scan_pcibus(void) | ||
85 | { | ||
86 | struct pci_dev *dev = NULL; | ||
87 | struct pci_driver *d; | ||
88 | struct list_head *l, *n; | ||
89 | |||
90 | pre_init = 0; | ||
91 | if (!ide_scan_direction) | ||
92 | while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev))) | ||
93 | ide_scan_pcidev(dev); | ||
94 | else | ||
95 | while ((dev = pci_get_device_reverse(PCI_ANY_ID, PCI_ANY_ID, | ||
96 | dev))) | ||
97 | ide_scan_pcidev(dev); | ||
98 | |||
99 | /* | ||
100 | * Hand the drivers over to the PCI layer now we | ||
101 | * are post init. | ||
102 | */ | ||
103 | |||
104 | list_for_each_safe(l, n, &ide_pci_drivers) { | ||
105 | list_del(l); | ||
106 | d = list_entry(l, struct pci_driver, node); | ||
107 | if (__pci_register_driver(d, d->driver.owner, | ||
108 | d->driver.mod_name)) | ||
109 | printk(KERN_ERR "%s: failed to register %s driver\n", | ||
110 | __FUNCTION__, d->driver.mod_name); | ||
111 | } | ||
112 | |||
113 | return 0; | ||
114 | } | ||
115 | |||
6 | static int __init ide_scan_pci(void) | 116 | static int __init ide_scan_pci(void) |
7 | { | 117 | { |
8 | return ide_scan_pcibus(); | 118 | return ide_scan_pcibus(); |
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index be9ae5a38cc7..676c66e72881 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c | |||
@@ -698,106 +698,3 @@ out: | |||
698 | } | 698 | } |
699 | 699 | ||
700 | EXPORT_SYMBOL_GPL(ide_setup_pci_devices); | 700 | EXPORT_SYMBOL_GPL(ide_setup_pci_devices); |
701 | |||
702 | #ifdef CONFIG_IDEPCI_PCIBUS_ORDER | ||
703 | /* | ||
704 | * Module interfaces | ||
705 | */ | ||
706 | |||
707 | static int pre_init = 1; /* Before first ordered IDE scan */ | ||
708 | static LIST_HEAD(ide_pci_drivers); | ||
709 | |||
710 | /* | ||
711 | * __ide_pci_register_driver - attach IDE driver | ||
712 | * @driver: pci driver | ||
713 | * @module: owner module of the driver | ||
714 | * | ||
715 | * Registers a driver with the IDE layer. The IDE layer arranges that | ||
716 | * boot time setup is done in the expected device order and then | ||
717 | * hands the controllers off to the core PCI code to do the rest of | ||
718 | * the work. | ||
719 | * | ||
720 | * Returns are the same as for pci_register_driver | ||
721 | */ | ||
722 | |||
723 | int __ide_pci_register_driver(struct pci_driver *driver, struct module *module, | ||
724 | const char *mod_name) | ||
725 | { | ||
726 | if (!pre_init) | ||
727 | return __pci_register_driver(driver, module, mod_name); | ||
728 | driver->driver.owner = module; | ||
729 | list_add_tail(&driver->node, &ide_pci_drivers); | ||
730 | return 0; | ||
731 | } | ||
732 | EXPORT_SYMBOL_GPL(__ide_pci_register_driver); | ||
733 | |||
734 | /** | ||
735 | * ide_scan_pcidev - find an IDE driver for a device | ||
736 | * @dev: PCI device to check | ||
737 | * | ||
738 | * Look for an IDE driver to handle the device we are considering. | ||
739 | * This is only used during boot up to get the ordering correct. After | ||
740 | * boot up the pci layer takes over the job. | ||
741 | */ | ||
742 | |||
743 | static int __init ide_scan_pcidev(struct pci_dev *dev) | ||
744 | { | ||
745 | struct list_head *l; | ||
746 | struct pci_driver *d; | ||
747 | |||
748 | list_for_each(l, &ide_pci_drivers) { | ||
749 | d = list_entry(l, struct pci_driver, node); | ||
750 | if (d->id_table) { | ||
751 | const struct pci_device_id *id = | ||
752 | pci_match_id(d->id_table, dev); | ||
753 | |||
754 | if (id != NULL && d->probe(dev, id) >= 0) { | ||
755 | dev->driver = d; | ||
756 | pci_dev_get(dev); | ||
757 | return 1; | ||
758 | } | ||
759 | } | ||
760 | } | ||
761 | return 0; | ||
762 | } | ||
763 | |||
764 | /** | ||
765 | * ide_scan_pcibus - perform the initial IDE driver scan | ||
766 | * | ||
767 | * Perform the initial bus rather than driver ordered scan of the | ||
768 | * PCI drivers. After this all IDE pci handling becomes standard | ||
769 | * module ordering not traditionally ordered. | ||
770 | */ | ||
771 | |||
772 | int __init ide_scan_pcibus(void) | ||
773 | { | ||
774 | struct pci_dev *dev = NULL; | ||
775 | struct pci_driver *d; | ||
776 | struct list_head *l, *n; | ||
777 | |||
778 | pre_init = 0; | ||
779 | if (!ide_scan_direction) | ||
780 | while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev))) | ||
781 | ide_scan_pcidev(dev); | ||
782 | else | ||
783 | while ((dev = pci_get_device_reverse(PCI_ANY_ID, PCI_ANY_ID, | ||
784 | dev))) | ||
785 | ide_scan_pcidev(dev); | ||
786 | |||
787 | /* | ||
788 | * Hand the drivers over to the PCI layer now we | ||
789 | * are post init. | ||
790 | */ | ||
791 | |||
792 | list_for_each_safe(l, n, &ide_pci_drivers) { | ||
793 | list_del(l); | ||
794 | d = list_entry(l, struct pci_driver, node); | ||
795 | if (__pci_register_driver(d, d->driver.owner, | ||
796 | d->driver.mod_name)) | ||
797 | printk(KERN_ERR "%s: failed to register %s driver\n", | ||
798 | __FUNCTION__, d->driver.mod_name); | ||
799 | } | ||
800 | |||
801 | return 0; | ||
802 | } | ||
803 | #endif | ||