lkml.org 
[lkml]   [2012]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH v4 2/5] leds-lm3530: replace i2c_client with led_classdev
To get members of lm3530_data, use 'struct led_classdev' rather than
'struct i2c_client'.

* patch base version : kernel 3.2.4

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
---
drivers/leds/leds-lm3530.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/leds/leds-lm3530.c b/drivers/leds/leds-lm3530.c
index 1c3eb81..8886959 100644
--- a/drivers/leds/leds-lm3530.c
+++ b/drivers/leds/leds-lm3530.c
@@ -297,9 +297,9 @@ 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 i2c_client *client = container_of(
- dev->parent, struct i2c_client, dev);
- struct lm3530_data *drvdata = i2c_get_clientdata(client);
+ struct led_classdev *led_cdev = dev_get_drvdata(dev);
+ struct lm3530_data *drvdata =
+ container_of(led_cdev, struct lm3530_data, led_dev);
int i, len = 0;

for (i = 0; i < ARRAY_SIZE(mode_map); i++)
@@ -316,11 +316,10 @@ static ssize_t lm3530_mode_get(struct device *dev,
static ssize_t lm3530_mode_set(struct device *dev, struct device_attribute
*attr, const char *buf, size_t size)
{
- int err;
- struct i2c_client *client = container_of(
- dev->parent, struct i2c_client, dev);
- struct lm3530_data *drvdata = i2c_get_clientdata(client);
- int mode;
+ struct led_classdev *led_cdev = dev_get_drvdata(dev);
+ struct lm3530_data *drvdata =
+ container_of(led_cdev, struct lm3530_data, led_dev);
+ int mode, err;

mode = lm3530_get_mode_from_str(buf);
if (mode < 0) {
--
1.7.4.1

Best Regards,
Milo (Woogyom) Kim
Texas Instruments Incorporated






\
 
 \ /
  Last update: 2012-02-07 06:17    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site