Messages in this thread Patch in this message | | | From | "Kim, Milo" <> | Date | Thu, 19 Jan 2012 17:49:25 -0800 | Subject | [PATCH 4/7] leds-lm3530: add 'lm3530_mode_get()' in the lm3530 device attribute |
| |
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
| |