PCI: Move no_pci_devices() to the only driver using it
Subsystems (3)
PATCH 1/1 PCI: Move no_pci_devices() to the only driver using it
Core PCI code provides no_pci_devices() that is only used in the pc110pad driver during init to detect cases when PC110 definitely cannot be present. Move this legacy detection trickery/hack into the pc110pad driver.
--- drivers/input/mouse/pc110pad.c | 19 +++++++++++++++++++ drivers/pci/probe.c | 17 ----------------- include/linux/pci.h | 3 --- 3 files changed, 19 insertions(+), 20 deletions(-)
drivers/input/mouse/pc110pad.c +19 -0
@@ -87,6 +87,25 @@ static int pc110pad_open(struct input_dev *dev)* that the PC110 is not a PCI system. So if we find any * PCI devices in the machine, we don't have a PC110. */ +#ifdef CONFIG_PCI +static int __init no_pci_devices (void ) +{ +struct device *dev; +int no_devices; + + dev =bus_find_next_device (&pci_bus_type,NULL ); + no_devices = (dev ==NULL ); +put_device (dev); +return no_devices; +} +#else +static int __init no_pci_devices (void ) +{ +return 1 ; +} +#endif + +static int __init pc110pad_init (void ) {int err;
drivers/pci/probe.c +0 -17
@@ -65,23 +65,6 @@ static struct resource *get_pci_domain_busn_res(int domain_nr)return &r->res; } -/* -* Some device drivers need know if PCI is initiated. -* Basically, we think PCI is not initiated when there -* is no device to be found on the pci_bus_type. -*/ -int no_pci_devices (void ) -{ -struct device *dev; -int no_devices; - - dev =bus_find_next_device (&pci_bus_type,NULL ); - no_devices = (dev ==NULL ); -put_device (dev); -return no_devices; -} -EXPORT_SYMBOL (no_pci_devices); -/* * PCI Bus Class */
include/linux/pci.h +0 -3
@@ -1107,8 +1107,6 @@ extern const struct bus_type pci_bus_type;/* Do NOT directly access these two variables, unless you are arch-specific PCI * code, or PCI core code. */ extern struct list_head pci_root_buses;/* List of all known PCI buses */ -/* Some device drivers need know if PCI is initiated */ -int no_pci_devices (void );void pcibios_resource_survey_bus (struct pci_bus *bus);void pcibios_bus_add_device (struct pci_dev *pdev);
@@ -1969,7 +1967,6 @@ static inline struct pci_dev *pci_get_base_class(unsigned int class,static inline int pci_dev_present (const struct pci_device_id *ids) {return 0 ; } -#define no_pci_devices () (1)#define pci_dev_put (dev) do { } while (0)static inline void pci_set_master (struct pci_dev *dev) { }
Signature · 1 line
2.39.5
Quoted 6 lines · Ilpo Järvinen
Core PCI code provides
no_pci_devices()that is only used in the pc110pad driver during init to detect cases when PC110 definitely cannot be present. Move this legacy detection trickery/hack into the pc110pad driver.Signed-off-by Ilpo Järvinen <[email protected]>
Thanks, this is indeed a gross hack, and I'd be glad to eradicate it from PCI.
Quoted 88 lines
--- drivers/input/mouse/pc110pad.c | 19 +++++++++++++++++++ drivers/pci/probe.c | 17 ----------------- include/linux/pci.h | 3 --- 3 files changed, 19 insertions(+), 20 deletions(-)drivers/input/mouse/pc110pad.c +19
-0@@ -87,6 +87,25 @@ static int pc110pad_open(struct input_dev *dev)* that the PC110 is not a PCI system. So if we find any * PCI devices in the machine, we don't have a PC110. */ +#ifdef CONFIG_PCI +static int __init no_pci_devices (void ) +{ +struct device *dev; +int no_devices; + + dev =bus_find_next_device (&pci_bus_type,NULL ); + no_devices = (dev ==NULL ); +put_device (dev); +return no_devices; +} +#else +static int __init no_pci_devices (void ) +{ +return 1 ; +} +#endif + +static int __init pc110pad_init (void ) {int err;drivers/pci/probe.c +0
-17@@ -65,23 +65,6 @@ static struct resource *get_pci_domain_busn_res(int domain_nr)return &r->res; } -/* -* Some device drivers need know if PCI is initiated. -* Basically, we think PCI is not initiated when there -* is no device to be found on the pci_bus_type. -*/ -int no_pci_devices (void ) -{ -struct device *dev; -int no_devices; - - dev =bus_find_next_device (&pci_bus_type,NULL ); - no_devices = (dev ==NULL ); -put_device (dev); -return no_devices; -} -EXPORT_SYMBOL (no_pci_devices); -/* * PCI Bus Class */ include/linux/pci.h +0
-3@@ -1107,8 +1107,6 @@ extern const struct bus_type pci_bus_type;/* Do NOT directly access these two variables, unless you are arch-specific PCI * code, or PCI core code. */ extern struct list_head pci_root_buses;/* List of all known PCI buses */ -/* Some device drivers need know if PCI is initiated */ -int no_pci_devices (void );void pcibios_resource_survey_bus (struct pci_bus *bus);void pcibios_bus_add_device (struct pci_dev *pdev);@@ -1969,7 +1967,6 @@ static inline struct pci_dev *pci_get_base_class(unsigned int class,static inline int pci_dev_present (const struct pci_device_id *ids) {return 0 ; } -#define no_pci_devices () (1)#define pci_dev_put (dev) do { } while (0)static inline void pci_set_master (struct pci_dev *dev) { }Signature · 1 line
2.39.5
Dmitry Torokhov
maintainerHi Bjorn, Ilpo,
Quoted 6 lines · Bjorn Helgaas
Quoted 5 lines · Ilpo Järvinen
Core PCI code provides
no_pci_devices()that is only used in the pc110pad driver during init to detect cases when PC110 definitely cannot be present. Move this legacy detection trickery/hack into the pc110pad driver.
Quoted 6 lines
Quoted 1 line
Signed-off-by Ilpo Järvinen <[email protected]>Acked-by Bjorn Helgaas <[email protected]>Thanks, this is indeed a gross hack, and I'd be glad to eradicate it from PCI.
I would much rather remove pc110_pad altogether. If I can get a "Reviewed-by" on [1] that would be great.
[1] https://lore.kernel.org/all/[email protected]/
Thanks.
Signature · 1 line
Dmitry