linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 1/5] serial: pxa: prepare/unprepare clocks
@ 2014-11-17 15:07 Dmitry Eremin-Solenikov
  2014-11-17 15:07 ` [PATCH V2 2/5] i2c: " Dmitry Eremin-Solenikov
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-11-17 15:07 UTC (permalink / raw)
  To: Robert Jarzmik, Daniel Mack, Haojian Zhuang, Greg Kroah-Hartman,
	Wolfram Sang, Samuel Ortiz, Lee Jones, Felipe Balbi
  Cc: Jiri Slaby, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA

Change clk_enable/disable() calls to clk_prepare_enable() and
clk_disable_unprepare().

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/tty/serial/pxa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c
index 21b7d8b8..2f4c329 100644
--- a/drivers/tty/serial/pxa.c
+++ b/drivers/tty/serial/pxa.c
@@ -647,7 +647,7 @@ serial_pxa_console_write(struct console *co, const char *s, unsigned int count)
 	unsigned long flags;
 	int locked = 1;
 
-	clk_enable(up->clk);
+	clk_prepare_enable(up->clk);
 	local_irq_save(flags);
 	if (up->port.sysrq)
 		locked = 0;
@@ -674,7 +674,7 @@ serial_pxa_console_write(struct console *co, const char *s, unsigned int count)
 	if (locked)
 		spin_unlock(&up->port.lock);
 	local_irq_restore(flags);
-	clk_disable(up->clk);
+	clk_disable_unprepare(up->clk);
 
 }
 
-- 
2.1.1

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

* [PATCH V2 2/5] i2c: pxa: prepare/unprepare clocks
  2014-11-17 15:07 [PATCH V2 1/5] serial: pxa: prepare/unprepare clocks Dmitry Eremin-Solenikov
@ 2014-11-17 15:07 ` Dmitry Eremin-Solenikov
  2014-11-17 15:51   ` Russell King - ARM Linux
       [not found]   ` <1416236863-20898-2-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
       [not found] ` <1416236863-20898-1-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2014-11-17 15:07 ` [PATCH V2 4/5] mfd: t7l66xb: " Dmitry Eremin-Solenikov
  2 siblings, 2 replies; 11+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-11-17 15:07 UTC (permalink / raw)
  To: Robert Jarzmik, Daniel Mack, Haojian Zhuang, Greg Kroah-Hartman,
	Wolfram Sang, Samuel Ortiz, Lee Jones, Felipe Balbi
  Cc: Jiri Slaby, linux-i2c, linux-arm-kernel, linux-serial, linux-usb

Change clk_enable/disable() calls to clk_prepare_enable() and
clk_disable_unprepare().

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 drivers/i2c/busses/i2c-pxa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index be671f7..2e75375 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1297,7 +1297,7 @@ static int i2c_pxa_suspend_noirq(struct device *dev)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct pxa_i2c *i2c = platform_get_drvdata(pdev);
 
-	clk_disable(i2c->clk);
+	clk_disable_unprepare(i2c->clk);
 
 	return 0;
 }
@@ -1307,7 +1307,7 @@ static int i2c_pxa_resume_noirq(struct device *dev)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct pxa_i2c *i2c = platform_get_drvdata(pdev);
 
-	clk_enable(i2c->clk);
+	clk_prepare_enable(i2c->clk);
 	i2c_pxa_reset(i2c);
 
 	return 0;
-- 
2.1.1


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

