From: Wan ZongShun <mcuos.com@gmail.com>
To: Wim Van Sebroeck <wim@iguana.be>
Cc: linux-arm-kernel <linux-arm-kernel@lists.arm.linux.org.uk>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Add watchdog driver for w90p910
Date: Wed, 5 Aug 2009 10:55:55 +0800 [thread overview]
Message-ID: <e68bb3470908041955t7e07929bv612a25e0bc0264c1@mail.gmail.com> (raw)
In-Reply-To: <20090804201032.GB30892@infomag.iguana.be>
Dear Wim,
I'm much obliged to you for helping me.
Before resubmitting fixed patch, I think it better to answer you
regarding your questions.
2009/8/5 Wim Van Sebroeck <wim@iguana.be>:
> Hi Wan,
>
> I reviewed your code and have some comments and questions.
>
> ...
>
>> +struct w90p910_wdt {
>> + struct resource *res;
>> + struct clk *wdt_clock;
>> + struct platform_device *pdev;
>> + unsigned int open_lock;
>> + unsigned int wdt_irq;
>> + void __iomem *wdt_base;
>> + char expect_close;
>> + spinlock_t wdt_lock;
>> +};
>
> Where is the spinlock initialized?
Sure, I forget it. sorry.
>
>> +static irqreturn_t w90p910_wdt_irq(int irq, void *dev_id)
>> +{
>> + w90p910_wdt_keepalive();
>> + return IRQ_HANDLED;
>> +}
>
> How does the interrupt work? what does the watchdog do when it times out?
> (Is there a datasheet available somewhere?)
>
The mechanism of watchdog of w90p910 is that the interrupt will occur
periodicity every a given time interval.
Hmm, there are only two choices to confirm the system running, one to
clear this WTIF and WTR bits in handler of interrupt, the other to
reset them in user application before interrupt occurs.
>> +static int w90p910_wdt_settimeout(int new_time_level)
>> +{
>> + unsigned int val;
>> +
>> + if ((new_time_level < 0) || (new_time_level > WDT_MAX_TIME_LEVEL))
>> + return -EINVAL;
>> +
>> + val = __raw_readl(w90p910_wdt->wdt_base + REG_WTCR);
>> + val &= ~WTIS;
>> + val |= new_time_level;
>
> Shouldn't this be val |= (new_time_level << 0x04); ?
sure.
> The read-write cyclus to REG_WTCR should also be guarded with a spinlock.
> Can you incorporate the call to w90p910_wdt_start() in the ioctl code into this function?
>
Do you mean that I should merge the "w90p910_wdt_settimeout" to
"w90p910_wdt_start()"? or contrary?
>
>> +static ssize_t w90p910_wdt_write(struct file *file, const char *data,
>> + size_t len, loff_t *ppos)
>
> should be: ..., const char __user *data, ...
>
sure.
>
>> +static int __devinit w90p910wdt_probe(struct platform_device *pdev)
>> +{
>> + int ret;
>> +
>> + w90p910_wdt = kzalloc(sizeof(struct w90p910_wdt), GFP_KERNEL);
>> + if (!w90p910_wdt)
>> + return -ENOMEM;
>> +
>> + w90p910_wdt->pdev = pdev;
>> +
>> + w90p910_wdt->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> + if (w90p910_wdt->res == NULL) {
>> + dev_err(&pdev->dev, "no memory resource specified\n");
>> + ret = -ENOENT;
>> + goto err_get;
>> + }
>> +
>> + if (!request_mem_region(w90p910_wdt->res->start,
>> + resource_size(w90p910_wdt->res), pdev->name)) {
>> + dev_err(&pdev->dev, "failed to get memory region\n");
>> + ret = -ENOENT;
>> + goto err_req;
>
> This should be: goto err_get;
sure.
> ...
>
>> +
>> +static int __devexit w90p910wdt_remove(struct platform_device *pdev)
>> +{
>
> The misc_deregister(&w90p910wdt_miscdev); should go first. We don't want userspace interactivity when we clean up all reservations.
>
>> + free_irq(w90p910_wdt->wdt_irq, NULL);
>> +
>> + clk_disable(w90p910_wdt->wdt_clock);
>> + clk_put(w90p910_wdt->wdt_clock);
>> +
>> + iounmap(w90p910_wdt->wdt_base);
>> +
>> + release_mem_region(w90p910_wdt->res->start,
>> + resource_size(w90p910_wdt->res));
>> +
>> + kfree(w90p910_wdt);
>> +
>> + misc_deregister(&w90p910wdt_miscdev);
>
> see comment about misc_deregister above.
>
> For the rest the code looks good to me.
>
> Kind regards,
> Wim.
>
>
--
Wan z.s
next prev parent reply other threads:[~2009-08-05 2:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-24 15:06 Wan ZongShun
2009-07-30 1:17 ` Wan ZongShun
2009-07-30 5:00 ` Wim Van Sebroeck
2009-07-30 5:03 ` Wan ZongShun
2009-08-04 20:10 ` Wim Van Sebroeck
2009-08-05 2:55 ` Wan ZongShun [this message]
2009-08-05 7:08 ` Wim Van Sebroeck
2009-08-05 8:00 ` Wan ZongShun
2009-08-05 10:31 ` Wim Van Sebroeck
2009-08-05 10:44 ` Wan ZongShun
2009-08-05 13:20 ` [PATCH v2] " Wan ZongShun
2009-08-17 2:40 ` Wan ZongShun
2009-08-17 9:14 ` Wim Van Sebroeck
2009-08-17 9:19 ` Wan ZongShun
2009-08-17 10:00 ` Wan ZongShun
2009-08-17 11:02 ` Wim Van Sebroeck
2009-08-17 11:04 ` Wan ZongShun
2009-08-05 11:37 ` [PATCH] " Wan ZongShun
2009-08-20 12:16 ` Wim Van Sebroeck
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=e68bb3470908041955t7e07929bv612a25e0bc0264c1@mail.gmail.com \
--to=mcuos.com@gmail.com \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=wim@iguana.be \
/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
all inboxes | Powered by JetHome®