linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: dwapb: Add support for a bus clock
@ 2018-03-09 10:34 Phil Edworthy
  2018-03-12 13:58 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Phil Edworthy @ 2018-03-09 10:34 UTC (permalink / raw)
  To: Hoan Tran; +Cc: Linus Walleij, linux-gpio, linux-kernel, Michel Pollet

From: Michel Pollet <michel.pollet@bp.renesas.com>

Enable specified clocks from DTS, if any.

Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
---
 drivers/gpio/gpio-dwapb.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
index b0704a8..56c58b5 100644
--- a/drivers/gpio/gpio-dwapb.c
+++ b/drivers/gpio/gpio-dwapb.c
@@ -27,6 +27,7 @@
 #include <linux/spinlock.h>
 #include <linux/platform_data/gpio-dwapb.h>
 #include <linux/slab.h>
+#include <linux/clk.h>
 
 #include "gpiolib.h"
 
@@ -637,6 +638,7 @@ static int dwapb_gpio_probe(struct platform_device *pdev)
 	int err;
 	struct device *dev = &pdev->dev;
 	struct dwapb_platform_data *pdata = dev_get_platdata(dev);
+	struct clk *clk;
 
 	if (!pdata) {
 		pdata = dwapb_gpio_get_pdata(dev);
@@ -670,6 +672,10 @@ static int dwapb_gpio_probe(struct platform_device *pdev)
 	if (IS_ERR(gpio->regs))
 		return PTR_ERR(gpio->regs);
 
+	clk = devm_clk_get(&pdev->dev, NULL);
+	if (!IS_ERR(clk) && clk_prepare_enable(clk))
+		dev_info(&pdev->dev, "no clock source\n");
+
 	gpio->flags = 0;
 	if (dev->of_node) {
 		const struct of_device_id *of_devid;
-- 
2.7.4

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

* Re: [PATCH] gpio: dwapb: Add support for a bus clock
  2018-03-09 10:34 [PATCH] gpio: dwapb: Add support for a bus clock Phil Edworthy
@ 2018-03-12 13:58 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2018-03-12 13:58 UTC (permalink / raw)
  To: Phil Edworthy
  Cc: Hoan Tran, Linus Walleij, open list:GPIO SUBSYSTEM,
	Linux Kernel Mailing List, Michel Pollet

On Fri, Mar 9, 2018 at 12:34 PM, Phil Edworthy
<phil.edworthy@renesas.com> wrote:
> From: Michel Pollet <michel.pollet@bp.renesas.com>
>
> Enable specified clocks from DTS, if any.
>
> Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>

>  #include <linux/spinlock.h>
>  #include <linux/platform_data/gpio-dwapb.h>
>  #include <linux/slab.h>
> +#include <linux/clk.h>

Keep in order.


> +       clk = devm_clk_get(&pdev->dev, NULL);
> +       if (!IS_ERR(clk) && clk_prepare_enable(clk))
> +               dev_info(&pdev->dev, "no clock source\n");

First of all, it shadows any error from clk_prepare_enable(), second,
it misses the clock name.
Next, I don't see how you managed the clock during PM and / or
->remove() operation.

-- 
With Best Regards,
Andy Shevchenko

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

end of thread, other threads:[~2018-03-12 13:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-09 10:34 [PATCH] gpio: dwapb: Add support for a bus clock Phil Edworthy
2018-03-12 13:58 ` Andy Shevchenko

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