diff options
author | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2024-08-23 11:33:23 +0200 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2024-09-03 17:11:05 -0500 |
commit | 8f62819aaace77dd85037ae766eb767f8c4417ce (patch) | |
tree | fa176d1760bf08e148e38ae41632fc8a67700859 /include | |
parent | f1536585588ba630c533b6ffbca8ad8424aa5c39 (diff) | |
download | lwn-8f62819aaace77dd85037ae766eb767f8c4417ce.tar.gz lwn-8f62819aaace77dd85037ae766eb767f8c4417ce.zip |
PCI/pwrctl: Rescan bus on a separate thread
If we trigger the bus rescan from sysfs, we'll try to lock the PCI rescan
mutex recursively and deadlock - the platform device will be populated and
probed on the same thread that handles the sysfs write.
Add a workqueue to the pwrctl code on which we schedule the rescan for
controlled PCI devices. While at it: add a new interface for initializing
the pwrctl context where we'd now assign the parent device address and
initialize the workqueue.
Link: https://lore.kernel.org/r/20240823093323.33450-3-brgl@bgdev.pl
Fixes: 4565d2652a37 ("PCI/pwrctl: Add PCI power control core code")
Reported-by: Konrad Dybcio <konradybcio@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/pci-pwrctl.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/pci-pwrctl.h b/include/linux/pci-pwrctl.h index 45e9cfe740e4..0d23dddf59ec 100644 --- a/include/linux/pci-pwrctl.h +++ b/include/linux/pci-pwrctl.h @@ -7,6 +7,7 @@ #define __PCI_PWRCTL_H__ #include <linux/notifier.h> +#include <linux/workqueue.h> struct device; struct device_link; @@ -41,8 +42,10 @@ struct pci_pwrctl { /* Private: don't use. */ struct notifier_block nb; struct device_link *link; + struct work_struct work; }; +void pci_pwrctl_init(struct pci_pwrctl *pwrctl, struct device *dev); int pci_pwrctl_device_set_ready(struct pci_pwrctl *pwrctl); void pci_pwrctl_device_unset_ready(struct pci_pwrctl *pwrctl); int devm_pci_pwrctl_device_set_ready(struct device *dev, |