* [PATCH -next] IB/hfi1,PCI: Fix missing pci_disable_device() in probe and remove
@ 2022-09-22 2:46 ruanjinjie
2022-09-22 11:46 ` Leon Romanovsky
2022-09-26 17:35 ` Jason Gunthorpe
0 siblings, 2 replies; 4+ messages in thread
From: ruanjinjie @ 2022-09-22 2:46 UTC (permalink / raw)
To: dennis.dalessandro, jgg, leon, linux-rdma, linux-kernel; +Cc: ruanjinjie
Replace pci_enable_device() with pcim_enable_device(),
pci_disable_device() and pci_release_regions() will be
called in release automatically.
Signed-off-by: ruanjinjie <ruanjinjie@huawei.com>
---
drivers/infiniband/hw/hfi1/pcie.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/infiniband/hw/hfi1/pcie.c b/drivers/infiniband/hw/hfi1/pcie.c
index a0802332c8cb..45a0fb75f2d8 100644
--- a/drivers/infiniband/hw/hfi1/pcie.c
+++ b/drivers/infiniband/hw/hfi1/pcie.c
@@ -26,7 +26,7 @@ int hfi1_pcie_init(struct hfi1_devdata *dd)
int ret;
struct pci_dev *pdev = dd->pcidev;
- ret = pci_enable_device(pdev);
+ ret = pcim_enable_device(pdev);
if (ret) {
/*
* This can happen (in theory) iff:
@@ -78,12 +78,10 @@ int hfi1_pcie_init(struct hfi1_devdata *dd)
*/
void hfi1_pcie_cleanup(struct pci_dev *pdev)
{
- pci_disable_device(pdev);
/*
* Release regions should be called after the disable. OK to
* call if request regions has not been called or failed.
*/
- pci_release_regions(pdev);
}
/*
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH -next] IB/hfi1,PCI: Fix missing pci_disable_device() in probe and remove
2022-09-22 2:46 [PATCH -next] IB/hfi1,PCI: Fix missing pci_disable_device() in probe and remove ruanjinjie
@ 2022-09-22 11:46 ` Leon Romanovsky
2022-09-26 17:35 ` Jason Gunthorpe
1 sibling, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2022-09-22 11:46 UTC (permalink / raw)
To: ruanjinjie; +Cc: dennis.dalessandro, jgg, linux-rdma, linux-kernel
On Thu, Sep 22, 2022 at 10:46:01AM +0800, ruanjinjie wrote:
> Replace pci_enable_device() with pcim_enable_device(),
> pci_disable_device() and pci_release_regions() will be
> called in release automatically.
>
> Signed-off-by: ruanjinjie <ruanjinjie@huawei.com>
> ---
> drivers/infiniband/hw/hfi1/pcie.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
This driver doesn't use devres model and manages all resources by
itself. IMHO, it is much more saner than using automatic resource
release.
Thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] IB/hfi1,PCI: Fix missing pci_disable_device() in probe and remove
2022-09-22 2:46 [PATCH -next] IB/hfi1,PCI: Fix missing pci_disable_device() in probe and remove ruanjinjie
2022-09-22 11:46 ` Leon Romanovsky
@ 2022-09-26 17:35 ` Jason Gunthorpe
2022-09-27 0:57 ` Ruan Jinjie
1 sibling, 1 reply; 4+ messages in thread
From: Jason Gunthorpe @ 2022-09-26 17:35 UTC (permalink / raw)
To: ruanjinjie; +Cc: dennis.dalessandro, leon, linux-rdma, linux-kernel
On Thu, Sep 22, 2022 at 10:46:01AM +0800, ruanjinjie wrote:
> Replace pci_enable_device() with pcim_enable_device(),
> pci_disable_device() and pci_release_regions() will be
> called in release automatically.
>
> Signed-off-by: ruanjinjie <ruanjinjie@huawei.com>
> ---
> drivers/infiniband/hw/hfi1/pcie.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
Please no, at LPC it seems the general consensus is that the devm
varients were a Bad Idea. If the code as-is is correct then lets leave
it alone.
Jason
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] IB/hfi1,PCI: Fix missing pci_disable_device() in probe and remove
2022-09-26 17:35 ` Jason Gunthorpe
@ 2022-09-27 0:57 ` Ruan Jinjie
0 siblings, 0 replies; 4+ messages in thread
From: Ruan Jinjie @ 2022-09-27 0:57 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: dennis.dalessandro, leon, linux-rdma, linux-kernel
OK! Thank you very much.
On 2022/9/27 1:35, Jason Gunthorpe wrote:
> Please no, at LPC it seems the general consensus is that the devm
> varients were a Bad Idea. If the code as-is is correct then lets leave
> it alone.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-09-27 0:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-22 2:46 [PATCH -next] IB/hfi1,PCI: Fix missing pci_disable_device() in probe and remove ruanjinjie
2022-09-22 11:46 ` Leon Romanovsky
2022-09-26 17:35 ` Jason Gunthorpe
2022-09-27 0:57 ` Ruan Jinjie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).