From: Mark Rutland <mark.rutland@arm.com>
To: Milo Kim <milo.kim@ti.com>
Cc: Lee Jones <lee.jones@linaro.org>,
Jingoo Han <jg1.han@samsung.com>, Bryan Wu <cooloney@gmail.com>,
Mark Brown <broonie@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Samuel Ortiz <sameo@linux.intel.com>
Subject: Re: [PATCH 08/10] leds: Add LM3633 driver
Date: Fri, 14 Feb 2014 10:09:30 +0000 [thread overview]
Message-ID: <20140214100930.GE25107@e106331-lin.cambridge.arm.com> (raw)
In-Reply-To: <1392359540-7135-1-git-send-email-milo.kim@ti.com>
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@gmail.com>
> Signed-off-by: Milo Kim <milo.kim@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.
prev parent reply other threads:[~2014-02-14 10:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-14 6:32 [PATCH 08/10] leds: Add LM3633 driver Milo Kim
2014-02-14 10:09 ` Mark Rutland [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140214100930.GE25107@e106331-lin.cambridge.arm.com \
--to=mark.rutland@arm.com \
--cc=broonie@kernel.org \
--cc=cooloney@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=jg1.han@samsung.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=milo.kim@ti.com \
--cc=sameo@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).