mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: Adrian Bunk <bunk@kernel.org>
Cc: Dave Jones <davej@redhat.com>, Wim Van Sebroeck <wim@iguana.be>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH] [WATCHDOG] mpc8xxx_wdt: fix modular build
Date: Wed, 13 Aug 2008 21:21:40 +0400	[thread overview]
Message-ID: <20080813172140.GA5095@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20080813143159.GD26351@cs181140183.pp.htv.fi>

On Wed, Aug 13, 2008 at 05:31:59PM +0300, Adrian Bunk wrote:
> On Wed, Aug 13, 2008 at 04:23:41PM +0400, Anton Vorontsov wrote:
> >...
> > --- a/drivers/watchdog/mpc8xxx_wdt.c
> > +++ b/drivers/watchdog/mpc8xxx_wdt.c
> > @@ -48,6 +48,7 @@ struct mpc8xxx_wdt_type {
> >  };
> >  
> >  static struct mpc8xxx_wdt __iomem *wd_base;
> > +static int mpc8xxx_wdt_init_late(void);
> >  
> >  static u16 timeout = 0xffff;
> >  module_param(timeout, ushort, 0);
> > @@ -213,6 +214,12 @@ static int __devinit mpc8xxx_wdt_probe(struct of_device *ofdev,
> >  	else
> >  		timeout_sec = timeout / freq;
> >  
> > +#ifdef CONFIG_8xxx_WDT_MODULE
> > +	ret = mpc8xxx_wdt_init_late();
> > +	if (ret)
> > +		goto err_unmap;
> > +#endif
> 
> In mpc8xxx_wdt_probe()?

Yes.

> Isn't mpc8xxx_wdt_init() the correct place?

Not exactly. In case of non-modular build we rely on the fact
that OF devices are populated before module_init(), so _probe
is executed before _init_late.

But with modules, we can do the right thing: just register the driver
and await for the usual probe, then probe the wdt, and then register
userspace interface. Yes, kind of complicated, but we really need
this on 8xx.

> >  	pr_info("WDT driver for MPC8xxx initialized. mode:%s timeout=%d "
> >  		"(%d seconds)\n", reset ? "reset" : "interrupt", timeout,
> >  		timeout_sec);
> > @@ -280,7 +287,7 @@ static struct of_platform_driver mpc8xxx_wdt_driver = {
> >   * very early to start pinging the watchdog (misc devices are not yet
> >   * available), and later module_init() just registers the misc device.
> >   */
> > -static int __init mpc8xxx_wdt_init_late(void)
> > +static int mpc8xxx_wdt_init_late(void)
> >  {
> >  	int ret;
> >  
> > @@ -295,7 +302,9 @@ static int __init mpc8xxx_wdt_init_late(void)
> >  	}
> >  	return 0;
> >  }
> > +#ifndef CONFIG_8xxx_WDT_MODULE
> 
> Your #ifdef is correct, but "#ifdef MODULE" would express this better.

Thanks, will repost soon.

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

  reply	other threads:[~2008-08-13 17:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-06 20:29 [WATCHDOG] v2.6.27-rc patches Wim Van Sebroeck
2008-08-07  7:03 ` Martin Michlmayr
2008-08-07  9:32   ` Ben Dooks
2008-08-07 10:21   ` Wim Van Sebroeck
2008-08-07  8:38 ` Florian Fainelli
2008-08-07 10:24   ` Wim Van Sebroeck
2008-08-13  3:10 ` Dave Jones
2008-08-13 12:23   ` [PATCH] [WATCHDOG] mpc8xxx_wdt: fix modular build Anton Vorontsov
2008-08-13 14:31     ` Adrian Bunk
2008-08-13 17:21       ` Anton Vorontsov [this message]
2008-08-13 18:34   ` [PATCH v2] " Anton Vorontsov

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=20080813172140.GA5095@oksana.dev.rtsoft.ru \
    --to=avorontsov@ru.mvista.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=bunk@kernel.org \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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®