public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: arnd@arndb•de (Arnd Bergmann)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 6/7] rtc: sa1100: enable clk support
Date: Wed, 22 Feb 2012 12:29:17 +0000	[thread overview]
Message-ID: <201202221229.17934.arnd@arndb.de> (raw)
In-Reply-To: <1329815096-6200-7-git-send-email-haojian.zhuang@marvell.com>

On Tuesday 21 February 2012, Haojian Zhuang wrote:
> @@ -306,6 +308,13 @@ static int sa1100_rtc_probe(struct platform_device *pdev)
>         if (!info)
>                 return -ENOMEM;
>  
> +       info->clk = clk_get(&pdev->dev, NULL);
> +       if (IS_ERR(info->clk)) {
> +               dev_err(&pdev->dev, "failed to find rtc clock source\n");
> +               ret = PTR_ERR(info->clk);
> +               goto err_clk;
> +       }
> +       clk_prepare_enable(info->clk);
>         info->iobase = res->start;
>         info->iosize = resource_size(res);
>         info->irq_1hz = irq_1hz;
> @@ -379,6 +388,9 @@ err_dev:
>         iounmap(info->reg_base);
>  err_map:
>         platform_set_drvdata(pdev, NULL);
> +       clk_disable_unprepare(info->clk);
> +       clk_put(info->clk);
> +err_clk:
>         kfree(info);
>         return ret;

I wonder whether it would be easier to just make the clk handling
conditional here, like

	info->clk = clk_get(&pdev->dev, NULL);
	if (PTR_ERR(info->clk) == -ENOENT)
		info->clk = NULL;
	if (IS_ERR(info->clk)) {
		ret =  PTR_ERR(info->clk);
		goto err_clk;
	}

	if (info->clk)
		clk_prepare_enable(info->clk);
	...
	if (info->clk) {
		clk_disable_unprepare(info->clk);
		clk_put(info->clk);
	}
		
With this, you would no longer need to add dummy clocks in platforms
that really have no clock handling.

	Arnd

  reply	other threads:[~2012-02-22 12:29 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-21  9:04 [PATCH 0/7] share sa1100 rtc driver to arch-mmp Haojian Zhuang
2012-02-21  9:04 ` [PATCH 1/7] rtc: sa1100: remove periodic code Haojian Zhuang
2012-02-21  9:04 ` [PATCH 2/7] rtc: sa1100: remove verification code of alarm Haojian Zhuang
2012-02-21  9:04 ` [PATCH 3/7] rtc: sa1100: use ioremap to map registers Haojian Zhuang
2012-02-22 12:33   ` Arnd Bergmann
2012-02-22 23:58   ` Russell King - ARM Linux
2012-02-23  0:55     ` Haojian Zhuang
2012-02-23  3:28   ` [PATCH v2 " Haojian Zhuang
2012-02-23 10:26     ` Russell King - ARM Linux
2012-02-21  9:04 ` [PATCH 4/7] ARM: sa1100: clean up of the clock support Haojian Zhuang
2012-02-22 12:31   ` Arnd Bergmann
2012-02-23 10:32   ` Russell King - ARM Linux
2012-02-21  9:04 ` [PATCH 5/7] ARM: pxa: add rtc dummy clock Haojian Zhuang
2012-02-21  9:04 ` [PATCH 6/7] rtc: sa1100: enable clk support Haojian Zhuang
2012-02-22 12:29   ` Arnd Bergmann [this message]
2012-02-22 13:16     ` Haojian Zhuang
2012-02-22 13:20     ` Russell King - ARM Linux
2012-02-22 13:47       ` Arnd Bergmann
2012-02-23 10:34   ` Russell King - ARM Linux
2012-02-23 10:40     ` Haojian Zhuang
2012-02-23 10:54       ` Russell King - ARM Linux
2012-02-21  9:04 ` [PATCH 7/7] ARM: mmp: enable rtc Haojian Zhuang
     [not found]   ` <1329815642.22876.YahooMailNeo@web162001.mail.bf1.yahoo.com>
2012-02-21  9:15     ` [HELP REQUIRED] : Andorid FIQ Debugger Porting issue on Kernel2.6.36 PINTU KUMAR
2012-02-21 15:37 ` [PATCH 0/7] share sa1100 rtc driver to arch-mmp Jean-Christophe PLAGNIOL-VILLARD
2012-02-21 15:54   ` Nicolas Ferre
2012-02-22 12:39 ` Arnd Bergmann
2012-02-22 13:22   ` Haojian Zhuang
2012-02-22 13:49     ` Arnd Bergmann
2012-02-22 15:37       ` Haojian Zhuang
2012-02-22 16:38         ` Robert Jarzmik
2012-02-23  0:51           ` Haojian Zhuang
2012-02-23  8:52             ` Robert Jarzmik
2012-02-23  9:45               ` Haojian Zhuang
2012-02-23 10:00                 ` Russell King - ARM Linux
2012-02-23 10:22                   ` Haojian Zhuang
2012-02-23 10:49                     ` Russell King - ARM Linux
2012-02-23 10:59                       ` Russell King - ARM Linux
2012-02-23 13:32                       ` Haojian Zhuang
2012-02-23 14:04                         ` Russell King - ARM Linux
2012-02-23  0:01 ` Russell King - ARM Linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201202221229.17934.arnd@arndb.de \
    --to=arnd@arndb$(echo .)de \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox