[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120820055817.GA17149@avionic-0098.adnet.avionic-design.de>
Date: Mon, 20 Aug 2012 07:58:17 +0200
From: Thierry Reding <thierry.reding@...onic-design.de>
To: Arnd Bergmann <arnd@...db.de>
Cc: "Kim, Milo" <Milo.Kim@...com>, Bryan Wu <bryan.wu@...onical.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] leds-lm3530: replace pwm platform functions with generic
pwm functions
On Mon, Aug 20, 2012 at 05:37:48AM +0000, Arnd Bergmann wrote:
> On Monday 20 August 2012, Kim, Milo wrote:
> > +#ifdef CONFIG_PWM
> > +static int lm3530_pwm_request(struct lm3530_data *drvdata)
> > +{
> > + int pwm_id;
> > +
> > + /* if the pwm device exists, skip requesting the device */
> > + if (drvdata->pwm)
> > + return 0;
> > +
> > + pwm_id = drvdata->pdata ? drvdata->pdata->pwm_id : 0;
> > +
> > + drvdata->pwm = pwm_request(pwm_id, "lm3530-pwm");
> > + drvdata->period_ns = drvdata->pdata ? drvdata->pdata->period_ns : 0;
> > +
> > + return IS_ERR(drvdata->pwm) ? PTR_ERR(drvdata->pwm) : 0;
> > +}
> > +
>
> A few comments on this:
>
> * Rather than having to do the #ifdef here, I think it would be better if
> the PWM subsystem provided stub functions for pwm_request, pwm_config,
> pwm_enable, pwm_disable and pwm_free that do nothing, so you can in effect
> let the compiler optimize away the above code.
That's actually on my TODO list, but I think it needs to wait until we
have gotten rid of all legacy implementations. The stubs would have to
move into the !CONFIG_PWM branch, which will in turn break because the
legacy implementations would provide non-inlined duplicates.
Thierry
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists