On Mon, Oct 19, 2009 at 21:42, Bill Gatliff wrote: > Mike Frysinger wrote: >> On Mon, Oct 19, 2009 at 16:32, Bill Gatliff wrote: >>> #include <linux/pwm.h> >>> +#include <linux/pwm-led.h> >> >> if there's going to be a bunch of new pwm related headers, perhaps a >> subdir makes more sense: linux/pwm/xxx > > In general I don't have a problem with this. However, in this specific case > would it make more sense to just fold pwm-led.h into pwm.h? There really > isn't much to pwm-led.h. since pwm-led.h is meant for platform data and for boards to include it, keeping it separate makes sense to me. and once we start getting more pwm based drivers that want to do headers of their own, having linux/pwm/ for them would be nice. as for the core pwm header, either linux/pwm.h or linux/pwm/pwm.h would work i think. >>> +static void >>> +led_pwm_brightness_set(struct led_classdev *c, >>> + enum led_brightness b) >>> +{ >>> + struct led_pwm *led; >>> + int percent; >>> + >>> + percent = (b * 100) / (LED_FULL - LED_OFF); >>> + led = container_of(c, struct led_pwm, led); >> >> instead of using container_of() everywhere, why not add a helper macro >> that turns a led_classev into a led_pwm > > That's just a personal style thing. As soon as I write a helper macro, I > tend to forget how it works and then start mis-using it everywhere. But I > don't have a problem with doing a helper. > > For better type-safety, would a helper inline-function be a better choice > than a helper macro? Or would it make any difference? an inline function might be better. it would also allow you to pass in void* pointers though ... >>> + if (!try_module_get(d->driver->owner)) >>> + return -ENODEV; >> >> is this really needed ? > > Not sure. after looking at the other patches, i dont think it is. the core pwm framework does the module_get for you when you register the driver. -mike -- To unsubscribe from this list: send the line "unsubscribe linux-embedded" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html