* [PATCH 0/3] remove {get|put}_device from I2C drivers
@ 2013-04-18 17:13 Wolfram Sang
[not found] ` <1366305218-22817-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2013-04-18 17:13 UTC (permalink / raw)
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
Mika Westerberg, Andy Shevchenko, Viresh Kumar,
manishv.b-l0cyMroinI0, Wolfram Sang
I can't see a reason why these drivers should have additional refcounting on
top of what the driver core already does. So, remove it.
These patches are compile tested only. Tested-by tags are thus much appreciated!
The patches are based on my i2c/for-next branch on kernel.org.
Wolfram Sang (3):
i2c: davinci: drop superfluous {get|put}_device
i2c: designware-plat: drop superfluous {get|put}_device
i2c: designware-pci: drop superfluous {get|put}_device
drivers/i2c/busses/i2c-davinci.c | 19 ++++++-------------
drivers/i2c/busses/i2c-designware-pcidrv.c | 4 ----
drivers/i2c/busses/i2c-designware-platdrv.c | 4 ----
3 files changed, 6 insertions(+), 21 deletions(-)
--
1.7.10.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] i2c: davinci: drop superfluous {get|put}_device
[not found] ` <1366305218-22817-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
@ 2013-04-18 17:13 ` Wolfram Sang
[not found] ` <1366305218-22817-2-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2013-04-18 17:13 ` [PATCH 2/3] i2c: designware-plat: " Wolfram Sang
2013-04-18 17:13 ` [PATCH 3/3] i2c: designware-pci: " Wolfram Sang
2 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2013-04-18 17:13 UTC (permalink / raw)
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
Mika Westerberg, Andy Shevchenko, Viresh Kumar,
manishv.b-l0cyMroinI0, Wolfram Sang
Driver core already takes care of refcounting, no need to do this on
driver level again.
Signed-off-by: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
---
drivers/i2c/busses/i2c-davinci.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index c01edac..cf20e06 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -670,7 +670,7 @@ static int davinci_i2c_probe(struct platform_device *pdev)
#ifdef CONFIG_CPU_FREQ
init_completion(&dev->xfr_complete);
#endif
- dev->dev = get_device(&pdev->dev);
+ dev->dev = &pdev->dev;
dev->irq = irq->start;
dev->pdata = dev->dev->platform_data;
platform_set_drvdata(pdev, dev);
@@ -680,10 +680,9 @@ static int davinci_i2c_probe(struct platform_device *pdev)
dev->pdata = devm_kzalloc(&pdev->dev,
sizeof(struct davinci_i2c_platform_data), GFP_KERNEL);
- if (!dev->pdata) {
- r = -ENOMEM;
- goto err_free_mem;
- }
+ if (!dev->pdata)
+ return -ENOMEM;
+
memcpy(dev->pdata, &davinci_i2c_platform_data_default,
sizeof(struct davinci_i2c_platform_data));
if (!of_property_read_u32(pdev->dev.of_node, "clock-frequency",
@@ -694,10 +693,8 @@ static int davinci_i2c_probe(struct platform_device *pdev)
}
dev->clk = devm_clk_get(&pdev->dev, NULL);
- if (IS_ERR(dev->clk)) {
- r = -ENODEV;
- goto err_free_mem;
- }
+ if (IS_ERR(dev->clk))
+ return -ENODEV;
clk_prepare_enable(dev->clk);
dev->base = devm_ioremap_resource(&pdev->dev, mem);
@@ -744,9 +741,6 @@ static int davinci_i2c_probe(struct platform_device *pdev)
err_unuse_clocks:
clk_disable_unprepare(dev->clk);
dev->clk = NULL;
-err_free_mem:
- put_device(&pdev->dev);
-
return r;
}
@@ -757,7 +751,6 @@ static int davinci_i2c_remove(struct platform_device *pdev)
i2c_davinci_cpufreq_deregister(dev);
i2c_del_adapter(&dev->adapter);
- put_device(&pdev->dev);
clk_disable_unprepare(dev->clk);
dev->clk = NULL;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] i2c: designware-plat: drop superfluous {get|put}_device
[not found] ` <1366305218-22817-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2013-04-18 17:13 ` [PATCH 1/3] i2c: davinci: drop superfluous {get|put}_device Wolfram Sang
@ 2013-04-18 17:13 ` Wolfram Sang
[not found] ` <1366305218-22817-3-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2013-04-18 17:13 ` [PATCH 3/3] i2c: designware-pci: " Wolfram Sang
2 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2013-04-18 17:13 UTC (permalink / raw)
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
Mika Westerberg, Andy Shevchenko, Viresh Kumar,
manishv.b-l0cyMroinI0, Wolfram Sang
Driver core already takes care of refcounting, no need to do this on
driver level again.
Signed-off-by: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
---
drivers/i2c/busses/i2c-designware-platdrv.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index dec939a..f7549b6 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -170,9 +170,6 @@ static int dw_i2c_probe(struct platform_device *pdev)
of_i2c_register_devices(adap);
acpi_i2c_register_devices(adap);
- /* Increase reference counter */
- get_device(&pdev->dev);
-
pm_runtime_set_autosuspend_delay(&pdev->dev, 1000);
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_set_active(&pdev->dev);
@@ -188,7 +185,6 @@ static int dw_i2c_remove(struct platform_device *pdev)
pm_runtime_get_sync(&pdev->dev);
i2c_del_adapter(&dev->adapter);
- put_device(&pdev->dev);
i2c_dw_disable(dev);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] i2c: designware-pci: drop superfluous {get|put}_device
[not found] ` <1366305218-22817-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2013-04-18 17:13 ` [PATCH 1/3] i2c: davinci: drop superfluous {get|put}_device Wolfram Sang
2013-04-18 17:13 ` [PATCH 2/3] i2c: designware-plat: " Wolfram Sang
@ 2013-04-18 17:13 ` Wolfram Sang
[not found] ` <1366305218-22817-4-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2013-04-18 17:13 UTC (permalink / raw)
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
Mika Westerberg, Andy Shevchenko, Viresh Kumar,
manishv.b-l0cyMroinI0, Wolfram Sang
Driver core already takes care of refcounting, no need to do this on
driver level again.
Signed-off-by: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
---
drivers/i2c/busses/i2c-designware-pcidrv.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index c8797e2..f6ed06c 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
@@ -288,9 +288,6 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
return r;
}
- /* Increase reference counter */
- get_device(&pdev->dev);
-
pm_runtime_set_autosuspend_delay(&pdev->dev, 1000);
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_allow(&pdev->dev);
@@ -307,7 +304,6 @@ static void i2c_dw_pci_remove(struct pci_dev *pdev)
pm_runtime_get_noresume(&pdev->dev);
i2c_del_adapter(&dev->adapter);
- put_device(&pdev->dev);
}
/* work with hotplug and coldplug */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] i2c: designware-plat: drop superfluous {get|put}_device
[not found] ` <1366305218-22817-3-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
@ 2013-04-19 9:46 ` Mika Westerberg
0 siblings, 0 replies; 7+ messages in thread
From: Mika Westerberg @ 2013-04-19 9:46 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
Andy Shevchenko, Viresh Kumar, manishv.b-l0cyMroinI0
On Thu, Apr 18, 2013 at 07:13:37PM +0200, Wolfram Sang wrote:
> Driver core already takes care of refcounting, no need to do this on
> driver level again.
>
> Signed-off-by: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
Tested-by: Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] i2c: designware-pci: drop superfluous {get|put}_device
[not found] ` <1366305218-22817-4-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
@ 2013-04-19 9:47 ` Mika Westerberg
0 siblings, 0 replies; 7+ messages in thread
From: Mika Westerberg @ 2013-04-19 9:47 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
Andy Shevchenko, Viresh Kumar, manishv.b-l0cyMroinI0
On Thu, Apr 18, 2013 at 07:13:38PM +0200, Wolfram Sang wrote:
> Driver core already takes care of refcounting, no need to do this on
> driver level again.
>
> Signed-off-by: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
Tested-by: Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] i2c: davinci: drop superfluous {get|put}_device
[not found] ` <1366305218-22817-2-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
@ 2013-04-19 11:43 ` Sekhar Nori
0 siblings, 0 replies; 7+ messages in thread
From: Sekhar Nori @ 2013-04-19 11:43 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
Viresh Kumar, Andy Shevchenko, Mika Westerberg
On 4/18/2013 10:43 PM, Wolfram Sang wrote:
> Driver core already takes care of refcounting, no need to do this on
> driver level again.
>
> Signed-off-by: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
Tested I2C probe on DA850 EVM.
Tested-by: Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org>
Thanks,
Sekhar
> ---
> drivers/i2c/busses/i2c-davinci.c | 19 ++++++-------------
> 1 file changed, 6 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
> index c01edac..cf20e06 100644
> --- a/drivers/i2c/busses/i2c-davinci.c
> +++ b/drivers/i2c/busses/i2c-davinci.c
> @@ -670,7 +670,7 @@ static int davinci_i2c_probe(struct platform_device *pdev)
> #ifdef CONFIG_CPU_FREQ
> init_completion(&dev->xfr_complete);
> #endif
> - dev->dev = get_device(&pdev->dev);
> + dev->dev = &pdev->dev;
> dev->irq = irq->start;
> dev->pdata = dev->dev->platform_data;
> platform_set_drvdata(pdev, dev);
> @@ -680,10 +680,9 @@ static int davinci_i2c_probe(struct platform_device *pdev)
>
> dev->pdata = devm_kzalloc(&pdev->dev,
> sizeof(struct davinci_i2c_platform_data), GFP_KERNEL);
> - if (!dev->pdata) {
> - r = -ENOMEM;
> - goto err_free_mem;
> - }
> + if (!dev->pdata)
> + return -ENOMEM;
> +
> memcpy(dev->pdata, &davinci_i2c_platform_data_default,
> sizeof(struct davinci_i2c_platform_data));
> if (!of_property_read_u32(pdev->dev.of_node, "clock-frequency",
> @@ -694,10 +693,8 @@ static int davinci_i2c_probe(struct platform_device *pdev)
> }
>
> dev->clk = devm_clk_get(&pdev->dev, NULL);
> - if (IS_ERR(dev->clk)) {
> - r = -ENODEV;
> - goto err_free_mem;
> - }
> + if (IS_ERR(dev->clk))
> + return -ENODEV;
> clk_prepare_enable(dev->clk);
>
> dev->base = devm_ioremap_resource(&pdev->dev, mem);
> @@ -744,9 +741,6 @@ static int davinci_i2c_probe(struct platform_device *pdev)
> err_unuse_clocks:
> clk_disable_unprepare(dev->clk);
> dev->clk = NULL;
> -err_free_mem:
> - put_device(&pdev->dev);
> -
> return r;
> }
>
> @@ -757,7 +751,6 @@ static int davinci_i2c_remove(struct platform_device *pdev)
> i2c_davinci_cpufreq_deregister(dev);
>
> i2c_del_adapter(&dev->adapter);
> - put_device(&pdev->dev);
>
> clk_disable_unprepare(dev->clk);
> dev->clk = NULL;
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-04-19 11:43 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-18 17:13 [PATCH 0/3] remove {get|put}_device from I2C drivers Wolfram Sang
[not found] ` <1366305218-22817-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2013-04-18 17:13 ` [PATCH 1/3] i2c: davinci: drop superfluous {get|put}_device Wolfram Sang
[not found] ` <1366305218-22817-2-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2013-04-19 11:43 ` Sekhar Nori
2013-04-18 17:13 ` [PATCH 2/3] i2c: designware-plat: " Wolfram Sang
[not found] ` <1366305218-22817-3-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2013-04-19 9:46 ` Mika Westerberg
2013-04-18 17:13 ` [PATCH 3/3] i2c: designware-pci: " Wolfram Sang
[not found] ` <1366305218-22817-4-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2013-04-19 9:47 ` Mika Westerberg
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).