aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Anderson <dianders@chromium.org>2013-02-15 08:18:35 -0500
committerWolfram Sang <wolfram@the-dreams.de>2013-02-21 18:25:50 -0500
commit55827f4aa6442ddd1d6a4e1e32f2f457eb113c22 (patch)
tree5fb9f31a58c05d678694d8102fed07b4d45bb14f
parent0a6d2246790512c88931ddbfedf3fd48e0979093 (diff)
i2c: Remove unneeded xxx_set_drvdata(..., NULL) calls
There is simply no reason to be manually setting the private driver data to NULL in the remove/fail to probe cases. This is just extra cruft code that can be removed. A few notes: * Nothing relies on drvdata being set to NULL. * The __device_release_driver() function eventually calls dev_set_drvdata(dev, NULL) anyway, so there's no need to do it twice. * I verified that there were no cases where xxx_get_drvdata() was being called in these drivers and checking for / relying on the NULL return value. This could be cleaned up kernel-wide but for now just take the baby step and remove from the i2c subsystem. Reported-by: Wolfram Sang <wsa@the-dreams.de> Reported-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Doug Anderson <dianders@chromium.org> Reviewed-by: Jean Delvare <khali@linux-fr.org> Acked-by: Peter Korsgaard <jacmet@sunsite.dk> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Marek Vasut <marex@denx.de> Signed-off-by: Wolfram Sang <wolfram@the-dreams.de>
-rw-r--r--drivers/i2c/busses/i2c-au1550.c1
-rw-r--r--drivers/i2c/busses/i2c-bfin-twi.c2
-rw-r--r--drivers/i2c/busses/i2c-cpm.c2
-rw-r--r--drivers/i2c/busses/i2c-davinci.c2
-rw-r--r--drivers/i2c/busses/i2c-designware-pcidrv.c2
-rw-r--r--drivers/i2c/busses/i2c-designware-platdrv.c2
-rw-r--r--drivers/i2c/busses/i2c-eg20t.c2
-rw-r--r--drivers/i2c/busses/i2c-highlander.c4
-rw-r--r--drivers/i2c/busses/i2c-i801.c1
-rw-r--r--drivers/i2c/busses/i2c-ibm_iic.c3
-rw-r--r--drivers/i2c/busses/i2c-imx.c1
-rw-r--r--drivers/i2c/busses/i2c-intel-mid.c2
-rw-r--r--drivers/i2c/busses/i2c-iop3xx.c2
-rw-r--r--drivers/i2c/busses/i2c-mpc.c2
-rw-r--r--drivers/i2c/busses/i2c-mxs.c2
-rw-r--r--drivers/i2c/busses/i2c-nomadik.c2
-rw-r--r--drivers/i2c/busses/i2c-ocores.c1
-rw-r--r--drivers/i2c/busses/i2c-octeon.c5
-rw-r--r--drivers/i2c/busses/i2c-omap.c3
-rw-r--r--drivers/i2c/busses/i2c-pca-platform.c1
-rw-r--r--drivers/i2c/busses/i2c-pmcmsp.c2
-rw-r--r--drivers/i2c/busses/i2c-pnx.c2
-rw-r--r--drivers/i2c/busses/i2c-powermac.c1
-rw-r--r--drivers/i2c/busses/i2c-puv3.c2
-rw-r--r--drivers/i2c/busses/i2c-pxa-pci.c2
-rw-r--r--drivers/i2c/busses/i2c-pxa.c2
-rw-r--r--drivers/i2c/busses/i2c-s6000.c1
-rw-r--r--drivers/i2c/busses/i2c-sh7760.c1
-rw-r--r--drivers/i2c/busses/i2c-stu300.c1
-rw-r--r--drivers/i2c/busses/i2c-taos-evm.c2
-rw-r--r--drivers/i2c/busses/i2c-versatile.c2
-rw-r--r--drivers/i2c/busses/i2c-xiic.c2
-rw-r--r--drivers/i2c/busses/i2c-xlr.c1
-rw-r--r--drivers/i2c/busses/scx200_acb.c1
-rw-r--r--drivers/i2c/muxes/i2c-mux-gpio.c1
35 files changed, 1 insertions, 64 deletions
diff --git a/drivers/i2c/busses/i2c-au1550.c b/drivers/i2c/busses/i2c-au1550.c
index b278298787d7..b5b89239d622 100644
--- a/drivers/i2c/busses/i2c-au1550.c
+++ b/drivers/i2c/busses/i2c-au1550.c
@@ -376,7 +376,6 @@ static int i2c_au1550_remove(struct platform_device *pdev)
376{ 376{
377 struct i2c_au1550_data *priv = platform_get_drvdata(pdev); 377 struct i2c_au1550_data *priv = platform_get_drvdata(pdev);
378 378
379 platform_set_drvdata(pdev, NULL);
380 i2c_del_adapter(&priv->adap); 379 i2c_del_adapter(&priv->adap);
381 i2c_au1550_disable(priv); 380 i2c_au1550_disable(priv);
382 iounmap(priv->psc_base); 381 iounmap(priv->psc_base);
diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c
index 0cf780fd6ef1..05080c449c6b 100644
--- a/drivers/i2c/busses/i2c-bfin-twi.c
+++ b/drivers/i2c/busses/i2c-bfin-twi.c
@@ -724,8 +724,6 @@ static int i2c_bfin_twi_remove(struct platform_device *pdev)
724{ 724{
725 struct bfin_twi_iface *iface = platform_get_drvdata(pdev); 725 struct bfin_twi_iface *iface = platform_get_drvdata(pdev);
726 726
727 platform_set_drvdata(pdev, NULL);
728
729 i2c_del_adapter(&(iface->adap)); 727 i2c_del_adapter(&(iface->adap));
730 free_irq(iface->irq, iface); 728 free_irq(iface->irq, iface);
731 peripheral_free_list((unsigned short *)pdev->dev.platform_data); 729 peripheral_free_list((unsigned short *)pdev->dev.platform_data);
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index 2e79c1024191..3823623baa48 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -682,7 +682,6 @@ static int cpm_i2c_probe(struct platform_device *ofdev)
682out_shut: 682out_shut:
683 cpm_i2c_shutdown(cpm); 683 cpm_i2c_shutdown(cpm);
684out_free: 684out_free:
685 dev_set_drvdata(&ofdev->dev, NULL);
686 kfree(cpm); 685 kfree(cpm);
687 686
688 return result; 687 return result;
@@ -696,7 +695,6 @@ static int cpm_i2c_remove(struct platform_device *ofdev)
696 695
697 cpm_i2c_shutdown(cpm); 696 cpm_i2c_shutdown(cpm);
698 697
699 dev_set_drvdata(&ofdev->dev, NULL);
700 kfree(cpm); 698 kfree(cpm);
701 699
702 return 0; 700 return 0;
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index 6a0a55319449..7d1e590a7bb6 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -755,7 +755,6 @@ err_mem_ioremap:
755 clk_put(dev->clk); 755 clk_put(dev->clk);
756 dev->clk = NULL; 756 dev->clk = NULL;
757err_free_mem: 757err_free_mem:
758 platform_set_drvdata(pdev, NULL);
759 put_device(&pdev->dev); 758 put_device(&pdev->dev);
760 kfree(dev); 759 kfree(dev);
761err_release_region: 760err_release_region:
@@ -771,7 +770,6 @@ static int davinci_i2c_remove(struct platform_device *pdev)
771 770
772 i2c_davinci_cpufreq_deregister(dev); 771 i2c_davinci_cpufreq_deregister(dev);
773 772
774 platform_set_drvdata(pdev, NULL);
775 i2c_del_adapter(&dev->adapter); 773 i2c_del_adapter(&dev->adapter);
776 put_device(&pdev->dev); 774 put_device(&pdev->dev);
777 775
diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index 6add851e9dee..7c5e383c350d 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
@@ -319,7 +319,6 @@ err_free_irq:
319 free_irq(pdev->irq, dev); 319 free_irq(pdev->irq, dev);
320err_iounmap: 320err_iounmap:
321 iounmap(dev->base); 321 iounmap(dev->base);
322 pci_set_drvdata(pdev, NULL);
323 put_device(&pdev->dev); 322 put_device(&pdev->dev);
324 kfree(dev); 323 kfree(dev);
325err_release_region: 324err_release_region:
@@ -336,7 +335,6 @@ static void i2c_dw_pci_remove(struct pci_dev *pdev)
336 pm_runtime_forbid(&pdev->dev); 335 pm_runtime_forbid(&pdev->dev);
337 pm_runtime_get_noresume(&pdev->dev); 336 pm_runtime_get_noresume(&pdev->dev);
338 337
339 pci_set_drvdata(pdev, NULL);
340 i2c_del_adapter(&dev->adapter); 338 i2c_del_adapter(&dev->adapter);
341 put_device(&pdev->dev); 339 put_device(&pdev->dev);
342 340
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index d2a33e93f8ab..0ceb6e1b0f65 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -207,7 +207,6 @@ err_unuse_clocks:
207 clk_put(dev->clk); 207 clk_put(dev->clk);
208 dev->clk = NULL; 208 dev->clk = NULL;
209err_free_mem: 209err_free_mem:
210 platform_set_drvdata(pdev, NULL);
211 put_device(&pdev->dev); 210 put_device(&pdev->dev);
212 kfree(dev); 211 kfree(dev);
213err_release_region: 212err_release_region:
@@ -221,7 +220,6 @@ static int dw_i2c_remove(struct platform_device *pdev)
221 struct dw_i2c_dev *dev = platform_get_drvdata(pdev); 220 struct dw_i2c_dev *dev = platform_get_drvdata(pdev);
222 struct resource *mem; 221 struct resource *mem;
223 222
224 platform_set_drvdata(pdev, NULL);
225 pm_runtime_get_sync(&pdev->dev); 223 pm_runtime_get_sync(&pdev->dev);
226 224
227 i2c_del_adapter(&dev->adapter); 225 i2c_del_adapter(&dev->adapter);
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index 5e7886e7136e..0f3752967c4b 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -869,8 +869,6 @@ static void pch_i2c_remove(struct pci_dev *pdev)
869 for (i = 0; i < adap_info->ch_num; i++) 869 for (i = 0; i < adap_info->ch_num; i++)
870 adap_info->pch_data[i].pch_base_address = NULL; 870 adap_info->pch_data[i].pch_base_address = NULL;
871 871
872 pci_set_drvdata(pdev, NULL);
873
874 pci_release_regions(pdev); 872 pci_release_regions(pdev);
875 873
876 pci_disable_device(pdev); 874 pci_disable_device(pdev);
diff --git a/drivers/i2c/busses/i2c-highlander.c b/drivers/i2c/busses/i2c-highlander.c
index 3351cc7ed11f..436b0f254916 100644
--- a/drivers/i2c/busses/i2c-highlander.c
+++ b/drivers/i2c/busses/i2c-highlander.c
@@ -436,8 +436,6 @@ err_unmap:
436err: 436err:
437 kfree(dev); 437 kfree(dev);
438 438
439 platform_set_drvdata(pdev, NULL);
440
441 return ret; 439 return ret;
442} 440}
443 441
@@ -453,8 +451,6 @@ static int highlander_i2c_remove(struct platform_device *pdev)
453 iounmap(dev->base); 451 iounmap(dev->base);
454 kfree(dev); 452 kfree(dev);
455 453
456 platform_set_drvdata(pdev, NULL);
457
458 return 0; 454 return 0;
459} 455}
460 456
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 76febfb09760..e1cf2e0e1f23 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -1254,7 +1254,6 @@ static void i801_remove(struct pci_dev *dev)
1254 free_irq(dev->irq, priv); 1254 free_irq(dev->irq, priv);
1255 pci_release_region(dev, SMBBAR); 1255 pci_release_region(dev, SMBBAR);
1256 1256
1257 pci_set_drvdata(dev, NULL);
1258 kfree(priv); 1257 kfree(priv);
1259 /* 1258 /*
1260 * do not call pci_disable_device(dev) since it can cause hard hangs on 1259 * do not call pci_disable_device(dev) since it can cause hard hangs on
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index 33a2abb6c063..405a2e240454 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -773,7 +773,6 @@ error_cleanup:
773 if (dev->vaddr) 773 if (dev->vaddr)
774 iounmap(dev->vaddr); 774 iounmap(dev->vaddr);
775 775
776 dev_set_drvdata(&ofdev->dev, NULL);
777 kfree(dev); 776 kfree(dev);
778 return ret; 777 return ret;
779} 778}
@@ -785,8 +784,6 @@ static int iic_remove(struct platform_device *ofdev)
785{ 784{
786 struct ibm_iic_private *dev = dev_get_drvdata(&ofdev->dev); 785 struct ibm_iic_private *dev = dev_get_drvdata(&ofdev->dev);
787 786
788 dev_set_drvdata(&ofdev->dev, NULL);
789
790 i2c_del_adapter(&dev->adap); 787 i2c_del_adapter(&dev->adap);
791 788
792 if (dev->irq) { 789 if (dev->irq) {
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index b9734747d610..c5d2ba3c4cd0 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -605,7 +605,6 @@ static int __exit i2c_imx_remove(struct platform_device *pdev)
605 /* remove adapter */ 605 /* remove adapter */
606 dev_dbg(&i2c_imx->adapter.dev, "adapter removed\n"); 606 dev_dbg(&i2c_imx->adapter.dev, "adapter removed\n");
607 i2c_del_adapter(&i2c_imx->adapter); 607 i2c_del_adapter(&i2c_imx->adapter);
608 platform_set_drvdata(pdev, NULL);
609 608
610 /* setup chip registers to defaults */ 609 /* setup chip registers to defaults */
611 writeb(0, i2c_imx->base + IMX_I2C_IADR); 610 writeb(0, i2c_imx->base + IMX_I2C_IADR);
diff --git a/drivers/i2c/busses/i2c-intel-mid.c b/drivers/i2c/busses/i2c-intel-mid.c
index de3736bf6465..323fa018ffd5 100644
--- a/drivers/i2c/busses/i2c-intel-mid.c
+++ b/drivers/i2c/busses/i2c-intel-mid.c
@@ -1069,7 +1069,6 @@ static int intel_mid_i2c_probe(struct pci_dev *dev,
1069fail3: 1069fail3:
1070 free_irq(dev->irq, mrst); 1070 free_irq(dev->irq, mrst);
1071fail2: 1071fail2:
1072 pci_set_drvdata(dev, NULL);
1073 kfree(mrst); 1072 kfree(mrst);
1074fail1: 1073fail1:
1075 iounmap(base); 1074 iounmap(base);
@@ -1087,7 +1086,6 @@ static void intel_mid_i2c_remove(struct pci_dev *dev)
1087 dev_err(&dev->dev, "Failed to delete i2c adapter"); 1086 dev_err(&dev->dev, "Failed to delete i2c adapter");
1088 1087
1089 free_irq(dev->irq, mrst); 1088 free_irq(dev->irq, mrst);
1090 pci_set_drvdata(dev, NULL);
1091 iounmap(mrst->base); 1089 iounmap(mrst->base);
1092 kfree(mrst); 1090 kfree(mrst);
1093 pci_release_region(dev, 0); 1091 pci_release_region(dev, 0);
diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
index 2f99613fd677..bc993331c695 100644
--- a/drivers/i2c/busses/i2c-iop3xx.c
+++ b/drivers/i2c/busses/i2c-iop3xx.c
@@ -415,8 +415,6 @@ iop3xx_i2c_remove(struct platform_device *pdev)
415 kfree(adapter_data); 415 kfree(adapter_data);
416 kfree(padapter); 416 kfree(padapter);
417 417
418 platform_set_drvdata(pdev, NULL);
419
420 return 0; 418 return 0;
421} 419}
422 420
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index a69459e5c3f3..5e705ee02f4a 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -696,7 +696,6 @@ static int fsl_i2c_probe(struct platform_device *op)
696 return result; 696 return result;
697 697
698 fail_add: 698 fail_add:
699 dev_set_drvdata(&op->dev, NULL);
700 free_irq(i2c->irq, i2c); 699 free_irq(i2c->irq, i2c);
701 fail_request: 700 fail_request:
702 irq_dispose_mapping(i2c->irq); 701 irq_dispose_mapping(i2c->irq);
@@ -711,7 +710,6 @@ static int fsl_i2c_remove(struct platform_device *op)
711 struct mpc_i2c *i2c = dev_get_drvdata(&op->dev); 710 struct mpc_i2c *i2c = dev_get_drvdata(&op->dev);
712 711
713 i2c_del_adapter(&i2c->adap); 712 i2c_del_adapter(&i2c->adap);
714 dev_set_drvdata(&op->dev, NULL);
715 713
716 if (i2c->irq) 714 if (i2c->irq)
717 free_irq(i2c->irq, i2c); 715 free_irq(i2c->irq, i2c);
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 22d8ad353409..120f24646696 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -697,8 +697,6 @@ static int mxs_i2c_remove(struct platform_device *pdev)
697 697
698 writel(MXS_I2C_CTRL0_SFTRST, i2c->regs + MXS_I2C_CTRL0_SET); 698 writel(MXS_I2C_CTRL0_SFTRST, i2c->regs + MXS_I2C_CTRL0_SET);
699 699
700 platform_set_drvdata(pdev, NULL);
701
702 return 0; 700 return 0;
703} 701}
704 702
diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
index 5b1b1948128e..650293ff4d62 100644
--- a/drivers/i2c/busses/i2c-nomadik.c
+++ b/drivers/i2c/busses/i2c-nomadik.c
@@ -1105,7 +1105,6 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id)
1105 err_irq: 1105 err_irq:
1106 iounmap(dev->virtbase); 1106 iounmap(dev->virtbase);
1107 err_no_ioremap: 1107 err_no_ioremap:
1108 amba_set_drvdata(adev, NULL);
1109 kfree(dev); 1108 kfree(dev);
1110 err_pinctrl: 1109 err_pinctrl:
1111 err_no_mem: 1110 err_no_mem:
@@ -1130,7 +1129,6 @@ static int nmk_i2c_remove(struct amba_device *adev)
1130 release_mem_region(res->start, resource_size(res)); 1129 release_mem_region(res->start, resource_size(res));
1131 clk_put(dev->clk); 1130 clk_put(dev->clk);
1132 pm_runtime_disable(&adev->dev); 1131 pm_runtime_disable(&adev->dev);
1133 amba_set_drvdata(adev, NULL);
1134 kfree(dev); 1132 kfree(dev);
1135 1133
1136 return 0; 1134 return 0;
diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
index 6afa02db1156..dd3df76c2e35 100644
--- a/drivers/i2c/busses/i2c-ocores.c
+++ b/drivers/i2c/busses/i2c-ocores.c
@@ -451,7 +451,6 @@ static int ocores_i2c_remove(struct platform_device *pdev)
451 451
452 /* remove adapter & data */ 452 /* remove adapter & data */
453 i2c_del_adapter(&i2c->adap); 453 i2c_del_adapter(&i2c->adap);
454 platform_set_drvdata(pdev, NULL);
455 454
456 return 0; 455 return 0;
457} 456}
diff --git a/drivers/i2c/busses/i2c-octeon.c b/drivers/i2c/busses/i2c-octeon.c
index 484ca771fdff..935585ef4d39 100644
--- a/drivers/i2c/busses/i2c-octeon.c
+++ b/drivers/i2c/busses/i2c-octeon.c
@@ -595,7 +595,7 @@ static int octeon_i2c_probe(struct platform_device *pdev)
595 result = i2c_add_adapter(&i2c->adap); 595 result = i2c_add_adapter(&i2c->adap);
596 if (result < 0) { 596 if (result < 0) {
597 dev_err(i2c->dev, "failed to add adapter\n"); 597 dev_err(i2c->dev, "failed to add adapter\n");
598 goto fail_add; 598 goto out;
599 } 599 }
600 dev_info(i2c->dev, "version %s\n", DRV_VERSION); 600 dev_info(i2c->dev, "version %s\n", DRV_VERSION);
601 601
@@ -603,8 +603,6 @@ static int octeon_i2c_probe(struct platform_device *pdev)
603 603
604 return 0; 604 return 0;
605 605
606fail_add:
607 platform_set_drvdata(pdev, NULL);
608out: 606out:
609 return result; 607 return result;
610}; 608};
@@ -614,7 +612,6 @@ static int octeon_i2c_remove(struct platform_device *pdev)
614 struct octeon_i2c *i2c = platform_get_drvdata(pdev); 612 struct octeon_i2c *i2c = platform_get_drvdata(pdev);
615 613
616 i2c_del_adapter(&i2c->adap); 614 i2c_del_adapter(&i2c->adap);
617 platform_set_drvdata(pdev, NULL);
618 return 0; 615 return 0;
619}; 616};
620 617
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 4cc2f0528c88..79d05128c77e 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1262,7 +1262,6 @@ err_unuse_clocks:
1262 pm_runtime_put(dev->dev); 1262 pm_runtime_put(dev->dev);
1263 pm_runtime_disable(&pdev->dev); 1263 pm_runtime_disable(&pdev->dev);
1264err_free_mem: 1264err_free_mem:
1265 platform_set_drvdata(pdev, NULL);
1266 1265
1267 return r; 1266 return r;
1268} 1267}
@@ -1272,8 +1271,6 @@ static int omap_i2c_remove(struct platform_device *pdev)
1272 struct omap_i2c_dev *dev = platform_get_drvdata(pdev); 1271 struct omap_i2c_dev *dev = platform_get_drvdata(pdev);
1273 int ret; 1272 int ret;
1274 1273
1275 platform_set_drvdata(pdev, NULL);
1276
1277 i2c_del_adapter(&dev->adapter); 1274 i2c_del_adapter(&dev->adapter);
1278 ret = pm_runtime_get_sync(&pdev->dev); 1275 ret = pm_runtime_get_sync(&pdev->dev);
1279 if (IS_ERR_VALUE(ret)) 1276 if (IS_ERR_VALUE(ret))
diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c
index a30d2f613c03..aa00df14e30b 100644
--- a/drivers/i2c/busses/i2c-pca-platform.c
+++ b/drivers/i2c/busses/i2c-pca-platform.c
@@ -260,7 +260,6 @@ e_print:
260static int i2c_pca_pf_remove(struct platform_device *pdev) 260static int i2c_pca_pf_remove(struct platform_device *pdev)
261{ 261{
262 struct i2c_pca_pf_data *i2c = platform_get_drvdata(pdev); 262 struct i2c_pca_pf_data *i2c = platform_get_drvdata(pdev);
263 platform_set_drvdata(pdev, NULL);
264 263
265 i2c_del_adapter(&i2c->adap); 264 i2c_del_adapter(&i2c->adap);
266 265
diff --git a/drivers/i2c/busses/i2c-pmcmsp.c b/drivers/i2c/busses/i2c-pmcmsp.c
index 083d68cfaf0b..f6389e2c9d02 100644
--- a/drivers/i2c/busses/i2c-pmcmsp.c
+++ b/drivers/i2c/busses/i2c-pmcmsp.c
@@ -349,7 +349,6 @@ static int pmcmsptwi_probe(struct platform_device *pldev)
349 return 0; 349 return 0;
350 350
351ret_unmap: 351ret_unmap:
352 platform_set_drvdata(pldev, NULL);
353 if (pmcmsptwi_data.irq) { 352 if (pmcmsptwi_data.irq) {
354 pmcmsptwi_writel(0, 353 pmcmsptwi_writel(0,
355 pmcmsptwi_data.iobase + MSP_TWI_INT_MSK_REG_OFFSET); 354 pmcmsptwi_data.iobase + MSP_TWI_INT_MSK_REG_OFFSET);
@@ -374,7 +373,6 @@ static int pmcmsptwi_remove(struct platform_device *pldev)
374 373
375 i2c_del_adapter(&pmcmsptwi_adapter); 374 i2c_del_adapter(&pmcmsptwi_adapter);
376 375
377 platform_set_drvdata(pldev, NULL);
378 if (pmcmsptwi_data.irq) { 376 if (pmcmsptwi_data.irq) {
379 pmcmsptwi_writel(0, 377 pmcmsptwi_writel(0,
380 pmcmsptwi_data.iobase + MSP_TWI_INT_MSK_REG_OFFSET); 378 pmcmsptwi_data.iobase + MSP_TWI_INT_MSK_REG_OFFSET);
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
index ce4097012e97..5f39c6d8117a 100644
--- a/drivers/i2c/busses/i2c-pnx.c
+++ b/drivers/i2c/busses/i2c-pnx.c
@@ -761,7 +761,6 @@ out_clkget:
761out_drvdata: 761out_drvdata:
762 kfree(alg_data); 762 kfree(alg_data);
763err_kzalloc: 763err_kzalloc:
764 platform_set_drvdata(pdev, NULL);
765 return ret; 764 return ret;
766} 765}
767 766
@@ -776,7 +775,6 @@ static int i2c_pnx_remove(struct platform_device *pdev)
776 release_mem_region(alg_data->base, I2C_PNX_REGION_SIZE); 775 release_mem_region(alg_data->base, I2C_PNX_REGION_SIZE);
777 clk_put(alg_data->clk); 776 clk_put(alg_data->clk);
778 kfree(alg_data); 777 kfree(alg_data);
779 platform_set_drvdata(pdev, NULL);
780 778
781 return 0; 779 return 0;
782} 780}
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c
index 0dd5b334d090..da54e673449d 100644
--- a/drivers/i2c/busses/i2c-powermac.c
+++ b/drivers/i2c/busses/i2c-powermac.c
@@ -221,7 +221,6 @@ static int i2c_powermac_remove(struct platform_device *dev)
221 printk(KERN_WARNING 221 printk(KERN_WARNING
222 "i2c-powermac.c: Failed to remove bus %s !\n", 222 "i2c-powermac.c: Failed to remove bus %s !\n",
223 adapter->name); 223 adapter->name);
224 platform_set_drvdata(dev, NULL);
225 memset(adapter, 0, sizeof(*adapter)); 224 memset(adapter, 0, sizeof(*adapter));
226 225
227 return 0; 226 return 0;
diff --git a/drivers/i2c/busses/i2c-puv3.c b/drivers/i2c/busses/i2c-puv3.c
index d7c512d717a7..261d7db437e2 100644
--- a/drivers/i2c/busses/i2c-puv3.c
+++ b/drivers/i2c/busses/i2c-puv3.c
@@ -223,7 +223,6 @@ static int puv3_i2c_probe(struct platform_device *pdev)
223 return 0; 223 return 0;
224 224
225fail_add_adapter: 225fail_add_adapter:
226 platform_set_drvdata(pdev, NULL);
227 kfree(adapter); 226 kfree(adapter);
228fail_nomem: 227fail_nomem:
229 release_mem_region(mem->start, resource_size(mem)); 228 release_mem_region(mem->start, resource_size(mem));
@@ -245,7 +244,6 @@ static int puv3_i2c_remove(struct platform_device *pdev)
245 } 244 }
246 245
247 put_device(&pdev->dev); 246 put_device(&pdev->dev);
248 platform_set_drvdata(pdev, NULL);
249 247
250 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 248 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
251 release_mem_region(mem->start, resource_size(mem)); 249 release_mem_region(mem->start, resource_size(mem));
diff --git a/drivers/i2c/busses/i2c-pxa-pci.c b/drivers/i2c/busses/i2c-pxa-pci.c
index 3d4985695aed..9639be86e53f 100644
--- a/drivers/i2c/busses/i2c-pxa-pci.c
+++ b/drivers/i2c/busses/i2c-pxa-pci.c
@@ -128,7 +128,6 @@ static int ce4100_i2c_probe(struct pci_dev *dev,
128 return 0; 128 return 0;
129 129
130err_dev_add: 130err_dev_add:
131 pci_set_drvdata(dev, NULL);
132 kfree(sds); 131 kfree(sds);
133err_mem: 132err_mem:
134 pci_disable_device(dev); 133 pci_disable_device(dev);
@@ -141,7 +140,6 @@ static void ce4100_i2c_remove(struct pci_dev *dev)
141 unsigned int i; 140 unsigned int i;
142 141
143 sds = pci_get_drvdata(dev); 142 sds = pci_get_drvdata(dev);
144 pci_set_drvdata(dev, NULL);
145 143
146 for (i = 0; i < ARRAY_SIZE(sds->pdev); i++) 144 for (i = 0; i < ARRAY_SIZE(sds->pdev); i++)
147 platform_device_unregister(sds->pdev[i]); 145 platform_device_unregister(sds->pdev[i]);
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 4a79e768a4d8..1e88e8d66c55 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1219,8 +1219,6 @@ static int i2c_pxa_remove(struct platform_device *dev)
1219{ 1219{
1220 struct pxa_i2c *i2c = platform_get_drvdata(dev); 1220 struct pxa_i2c *i2c = platform_get_drvdata(dev);
1221 1221
1222 platform_set_drvdata(dev, NULL);
1223
1224 i2c_del_adapter(&i2c->adap); 1222 i2c_del_adapter(&i2c->adap);
1225 if (!i2c->use_pio) 1223 if (!i2c->use_pio)
1226 free_irq(i2c->irq, i2c); 1224 free_irq(i2c->irq, i2c);
diff --git a/drivers/i2c/busses/i2c-s6000.c b/drivers/i2c/busses/i2c-s6000.c
index 008836409efe..7c1ca5aca088 100644
--- a/drivers/i2c/busses/i2c-s6000.c
+++ b/drivers/i2c/busses/i2c-s6000.c
@@ -365,7 +365,6 @@ static int s6i2c_remove(struct platform_device *pdev)
365{ 365{
366 struct s6i2c_if *iface = platform_get_drvdata(pdev); 366 struct s6i2c_if *iface = platform_get_drvdata(pdev);
367 i2c_wr16(iface, S6_I2C_ENABLE, 0); 367 i2c_wr16(iface, S6_I2C_ENABLE, 0);
368 platform_set_drvdata(pdev, NULL);
369 i2c_del_adapter(&iface->adap); 368 i2c_del_adapter(&iface->adap);
370 free_irq(iface->irq, iface); 369 free_irq(iface->irq, iface);
371 clk_disable(iface->clk); 370 clk_disable(iface->clk);
diff --git a/drivers/i2c/busses/i2c-sh7760.c b/drivers/i2c/busses/i2c-sh7760.c
index 3a2253e1bf59..5351a2f34912 100644
--- a/drivers/i2c/busses/i2c-sh7760.c
+++ b/drivers/i2c/busses/i2c-sh7760.c
@@ -546,7 +546,6 @@ static int sh7760_i2c_remove(struct platform_device *pdev)
546 release_resource(id->ioarea); 546 release_resource(id->ioarea);
547 kfree(id->ioarea); 547 kfree(id->ioarea);
548 kfree(id); 548 kfree(id);
549 platform_set_drvdata(pdev, NULL);
550 549
551 return 0; 550 return 0;
552} 551}
diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c
index 580a0c04cb42..f1912c8520fe 100644
--- a/drivers/i2c/busses/i2c-stu300.c
+++ b/drivers/i2c/busses/i2c-stu300.c
@@ -975,7 +975,6 @@ stu300_remove(struct platform_device *pdev)
975 i2c_del_adapter(&dev->adapter); 975 i2c_del_adapter(&dev->adapter);
976 /* Turn off everything */ 976 /* Turn off everything */
977 stu300_wr8(0x00, dev->virtbase + I2C_CR); 977 stu300_wr8(0x00, dev->virtbase + I2C_CR);
978 platform_set_drvdata(pdev, NULL);
979 return 0; 978 return 0;
980} 979}
981 980
diff --git a/drivers/i2c/busses/i2c-taos-evm.c b/drivers/i2c/busses/i2c-taos-evm.c
index 26c352a09298..6ffa56e08517 100644
--- a/drivers/i2c/busses/i2c-taos-evm.c
+++ b/drivers/i2c/busses/i2c-taos-evm.c
@@ -271,7 +271,6 @@ static int taos_connect(struct serio *serio, struct serio_driver *drv)
271 exit_close: 271 exit_close:
272 serio_close(serio); 272 serio_close(serio);
273 exit_kfree: 273 exit_kfree:
274 serio_set_drvdata(serio, NULL);
275 kfree(taos); 274 kfree(taos);
276 exit: 275 exit:
277 return err; 276 return err;
@@ -285,7 +284,6 @@ static void taos_disconnect(struct serio *serio)
285 i2c_unregister_device(taos->client); 284 i2c_unregister_device(taos->client);
286 i2c_del_adapter(&taos->adapter); 285 i2c_del_adapter(&taos->adapter);
287 serio_close(serio); 286 serio_close(serio);
288 serio_set_drvdata(serio, NULL);
289 kfree(taos); 287 kfree(taos);
290 288
291 dev_info(&serio->dev, "Disconnected from TAOS EVM\n"); 289 dev_info(&serio->dev, "Disconnected from TAOS EVM\n");
diff --git a/drivers/i2c/busses/i2c-versatile.c b/drivers/i2c/busses/i2c-versatile.c
index eec20db6246f..f3a8790a07e8 100644
--- a/drivers/i2c/busses/i2c-versatile.c
+++ b/drivers/i2c/busses/i2c-versatile.c
@@ -125,8 +125,6 @@ static int i2c_versatile_remove(struct platform_device *dev)
125{ 125{
126 struct i2c_versatile *i2c = platform_get_drvdata(dev); 126 struct i2c_versatile *i2c = platform_get_drvdata(dev);
127 127
128 platform_set_drvdata(dev, NULL);
129
130 i2c_del_adapter(&i2c->adap); 128 i2c_del_adapter(&i2c->adap);
131 return 0; 129 return 0;
132} 130}
diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index f042f6da0ace..332c720fb3fe 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -784,8 +784,6 @@ static int xiic_i2c_remove(struct platform_device *pdev)
784 784
785 xiic_deinit(i2c); 785 xiic_deinit(i2c);
786 786
787 platform_set_drvdata(pdev, NULL);
788
789 free_irq(platform_get_irq(pdev, 0), i2c); 787 free_irq(platform_get_irq(pdev, 0), i2c);
790 788
791 iounmap(i2c->base); 789 iounmap(i2c->base);
diff --git a/drivers/i2c/busses/i2c-xlr.c b/drivers/i2c/busses/i2c-xlr.c
index a005265461da..86010293e23c 100644
--- a/drivers/i2c/busses/i2c-xlr.c
+++ b/drivers/i2c/busses/i2c-xlr.c
@@ -257,7 +257,6 @@ static int xlr_i2c_remove(struct platform_device *pdev)
257 257
258 priv = platform_get_drvdata(pdev); 258 priv = platform_get_drvdata(pdev);
259 i2c_del_adapter(&priv->adap); 259 i2c_del_adapter(&priv->adap);
260 platform_set_drvdata(pdev, NULL);
261 return 0; 260 return 0;
262} 261}
263 262
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c
index 3862a953239c..2d1d2c5653fb 100644
--- a/drivers/i2c/busses/scx200_acb.c
+++ b/drivers/i2c/busses/scx200_acb.c
@@ -542,7 +542,6 @@ static int scx200_remove(struct platform_device *pdev)
542 struct scx200_acb_iface *iface; 542 struct scx200_acb_iface *iface;
543 543
544 iface = platform_get_drvdata(pdev); 544 iface = platform_get_drvdata(pdev);
545 platform_set_drvdata(pdev, NULL);
546 scx200_cleanup_iface(iface); 545 scx200_cleanup_iface(iface);
547 546
548 return 0; 547 return 0;
diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c
index 9f50ef04a4bd..abc2e55aa243 100644
--- a/drivers/i2c/muxes/i2c-mux-gpio.c
+++ b/drivers/i2c/muxes/i2c-mux-gpio.c
@@ -250,7 +250,6 @@ static int i2c_mux_gpio_remove(struct platform_device *pdev)
250 for (i = 0; i < mux->data.n_gpios; i++) 250 for (i = 0; i < mux->data.n_gpios; i++)
251 gpio_free(mux->gpio_base + mux->data.gpios[i]); 251 gpio_free(mux->gpio_base + mux->data.gpios[i]);
252 252
253 platform_set_drvdata(pdev, NULL);
254 i2c_put_adapter(mux->parent); 253 i2c_put_adapter(mux->parent);
255 254
256 return 0; 255 return 0;