Skip to contentSkip to conversation

can: remove unnecessary pci_set_drvdata()

PATCH In review Jingoo Han 2 participants 5 messages Sep 10, 2013

Subsystems (2)
lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

cover can: remove unnecessary pci_set_drvdata()

Since commit 0998d0631001288a5974afc0b2a5f568bcdecb4d (device-core: Ensure drvdata = NULL when no driver is bound), the driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/net/can/c_can/c_can_pci.c    |    2 --
 drivers/net/can/pch_can.c            |    1 -
 drivers/net/can/sja1000/ems_pci.c    |    1 -
 drivers/net/can/sja1000/kvaser_pci.c |    1 -
 drivers/net/can/sja1000/peak_pci.c   |    2 --
 drivers/net/can/sja1000/plx_pci.c    |    1 -
 6 files changed, 8 deletions(-)
author
#1 lore raw

PATCH 1/3 can: c_can: remove unnecessary pci_set_drvdata()

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/net/can/c_can/c_can_pci.c |    2 --
 1 file changed, 2 deletions(-)
drivers/net/can/c_can/c_can_pci.c +0 -2
index b374be7..bce0be5 100644
@@ -160,7 +160,6 @@ static int c_can_pci_probe(struct pci_dev *pdev,
 	return 0;
 
 out_free_c_can:
-	pci_set_drvdata(pdev, NULL);
 	free_c_can_dev(dev);
 out_iounmap:
 	pci_iounmap(pdev, addr);
@@ -181,7 +180,6 @@ static void c_can_pci_remove(struct pci_dev *pdev)
 
 	unregister_c_can_dev(dev);
 
-	pci_set_drvdata(pdev, NULL);
 	free_c_can_dev(dev);
 
 	pci_iounmap(pdev, priv->base);
Signature · 1 line
1.7.10.4
author
#2 lore raw

PATCH 2/3 can: pch_can: remove unnecessary pci_set_drvdata()

In reply to Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/net/can/pch_can.c |    1 -
 1 file changed, 1 deletion(-)
drivers/net/can/pch_can.c +0 -1
index 5c314a9..5f0e9b3 100644
@@ -964,7 +964,6 @@ static void pch_can_remove(struct pci_dev *pdev)
 		pci_disable_msi(priv->dev);
 	pci_release_regions(pdev);
 	pci_disable_device(pdev);
-	pci_set_drvdata(pdev, NULL);
 	pch_can_reset(priv);
 	pci_iounmap(pdev, priv->regs);
 	free_candev(priv->ndev);
Signature · 1 line
1.7.10.4
author
#3 lore raw

PATCH 3/3 can: sja1000: remove unnecessary pci_set_drvdata()

In reply to Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/net/can/sja1000/ems_pci.c    |    1 -
 drivers/net/can/sja1000/kvaser_pci.c |    1 -
 drivers/net/can/sja1000/peak_pci.c   |    2 --
 drivers/net/can/sja1000/plx_pci.c    |    1 -
 4 files changed, 5 deletions(-)
drivers/net/can/sja1000/ems_pci.c +0 -1
index 3752342..8359213 100644
@@ -207,7 +207,6 @@ static void ems_pci_del_card(struct pci_dev *pdev)
 	kfree(card);
 
 	pci_disable_device(pdev);
-	pci_set_drvdata(pdev, NULL);
 }
 
 static void ems_pci_card_reset(struct ems_pci_card *card)
drivers/net/can/sja1000/kvaser_pci.c +0 -1
index 217585b..087b13b 100644
@@ -387,7 +387,6 @@ static void kvaser_pci_remove_one(struct pci_dev *pdev)
 
 	pci_release_regions(pdev);
 	pci_disable_device(pdev);
-	pci_set_drvdata(pdev, NULL);
 }
 
 static struct pci_driver kvaser_pci_driver = {
drivers/net/can/sja1000/peak_pci.c +0 -2
index 6b6f0ad..065ca49 100644
@@ -744,8 +744,6 @@ static void peak_pci_remove(struct pci_dev *pdev)
 	pci_iounmap(pdev, cfg_base);
 	pci_release_regions(pdev);
 	pci_disable_device(pdev);
-
-	pci_set_drvdata(pdev, NULL);
 }
 
 static struct pci_driver peak_pci_driver = {
drivers/net/can/sja1000/plx_pci.c +0 -1
index c52c1e9..f9b4f81 100644
@@ -477,7 +477,6 @@ static void plx_pci_del_card(struct pci_dev *pdev)
 	kfree(card);
 
 	pci_disable_device(pdev);
-	pci_set_drvdata(pdev, NULL);
 }
 
 /*
Signature · 1 line
1.7.10.4
#4 lore raw
In reply to Jingoo Han
Quoted 5 lines · Jingoo Han

Since commit 0998d0631001288a5974afc0b2a5f568bcdecb4d (device-core: Ensure drvdata = NULL when no driver is bound), the driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

Tnx, all applied to net-next/testing. The series will be included in the next pull request to David Miller.

regards,
Marc

Signature · 4 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |