lkml.org 
[lkml]   [2020]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH net-next v2 2/3] net: dec: tulip: de2104x: Replace pci_enable_device with devres version
Date
Replace pci_enable_device() with its devres counterpart
pcim_enable_device().

Signed-off-by: Moritz Fischer <mdf@kernel.org>
---

Note: Please check my logic on this, it would seem to me
calling pci_disable_device() on devices enabled with
pcim_enable_device() *should* be fine.

Changes from v1:
- Fixed missing replace for resume function
---
drivers/net/ethernet/dec/tulip/de2104x.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/dec/tulip/de2104x.c b/drivers/net/ethernet/dec/tulip/de2104x.c
index 9bcfc82b71d1..698d79bc4784 100644
--- a/drivers/net/ethernet/dec/tulip/de2104x.c
+++ b/drivers/net/ethernet/dec/tulip/de2104x.c
@@ -2009,14 +2009,14 @@ static int de_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
netif_carrier_off(dev);

/* wake up device, assign resources */
- rc = pci_enable_device(pdev);
+ rc = pcim_enable_device(pdev);
if (rc)
return rc;

/* reserve PCI resources to ensure driver atomicity */
rc = pci_request_regions(pdev, DRV_NAME);
if (rc)
- goto err_out_disable;
+ return rc;

/* check for invalid IRQ value */
if (pdev->irq < 2) {
@@ -2096,8 +2096,6 @@ static int de_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
iounmap(regs);
err_out_res:
pci_release_regions(pdev);
-err_out_disable:
- pci_disable_device(pdev);
return rc;
}

@@ -2111,7 +2109,6 @@ static void de_remove_one(struct pci_dev *pdev)
kfree(de->ee_data);
iounmap(de->regs);
pci_release_regions(pdev);
- pci_disable_device(pdev);
}

#ifdef CONFIG_PM
@@ -2164,7 +2161,7 @@ static int de_resume (struct pci_dev *pdev)
goto out;
if (!netif_running(dev))
goto out_attach;
- if ((retval = pci_enable_device(pdev))) {
+ if ((retval = pcim_enable_device(pdev))) {
netdev_err(dev, "pci_enable_device failed in resume\n");
goto out;
}
--
2.28.0
\
 
 \ /
  Last update: 2020-09-15 06:26    [W:0.053 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site