linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 3/6] leds-lm3530: add lm3530_mode_get() in the dev_attr
@ 2012-01-31  7:33 Kim, Milo
  2012-01-31 20:19 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Kim, Milo @ 2012-01-31  7:33 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linus Walleij, shreshthakumar.sahu, rpurdie, linux-kernel

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

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/leds/leds-lm3530.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/leds/leds-lm3530.c b/drivers/leds/leds-lm3530.c
index 963a1db..b2fd545 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] 3+ messages in thread

* Re: [PATCH v3 3/6] leds-lm3530: add lm3530_mode_get() in the dev_attr
  2012-01-31  7:33 [PATCH v3 3/6] leds-lm3530: add lm3530_mode_get() in the dev_attr Kim, Milo
@ 2012-01-31 20:19 ` Andrew Morton
  2012-02-07  5:20   ` Kim, Milo
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2012-01-31 20:19 UTC (permalink / raw)
  To: Kim, Milo; +Cc: Linus Walleij, shreshthakumar.sahu, rpurdie, linux-kernel

On Mon, 30 Jan 2012 23:33:44 -0800
"Kim, Milo" <Milo.Kim@ti.com> wrote:

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

drivers/leds/leds-lm3530.c already has an implementation of
lm3530_mode_get().  I assume these patches were prepared against some
old kernel.  Please don't do that!



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

* RE: [PATCH v3 3/6] leds-lm3530: add lm3530_mode_get() in the dev_attr
  2012-01-31 20:19 ` Andrew Morton
@ 2012-02-07  5:20   ` Kim, Milo
  0 siblings, 0 replies; 3+ messages in thread
From: Kim, Milo @ 2012-02-07  5:20 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linus Walleij, shreshthakumar.sahu, rpurdie, linux-kernel


> -----Original Message-----
> From: Andrew Morton [mailto:akpm@linux-foundation.org]
> Sent: Wednesday, February 01, 2012 5:20 AM
> To: Kim, Milo
> Cc: Linus Walleij; shreshthakumar.sahu@stericsson.com;
> rpurdie@rpsys.net; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v3 3/6] leds-lm3530: add lm3530_mode_get() in the
> dev_attr
> 
> On Mon, 30 Jan 2012 23:33:44 -0800
> "Kim, Milo" <Milo.Kim@ti.com> wrote:
> 
> > To get information about brightness control mode, lm3530_mode_get()
> is added.
> 
> drivers/leds/leds-lm3530.c already has an implementation of
> lm3530_mode_get().  I assume these patches were prepared against some
> old kernel.  Please don't do that!
> 

Thank you for your advice.
Revised patches were sent - based on kernel 3.2.4.

[PATCH v4 1/5] leds-lm3530: set the max_brightness to 127
[PATCH v4 2/5] leds-lm3530: replace i2c_client with led_classdev
[PATCH v4 3/5] leds-lm3530: support pwm input mode
[PATCH v4 4/5] leds-lm3530: remove LM3530_ALS_ZONE_REG code
[PATCH v4 5/5] leds-lm3530: replace pltfm with pdata

Best Regards,
Milo -





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

end of thread, other threads:[~2012-02-07  5:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-31  7:33 [PATCH v3 3/6] leds-lm3530: add lm3530_mode_get() in the dev_attr Kim, Milo
2012-01-31 20:19 ` Andrew Morton
2012-02-07  5:20   ` Kim, Milo

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