You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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>
This commit is contained in:
committed by
Wolfram Sang
parent
0a6d224679
commit
55827f4aa6
@@ -376,7 +376,6 @@ static int i2c_au1550_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct i2c_au1550_data *priv = platform_get_drvdata(pdev);
|
||||
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
i2c_del_adapter(&priv->adap);
|
||||
i2c_au1550_disable(priv);
|
||||
iounmap(priv->psc_base);
|
||||
|
||||
@@ -724,8 +724,6 @@ static int i2c_bfin_twi_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct bfin_twi_iface *iface = platform_get_drvdata(pdev);
|
||||
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
|
||||
i2c_del_adapter(&(iface->adap));
|
||||
free_irq(iface->irq, iface);
|
||||
peripheral_free_list((unsigned short *)pdev->dev.platform_data);
|
||||
|
||||
@@ -682,7 +682,6 @@ static int cpm_i2c_probe(struct platform_device *ofdev)
|
||||
out_shut:
|
||||
cpm_i2c_shutdown(cpm);
|
||||
out_free:
|
||||
dev_set_drvdata(&ofdev->dev, NULL);
|
||||
kfree(cpm);
|
||||
|
||||
return result;
|
||||
@@ -696,7 +695,6 @@ static int cpm_i2c_remove(struct platform_device *ofdev)
|
||||
|
||||
cpm_i2c_shutdown(cpm);
|
||||
|
||||
dev_set_drvdata(&ofdev->dev, NULL);
|
||||
kfree(cpm);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -755,7 +755,6 @@ err_mem_ioremap:
|
||||
clk_put(dev->clk);
|
||||
dev->clk = NULL;
|
||||
err_free_mem:
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
put_device(&pdev->dev);
|
||||
kfree(dev);
|
||||
err_release_region:
|
||||
@@ -771,7 +770,6 @@ static int davinci_i2c_remove(struct platform_device *pdev)
|
||||
|
||||
i2c_davinci_cpufreq_deregister(dev);
|
||||
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
i2c_del_adapter(&dev->adapter);
|
||||
put_device(&pdev->dev);
|
||||
|
||||
|
||||
@@ -319,7 +319,6 @@ err_free_irq:
|
||||
free_irq(pdev->irq, dev);
|
||||
err_iounmap:
|
||||
iounmap(dev->base);
|
||||
pci_set_drvdata(pdev, NULL);
|
||||
put_device(&pdev->dev);
|
||||
kfree(dev);
|
||||
err_release_region:
|
||||
@@ -336,7 +335,6 @@ static void i2c_dw_pci_remove(struct pci_dev *pdev)
|
||||
pm_runtime_forbid(&pdev->dev);
|
||||
pm_runtime_get_noresume(&pdev->dev);
|
||||
|
||||
pci_set_drvdata(pdev, NULL);
|
||||
i2c_del_adapter(&dev->adapter);
|
||||
put_device(&pdev->dev);
|
||||
|
||||
|
||||
@@ -207,7 +207,6 @@ err_unuse_clocks:
|
||||
clk_put(dev->clk);
|
||||
dev->clk = NULL;
|
||||
err_free_mem:
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
put_device(&pdev->dev);
|
||||
kfree(dev);
|
||||
err_release_region:
|
||||
@@ -221,7 +220,6 @@ static int dw_i2c_remove(struct platform_device *pdev)
|
||||
struct dw_i2c_dev *dev = platform_get_drvdata(pdev);
|
||||
struct resource *mem;
|
||||
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
pm_runtime_get_sync(&pdev->dev);
|
||||
|
||||
i2c_del_adapter(&dev->adapter);
|
||||
|
||||
@@ -869,8 +869,6 @@ static void pch_i2c_remove(struct pci_dev *pdev)
|
||||
for (i = 0; i < adap_info->ch_num; i++)
|
||||
adap_info->pch_data[i].pch_base_address = NULL;
|
||||
|
||||
pci_set_drvdata(pdev, NULL);
|
||||
|
||||
pci_release_regions(pdev);
|
||||
|
||||
pci_disable_device(pdev);
|
||||
|
||||
@@ -436,8 +436,6 @@ err_unmap:
|
||||
err:
|
||||
kfree(dev);
|
||||
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -453,8 +451,6 @@ static int highlander_i2c_remove(struct platform_device *pdev)
|
||||
iounmap(dev->base);
|
||||
kfree(dev);
|
||||
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1254,7 +1254,6 @@ static void i801_remove(struct pci_dev *dev)
|
||||
free_irq(dev->irq, priv);
|
||||
pci_release_region(dev, SMBBAR);
|
||||
|
||||
pci_set_drvdata(dev, NULL);
|
||||
kfree(priv);
|
||||
/*
|
||||
* do not call pci_disable_device(dev) since it can cause hard hangs on
|
||||
|
||||
@@ -773,7 +773,6 @@ error_cleanup:
|
||||
if (dev->vaddr)
|
||||
iounmap(dev->vaddr);
|
||||
|
||||
dev_set_drvdata(&ofdev->dev, NULL);
|
||||
kfree(dev);
|
||||
return ret;
|
||||
}
|
||||
@@ -785,8 +784,6 @@ static int iic_remove(struct platform_device *ofdev)
|
||||
{
|
||||
struct ibm_iic_private *dev = dev_get_drvdata(&ofdev->dev);
|
||||
|
||||
dev_set_drvdata(&ofdev->dev, NULL);
|
||||
|
||||
i2c_del_adapter(&dev->adap);
|
||||
|
||||
if (dev->irq) {
|
||||
|
||||
@@ -605,7 +605,6 @@ static int __exit i2c_imx_remove(struct platform_device *pdev)
|
||||
/* remove adapter */
|
||||
dev_dbg(&i2c_imx->adapter.dev, "adapter removed\n");
|
||||
i2c_del_adapter(&i2c_imx->adapter);
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
|
||||
/* setup chip registers to defaults */
|
||||
writeb(0, i2c_imx->base + IMX_I2C_IADR);
|
||||
|
||||
@@ -1069,7 +1069,6 @@ static int intel_mid_i2c_probe(struct pci_dev *dev,
|
||||
fail3:
|
||||
free_irq(dev->irq, mrst);
|
||||
fail2:
|
||||
pci_set_drvdata(dev, NULL);
|
||||
kfree(mrst);
|
||||
fail1:
|
||||
iounmap(base);
|
||||
@@ -1087,7 +1086,6 @@ static void intel_mid_i2c_remove(struct pci_dev *dev)
|
||||
dev_err(&dev->dev, "Failed to delete i2c adapter");
|
||||
|
||||
free_irq(dev->irq, mrst);
|
||||
pci_set_drvdata(dev, NULL);
|
||||
iounmap(mrst->base);
|
||||
kfree(mrst);
|
||||
pci_release_region(dev, 0);
|
||||
|
||||
@@ -415,8 +415,6 @@ iop3xx_i2c_remove(struct platform_device *pdev)
|
||||
kfree(adapter_data);
|
||||
kfree(padapter);
|
||||
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -696,7 +696,6 @@ static int fsl_i2c_probe(struct platform_device *op)
|
||||
return result;
|
||||
|
||||
fail_add:
|
||||
dev_set_drvdata(&op->dev, NULL);
|
||||
free_irq(i2c->irq, i2c);
|
||||
fail_request:
|
||||
irq_dispose_mapping(i2c->irq);
|
||||
@@ -711,7 +710,6 @@ static int fsl_i2c_remove(struct platform_device *op)
|
||||
struct mpc_i2c *i2c = dev_get_drvdata(&op->dev);
|
||||
|
||||
i2c_del_adapter(&i2c->adap);
|
||||
dev_set_drvdata(&op->dev, NULL);
|
||||
|
||||
if (i2c->irq)
|
||||
free_irq(i2c->irq, i2c);
|
||||
|
||||
@@ -697,8 +697,6 @@ static int mxs_i2c_remove(struct platform_device *pdev)
|
||||
|
||||
writel(MXS_I2C_CTRL0_SFTRST, i2c->regs + MXS_I2C_CTRL0_SET);
|
||||
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1105,7 +1105,6 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id)
|
||||
err_irq:
|
||||
iounmap(dev->virtbase);
|
||||
err_no_ioremap:
|
||||
amba_set_drvdata(adev, NULL);
|
||||
kfree(dev);
|
||||
err_pinctrl:
|
||||
err_no_mem:
|
||||
@@ -1130,7 +1129,6 @@ static int nmk_i2c_remove(struct amba_device *adev)
|
||||
release_mem_region(res->start, resource_size(res));
|
||||
clk_put(dev->clk);
|
||||
pm_runtime_disable(&adev->dev);
|
||||
amba_set_drvdata(adev, NULL);
|
||||
kfree(dev);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -451,7 +451,6 @@ static int ocores_i2c_remove(struct platform_device *pdev)
|
||||
|
||||
/* remove adapter & data */
|
||||
i2c_del_adapter(&i2c->adap);
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -595,7 +595,7 @@ static int octeon_i2c_probe(struct platform_device *pdev)
|
||||
result = i2c_add_adapter(&i2c->adap);
|
||||
if (result < 0) {
|
||||
dev_err(i2c->dev, "failed to add adapter\n");
|
||||
goto fail_add;
|
||||
goto out;
|
||||
}
|
||||
dev_info(i2c->dev, "version %s\n", DRV_VERSION);
|
||||
|
||||
@@ -603,8 +603,6 @@ static int octeon_i2c_probe(struct platform_device *pdev)
|
||||
|
||||
return 0;
|
||||
|
||||
fail_add:
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
out:
|
||||
return result;
|
||||
};
|
||||
@@ -614,7 +612,6 @@ static int octeon_i2c_remove(struct platform_device *pdev)
|
||||
struct octeon_i2c *i2c = platform_get_drvdata(pdev);
|
||||
|
||||
i2c_del_adapter(&i2c->adap);
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -1262,7 +1262,6 @@ err_unuse_clocks:
|
||||
pm_runtime_put(dev->dev);
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
err_free_mem:
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
|
||||
return r;
|
||||
}
|
||||
@@ -1272,8 +1271,6 @@ static int omap_i2c_remove(struct platform_device *pdev)
|
||||
struct omap_i2c_dev *dev = platform_get_drvdata(pdev);
|
||||
int ret;
|
||||
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
|
||||
i2c_del_adapter(&dev->adapter);
|
||||
ret = pm_runtime_get_sync(&pdev->dev);
|
||||
if (IS_ERR_VALUE(ret))
|
||||
|
||||
@@ -260,7 +260,6 @@ e_print:
|
||||
static int i2c_pca_pf_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct i2c_pca_pf_data *i2c = platform_get_drvdata(pdev);
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
|
||||
i2c_del_adapter(&i2c->adap);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user