lkml.org 
[lkml]   [2008]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH -mm 2/2] PWM LED driver
Date
On Monday 28 January 2008, Andrew Morton wrote:
> > -     if (i > 0) {
> > -             for (i = i - 1; i >= 0; i--) {
> > -                     led_classdev_unregister(&leds[i].cdev);
> > -                     pwm_channel_free(&leds[i].pwmc);
> > -             }
> > +     while (i-- > 0) {
> > +             led_classdev_unregister(&leds[i].cdev);
> > +             pwm_channel_free(&leds[i].pwmc);
> >       }
>
> Looks OK, although I'd say that `while (--i >= 0)' is more idiomatic -
> predecrement, postincrement and all that?

Except for the "unsigned i;" declaration earlier... given that,
"while (true) cpu_relax();" becomes maximally idiomatic. :)

Odd how PDP-11 idioms linger. Just because C was designed on
that processor ...


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2008-01-28 10:43    [W:0.054 / U:0.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site