aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pci.h
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2008-07-30 15:07:04 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2008-08-07 09:52:01 -0400
commitbba81165867313766534dd31603de51bdd36ef9b (patch)
treef6233ae2f717c49b8642009f1762599d30415a9c /include/linux/pci.h
parent9d82d8eaec032bf935144e0d5789a5cd4b95e958 (diff)
PCI: make pci_register_driver() a macro
alpha: CC [M] drivers/usb/gadget/u_ether.o In file included from include/asm/dma-mapping.h:7, from include/linux/dma-mapping.h:52, from include/linux/dmaengine.h:29, from include/linux/skbuff.h:29, from include/linux/if_ether.h:114, from include/linux/etherdevice.h:27, from drivers/usb/gadget/u_ether.c:29: include/linux/pci.h: In function 'pci_register_driver': include/linux/pci.h:673: error: 'KBUILD_MODNAME' undeclared (first use in this function) include/linux/pci.h:673: error: (Each undeclared identifier is reported only once include/linux/pci.h:673: error: for each function it appears in.) Sam says: The problem is that u_ether.o is used by two modules so when we build it KBUILD_MODNAME is not defined because kbuild does not know what value to use. And in pci.h we have the following inline: static inline int __must_check pci_register_driver(struct pci_driver *driver) { return __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME); } And alpha uses dma-mapping.h to nullify a number of functions that seem to require something from pci.h. Making it a macro fixes this particular problem. However, the underlying issue of a file using KBUILD_MODNAME and being shared between multiple modules is *not* addressed. I guess the answer there is "don't do that". Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r--include/linux/pci.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 825be3878f68..b0269492c34e 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -680,10 +680,12 @@ void pci_enable_bridges(struct pci_bus *bus);
680/* Proper probing supporting hot-pluggable devices */ 680/* Proper probing supporting hot-pluggable devices */
681int __must_check __pci_register_driver(struct pci_driver *, struct module *, 681int __must_check __pci_register_driver(struct pci_driver *, struct module *,
682 const char *mod_name); 682 const char *mod_name);
683static inline int __must_check pci_register_driver(struct pci_driver *driver) 683
684{ 684/*
685 return __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME); 685 * pci_register_driver must be a macro so that KBUILD_MODNAME can be expanded
686} 686 */
687#define pci_register_driver(driver) \
688 __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
687 689
688void pci_unregister_driver(struct pci_driver *dev); 690void pci_unregister_driver(struct pci_driver *dev);
689void pci_remove_behind_bridge(struct pci_dev *dev); 691void pci_remove_behind_bridge(struct pci_dev *dev);