* [PATCH V2 3/5] usb: gadget: pxa25x_udc: prepare/unprepare clocks in pxa-ssp
       [not found] ` <1416236863-20898-1-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2014-11-17 15:07   ` Dmitry Eremin-Solenikov
  2014-11-17 18:44     ` Robert Jarzmik
  2014-11-17 15:07   ` [PATCH V2 5/5] mfd: tc6387xb: prepare/unprepare clocks Dmitry Eremin-Solenikov
  2014-11-17 15:51   ` [PATCH V2 1/5] serial: pxa: " Russell King - ARM Linux
  2 siblings, 1 reply; 11+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-11-17 15:07 UTC (permalink / raw)
  To: Robert Jarzmik, Daniel Mack, Haojian Zhuang, Greg Kroah-Hartman,
	Wolfram Sang, Samuel Ortiz, Lee Jones, Felipe Balbi
  Cc: Jiri Slaby, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA

Change clk_enable/disable() calls to clk_prepare_enable() and
clk_disable_unprepare().

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/usb/gadget/udc/pxa25x_udc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c
index 42f7eeb..e4964ee 100644
--- a/drivers/usb/gadget/udc/pxa25x_udc.c
+++ b/drivers/usb/gadget/udc/pxa25x_udc.c
@@ -103,8 +103,8 @@ static const char ep0name [] = "ep0";
 
 /* IXP doesn't yet support <linux/clk.h> */
 #define clk_get(dev,name)	NULL
-#define clk_enable(clk)		do { } while (0)
-#define clk_disable(clk)	do { } while (0)
+#define clk_prepare_enable(clk)	do { } while (0)
+#define clk_disable_unprepare(clk)	do { } while (0)
 #define clk_put(clk)		do { } while (0)
 
 #endif
@@ -932,7 +932,7 @@ static int pullup(struct pxa25x_udc *udc)
 		if (!udc->active) {
 			udc->active = 1;
 			/* Enable clock for USB device */
-			clk_enable(udc->clk);
+			clk_prepare_enable(udc->clk);
 			udc_enable(udc);
 		}
 	} else {
@@ -945,7 +945,7 @@ static int pullup(struct pxa25x_udc *udc)
 			}
 			udc_disable(udc);
 			/* Disable clock for USB device */
-			clk_disable(udc->clk);
+			clk_disable_unprepare(udc->clk);
 			udc->active = 0;
 		}
 
-- 
2.1.1

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

* [PATCH V2 4/5] mfd: t7l66xb: prepare/unprepare clocks
  2014-11-17 15:07 [PATCH V2 1/5] serial: pxa: prepare/unprepare clocks Dmitry Eremin-Solenikov
  2014-11-17 15:07 ` [PATCH V2 2/5] i2c: " Dmitry Eremin-Solenikov
       [not found] ` <1416236863-20898-1-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2014-11-17 15:07 ` Dmitry Eremin-Solenikov
  2014-11-18 13:14   ` Lee Jones
  2 siblings, 1 reply; 11+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-11-17 15:07 UTC (permalink / raw)
  To: Robert Jarzmik, Daniel Mack, Haojian Zhuang, Greg Kroah-Hartman,
	Wolfram Sang, Samuel Ortiz, Lee Jones, Felipe Balbi
  Cc: Jiri Slaby, linux-i2c, linux-arm-kernel, linux-serial, linux-usb

Change clk_enable/disable() calls to clk_prepare_enable() and
clk_disable_unprepare().

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 drivers/mfd/t7l66xb.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/mfd/t7l66xb.c b/drivers/mfd/t7l66xb.c
index 9e04a74..439d905 100644
--- a/drivers/mfd/t7l66xb.c
+++ b/drivers/mfd/t7l66xb.c
@@ -87,7 +87,7 @@ static int t7l66xb_mmc_enable(struct platform_device *mmc)
 	unsigned long flags;
 	u8 dev_ctl;
 
-	clk_enable(t7l66xb->clk32k);
+	clk_prepare_enable(t7l66xb->clk32k);
 
 	spin_lock_irqsave(&t7l66xb->lock, flags);
 
@@ -118,7 +118,7 @@ static int t7l66xb_mmc_disable(struct platform_device *mmc)
 
 	spin_unlock_irqrestore(&t7l66xb->lock, flags);
 
-	clk_disable(t7l66xb->clk32k);
+	clk_disable_unprepare(t7l66xb->clk32k);
 
 	return 0;
 }
@@ -285,7 +285,7 @@ static int t7l66xb_suspend(struct platform_device *dev, pm_message_t state)
 
 	if (pdata && pdata->suspend)
 		pdata->suspend(dev);
-	clk_disable(t7l66xb->clk48m);
+	clk_disable_unprepare(t7l66xb->clk48m);
 
 	return 0;
 }
@@ -295,7 +295,7 @@ static int t7l66xb_resume(struct platform_device *dev)
 	struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
 	struct t7l66xb_platform_data *pdata = dev_get_platdata(&dev->dev);
 
-	clk_enable(t7l66xb->clk48m);
+	clk_prepare_enable(t7l66xb->clk48m);
 	if (pdata && pdata->resume)
 		pdata->resume(dev);
 
@@ -369,7 +369,7 @@ static int t7l66xb_probe(struct platform_device *dev)
 		goto err_ioremap;
 	}
 
-	clk_enable(t7l66xb->clk48m);
+	clk_prepare_enable(t7l66xb->clk48m);
 
 	if (pdata && pdata->enable)
 		pdata->enable(dev);
@@ -414,9 +414,9 @@ static int t7l66xb_remove(struct platform_device *dev)
 	int ret;
 
 	ret = pdata->disable(dev);
-	clk_disable(t7l66xb->clk48m);
+	clk_disable_unprepare(t7l66xb->clk48m);
 	clk_put(t7l66xb->clk48m);
-	clk_disable(t7l66xb->clk32k);
+	clk_disable_unprepare(t7l66xb->clk32k);
 	clk_put(t7l66xb->clk32k);
 	t7l66xb_detach_irq(dev);
 	iounmap(t7l66xb->scr);
-- 
2.1.1


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

* [PATCH V2 5/5] mfd: tc6387xb: prepare/unprepare clocks
       [not found] ` <1416236863-20898-1-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2014-11-17 15:07   ` [PATCH V2 3/5] usb: gadget: pxa25x_udc: prepare/unprepare clocks in pxa-ssp Dmitry Eremin-Solenikov
@ 2014-11-17 15:07   ` Dmitry Eremin-Solenikov
  2014-11-18 12:04     ` Lee Jones
  2014-11-17 15:51   ` [PATCH V2 1/5] serial: pxa: " Russell King - ARM Linux
  2 siblings, 1 reply; 11+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-11-17 15:07 UTC (permalink / raw)
  To: Robert Jarzmik, Daniel Mack, Haojian Zhuang, Greg Kroah-Hartman,
	Wolfram Sang, Samuel Ortiz, Lee Jones, Felipe Balbi
  Cc: Jiri Slaby, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA

