pci-v6.3-fixes-3

-----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCgAyFiEEgMe7l+5h9hnxdsnuWYigwDrT+vwFAmRBmroUHGJoZWxnYWFz
 QGdvb2dsZS5jb20ACgkQWYigwDrT+vwtuA/+LsoJ0ohzhtph5SbVFR45tTYxr1uT
 3cUDhRmzEy5m7CPBogETTCn18r0VyPtjj2lgsDL7yubQJzCaQN5Sy8TkL43G/VhL
 kEPoP2KedWiaDHpzneLG0QAeRtA9nuZSzLokI1aHAjkFJ7KWlPyrNrBFDSMfxdiF
 N47o63q6UaREceM0jRF12FVB7OWLgr2Bx7spI093j3+KiVzC5EpdUveq4DyppNk2
 RjertZyWfVlzlV3DZ4yWSGDrya1IDRuCa7U6dNTq2vraEuT1sxCmdgblQJw6VClk
 irUF3xPnHZ4f/f2o443e70RV46gUqt8p639ONPm86bQtTPYxFbRGK0NZE5s/xDya
 fX0AmCx5/GcIcULxn76aSMTqOGRvzi5ainXdyEKNglxIVLJHqq2JronGVsbJlgjo
 QnUwVCThTz/xsRn2VNPV9kdwSgDZeIQ9xyQp8vSXSoQ1o1Yp13oEh02Adds0rFlM
 OULN4tEt9kuvR3rSTTPjeFzEd9JPS5DLawlLJemDAJYrerO3Hf3sKHK67mGL3vVu
 5PN9YztYeVc/0BMBl2H7aM9w4ISIH8admctGGvPn/3WpxCP4kztmXrD/1FzhWVxm
 NojwvRvMWcZJ7mPVXfzdbJ/RBoVxbur+FEKvuGlzgNDMlkwtTbiGFJG+reVoPHHz
 MoFc9Y47HNdiK44=
 =agMG
 -----END PGP SIGNATURE-----

Merge tag 'pci-v6.3-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci

Pull pci fix from Bjorn Helgaas:

 - Previously we ignored PCI devices if the DT "status" property or the
   ACPI _STA method said it was not present.

   Per spec, _STA cannot be used for that purpose, and using it that way
   caused regressions, so skip the _STA check (Rob Herring)

* tag 'pci-v6.3-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci:
  PCI: Restrict device disabled status check to DT
This commit is contained in:
Linus Torvalds 2023-04-20 15:36:23 -07:00
commit b7bc77e2f2
3 changed files with 30 additions and 12 deletions

View File

@ -16,14 +16,32 @@
#include "pci.h"
#ifdef CONFIG_PCI
void pci_set_of_node(struct pci_dev *dev)
/**
* pci_set_of_node - Find and set device's DT device_node
* @dev: the PCI device structure to fill
*
* Returns 0 on success with of_node set or when no device is described in the
* DT. Returns -ENODEV if the device is present, but disabled in the DT.
*/
int pci_set_of_node(struct pci_dev *dev)
{
struct device_node *node;
if (!dev->bus->dev.of_node)
return;
dev->dev.of_node = of_pci_find_child_device(dev->bus->dev.of_node,
dev->devfn);
if (dev->dev.of_node)
dev->dev.fwnode = &dev->dev.of_node->fwnode;
return 0;
node = of_pci_find_child_device(dev->bus->dev.of_node, dev->devfn);
if (!node)
return 0;
if (!of_device_is_available(node)) {
of_node_put(node);
return -ENODEV;
}
dev->dev.of_node = node;
dev->dev.fwnode = &node->fwnode;
return 0;
}
void pci_release_of_node(struct pci_dev *dev)

View File

@ -624,7 +624,7 @@ int of_pci_get_max_link_speed(struct device_node *node);
u32 of_pci_get_slot_power_limit(struct device_node *node,
u8 *slot_power_limit_value,
u8 *slot_power_limit_scale);
void pci_set_of_node(struct pci_dev *dev);
int pci_set_of_node(struct pci_dev *dev);
void pci_release_of_node(struct pci_dev *dev);
void pci_set_bus_of_node(struct pci_bus *bus);
void pci_release_bus_of_node(struct pci_bus *bus);
@ -662,7 +662,7 @@ of_pci_get_slot_power_limit(struct device_node *node,
return 0;
}
static inline void pci_set_of_node(struct pci_dev *dev) { }
static inline int pci_set_of_node(struct pci_dev *dev) { return 0; }
static inline void pci_release_of_node(struct pci_dev *dev) { }
static inline void pci_set_bus_of_node(struct pci_bus *bus) { }
static inline void pci_release_bus_of_node(struct pci_bus *bus) { }

View File

@ -1826,7 +1826,7 @@ int pci_setup_device(struct pci_dev *dev)
u32 class;
u16 cmd;
u8 hdr_type;
int pos = 0;
int err, pos = 0;
struct pci_bus_region region;
struct resource *res;
@ -1840,10 +1840,10 @@ int pci_setup_device(struct pci_dev *dev)
dev->error_state = pci_channel_io_normal;
set_pcie_port_type(dev);
pci_set_of_node(dev);
err = pci_set_of_node(dev);
if (err)
return err;
pci_set_acpi_fwnode(dev);
if (dev->dev.fwnode && !fwnode_device_is_available(dev->dev.fwnode))
return -ENODEV;
pci_dev_assign_slot(dev);