[PATCH 4/7] leds-lm3530: add 'lm3530_mode_get()' in the lm3530device attribute

From: Kim, Milo
Date: Thu Jan 19 2012 - 20:49:35 EST


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

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

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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/