All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <florian@openwrt.org>
To: Alexander Clouter <alex@digriz.org.uk>
Cc: linux-mips@linux-mips.org
Subject: Re: [PATCH] ar7: register watchdog driver only if enabled in hardware configuration
Date: Fri, 7 Aug 2009 19:27:19 +0200	[thread overview]
Message-ID: <200908071927.19714.florian@openwrt.org> (raw)
In-Reply-To: <3qqnk6-j07.ln1@chipmunk.wormnet.eu>

Hey Alexander,

Le Wednesday 05 August 2009 10:00:35 Alexander Clouter, vous avez écrit :
> Florian Fainelli <florian@openwrt.org> wrote:
> > This patch checks if the watchdog enable bit is set in the DCL
> > register meaning that the hardware watchdog actually works and
> > if so, register the ar7_wdt platform_device.
> >
> > Signed-off-by: Florian Fainelli <florian@openwrt.org>
> > ---
> > diff --git a/arch/mips/ar7/platform.c b/arch/mips/ar7/platform.c
> > index e2278c0..835f3f0 100644
> > --- a/arch/mips/ar7/platform.c
> > +++ b/arch/mips/ar7/platform.c
> > @@ -503,6 +503,7 @@ static int __init ar7_register_devices(void)
> > {
> >        u16 chip_id;
> >        int res;
> > +       u32 *bootcr, val;
> > #ifdef CONFIG_SERIAL_8250
> >        static struct uart_port uart_port[2];
> >
> > @@ -595,7 +596,13 @@ static int __init ar7_register_devices(void)
> >
> >        ar7_wdt_res.end = ar7_wdt_res.start + 0x20;
> >
> > -       res = platform_device_register(&ar7_wdt);
> > +       bootcr = (u32 *)ioremap_nocache(AR7_REGS_DCL, 4);
> > +       val = *bootcr;
> > +       iounmap(bootcr);
> > +
> > +       /* Register watchdog only if enabled in hardware */
> > +       if (val & AR7_WDT_HW_ENA)
> > +               res = platform_device_register(&ar7_wdt);
> >
> >        return res;
> > }
>
> 'res' can now return NULL[1].  Solved if you do:
> ----
> int res = -ENODEV;
> ----
>
> I'm guessing this is the most apprioate?

I prefer letting this as-is, since if the watchdog was not enabled in 
hardware, we will not register the watchdog driver, and return the last 
platform_device_register call.

>
> Cheers
>
> [1] I cannot see the full file annoyingly, it's not in my linux-mips
> 	git tree.

Not sure which tree you checked out, but it is in linux-queue: 
http://www.linux-mips.org/git?p=linux-queue.git;a=tree;f=arch/mips/ar7;h=40ee7382dfabf05ee6c967016e42f94992655c20;hb=HEAD
-- 
Best regards, Florian Fainelli
Email: florian@openwrt.org
Web: http://openwrt.org
IRC: [florian] on irc.freenode.net
-------------------------------

  reply	other threads:[~2009-08-07 17:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-04 21:09 [PATCH] ar7: register watchdog driver only if enabled in hardware configuration Florian Fainelli
2009-08-04 22:41 ` Alexander Clouter
2009-08-05  8:19   ` Sergei Shtylyov
2009-08-05  8:34     ` Alexander Clouter
2009-08-05  8:00 ` Alexander Clouter
2009-08-07 17:27   ` Florian Fainelli [this message]
2009-10-05  9:40 ` Florian Fainelli

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=200908071927.19714.florian@openwrt.org \
    --to=florian@openwrt.org \
    --cc=alex@digriz.org.uk \
    --cc=linux-mips@linux-mips.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.