pci-v6.12-fixes-1

-----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCgAyFiEEgMe7l+5h9hnxdsnuWYigwDrT+vwFAmcbz4UUHGJoZWxnYWFz
 QGdvb2dsZS5jb20ACgkQWYigwDrT+vxKsQ//f9wMVMlWkuL0O0vQBTp6kD5m4Cck
 hpXy84166sLhH/EgKuhcM69aKxJdY94j0Q2nVCVDErP6UTl8BnaQzKwOu9zK4XUD
 GlKd5EvPgURdIvQgJIcZbCQGdBVIw/08nVHxXsOHzyewIdnDFt2sOQOMxDnolztG
 E5OWOOHA2T3leeWGFdr5fDl4VZ8URtloJwK+FJZWkdKEichuRmNo/Hs//SRc8plh
 bK16Zi+yEu9ABBtgu1HjQ9hPYWhudFPmpvaNB3JW5dek2iqe9bzswmvdO2iW1AHh
 xttHnqFpWBVa+Uvrn73vFBC1Elb3wWSJgHGWs2RnsBtGHZWuvqLtodnVqbcWA5Yu
 jY9eWyegEYtJaWWllgiZNk4S6sBJdHStLqJsz4IZW6qXMBT/+/+JMdYpsu5gD4NC
 PdXW+2E5FIl9bRxFDNXt6jjaUGo3O/OwX0gTArXkj4C6GiPv2bTnIf4JeffaxdrA
 JR/LkgmRNwguA4tsTZAuOiG/DRwf7RMiui55Yf91cuNitiHZnlrKWepJI+LcLSUl
 CBRagPJ5JWGeiBxtpuEcW0rAOLbF4NcNc6aoe7zNak4Jdg4tGNwfgeWMw0egTJq8
 1dP2msvX82jCeyh4QbdUj6+NLE4YZar8WAB0+/WC5LVQuVkrIYLfR8tot1HBd6mX
 512QPvzdluGyJmE=
 =L6G0
 -----END PGP SIGNATURE-----

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

Pull pci fixes from Bjorn Helgaas:

 - Hold the rescan lock while adding devices to avoid race with
   concurrent pwrctl rescan that can lead to a crash (Bartosz
   Golaszewski)

 - Avoid binding pwrctl driver to QCom WCN wifi if the DT lacks the
   necessary PMU regulator descriptions (Bartosz Golaszewski)

* tag 'pci-v6.12-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci:
  PCI/pwrctl: Abandon QCom WCN probe on pre-pwrseq device-trees
  PCI: Hold rescan lock while adding devices during host probe
This commit is contained in:
Linus Torvalds 2024-10-25 10:56:06 -07:00
commit 48005a5a74
2 changed files with 52 additions and 5 deletions

View File

@ -3105,7 +3105,9 @@ int pci_host_probe(struct pci_host_bridge *bridge)
list_for_each_entry(child, &bus->children, node)
pcie_bus_configure_settings(child);
pci_lock_rescan_remove();
pci_bus_add_devices(bus);
pci_unlock_rescan_remove();
return 0;
}
EXPORT_SYMBOL_GPL(pci_host_probe);

View File

@ -6,9 +6,9 @@
#include <linux/device.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/pci-pwrctl.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/pwrseq/consumer.h>
#include <linux/slab.h>
#include <linux/types.h>
@ -18,6 +18,40 @@ struct pci_pwrctl_pwrseq_data {
struct pwrseq_desc *pwrseq;
};
struct pci_pwrctl_pwrseq_pdata {
const char *target;
/*
* Called before doing anything else to perform device-specific
* verification between requesting the power sequencing handle.
*/
int (*validate_device)(struct device *dev);
};
static int pci_pwrctl_pwrseq_qcm_wcn_validate_device(struct device *dev)
{
/*
* Old device trees for some platforms already define wifi nodes for
* the WCN family of chips since before power sequencing was added
* upstream.
*
* These nodes don't consume the regulator outputs from the PMU, and
* if we allow this driver to bind to one of such "incomplete" nodes,
* we'll see a kernel log error about the indefinite probe deferral.
*
* Check the existence of the regulator supply that exists on all
* WCN models before moving forward.
*/
if (!device_property_present(dev, "vddaon-supply"))
return -ENODEV;
return 0;
}
static const struct pci_pwrctl_pwrseq_pdata pci_pwrctl_pwrseq_qcom_wcn_pdata = {
.target = "wlan",
.validate_device = pci_pwrctl_pwrseq_qcm_wcn_validate_device,
};
static void devm_pci_pwrctl_pwrseq_power_off(void *data)
{
struct pwrseq_desc *pwrseq = data;
@ -27,15 +61,26 @@ static void devm_pci_pwrctl_pwrseq_power_off(void *data)
static int pci_pwrctl_pwrseq_probe(struct platform_device *pdev)
{
const struct pci_pwrctl_pwrseq_pdata *pdata;
struct pci_pwrctl_pwrseq_data *data;
struct device *dev = &pdev->dev;
int ret;
pdata = device_get_match_data(dev);
if (!pdata || !pdata->target)
return -EINVAL;
if (pdata->validate_device) {
ret = pdata->validate_device(dev);
if (ret)
return ret;
}
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;
data->pwrseq = devm_pwrseq_get(dev, of_device_get_match_data(dev));
data->pwrseq = devm_pwrseq_get(dev, pdata->target);
if (IS_ERR(data->pwrseq))
return dev_err_probe(dev, PTR_ERR(data->pwrseq),
"Failed to get the power sequencer\n");
@ -64,17 +109,17 @@ static const struct of_device_id pci_pwrctl_pwrseq_of_match[] = {
{
/* ATH11K in QCA6390 package. */
.compatible = "pci17cb,1101",
.data = "wlan",
.data = &pci_pwrctl_pwrseq_qcom_wcn_pdata,
},
{
/* ATH11K in WCN6855 package. */
.compatible = "pci17cb,1103",
.data = "wlan",
.data = &pci_pwrctl_pwrseq_qcom_wcn_pdata,
},
{
/* ATH12K in WCN7850 package. */
.compatible = "pci17cb,1107",
.data = "wlan",
.data = &pci_pwrctl_pwrseq_qcom_wcn_pdata,
},
{ }
};