public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] OMAP: I2C: Fix the mismatch of pm_runtime enable and disable
@ 2012-01-11 13:21 Shubhrajyoti D
  2012-01-11 13:59 ` Grazvydas Ignotas
  0 siblings, 1 reply; 4+ messages in thread
From: Shubhrajyoti D @ 2012-01-11 13:21 UTC (permalink / raw)
  To: linux-omap
  Cc: khilman, Rajendra Nayak, linux-i2c, linux-arm-kernel,
	Shubhrajyoti D

Currently the i2c driver calls the pm_runtime_enable and never
the disable. This may cause a warning when pm_runtime_enable
checks for the count match.Attempting to fix the same by calling
pm_runtime_disable in the error and the remove path.

Cc: Kevin Hilman <khilman@ti.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
 drivers/i2c/busses/i2c-omap.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 12d402c..abc7b5b 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1070,6 +1070,7 @@ err_unuse_clocks:
 	omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
 	pm_runtime_put(dev->dev);
 	iounmap(dev->base);
+	pm_runtime_disable(&pdev->dev);
 err_free_mem:
 	platform_set_drvdata(pdev, NULL);
 	kfree(dev);
@@ -1085,6 +1086,7 @@ omap_i2c_remove(struct platform_device *pdev)
 	struct omap_i2c_dev	*dev = platform_get_drvdata(pdev);
 	struct resource		*mem;
 
+	pm_runtime_disable(&pdev->dev);
 	platform_set_drvdata(pdev, NULL);
 
 	free_irq(dev->irq, dev);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH RFC] OMAP: I2C: Fix the mismatch of pm_runtime enable and disable
  2012-01-11 13:21 [PATCH RFC] OMAP: I2C: Fix the mismatch of pm_runtime enable and disable Shubhrajyoti D
@ 2012-01-11 13:59 ` Grazvydas Ignotas
  2012-01-11 14:25   ` Shubhrajyoti
  0 siblings, 1 reply; 4+ messages in thread
From: Grazvydas Ignotas @ 2012-01-11 13:59 UTC (permalink / raw)
  To: Shubhrajyoti D
  Cc: linux-omap, linux-i2c, linux-arm-kernel, khilman, Rajendra Nayak,
	Felipe Contreras

On Wed, Jan 11, 2012 at 3:21 PM, Shubhrajyoti D <shubhrajyoti@ti.com> wrote:
> Currently the i2c driver calls the pm_runtime_enable and never
> the disable. This may cause a warning when pm_runtime_enable
> checks for the count match.Attempting to fix the same by calling
> pm_runtime_disable in the error and the remove path.

I remember seeing Felipe doing the reverse to musb here:
http://marc.info/?l=linux-omap&m=132432610700952&w=2
so I'm confused here.

>
> Cc: Kevin Hilman <khilman@ti.com>
> Cc: Rajendra Nayak <rnayak@ti.com>
> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
> ---
>  drivers/i2c/busses/i2c-omap.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 12d402c..abc7b5b 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -1070,6 +1070,7 @@ err_unuse_clocks:
>        omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
>        pm_runtime_put(dev->dev);
>        iounmap(dev->base);
> +       pm_runtime_disable(&pdev->dev);
>  err_free_mem:
>        platform_set_drvdata(pdev, NULL);
>        kfree(dev);
> @@ -1085,6 +1086,7 @@ omap_i2c_remove(struct platform_device *pdev)
>        struct omap_i2c_dev     *dev = platform_get_drvdata(pdev);
>        struct resource         *mem;
>
> +       pm_runtime_disable(&pdev->dev);
>        platform_set_drvdata(pdev, NULL);
>
>        free_irq(dev->irq, dev);
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Gražvydas
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RFC] OMAP: I2C: Fix the mismatch of pm_runtime enable and disable
  2012-01-11 13:59 ` Grazvydas Ignotas
@ 2012-01-11 14:25   ` Shubhrajyoti
       [not found]     ` <4F0D9BE1.6070209-l0cyMroinI0@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Shubhrajyoti @ 2012-01-11 14:25 UTC (permalink / raw)
  To: Grazvydas Ignotas
  Cc: linux-omap, linux-i2c, linux-arm-kernel, khilman, Rajendra Nayak,
	Felipe Contreras

