linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/7] leds-lm3530: add 'lm3530_mode_get()' in the lm3530 device attribute
@ 2012-01-20  1:49 ` Kim, Milo
  2012-01-23 19:16   ` Linus Walleij
  0 siblings, 1 reply; 4+ messages in thread
From: Kim, Milo @ 2012-01-20  1:49 UTC (permalink / raw)
  To: Linus Walleij, shreshthakumar.sahu; +Cc: linux-kernel, rpurdie

To get information about brightness control mode, lm3530_mode_get() is added.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>

diff --git a/drivers/leds/leds-lm3530.c b/drivers/leds/leds-lm3530.c
index ba2bb7e..0a42207 100644
--- a/drivers/leds/leds-lm3530.c
+++ b/drivers/leds/leds-lm3530.c
@@ -275,6 +275,17 @@ static void lm3530_brightness_set(struct led_classdev *led_cdev,
 	}
 }
 
+static ssize_t lm3530_mode_get(struct device *dev,
+			struct device_attribute *attr,
+			char *buf)
+{
+	struct led_classdev *led_cdev = dev_get_drvdata(dev);
+	struct lm3530_data *drvdata =
+	    container_of(led_cdev, struct lm3530_data, led_dev);
+	enum lm3530_mode m = drvdata->mode;
+
+	return sprintf(buf, "%s\n", mode_map[m].mode);
+}
 
 static ssize_t lm3530_mode_set(struct device *dev, struct device_attribute
 				   *attr, const char *buf, size_t size)
@@ -302,7 +313,7 @@ static ssize_t lm3530_mode_set(struct device *dev, struct device_attribute
 	return sizeof(drvdata->mode);
 }
 
-static DEVICE_ATTR(mode, 0644, NULL, lm3530_mode_set);
+static DEVICE_ATTR(mode, 0644, lm3530_mode_get, lm3530_mode_set);
 
 static int __devinit lm3530_probe(struct i2c_client *client,
 			   const struct i2c_device_id *id)
-- 
1.7.4.1


Best Regards,
Milo (Woogyom) Kim
Texas Instruments Incorporated


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 4/7] leds-lm3530: add 'lm3530_mode_get()' in the lm3530 device attribute
  2012-01-20  1:49 ` [PATCH 4/7] leds-lm3530: add 'lm3530_mode_get()' in the lm3530 device attribute Kim, Milo
@ 2012-01-23 19:16   ` Linus Walleij
  2012-01-25  2:02     ` Kim, Milo
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2012-01-23 19:16 UTC (permalink / raw)
  To: Kim, Milo; +Cc: shreshthakumar.sahu, linux-kernel, rpurdie

On Fri, Jan 20, 2012 at 2:49 AM, Kim, Milo <Milo.Kim@ti.com> wrote:

> To get information about brightness control mode, lm3530_mode_get() is added.
>
> Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>

When adding new ABIs, create a Documentation/ABI/testing/* file
for the new attribute explaining what it is and how it works.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH 4/7] leds-lm3530: add 'lm3530_mode_get()' in the lm3530 device attribute
  2012-01-23 19:16   ` Linus Walleij
@ 2012-01-25  2:02     ` Kim, Milo
  2012-01-26 11:56       ` Linus Walleij
  0 siblings, 1 reply; 4+ messages in thread
From: Kim, Milo @ 2012-01-25  2:02 UTC (permalink / raw)
  To: Linus Walleij; +Cc: shreshthakumar.sahu, linux-kernel, rpurdie

Yes, but this patch is additional function for 'mode' device attribute.
'Mode' attribute already exists before this patch.
Then, should I add some explanation under Documentation ?

Thanks & BR
Milo -


-----Original Message-----
From: Linus Walleij [mailto:linus.walleij@linaro.org] 
Sent: Tuesday, January 24, 2012 4:16 AM
To: Kim, Milo
Cc: shreshthakumar.sahu@stericsson.com; linux-kernel@vger.kernel.org; rpurdie@rpsys.net
Subject: Re: [PATCH 4/7] leds-lm3530: add 'lm3530_mode_get()' in the lm3530 device attribute

On Fri, Jan 20, 2012 at 2:49 AM, Kim, Milo <Milo.Kim@ti.com> wrote:

> To get information about brightness control mode, lm3530_mode_get() is added.
>
> Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>

When adding new ABIs, create a Documentation/ABI/testing/* file
for the new attribute explaining what it is and how it works.

Yours,
Linus Walleij


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 4/7] leds-lm3530: add 'lm3530_mode_get()' in the lm3530 device attribute
  2012-01-25  2:02     ` Kim, Milo
@ 2012-01-26 11:56       ` Linus Walleij
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2012-01-26 11:56 UTC (permalink / raw)
  To: Kim, Milo; +Cc: shreshthakumar.sahu, linux-kernel, rpurdie

On Wed, Jan 25, 2012 at 3:02 AM, Kim, Milo <Milo.Kim@ti.com> wrote:

> Yes, but this patch is additional function for 'mode' device attribute.
> 'Mode' attribute already exists before this patch.
> Then, should I add some explanation under Documentation ?

OK I see, well I would take this opportunity to add it, but no big deal
to me.

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Thanks,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-01-26 11:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <AczXFb0awj5rU2NWTZyzBVK6p9EmMg==>
2012-01-20  1:49 ` [PATCH 4/7] leds-lm3530: add 'lm3530_mode_get()' in the lm3530 device attribute Kim, Milo
2012-01-23 19:16   ` Linus Walleij
2012-01-25  2:02     ` Kim, Milo
2012-01-26 11:56       ` Linus Walleij

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).