[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VcYbeRTiggEiQnEV6DKR=F47RxNR0FZ+E-XKPpq8VNpqw@mail.gmail.com>
Date: Sat, 30 Jun 2018 00:43:32 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Sinan Kaya <okaya@...eaurora.org>
Cc: linux-pci@...r.kernel.org, linux-arm-msm@...r.kernel.org,
linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
Mike Marciniszyn <mike.marciniszyn@...el.com>,
Dennis Dalessandro <dennis.dalessandro@...el.com>,
Doug Ledford <dledford@...hat.com>,
Jason Gunthorpe <jgg@...pe.ca>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Alex Williamson <alex.williamson@...hat.com>,
Alexey Kardashevskiy <aik@...abs.ru>,
Peter Xu <peterx@...hat.com>,
Zhenyu Wang <zhenyuw@...ux.intel.com>,
"open list:HFI1 DRIVER" <linux-rdma@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>,
"open list:VFIO DRIVER" <kvm@...r.kernel.org>
Subject: Re: [PATCH V4 4/7] PCI: Unify try slot and bus reset API
On Thu, Jun 28, 2018 at 10:31 PM, Sinan Kaya <okaya@...eaurora.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
Powered by blists - more mailing lists