From: Onkalo Samu <samu.p.onkalo@nokia.com>
To: ext Arun Murthy <arun.murthy@stericsson.com>
Cc: akpm@linux-foundation.org, rpurdie@rpsys.net,
linus.walleij@stericsson.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] leds-lp5521: modify the way of setting led device name
Date: Thu, 16 Dec 2010 15:07:16 +0200 [thread overview]
Message-ID: <1292504836.7561.3.camel@kolo> (raw)
In-Reply-To: <1292414108-2445-1-git-send-email-arun.murthy@stericsson.com>
On Wed, 2010-12-15 at 17:25 +0530, ext Arun Murthy wrote:
> Currently the led device name is fetched from the device_type in
> I2C_BOARD_INFO which comes from the platform data. This name is in turn
> used to create an entry in sysfs.
>
> If there exists two or more lp5521 on a particular platform, the
> device_type in I2C_BOARD_INFO has to be the same, else lp5521 driver
> probe wont be called and if used so, results in run time warning "cannot
> create sysfs with same name" and hence a failure.
>
> The name that is used to create sysfs entry is to be passed by the
> struct led_platform_data. Hence adding an element of type const char *
> and change in lp5521 driver to use this name in creating the led device
> if present else use the name obtained by I2C_BOARD_INFO.
>
> Signed-off-by: Arun Murthy <arun.murthy@stericsson.com>
Looks ok.
I'll make similar patch for lp5523 at some point.
Acked-by: Samu Onkalo <samu.p.onkalo@nokia.com>
> ---
> drivers/leds/leds-lp5521.c | 3 ++-
> include/linux/leds-lp5521.h | 1 +
> 2 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c
> index 33facd0..745ad99 100644
> --- a/drivers/leds/leds-lp5521.c
> +++ b/drivers/leds/leds-lp5521.c
> @@ -651,7 +651,8 @@ static int __init lp5521_init_led(struct lp5521_led *led,
> return -EINVAL;
> }
>
> - snprintf(name, sizeof(name), "%s:channel%d", client->name, chan);
> + snprintf(name, sizeof(name), "%s:channel%d",
> + pdata->label ?: client->name, chan);
> led->cdev.brightness_set = lp5521_set_brightness;
> led->cdev.name = name;
> res = led_classdev_register(dev, &led->cdev);
> diff --git a/include/linux/leds-lp5521.h b/include/linux/leds-lp5521.h
> index 38368d7..fd548d2 100644
> --- a/include/linux/leds-lp5521.h
> +++ b/include/linux/leds-lp5521.h
> @@ -42,6 +42,7 @@ struct lp5521_platform_data {
> int (*setup_resources)(void);
> void (*release_resources)(void);
> void (*enable)(bool state);
> + const char *label;
> };
>
> #endif /* __LINUX_LP5521_H */
next prev parent reply other threads:[~2010-12-16 13:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-15 11:55 [PATCH] leds-lp5521: modify the way of setting led device name Arun Murthy
2010-12-16 13:07 ` Onkalo Samu [this message]
2010-12-19 10:57 ` Arun MURTHY
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=1292504836.7561.3.camel@kolo \
--to=samu.p.onkalo@nokia.com \
--cc=akpm@linux-foundation.org \
--cc=arun.murthy@stericsson.com \
--cc=linus.walleij@stericsson.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rpurdie@rpsys.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.