lkml.org 
[lkml]   [2018]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH V4 4/7] PCI: Unify try slot and bus reset API
On Thu, Jun 28, 2018 at 10:31 PM, Sinan Kaya <okaya@codeaurora.org> 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

\
 
 \ /
  Last update: 2018-06-29 23:44    [W:0.078 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site