Thread (10 messages) 10 messages, 2 authors, 2018-07-02

[PATCH V4 4/7] PCI: Unify try slot and bus reset API

From: Andy Shevchenko <hidden>
Date: 2018-06-29 21:43:39
Also in: kvm, linux-arm-msm, linux-pci, linux-rdma, lkml

On Thu, Jun 28, 2018 at 10:31 PM, Sinan Kaya [off-list ref] wrote:
Drivers are expected to call pci_try_reset_slot() or pci_try_reset_bus() by
querying if a system supports hotplug or not. A survey showed that most
drivers don't do this and we are leaking hotplug capability to the user.

Hide pci_try_slot_reset() from drivers and embed into pci_try_bus_reset().
Change pci_try_reset_bus() parameter from struct pci_bus to struct pci_dev.
+/**
+ * pci_try_reset_bus - Try to reset a PCI bus
+ * @pdev: top level PCI device to reset via slot/bus
+ *
+ * Same as above except return -EAGAIN if the bus cannot be locked
+ */
+int pci_try_reset_bus(struct pci_dev *pdev)
+{
+       bool slot = false;
+
+       if (!pci_probe_reset_slot(pdev->slot))
+               slot = true;
+
+       return slot ? __pci_try_reset_slot(pdev->slot) :
+                       __pci_try_reset_bus(pdev->bus);
This can be as simple as

  return pci_probe_reset_slot(pdev->slot) ?
    __pci_try_reset_bus(pdev->slot) : __pci_try_reset_slot(pdev->bus);

+}
 EXPORT_SYMBOL_GPL(pci_try_reset_bus);

-- 
With Best Regards,
Andy Shevchenko
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help