Change clk_enable/disable() calls to clk_prepare_enable() and
clk_disable_unprepare().

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/mfd/tc6387xb.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/tc6387xb.c b/drivers/mfd/tc6387xb.c
index e71f880..85fab37 100644
--- a/drivers/mfd/tc6387xb.c
+++ b/drivers/mfd/tc6387xb.c
@@ -52,7 +52,7 @@ static int tc6387xb_suspend(struct platform_device *dev, pm_message_t state)
 
 	if (pdata && pdata->suspend)
 		pdata->suspend(dev);
-	clk_disable(tc6387xb->clk32k);
+	clk_disable_unprepare(tc6387xb->clk32k);
 
 	return 0;
 }
@@ -62,7 +62,7 @@ static int tc6387xb_resume(struct platform_device *dev)
 	struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
 	struct tc6387xb_platform_data *pdata = dev_get_platdata(&dev->dev);
 
-	clk_enable(tc6387xb->clk32k);
+	clk_prepare_enable(tc6387xb->clk32k);
 	if (pdata && pdata->resume)
 		pdata->resume(dev);
 
@@ -100,7 +100,7 @@ static int tc6387xb_mmc_enable(struct platform_device *mmc)
 	struct platform_device *dev      = to_platform_device(mmc->dev.parent);
 	struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
 
-	clk_enable(tc6387xb->clk32k);
+	clk_prepare_enable(tc6387xb->clk32k);
 
 	tmio_core_mmc_enable(tc6387xb->scr + 0x200, 0,
 		tc6387xb_mmc_resources[0].start & 0xfffe);
@@ -113,7 +113,7 @@ static int tc6387xb_mmc_disable(struct platform_device *mmc)
 	struct platform_device *dev      = to_platform_device(mmc->dev.parent);
 	struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
 
