Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sparc/PCI: Remove pcibios_enable_device() as they do nothing extra

Under arch/sparc/ there are multiple copies of pcibios_enable_device() but
none of those seem to do anything extra beyond what pci_enable_resources()
is supposed to do. These functions could lead to inconsistencies in
behavior, especially now as pci_enable_resources() and the bridge window
resource flags behavior are going to be altered by upcoming changes.

Remove all pcibios_enable_device() from arch/sparc/ so that PCI core can
simply call into pci_enable_resources() instead using its __weak version
of pcibios_enable_device().

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20250829131113.36754-3-ilpo.jarvinen@linux.intel.com

authored by

Ilpo Järvinen and committed by
Bjorn Helgaas
754babaa 2657a0c9

-81
-27
arch/sparc/kernel/leon_pci.c
··· 60 60 pci_assign_unassigned_resources(); 61 61 pci_bus_add_devices(root_bus); 62 62 } 63 - 64 - int pcibios_enable_device(struct pci_dev *dev, int mask) 65 - { 66 - struct resource *res; 67 - u16 cmd, oldcmd; 68 - int i; 69 - 70 - pci_read_config_word(dev, PCI_COMMAND, &cmd); 71 - oldcmd = cmd; 72 - 73 - pci_dev_for_each_resource(dev, res, i) { 74 - /* Only set up the requested stuff */ 75 - if (!(mask & (1<<i))) 76 - continue; 77 - 78 - if (res->flags & IORESOURCE_IO) 79 - cmd |= PCI_COMMAND_IO; 80 - if (res->flags & IORESOURCE_MEM) 81 - cmd |= PCI_COMMAND_MEMORY; 82 - } 83 - 84 - if (cmd != oldcmd) { 85 - pci_info(dev, "enabling device (%04x -> %04x)\n", oldcmd, cmd); 86 - pci_write_config_word(dev, PCI_COMMAND, cmd); 87 - } 88 - return 0; 89 - }
-27
arch/sparc/kernel/pci.c
··· 722 722 return bus; 723 723 } 724 724 725 - int pcibios_enable_device(struct pci_dev *dev, int mask) 726 - { 727 - struct resource *res; 728 - u16 cmd, oldcmd; 729 - int i; 730 - 731 - pci_read_config_word(dev, PCI_COMMAND, &cmd); 732 - oldcmd = cmd; 733 - 734 - pci_dev_for_each_resource(dev, res, i) { 735 - /* Only set up the requested stuff */ 736 - if (!(mask & (1<<i))) 737 - continue; 738 - 739 - if (res->flags & IORESOURCE_IO) 740 - cmd |= PCI_COMMAND_IO; 741 - if (res->flags & IORESOURCE_MEM) 742 - cmd |= PCI_COMMAND_MEMORY; 743 - } 744 - 745 - if (cmd != oldcmd) { 746 - pci_info(dev, "enabling device (%04x -> %04x)\n", oldcmd, cmd); 747 - pci_write_config_word(dev, PCI_COMMAND, cmd); 748 - } 749 - return 0; 750 - } 751 - 752 725 /* Platform support for /proc/bus/pci/X/Y mmap()s. */ 753 726 int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct vm_area_struct *vma) 754 727 {
-27
arch/sparc/kernel/pcic.c
··· 641 641 } 642 642 } 643 643 644 - int pcibios_enable_device(struct pci_dev *dev, int mask) 645 - { 646 - struct resource *res; 647 - u16 cmd, oldcmd; 648 - int i; 649 - 650 - pci_read_config_word(dev, PCI_COMMAND, &cmd); 651 - oldcmd = cmd; 652 - 653 - pci_dev_for_each_resource(dev, res, i) { 654 - /* Only set up the requested stuff */ 655 - if (!(mask & (1<<i))) 656 - continue; 657 - 658 - if (res->flags & IORESOURCE_IO) 659 - cmd |= PCI_COMMAND_IO; 660 - if (res->flags & IORESOURCE_MEM) 661 - cmd |= PCI_COMMAND_MEMORY; 662 - } 663 - 664 - if (cmd != oldcmd) { 665 - pci_info(dev, "enabling device (%04x -> %04x)\n", oldcmd, cmd); 666 - pci_write_config_word(dev, PCI_COMMAND, cmd); 667 - } 668 - return 0; 669 - } 670 - 671 644 /* Makes compiler happy */ 672 645 static volatile int pcic_timer_dummy; 673 646