PCI: Remove no_pci_devices
Subsystems (3)
cover PCI: Remove no_pci_devices
Remove the last user of no_pci_devices(), and then the function itself.
Heiner Kallweit (2):
input: pc110pad: change PCI check to get rid of orphaned
no_pci_devices
PCI: Remove no_pci_devices
drivers/input/mouse/pc110pad.c | 2 +- drivers/pci/probe.c | 17 ----------------- include/linux/pci.h | 3 --- 3 files changed, 1 insertion(+), 21 deletions(-)
Signature · 1 line
2.53.0
PATCH 1/2 input: pc110pad: change PCI check to get rid of orphaned no_pci_devices
As a prerequisite for removing no_pci_devices(), replace its usage here with an equivalent check for presence of a PCI bus.
--- drivers/input/mouse/pc110pad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/mouse/pc110pad.c +1 -1
@@ -91,7 +91,7 @@ static int __init pc110pad_init(void) {int err; -if (!no_pci_devices ()) +if (pci_find_next_bus (NULL ))return -ENODEV ;if (!request_region (pc110pad_io,4 ,"pc110pad" )) {
Signature · 1 line
2.53.0
Re: [PATCH 1/2] input: pc110pad: change PCI check to get rid of orphaned no_pci_devices
Quoted 13 lines · Heiner Kallweit
As a prerequisite for removing
no_pci_devices(), replace its usage here with an equivalent check for presence of a PCI bus.Signed-off-by Heiner Kallweit <[email protected]>--- drivers/input/mouse/pc110pad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/input/mouse/pc110pad.c +0
-0
drivers/input/mouse/pc110pad.c static int __init pc110pad_init(void) · line 95
Quoted 6 lines
drivers/input/mouse/pc110pad.c +1
-1@@ -91,7 +91,7 @@ static int __init pc110pad_init(void) {int err; -if (!no_pci_devices ()) +if (pci_find_next_bus (NULL ))return -ENODEV ;
I'd certainly love to get rid of no_pci_devices(), although using pci_find_next_bus() is not really much better.
I don't have much opinion about pc110pad.c change. It's essentially still the same kludge, which has been there at least since the beginning of git history.
Dmitry, if you want to ack this, I can take both together.
Bjorn
Dmitry Torokhov
maintainerRe: [PATCH 1/2] input: pc110pad: change PCI check to get rid of orphaned no_pci_devices
Quoted 24 lines · Bjorn Helgaas
Quoted 13 lines · Heiner Kallweit
As a prerequisite for removing
no_pci_devices(), replace its usage here with an equivalent check for presence of a PCI bus.Signed-off-by Heiner Kallweit <[email protected]>--- drivers/input/mouse/pc110pad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/input/mouse/pc110pad.c +0
-0drivers/input/mouse/pc110pad.c static int __init pc110pad_init(void) · line 95
Quoted 6 lines
drivers/input/mouse/pc110pad.c +1
-1@@ -91,7 +91,7 @@ static int __init pc110pad_init(void) {int err; -if (!no_pci_devices ()) +if (pci_find_next_bus (NULL ))return -ENODEV ;I'd certainly love to get rid of
no_pci_devices(), although usingpci_find_next_bus()is not really much better.
Quoted 5 lines
I don't have much opinion about
pc110pad.cchange. It's essentially still the same kludge, which has been there at least since the beginning of git history.Dmitry, if you want to ack this, I can take both together.
Given "x86/cpu: Remove M486/M486SX/ELAN support" I'd just drop the driver completely.
I tried it in 2024 but Maciej was insistent that keeping these old drivers doe snot hurt. Now I think we can get rid of them.
You can grab the patch removing it from
https://lore.kernel.org/all/[email protected]/
as I think it should still apply.
Thanks.
Signature · 1 line
Dmitry
PATCH 2/2 PCI: Remove no_pci_devices
In reply to Heiner KallweitAfter having removed the last usage of no_pci_devices(), this function can be removed.
--- drivers/pci/probe.c | 17 ----------------- include/linux/pci.h | 3 --- 2 files changed, 20 deletions(-)
drivers/pci/probe.c +0 -17
@@ -67,23 +67,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
@@ -1201,8 +1201,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);
@@ -2140,7 +2138,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.53.0
[+cc Maciej]
Quoted 6 lines · Heiner Kallweit
Remove the last user of
no_pci_devices(), and then the function itself.Heiner Kallweit (2):
input: pc110pad: change PCI check to get rid of orphaned
no_pci_devices
PCI: Removeno_pci_devices
Applied Dmitry's patch to remove pc110pad and your patch to remove no_pci_devices() to pci/enumeration for v7.1, thanks!
Quoted 8 lines
drivers/input/mouse/pc110pad.c | 2 +- drivers/pci/probe.c | 17 ----------------- include/linux/pci.h | 3 --- 3 files changed, 1 insertion(+), 21 deletions(-)Signature · 1 line
2.53.0
Quoted 5 lines · Bjorn Helgaas
[+cc Maciej]
Quoted 2 lines · Heiner Kallweit
Remove the last user of
no_pci_devices(), and then the function itself.
Quoted 7 lines
Quoted 4 lines
Heiner Kallweit (2):
input: pc110pad: change PCI check to get rid of orphaned
no_pci_devices
PCI: Removeno_pci_devicesApplied Dmitry's patch to remove pc110pad and your patch to remove
no_pci_devices()to pci/enumeration for v7.1, thanks!
What can I say?
This:
static int pc110pad_io = 0x15e0;
seems to be a reasonably safe location in the PC/AT architecture to poke at blindly, especially while guarded with request_region(). Ralf Brown's "Ports List" doesn't list anything at location 0x1e0 modulo 0x400, and for PCI/e we never assign locations 0x100-0x300 modulo 0x400 anyway. With PCI systems featuring a southbridge ISA is subtractively decoded, so unclaimed accesses will simply time out.
There could be an issue though with preventing the claimed IRQ from being
used for a legitimate device, and the call to no_pci_devices() only pushes the problem to non-PCI systems. Poking at the handshake port and checking for it being fixed at all-ones might be a way to figure out whether there is anything actually wired there.
Overall this seems a case for a platform device, but these are hard to
wire in arch/x86 given how the platform has evolved. I imagine there's no way to probe for a PC-110 system, as back in the day stuff used to rely on manual configuration, though there could be a vendor BIOS call available for guesswork. A kernel parameter to tell the various odd systems apart would IMHO be a reasonable approach if this part of the kernel were being implemented now.
Then I have nothing to say as to the removal of the driver itself; if I
do manage to find time to revive 486 support via emulation as I outlined last year, then whoever wants the driver they can bring it back too; it's not like the most complex piece of code I've ever seen.
Thanks for looping me in.
Maciej