-	clk_disable(tc6387xb->clk32k);
+	clk_disable_unprepare(tc6387xb->clk32k);
 
 	return 0;
 }
@@ -214,7 +214,7 @@ static int tc6387xb_remove(struct platform_device *dev)
 	mfd_remove_devices(&dev->dev);
 	iounmap(tc6387xb->scr);
 	release_resource(&tc6387xb->rscr);
-	clk_disable(tc6387xb->clk32k);
+	clk_disable_unprepare(tc6387xb->clk32k);
 	clk_put(tc6387xb->clk32k);
 	kfree(tc6387xb);
 
-- 
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH V2 2/5] i2c: pxa: prepare/unprepare clocks
  2014-11-17 15:07 ` [PATCH V2 2/5] i2c: " Dmitry Eremin-Solenikov
@ 2014-11-17 15:51   ` Russell King - ARM Linux
       [not found]   ` <1416236863-20898-2-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  1 sibling, 0 replies; 11+ messages in thread
From: Russell King - ARM Linux @ 2014-11-17 15:51 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: Robert Jarzmik, Daniel Mack, Haojian Zhuang, Greg Kroah-Hartman,
	Wolfram Sang, Samuel Ortiz, Lee Jones, Felipe Balbi, linux-usb,
	Jiri Slaby, linux-i2c, linux-arm-kernel, linux-serial

On Mon, Nov 17, 2014 at 06:07:40PM +0300, Dmitry Eremin-Solenikov wrote:
> Change clk_enable/disable() calls to clk_prepare_enable() and
> clk_disable_unprepare().
> 
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> ---
>  drivers/i2c/busses/i2c-pxa.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index be671f7..2e75375 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -1297,7 +1297,7 @@ static int i2c_pxa_suspend_noirq(struct device *dev)
>  	struct platform_device *pdev = to_platform_device(dev);
>  	struct pxa_i2c *i2c = platform_get_drvdata(pdev);
>  
> -	clk_disable(i2c->clk);
> +	clk_disable_unprepare(i2c->clk);

Since clk_unprepare() and clk_prepare() can sleep, it is unwise to call
these with IRQs disabled - the _noirq variants of these are run with
IRQs disabled.

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.

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

* Re: [PATCH V2 1/5] serial: pxa: prepare/unprepare clocks
       [not found] ` <1416236863-20898-1-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2014-11-17 15:07   ` [PATCH V2 3/5] usb: gadget: pxa25x_udc: prepare/unprepare clocks in pxa-ssp Dmitry Eremin-Solenikov
  2014-11-17 15:07   ` [PATCH V2 5/5] mfd: tc6387xb: prepare/unprepare clocks Dmitry Eremin-Solenikov
