From: Ingi Kim <ingi2.kim@samsung.com>
To: Varka Bhadram <varkabhadram@gmail.com>
Cc: robh+dt@kernel.org, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>, Bryan Wu <cooloney@gmail.com>,
rpurdie@rpsys.net, treding@nvidia.com,
Philipp Zabel <p.zabel@pengutronix.de>,
Andrew Lunn <andrew@lunn.ch>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
florian.vaussard@epfl.ch, arno@natisbad.org,
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
Hayato Suzuki <hytszk@gmail.com>,
antonynpavlov@gmail.com, sw0312.kim@samsung.com,
ideal.song@samsung.com,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
linux-leds@vger.kernel.org
Subject: Re: [PATCH 3/3] leds: Add ktd2692 flash LED driver
Date: Fri, 27 Feb 2015 15:55:08 +0900 [thread overview]
Message-ID: <54F014CC.2000605@samsung.com> (raw)
In-Reply-To: <CAEUmHybnzdVk59UTsVczW59hpLrimoMeF+j5Gbtue2jNayHHuw@mail.gmail.com>
hi
On 2015년 02월 27일 12:36, Varka Bhadram wrote:
> On 02/27/2015 06:31 AM, Ingi Kim wrote:
>> This patch adds a driver to support the ktd2692 flash LEDs.
>> ktd2692 can control flash current by ExpressWire interface.
>>
>> Signed-off-by: Ingi Kim <ingi2.kim@samsung.com>
>> ---
>> drivers/leds/Kconfig | 8 ++
>> drivers/leds/Makefile | 1 +
>> drivers/leds/leds-ktd2692.c | 245 +++++++++++++++++++++++++++++++++++++++++++
>> 3 files changed, 254 insertions(+)
>> create mode 100644 drivers/leds/leds-ktd2692.c
>>
> (...)
>
>> +static struct ktd2692_context *ktd2692_parse_dt(struct device *dev)
>> +{
>> + struct device_node *np = dev->of_node;
>> + struct ktd2692_context *led;
>> +
>> + led = devm_kzalloc(dev, sizeof(struct ktd2692_context), GFP_KERNEL);
>> + if (!led)
>> + return ERR_PTR((long)led);
>
> What about using sizeof(*led) in place of sizeof(struct ktd2692_context)..?
>
> Also the error return for devm_kzalloc() should be -ENOMEM.
>
Thanks, I'll check and change sizeof() and error return style.
>> +
>> + led->strobe_gpio = of_get_named_gpio(np, "strobe-gpio", 0);
>> + if (!gpio_is_valid(led->strobe_gpio)) {
>> + dev_err(dev, "no strobe_gpio property found\n");
>> + return ERR_PTR(led->strobe_gpio);
>> + }
>> +
>> + return led;
>> +}
>> +
>> +static int ktd2692_probe(struct platform_device *pdev)
>> +{
>> + struct device *dev = &pdev->dev;
>> + struct ktd2692_context *led;
>> + int ret;
>> +
>> + if (!dev->of_node)
>> + return -ENODEV;
>> +
>> + led = ktd2692_parse_dt(dev);
>> + if (IS_ERR(led))
>> + return PTR_ERR(led);
>> +
>> + led->cdev.name = KTD2692_DEFAULT_NAME;
>> + led->cdev.brightness = LED_OFF;
>> + led->cdev.max_brightness = LED_FULL;
>> + led->cdev.flags |= LED_CORE_SUSPENDRESUME;
>> + led->cdev.brightness_set = ktd2692_brightness_set;
>> + led->cdev.brightness_get = ktd2692_brightness_get;
>> + led->mode = KTD2692_REG_MODE_BASE | KTD2692_MODE_DISABLE;
>> +
>> + platform_set_drvdata(pdev, led);
>> +
>> + ret = led_classdev_register(&pdev->dev, &led->cdev);
>> + if (ret) {
>> + dev_err(dev, "couldn't register LED %s\n", led->cdev.name);
>> + return ret;
>> + }
>> +
>> + ret = ktd2692_brightness_set_gpio(led);
>> + if (ret) {
>> + led_classdev_unregister(&led->cdev);
>> + return ret;
>> + }
>> +
>> + ktd2692_expresswire_reset(led);
>> +
>> + return ret;
>
> return 0 instead of ret...?
>
>
>
I'll check and try
Thanks,
next prev parent reply other threads:[~2015-02-27 6:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-27 1:01 [PATCH 0/3] Add ktd2692 Flash LED driver Ingi Kim
[not found] ` <1424998891-25591-1-git-send-email-ingi2.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-02-27 1:01 ` [PATCH 1/3] of: Add vendor prefix for Kinetic technologies Ingi Kim
2015-02-27 1:01 ` [PATCH 2/3] leds: ktd2692: add device tree bindings for ktd2692 Ingi Kim
2015-02-27 1:01 ` [PATCH 3/3] leds: Add ktd2692 flash LED driver Ingi Kim
[not found] ` <1424998891-25591-4-git-send-email-ingi2.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-02-27 3:36 ` Varka Bhadram
2015-02-27 6:55 ` Ingi Kim [this message]
2015-02-27 8:42 ` [PATCH 0/3] Add ktd2692 Flash " Jacek Anaszewski
2015-03-02 7:14 ` Ingi Kim
2015-03-02 9:15 ` Sakari Ailus
[not found] ` <20150302091530.GQ6539-S+BSfZ9RZZmRSg0ZkenSGLdO1Tsj/99ntUK59QYPAWc@public.gmane.org>
2015-03-02 20:07 ` Bryan Wu
2015-03-02 22:03 ` Sakari Ailus
2015-03-03 2:55 ` Ingi Kim
2015-03-03 7:48 ` Jacek Anaszewski
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=54F014CC.2000605@samsung.com \
--to=ingi2.kim@samsung.com \
--cc=andrew@lunn.ch \
--cc=antonynpavlov@gmail.com \
--cc=arno@natisbad.org \
--cc=cooloney@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=florian.vaussard@epfl.ch \
--cc=galak@codeaurora.org \
--cc=gregkh@linuxfoundation.org \
--cc=hytszk@gmail.com \
--cc=ideal.song@samsung.com \
--cc=ijc+devicetree@hellion.org.uk \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=p.zabel@pengutronix.de \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=rpurdie@rpsys.net \
--cc=sw0312.kim@samsung.com \
--cc=treding@nvidia.com \
--cc=varkabhadram@gmail.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).