lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140214100930.GE25107@e106331-lin.cambridge.arm.com>
Date:	Fri, 14 Feb 2014 10:09:30 +0000
From:	Mark Rutland <mark.rutland@....com>
To:	Milo Kim <milo.kim@...com>
Cc:	Lee Jones <lee.jones@...aro.org>, Jingoo Han <jg1.han@...sung.com>,
	Bryan Wu <cooloney@...il.com>, Mark Brown <broonie@...nel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	Samuel Ortiz <sameo@...ux.intel.com>
Subject: Re: [PATCH 08/10] leds: Add LM3633 driver

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 <cooloney@...il.com>
> Signed-off-by: Milo Kim <milo.kim@...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 majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