@ 2014-11-17 15:51   ` Russell King - ARM Linux
  2 siblings, 0 replies; 11+ messages in thread
From: Russell King - ARM Linux @ 2014-11-17 15:51 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: Robert Jarzmik, Daniel Mack, Haojian Zhuang, Greg Kroah-Hartman,
	Wolfram Sang, Samuel Ortiz, Lee Jones, Felipe Balbi,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Jiri Slaby,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-serial-u79uwXL29TY76Z2rM5mHXA

On Mon, Nov 17, 2014 at 06:07:39PM +0300, Dmitry Eremin-Solenikov wrote:
> Change clk_enable/disable() calls to clk_prepare_enable() and
> clk_disable_unprepare().

NAK.  Console writes can be called from IRQs-off regions.  clk_prepare()
can sleep.  Sleeping is not permitted with IRQs off.

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.

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

* Re: [PATCH V2 2/5] i2c: pxa: prepare/unprepare clocks
       [not found]   ` <1416236863-20898-2-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2014-11-17 18:26     ` Wolfram Sang
  0 siblings, 0 replies; 11+ messages in thread
From: Wolfram Sang @ 2014-11-17 18:26 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: Robert Jarzmik, Daniel Mack, Haojian Zhuang, Greg Kroah-Hartman,
	Samuel Ortiz, Lee Jones, Felipe Balbi, Jiri Slaby,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 1287 bytes --]

On Mon, Nov 17, 2014 at 06:07:40PM +0300, Dmitry Eremin-Solenikov wrote:
> Change clk_enable/disable() calls to clk_prepare_enable() and
> clk_disable_unprepare().

You describe what is done but we can see that from the patch. Please
describe here why the change is needed.

> 
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  drivers/i2c/busses/i2c-pxa.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index be671f7..2e75375 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -1297,7 +1297,7 @@ static int i2c_pxa_suspend_noirq(struct device *dev)
>  	struct platform_device *pdev = to_platform_device(dev);
>  	struct pxa_i2c *i2c = platform_get_drvdata(pdev);
>  
> -	clk_disable(i2c->clk);
> +	clk_disable_unprepare(i2c->clk);
>  
>  	return 0;
>  }
> @@ -1307,7 +1307,7 @@ static int i2c_pxa_resume_noirq(struct device *dev)
>  	struct platform_device *pdev = to_platform_device(dev);
>  	struct pxa_i2c *i2c = platform_get_drvdata(pdev);
>  
> -	clk_enable(i2c->clk);
> +	clk_prepare_enable(i2c->clk);
>  	i2c_pxa_reset(i2c);
>  
>  	return 0;
> -- 
> 2.1.1
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH V2 3/5] usb: gadget: pxa25x_udc: prepare/unprepare clocks in pxa-ssp
  2014-11-17 15:07   ` [PATCH V2 3/5] usb: gadget: pxa25x_udc: prepare/unprepare clocks in pxa-ssp Dmitry Eremin-Solenikov
@ 2014-11-17 18:44     ` Robert Jarzmik
  0 siblings, 0 replies; 11+ messages in thread
From: Robert Jarzmik @ 2014-11-17 18:44 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: Daniel Mack, Haojian Zhuang, Greg Kroah-Hartman, Wolfram Sang,
	Samuel Ortiz, Lee Jones, Felipe Balbi, Jiri Slaby, linux-i2c,
	linux-arm-kernel, linux-serial, linux-usb

Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> writes:

> Change clk_enable/disable() calls to clk_prepare_enable() and
> clk_disable_unprepare().
>
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> ---
>  drivers/usb/gadget/udc/pxa25x_udc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c
> index 42f7eeb..e4964ee 100644
> --- a/drivers/usb/gadget/udc/pxa25x_udc.c
> +++ b/drivers/usb/gadget/udc/pxa25x_udc.c
> @@ -103,8 +103,8 @@ static const char ep0name [] = "ep0";
>  
>  /* IXP doesn't yet support <linux/clk.h> */
>  #define clk_get(dev,name)	NULL
> -#define clk_enable(clk)		do { } while (0)
> -#define clk_disable(clk)	do { } while (0)
> +#define clk_prepare_enable(clk)	do { } while (0)
> +#define clk_disable_unprepare(clk)	do { } while (0)
>  #define clk_put(clk)		do { } while (0)
>  
>  #endif
> @@ -932,7 +932,7 @@ static int pullup(struct pxa25x_udc *udc)
>  		if (!udc->active) {
>  			udc->active = 1;
>  			/* Enable clock for USB device */
> -			clk_enable(udc->clk);
> +			clk_prepare_enable(udc->clk);

Guess what, Russell's remark on i2c and serial made me cross-check.  And there
is a case where this will be called in irq context too ...

See :
-> do_IRQ
  -> lubbock_vbus_irq()
    -> pxa25x_udc_vbus_session()
      -> pullup()
        -> clk_prepare_enable()
          -> CRACK

Note that your patch is not really the faulty one, I think a threaded irq
instead of the "raw" irq should do the trick. And it is granted on UDC api that
vbus function is called in a "sleeping" context (Felipe correct me if I'm
wrong), so a patch to fix this before your current code would be fine.

Cheers.

--
Robert

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

* Re: [PATCH V2 5/5] mfd: tc6387xb: prepare/unprepare clocks
  2014-11-17 15:07   ` [PATCH V2 5/5] mfd: tc6387xb: prepare/unprepare clocks Dmitry Eremin-Solenikov
