On Fri, Feb 14, 2014 at 06:32:20AM +0000, Milo Kim wrote: > LM3633 LED driver supports generic LED functions and pattern generation. > Pattern is generated by using LMU effect driver APIs. > Sysfs documentation is added. > > Cc: Bryan Wu <coolo...@gmail.com> > Signed-off-by: Milo Kim <milo....@ti.com> > --- > Documentation/leds/leds-lm3633.txt | 38 +++ > drivers/leds/Kconfig | 10 + > drivers/leds/Makefile | 1 + > drivers/leds/leds-lm3633.c | 661 > ++++++++++++++++++++++++++++++++++++ > 4 files changed, 710 insertions(+) > create mode 100644 Documentation/leds/leds-lm3633.txt > create mode 100644 drivers/leds/leds-lm3633.c
[...] > +static int lm3633_led_parse_dt(struct device *dev, struct ti_lmu *lmu) > +{ > + struct ti_lmu_led_platform_data *pdata; > + struct device_node *node = dev->of_node; > + struct device_node *child; > + int num_leds; > + int i = 0; > + u8 imax_mA; > + > + if (!node) { > + dev_err(dev, "No device node exists\n"); > + return -ENODEV; > + } > + > + num_leds = of_get_child_count(node); > + if (num_leds == 0) { > + dev_err(dev, "No LED channels\n"); > + return -EINVAL; > + } > + > + pdata = devm_kzalloc(dev, sizeof(*pdata) * num_leds, GFP_KERNEL); > + if (!pdata) > + return -ENOMEM; > + > + for_each_child_of_node(node, child) { > + of_property_read_string(child, "chan-name", &pdata[i].name); What if this is missing from a node.? > + > + /* Make LED strings */ > + pdata[i].led_string = 0; > + if (of_find_property(child, "lvled1-used", NULL)) > + pdata[i].led_string |= LMU_LVLED1; > + if (of_find_property(child, "lvled2-used", NULL)) > + pdata[i].led_string |= LMU_LVLED2; > + if (of_find_property(child, "lvled3-used", NULL)) > + pdata[i].led_string |= LMU_LVLED3; > + if (of_find_property(child, "lvled4-used", NULL)) > + pdata[i].led_string |= LMU_LVLED4; > + if (of_find_property(child, "lvled5-used", NULL)) > + pdata[i].led_string |= LMU_LVLED5; > + if (of_find_property(child, "lvled6-used", NULL)) > + pdata[i].led_string |= LMU_LVLED6; You can use of_property_read_bool for these. > + > + of_property_read_u8(child, "max-current-milliamp", &imax_mA); > + pdata[i].imax = ti_lmu_get_current_code(imax_mA); What happens if this is missing from a node? Cheers, Mark. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/