From: Wolfram Sang <w.sang@pengutronix.de>
To: rtc-linux@googlegroups.com
Cc: a.zummo@towertech.it, linux-mips@linux-mips.org,
linux-kernel@vger.kernel.org, ralf@linux-mips.org,
keguang.zhang@gmail.com, wuzhangjin@gmail.com,
r0bertz@gentoo.org, zhao zhang <zhzhl555@gmail.com>
Subject: Re: [rtc-linux] [PATCH V1] MIPS: Add RTC support for loongson1B
Date: Sun, 27 Nov 2011 10:18:03 +0100 [thread overview]
Message-ID: <20111127091803.GD5263@pengutronix.de> (raw)
In-Reply-To: <1322189527-4761-1-git-send-email-zhzhl555@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2305 bytes --]
On Fri, Nov 25, 2011 at 10:52:07AM +0800, zhzhl555@gmail.com wrote:
> + writel(t, SYS_TOYWRITE1);
> + while (readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_TS)
> + usleep_range(1000, 3000);
> + __asm__ volatile ("sync");
Timeout?
> +
> +static int __devinit ls1x_rtc_probe(struct platform_device *pdev)
> +{
> + struct rtc_device *rtcdev;
> + unsigned long v;
> + int ret;
> +
> + v = readl(SYS_COUNTER_CNTRL);
> + if (!(v & RTC_CNTR_OK)) {
> + dev_err(&pdev->dev, "rtc counters not working\n");
> + ret = -ENODEV;
> + goto err;
> + }
> + ret = -ETIMEDOUT;
Why not putting this line to the corresponding dev_err-block?
> + /*set to 1 HZ if needed*/
Minor: Spaces around comment-markers, here and in other places
/* Comment */
> + if (readl(SYS_TOYTRIM) != 32767) {
> + v = 0x100000;
> + while ((readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_TTS) && --v)
> + usleep_range(1000, 3000);
Timeout?
> +
> + if (!v) {
> + dev_err(&pdev->dev, "time out\n");
> + goto err;
> + }
> + writel(32767, SYS_TOYTRIM);
> + __asm__ volatile("sync");
> + }
> + /*this loop coundn't be endless*/
> + while (readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_TTS)
> + usleep_range(1000, 3000);
Timeout again. First, the comment does not help. Why are you sure the loop
could not be endless? And: Does it really need to be a usleep_range() instead
of a simple msleep()? And to make sure: There is no interrupt signalling the
status changed?
> +
> + rtcdev = rtc_device_register("ls1x-rtc", &pdev->dev,
> + &ls1x_rtc_ops , THIS_MODULE);
> + if (IS_ERR(rtcdev)) {
> + ret = PTR_ERR(rtcdev);
> + goto err;
> + }
> +
> + platform_set_drvdata(pdev, rtcdev);
> + return 0;
> +err:
> + return ret;
> +}
> +
...
> +static int __init ls1x_rtc_init(void)
> +{
> + return platform_driver_probe(&ls1x_rtc_driver, ls1x_rtc_probe);
> +}
> +
> +static void __exit ls1x_rtc_exit(void)
> +{
> + platform_driver_unregister(&ls1x_rtc_driver);
> +}
> +
> +
> +module_init(ls1x_rtc_init);
> +module_exit(ls1x_rtc_exit);
Please use the new module_platform_driver()-macro.
Thanks,
Wolfram
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2011-11-27 9:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-25 2:52 [PATCH V1] MIPS: Add RTC support for loongson1B zhzhl555
2011-11-25 9:13 ` [rtc-linux] " Wolfram Sang
[not found] ` <CANY2MLJ6e02--f6D5yAK0Q6C57QGo5gqyBjWGmvCGhNr0XajJQ@mail.gmail.com>
2011-11-25 9:51 ` Wolfram Sang
2011-11-27 9:18 ` Wolfram Sang [this message]
2011-11-28 5:06 ` zhao zhang
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=20111127091803.GD5263@pengutronix.de \
--to=w.sang@pengutronix.de \
--cc=a.zummo@towertech.it \
--cc=keguang.zhang@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=r0bertz@gentoo.org \
--cc=ralf@linux-mips.org \
--cc=rtc-linux@googlegroups.com \
--cc=wuzhangjin@gmail.com \
--cc=zhzhl555@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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