@ 2014-11-18 12:04     ` Lee Jones
  0 siblings, 0 replies; 11+ messages in thread
From: Lee Jones @ 2014-11-18 12:04 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: Robert Jarzmik, Daniel Mack, Haojian Zhuang, Greg Kroah-Hartman,
	Wolfram Sang, Samuel Ortiz, Felipe Balbi, Jiri Slaby, linux-i2c,
	linux-arm-kernel, linux-serial, linux-usb

On Mon, 17 Nov 2014, Dmitry Eremin-Solenikov wrote:

> Change clk_enable/disable() calls to clk_prepare_enable() and
> clk_disable_unprepare().
> 
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> ---
>  drivers/mfd/tc6387xb.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

Looks good.  Applied, thanks.

> diff --git a/drivers/mfd/tc6387xb.c b/drivers/mfd/tc6387xb.c
> index e71f880..85fab37 100644
> --- a/drivers/mfd/tc6387xb.c
> +++ b/drivers/mfd/tc6387xb.c
> @@ -52,7 +52,7 @@ static int tc6387xb_suspend(struct platform_device *dev, pm_message_t state)
>  
>  	if (pdata && pdata->suspend)
>  		pdata->suspend(dev);
> -	clk_disable(tc6387xb->clk32k);
> +	clk_disable_unprepare(tc6387xb->clk32k);
>  
>  	return 0;
>  }
> @@ -62,7 +62,7 @@ static int tc6387xb_resume(struct platform_device *dev)
>  	struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
>  	struct tc6387xb_platform_data *pdata = dev_get_platdata(&dev->dev);
>  
> -	clk_enable(tc6387xb->clk32k);
> +	clk_prepare_enable(tc6387xb->clk32k);
>  	if (pdata && pdata->resume)
>  		pdata->resume(dev);
>  
> @@ -100,7 +100,7 @@ static int tc6387xb_mmc_enable(struct platform_device *mmc)
>  	struct platform_device *dev      = to_platform_device(mmc->dev.parent);
>  	struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
>  
> -	clk_enable(tc6387xb->clk32k);
> +	clk_prepare_enable(tc6387xb->clk32k);
>  
>  	tmio_core_mmc_enable(tc6387xb->scr + 0x200, 0,
>  		tc6387xb_mmc_resources[0].start & 0xfffe);
> @@ -113,7 +113,7 @@ static int tc6387xb_mmc_disable(struct platform_device *mmc)
>  	struct platform_device *dev      = to_platform_device(mmc->dev.parent);
>  	struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
>  
> -	clk_disable(tc6387xb->clk32k);
> +	clk_disable_unprepare(tc6387xb->clk32k);
>  
>  	return 0;
>  }
> @@ -214,7 +214,7 @@ static int tc6387xb_remove(struct platform_device *dev)
>  	mfd_remove_devices(&dev->dev);
>  	iounmap(tc6387xb->scr);
>  	release_resource(&tc6387xb->rscr);
> -	clk_disable(tc6387xb->clk32k);
> +	clk_disable_unprepare(tc6387xb->clk32k);
>  	clk_put(tc6387xb->clk32k);
>  	kfree(tc6387xb);
>  

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" 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] 11+ messages in thread

* Re: [PATCH V2 4/5] mfd: t7l66xb: prepare/unprepare clocks
  2014-11-17 15:07 ` [PATCH V2 4/5] mfd: t7l66xb: " Dmitry Eremin-Solenikov
