Messages in this thread | | | Date | Mon, 28 Jan 2008 10:32:45 +0100 | From | Haavard Skinnemoen <> | Subject | Re: [PATCH -mm 2/2] PWM LED driver |
| |
On Mon, 28 Jan 2008 01:29:32 -0800 Andrew Morton <akpm@linux-foundation.org> 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?
Maybe. while (i-- > 0) has the advantage that it will work even if i is unsigned though...
Haavard
| |