if (dev_fwnode(dev) != dev_fwnode(pwrctrl->dev)) return NOTIFY_DONE;
switch (action) { case BUS_NOTIFY_ADD_DEVICE: /* * We will have two struct device objects bound to two different * drivers on different buses but consuming the same DT node. We * must not bind the pins twice in this case but only once for * the first device to be added. * * If we got here then the PCI device is the second after the * power control platform device. Mark its OF node as reused.
*/
dev->of_node_reused = true; break;
}
/** * pci_pwrctrl_init() - Initialize the PCI power control context struct * * @pwrctrl: PCI power control data * @dev: Parent device
*/ void pci_pwrctrl_init(struct pci_pwrctrl *pwrctrl, struct device *dev)
{
pwrctrl->dev = dev;
INIT_WORK(&pwrctrl->work, rescan_work_func);
}
EXPORT_SYMBOL_GPL(pci_pwrctrl_init);
/** * pci_pwrctrl_device_set_ready() - Notify the pwrctrl subsystem that the PCI * device is powered-up and ready to be detected. * * @pwrctrl: PCI power control data. * * Returns: * 0 on success, negative error number on error. * * Note: * This function returning 0 doesn't mean the device was detected. It means, * that the bus rescan was successfully started. The device will get bound to * its PCI driver asynchronously.
*/ int pci_pwrctrl_device_set_ready(struct pci_pwrctrl *pwrctrl)
{ int ret;
if (!pwrctrl->dev) return -ENODEV;
pwrctrl->nb.notifier_call = pci_pwrctrl_notify;
ret = bus_register_notifier(&pci_bus_type, &pwrctrl->nb); if (ret) return ret;
/** * pci_pwrctrl_device_unset_ready() - Notify the pwrctrl subsystem that the PCI * device is about to be powered-down. * * @pwrctrl: PCI power control data.
*/ void pci_pwrctrl_device_unset_ready(struct pci_pwrctrl *pwrctrl)
{
cancel_work_sync(&pwrctrl->work);
/* * We don't have to delete the link here. Typically, this function * is only called when the power control device is being detached. If * it is being detached then the child PCI device must have already * been unbound too or the device core wouldn't let us unbind.
*/
bus_unregister_notifier(&pci_bus_type, &pwrctrl->nb);
}
EXPORT_SYMBOL_GPL(pci_pwrctrl_device_unset_ready);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.