public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: "Kim, Milo" <Milo.Kim@ti.com>
Cc: "Samuel Ortiz (sameo@linux.intel.com)" <sameo@linux.intel.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
	"thierry.reding@gmail.com" <thierry.reding@gmail.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-pwm@vger.kernel.org" <linux-pwm@vger.kernel.org>
Subject: Re: [PATCH v2 1/4] mfd: add LP3943 MFD driver
Date: Thu, 1 Aug 2013 09:03:31 +0100	[thread overview]
Message-ID: <20130801080331.GK13298@lee--X1> (raw)
In-Reply-To: <A874F61F95741C4A9BA573A70FE3998F82E850A9@DQHE06.ent.ti.com>

On Wed, 31 Jul 2013, Kim, Milo wrote:

> Thanks for the review, please see my comments.
> 
> > <snip> * looks good up to me up to here *
> > 
> > Although, I think the 0 = 1, 1 = 2 ... stuff is really confusing. Is
> > there nothing we can do about that?
> 
> OK, enum value of lp3943_pwm_output can be changed as below
> because LP3943_PWM_INVALID is not used anymore.
> 
> enum lp3943_pwm_output {
> 	LP3943_PWM_OUT0,
> 	LP3943_PWM_OUT1,
> 	...
> 	LP3943_PWM_OUT15,
> };
> 
> Then, output index will match each enum integer value.
> Does it make sense?

Not really. IIRC the documentation said that LED0 (which I believe
you're calling OUT0 here) is located at pin one. So your enum above is
now incorrect isn't it? As *_OUT0 will be 0 and not 1? Or am I missing
something?

> > > +static int __init lp3943_init(void)
> > > +{
> > > +	return i2c_add_driver(&lp3943_driver);
> > > +}
> > > +subsys_initcall(lp3943_init);
> > > +
> > > +static void __exit lp3943_exit(void)
> > > +{
> > > +	i2c_del_driver(&lp3943_driver);
> > > +}
> > > +module_exit(lp3943_exit);
> > 
> > I think you want to replace:
> >   lp3943_init()
> >   lp3943_exit
> > 
> > With:
> >   module_i2c_driver()
> 
> This is related with initcall sequence.
> Some problem may happen if any GPIO or PWM consumer tries to request before
> LP3943 MFDs are added.
> For example, a GPIO is requested in _probe() of some device.
> Let's assume the GPIO number is in range of what LP3943 GPIO driver provided.
> Then, gpio_request() will be failed because the GPIO is invalid at this moment.
> If the device request again later, it will be OK, but we can't expect this 
> situation for every driver.
> Some drivers request a GPIO only once in _probe(), other devices may request
> a GPIO in some cases.
> So, I think lp3943_init() should be defined as subsys_initcall() instead of 
> module_init().

No I don't think so. Instead, you should use -EPROBE_DEFER in lieu of
messing around with initialisation orders.

-- 
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

  reply	other threads:[~2013-08-01  8:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-30  0:42 [PATCH v2 1/4] mfd: add LP3943 MFD driver Kim, Milo
2013-07-31 11:56 ` Lee Jones
2013-07-31 23:29   ` Kim, Milo
2013-08-01  8:03     ` Lee Jones [this message]
2013-08-05  7:09       ` Kim, Milo
2013-08-05  7:47         ` Lee Jones
2013-08-14 17:53         ` Linus Walleij

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=20130801080331.GK13298@lee--X1 \
    --to=lee.jones@linaro.org \
    --cc=Milo.Kim@ti.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    --cc=thierry.reding@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