On Wednesday 11 January 2012 07:29 PM, Grazvydas Ignotas wrote:
> On Wed, Jan 11, 2012 at 3:21 PM, Shubhrajyoti D <shubhrajyoti@ti.com> wrote:
>> Currently the i2c driver calls the pm_runtime_enable and never
>> the disable. This may cause a warning when pm_runtime_enable
>> checks for the count match.Attempting to fix the same by calling
>> pm_runtime_disable in the error and the remove path.
> I remember seeing Felipe doing the reverse to musb here:
> http://marc.info/?l=linux-omap&m=132432610700952&w=2
> so I'm confused here.
Strange however  I see many drivers doing the same in the kernel
on greping . Besides I expect a warn to come up.

Felipe could you explain the issue?


>> Cc: Kevin Hilman <khilman@ti.com>
>> Cc: Rajendra Nayak <rnayak@ti.com>
>> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
>> ---
>>  drivers/i2c/busses/i2c-omap.c |    2 ++
>>  1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
>> index 12d402c..abc7b5b 100644
>> --- a/drivers/i2c/busses/i2c-omap.c
>> +++ b/drivers/i2c/busses/i2c-omap.c
>> @@ -1070,6 +1070,7 @@ err_unuse_clocks:
>>        omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
>>        pm_runtime_put(dev->dev);
>>        iounmap(dev->base);
>> +       pm_runtime_disable(&pdev->dev);
>>  err_free_mem:
>>        platform_set_drvdata(pdev, NULL);
>>        kfree(dev);
>> @@ -1085,6 +1086,7 @@ omap_i2c_remove(struct platform_device *pdev)
>>        struct omap_i2c_dev     *dev = platform_get_drvdata(pdev);
>>        struct resource         *mem;
>>
>> +       pm_runtime_disable(&pdev->dev);
>>        platform_set_drvdata(pdev, NULL);
>>
>>        free_irq(dev->irq, dev);
>> --
>> 1.7.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RFC] OMAP: I2C: Fix the mismatch of pm_runtime enable and disable
       [not found]     ` <4F0D9BE1.6070209-l0cyMroinI0@public.gmane.org>
@ 2012-01-12 15:24       ` Felipe Contreras
  0 siblings, 0 replies; 4+ messages in thread
From: Felipe Contreras @ 2012-01-12 15:24 UTC (permalink / raw)
  To: Shubhrajyoti
  Cc: Grazvydas Ignotas, linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	khilman-l0cyMroinI0, Rajendra Nayak

On Wed, Jan 11, 2012 at 4:25 PM, Shubhrajyoti <shubhrajyoti-l0cyMroinI0@public.gmane.org> wrote:
> On Wednesday 11 January 2012 07:29 PM, Grazvydas Ignotas wrote:
>> On Wed, Jan 11, 2012 at 3:21 PM, Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org> wrote:
>>> Currently the i2c driver calls the pm_runtime_enable and never
>>> the disable. This may cause a warning when pm_runtime_enable
>>> checks for the count match.Attempting to fix the same by calling
>>> pm_runtime_disable in the error and the remove path.
>> I remember seeing Felipe doing the reverse to musb here:
>> http://marc.info/?l=linux-omap&m=132432610700952&w=2
>> so I'm confused here.
> Strange however  I see many drivers doing the same in the kernel
> on greping . Besides I expect a warn to come up.
>
> Felipe could you explain the issue?

When do you see the warning? kfree(dev) should disable runtime pm, but
without waking up the device.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-01-12 15:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-11 13:21 [PATCH RFC] OMAP: I2C: Fix the mismatch of pm_runtime enable and disable Shubhrajyoti D
2012-01-11 13:59 ` Grazvydas Ignotas
2012-01-11 14:25   ` Shubhrajyoti
     [not found]     ` <4F0D9BE1.6070209-l0cyMroinI0@public.gmane.org>
2012-01-12 15:24       ` Felipe Contreras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox