PCI/pwrctl: Reuse the OF node for power controlled devices
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Wed, 12 Jun 2024 08:20:15 +0000 (10:20 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Wed, 12 Jun 2024 11:20:56 +0000 (13:20 +0200)
commit62c953f0f4fb0b5f67b0ad3096ab38f5c5712d75
tree4cc100f1fb8cf86f80b366728020349f60d8d7f3
parent5799eba8eeabe79a476016f22a7aea57467b7638
PCI/pwrctl: Reuse the OF node for power controlled devices

With PCI power control we deal with two struct device objects bound to
two different drivers but consuming the same OF node. We must not bind
the pinctrl twice. To that end: before setting the OF node of the newly
instantiated PCI device, check if a platform device consuming the same
OF node doesn't already exist on the platform bus and - if so - mark the
PCI device as reusing the OF node.

Tested-by: Amit Pundir <amit.pundir@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD, SM8650-QRD & SM8650-HDK
Tested-by: Caleb Connolly <caleb.connolly@linaro.org> # OnePlus 8T
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20240612082019.19161-3-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/pci/of.c