Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions drivers/pci/pwrctrl/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,22 @@ static void pci_pwrctrl_power_off_device(struct device_node *np)
if (!pdev)
return;

/*
* Sanity check to make sure that the node has the compatible property
* to allow driver binding.
*/
if (!of_property_present(np, "compatible"))
return;

/*
* Check whether the pwrctrl device really needs to be created or not.
* This is decided based on at least one of the power supplies being
* defined in the devicetree node of the device.
*/
if (!of_pci_supply_present(np)) {
//dev_dbg(parent, "Skipping OF node: %s\n", np->name);
return;
}
if (device_is_bound(&pdev->dev)) {
ret = __pci_pwrctrl_power_off_device(&pdev->dev);
if (ret)
Expand Down Expand Up @@ -216,6 +232,23 @@ static int pci_pwrctrl_power_on_device(struct device_node *np)
if (!pdev)
return 0;

/*
* Sanity check to make sure that the node has the compatible property
* to allow driver binding.
*/
if (!of_property_present(np, "compatible"))
return 0;

/*
* Check whether the pwrctrl device really needs to be created or not.
* This is decided based on at least one of the power supplies being
* defined in the devicetree node of the device.
*/
if (!of_pci_supply_present(np)) {
//dev_dbg(parent, "Skipping OF node: %s\n", np->name);
return 0;
}

if (device_is_bound(&pdev->dev)) {
ret = __pci_pwrctrl_power_on_device(&pdev->dev);
} else {
Expand Down