@ 2014-11-18 13:14   ` Lee Jones
  0 siblings, 0 replies; 11+ messages in thread
From: Lee Jones @ 2014-11-18 13:14 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: Robert Jarzmik, Daniel Mack, Haojian Zhuang, Greg Kroah-Hartman,
	Wolfram Sang, Samuel Ortiz, Felipe Balbi, Jiri Slaby, linux-i2c,
	linux-arm-kernel, linux-serial, linux-usb

On Mon, 17 Nov 2014, Dmitry Eremin-Solenikov wrote:

> Change clk_enable/disable() calls to clk_prepare_enable() and
> clk_disable_unprepare().
> 
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> ---
>  drivers/mfd/t7l66xb.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/t7l66xb.c b/drivers/mfd/t7l66xb.c
> index 9e04a74..439d905 100644
> --- a/drivers/mfd/t7l66xb.c
> +++ b/drivers/mfd/t7l66xb.c
> @@ -87,7 +87,7 @@ static int t7l66xb_mmc_enable(struct platform_device *mmc)
>  	unsigned long flags;
>  	u8 dev_ctl;
>  
> -	clk_enable(t7l66xb->clk32k);
> +	clk_prepare_enable(t7l66xb->clk32k);
>  
>  	spin_lock_irqsave(&t7l66xb->lock, flags);
>  
> @@ -118,7 +118,7 @@ static int t7l66xb_mmc_disable(struct platform_device *mmc)
>  
>  	spin_unlock_irqrestore(&t7l66xb->lock, flags);
>  
> -	clk_disable(t7l66xb->clk32k);
> +	clk_disable_unprepare(t7l66xb->clk32k);
>  
>  	return 0;
>  }
> @@ -285,7 +285,7 @@ static int t7l66xb_suspend(struct platform_device *dev, pm_message_t state)
>  
>  	if (pdata && pdata->suspend)
>  		pdata->suspend(dev);
> -	clk_disable(t7l66xb->clk48m);
> +	clk_disable_unprepare(t7l66xb->clk48m);
>  
>  	return 0;
>  }
> @@ -295,7 +295,7 @@ static int t7l66xb_resume(struct platform_device *dev)
>  	struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
>  	struct t7l66xb_platform_data *pdata = dev_get_platdata(&dev->dev);
>  
> -	clk_enable(t7l66xb->clk48m);
> +	clk_prepare_enable(t7l66xb->clk48m);
>  	if (pdata && pdata->resume)
>  		pdata->resume(dev);
>  
> @@ -369,7 +369,7 @@ static int t7l66xb_probe(struct platform_device *dev)
>  		goto err_ioremap;
>  	}
>  
> -	clk_enable(t7l66xb->clk48m);
> +	clk_prepare_enable(t7l66xb->clk48m);
>  
>  	if (pdata && pdata->enable)
>  		pdata->enable(dev);
> @@ -414,9 +414,9 @@ static int t7l66xb_remove(struct platform_device *dev)
>  	int ret;
>  
>  	ret = pdata->disable(dev);
> -	clk_disable(t7l66xb->clk48m);
> +	clk_disable_unprepare(t7l66xb->clk48m);
>  	clk_put(t7l66xb->clk48m);
> -	clk_disable(t7l66xb->clk32k);
> +	clk_disable_unprepare(t7l66xb->clk32k);
>  	clk_put(t7l66xb->clk32k);
>  	t7l66xb_detach_irq(dev);
>  	iounmap(t7l66xb->scr);

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" 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] 11+ messages in thread

end of thread, other threads:[~2014-11-18 13:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-17 15:07 [PATCH V2 1/5] serial: pxa: prepare/unprepare clocks Dmitry Eremin-Solenikov
2014-11-17 15:07 ` [PATCH V2 2/5] i2c: " Dmitry Eremin-Solenikov
2014-11-17 15:51   ` Russell King - ARM Linux
     [not found]   ` <1416236863-20898-2-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-11-17 18:26     ` Wolfram Sang
     [not found] ` <1416236863-20898-1-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-11-17 15:07   ` [PATCH V2 3/5] usb: gadget: pxa25x_udc: prepare/unprepare clocks in pxa-ssp Dmitry Eremin-Solenikov
2014-11-17 18:44     ` Robert Jarzmik
2014-11-17 15:07   ` [PATCH V2 5/5] mfd: tc6387xb: prepare/unprepare clocks Dmitry Eremin-Solenikov
2014-11-18 12:04     ` Lee Jones
2014-11-17 15:51   ` [PATCH V2 1/5] serial: pxa: " Russell King - ARM Linux
2014-11-17 15:07 ` [PATCH V2 4/5] mfd: t7l66xb: " Dmitry Eremin-Solenikov
2014-11-18 13:14   ` Lee Jones

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).