[PATCH v3 06/10] pwm: Add NVIDIA Tegra SoC support
Thierry Reding
thierry.reding at avionic-design.de
Thu Feb 23 19:14:59 EST 2012
* Ryan Mallon wrote:
> On 23/02/12 02:17, Thierry Reding wrote:
>
> > This commit adds a generic PWM framework driver for the PWFM controller
> > found on NVIDIA Tegra SoCs. The driver is based on code from the
> > Chromium kernel tree and was originally written by Gary King (NVIDIA)
> > and later modified by Simon Que (Chromium).
> >
> > Signed-off-by: Thierry Reding <thierry.reding at avionic-design.de>
> > ---
>
> <snip>
>
> > +
> > + pwm->chip.dev = &pdev->dev;
> > + pwm->chip.ops = &tegra_pwm_ops;
> > + pwm->chip.base = -1;
> > + pwm->chip.npwm = NUM_PWM;
>
> > +
> > + ret = pwmchip_add(&pwm->chip);
>
>
> If a driver fails to initialise the pwm_chip structure correctly it can
> cause problems in the pwm core. For example, if the dev field doesn't
> get set, then you will get an oops if you try to cat the pwm debugfs file.
>
> pwmchip_add should probably verify that the initialisation of the
> pwm_chip structure is sane to avoid problems like this.
Absolutely. What would be the best response to an invalid struct pwm_chip? I
suppose at least returning -EINVAL, perhaps complemented with WARN_ON?
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/devicetree-discuss/attachments/20120223/9a5b0415/attachment.pgp>
More information about the devicetree-discuss
mailing list