On Tue, Jan 08, 2013 at 01:43:56PM +0100, Boris BREZILLON wrote:
> On 08/01/2013 08:10, Thierry Reding wrote:
> > On Thu, Dec 20, 2012 at 10:12:56AM +0100, Boris BREZILLON wrote:
[...]
> >> +static void atmel_tcb_pwm_disable(struct pwm_chip *chip, struct 
> >> pwm_device *pwm)
> >> +{
> > [...]
> >> +  /* If duty is 0 reverse polarity */
> >> +  if (tcbpwm->duty == 0)
> >> +          polarity = !polarity;
> > 
> > Rather than commenting on what the code does, this should say why it
> > does so.
> > 
> 
> Is this an acceptable explanation ?
> 
>       /*
>        * If duty is 0 the timer will be stopped and we have to
>        * configure the output correctly on software trigger:
>        *  - set output to high if PWM_POLARITY_INVERSED
>        *  - set output to low if PWM_POLARITY_NORMAL
>        *
>        * This is why we're reverting polarity in this case.
>        */

Yes, that should work.

Thierry

Attachment: pgpkuZvZg2X6P.pgp
Description: PGP signature

Reply via email to