diff options
-rw-r--r-- | drivers/ide/setup-pci.c | 12 | ||||
-rw-r--r-- | drivers/pci/pci-driver.c | 9 | ||||
-rw-r--r-- | include/linux/ide.h | 3 | ||||
-rw-r--r-- | include/linux/pci.h | 10 |
4 files changed, 22 insertions, 12 deletions
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 18ed7765417c..d4f2111d4364 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c | |||
@@ -787,8 +787,9 @@ static int pre_init = 1; /* Before first ordered IDE scan */ | |||
787 | static LIST_HEAD(ide_pci_drivers); | 787 | static LIST_HEAD(ide_pci_drivers); |
788 | 788 | ||
789 | /* | 789 | /* |
790 | * ide_register_pci_driver - attach IDE driver | 790 | * __ide_register_pci_driver - attach IDE driver |
791 | * @driver: pci driver | 791 | * @driver: pci driver |
792 | * @module: owner module of the driver | ||
792 | * | 793 | * |
793 | * Registers a driver with the IDE layer. The IDE layer arranges that | 794 | * Registers a driver with the IDE layer. The IDE layer arranges that |
794 | * boot time setup is done in the expected device order and then | 795 | * boot time setup is done in the expected device order and then |
@@ -801,15 +802,16 @@ static LIST_HEAD(ide_pci_drivers); | |||
801 | * Returns are the same as for pci_register_driver | 802 | * Returns are the same as for pci_register_driver |
802 | */ | 803 | */ |
803 | 804 | ||
804 | int ide_pci_register_driver(struct pci_driver *driver) | 805 | int __ide_pci_register_driver(struct pci_driver *driver, struct module *module) |
805 | { | 806 | { |
806 | if(!pre_init) | 807 | if(!pre_init) |
807 | return pci_module_init(driver); | 808 | return __pci_register_driver(driver, module); |
809 | driver->driver.owner = module; | ||
808 | list_add_tail(&driver->node, &ide_pci_drivers); | 810 | list_add_tail(&driver->node, &ide_pci_drivers); |
809 | return 0; | 811 | return 0; |
810 | } | 812 | } |
811 | 813 | ||
812 | EXPORT_SYMBOL_GPL(ide_pci_register_driver); | 814 | EXPORT_SYMBOL_GPL(__ide_pci_register_driver); |
813 | 815 | ||
814 | /** | 816 | /** |
815 | * ide_unregister_pci_driver - unregister an IDE driver | 817 | * ide_unregister_pci_driver - unregister an IDE driver |
@@ -897,6 +899,6 @@ void __init ide_scan_pcibus (int scan_direction) | |||
897 | { | 899 | { |
898 | list_del(l); | 900 | list_del(l); |
899 | d = list_entry(l, struct pci_driver, node); | 901 | d = list_entry(l, struct pci_driver, node); |
900 | pci_register_driver(d); | 902 | __pci_register_driver(d, d->driver.owner); |
901 | } | 903 | } |
902 | } | 904 | } |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index efb88c10ed16..a9046d4b8af3 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -364,15 +364,16 @@ static struct kobj_type pci_driver_kobj_type = { | |||
364 | }; | 364 | }; |
365 | 365 | ||
366 | /** | 366 | /** |
367 | * pci_register_driver - register a new pci driver | 367 | * __pci_register_driver - register a new pci driver |
368 | * @drv: the driver structure to register | 368 | * @drv: the driver structure to register |
369 | * @owner: owner module of drv | ||
369 | * | 370 | * |
370 | * Adds the driver structure to the list of registered drivers. | 371 | * Adds the driver structure to the list of registered drivers. |
371 | * Returns a negative value on error, otherwise 0. | 372 | * Returns a negative value on error, otherwise 0. |
372 | * If no error occurred, the driver remains registered even if | 373 | * If no error occurred, the driver remains registered even if |
373 | * no device was claimed during registration. | 374 | * no device was claimed during registration. |
374 | */ | 375 | */ |
375 | int pci_register_driver(struct pci_driver *drv) | 376 | int __pci_register_driver(struct pci_driver *drv, struct module *owner) |
376 | { | 377 | { |
377 | int error; | 378 | int error; |
378 | 379 | ||
@@ -389,7 +390,7 @@ int pci_register_driver(struct pci_driver *drv) | |||
389 | printk(KERN_WARNING "Warning: PCI driver %s has a struct " | 390 | printk(KERN_WARNING "Warning: PCI driver %s has a struct " |
390 | "device_driver shutdown method, please update!\n", | 391 | "device_driver shutdown method, please update!\n", |
391 | drv->name); | 392 | drv->name); |
392 | drv->driver.owner = drv->owner; | 393 | drv->driver.owner = owner; |
393 | drv->driver.kobj.ktype = &pci_driver_kobj_type; | 394 | drv->driver.kobj.ktype = &pci_driver_kobj_type; |
394 | 395 | ||
395 | spin_lock_init(&drv->dynids.lock); | 396 | spin_lock_init(&drv->dynids.lock); |
@@ -526,7 +527,7 @@ postcore_initcall(pci_driver_init); | |||
526 | 527 | ||
527 | EXPORT_SYMBOL(pci_match_id); | 528 | EXPORT_SYMBOL(pci_match_id); |
528 | EXPORT_SYMBOL(pci_match_device); | 529 | EXPORT_SYMBOL(pci_match_device); |
529 | EXPORT_SYMBOL(pci_register_driver); | 530 | EXPORT_SYMBOL(__pci_register_driver); |
530 | EXPORT_SYMBOL(pci_unregister_driver); | 531 | EXPORT_SYMBOL(pci_unregister_driver); |
531 | EXPORT_SYMBOL(pci_dev_driver); | 532 | EXPORT_SYMBOL(pci_dev_driver); |
532 | EXPORT_SYMBOL(pci_bus_type); | 533 | EXPORT_SYMBOL(pci_bus_type); |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 77ae55d4c13c..ac8b25fa6506 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -1329,7 +1329,8 @@ void ide_init_disk(struct gendisk *, ide_drive_t *); | |||
1329 | extern int ideprobe_init(void); | 1329 | extern int ideprobe_init(void); |
1330 | 1330 | ||
1331 | extern void ide_scan_pcibus(int scan_direction) __init; | 1331 | extern void ide_scan_pcibus(int scan_direction) __init; |
1332 | extern int ide_pci_register_driver(struct pci_driver *driver); | 1332 | extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner); |
1333 | #define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE) | ||
1333 | extern void ide_pci_unregister_driver(struct pci_driver *driver); | 1334 | extern void ide_pci_unregister_driver(struct pci_driver *driver); |
1334 | void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *); | 1335 | void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *); |
1335 | extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d); | 1336 | extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d); |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 7063241e34d9..60702fccf9e7 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -433,8 +433,13 @@ int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, | |||
433 | void *alignf_data); | 433 | void *alignf_data); |
434 | void pci_enable_bridges(struct pci_bus *bus); | 434 | void pci_enable_bridges(struct pci_bus *bus); |
435 | 435 | ||
436 | /* New-style probing supporting hot-pluggable devices */ | 436 | /* Proper probing supporting hot-pluggable devices */ |
437 | int pci_register_driver(struct pci_driver *); | 437 | int __pci_register_driver(struct pci_driver *, struct module *); |
438 | static inline int pci_register_driver(struct pci_driver *driver) | ||
439 | { | ||
440 | return __pci_register_driver(driver, THIS_MODULE); | ||
441 | } | ||
442 | |||
438 | void pci_unregister_driver(struct pci_driver *); | 443 | void pci_unregister_driver(struct pci_driver *); |
439 | void pci_remove_behind_bridge(struct pci_dev *); | 444 | void pci_remove_behind_bridge(struct pci_dev *); |
440 | struct pci_driver *pci_dev_driver(const struct pci_dev *); | 445 | struct pci_driver *pci_dev_driver(const struct pci_dev *); |
@@ -548,6 +553,7 @@ static inline int pci_enable_device(struct pci_dev *dev) { return -EIO; } | |||
548 | static inline void pci_disable_device(struct pci_dev *dev) { } | 553 | static inline void pci_disable_device(struct pci_dev *dev) { } |
549 | static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask) { return -EIO; } | 554 | static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask) { return -EIO; } |
550 | static inline int pci_assign_resource(struct pci_dev *dev, int i) { return -EBUSY;} | 555 | static inline int pci_assign_resource(struct pci_dev *dev, int i) { return -EBUSY;} |
556 | static inline int __pci_register_driver(struct pci_driver *drv, struct module *owner) { return 0;} | ||
551 | static inline int pci_register_driver(struct pci_driver *drv) { return 0;} | 557 | static inline int pci_register_driver(struct pci_driver *drv) { return 0;} |
552 | static inline void pci_unregister_driver(struct pci_driver *drv) { } | 558 | static inline void pci_unregister_driver(struct pci_driver *drv) { } |
553 | static inline int pci_find_capability (struct pci_dev *dev, int cap) {return 0; } | 559 | static inline int pci_find_capability (struct pci_dev *dev, int cap) {return 0; } |