lkml.org 
[lkml]   [2012]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] leds-lm3530: replace pwm platform functions with generic pwm functions
Date
On Monday 20 August 2012, Kim, Milo wrote:
> > * I don't understand why you need the "if (rvdata->pwm) return 0;" case.
> > It's normally better to do the initialization exactly once from the
> > probe() function. You might want to return -EPROBE_DEFER if the pwm
> > source is not yet available though.
>
> This device has 3 control mode. - register access, sensor input and PWM input.
> One of modes can be selected on-the-fly.
> So that's why I add code which returning 0 when PWM device exists.
> Whenever mode change occurs from/to 'PWM input', pwm_request() and pwm_free() should be called.

In that case, I would recommend changing it from

+ /* if the pwm device exists, skip requesting the device */
+ if (drvdata->pwm)
+ return 0;

to

/* warn if the PWM was not released prior to reneabling it */
WARN_ON(drvdata->pwm);


Arnd


\
 
 \ /
  Last update: 2012-08-20 09:21    [W:0.051 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site