aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-lp8788.c
diff options
context:
space:
mode:
authorKim, Milo <Milo.Kim@ti.com>2013-01-03 01:28:12 -0500
committerBryan Wu <cooloney@gmail.com>2013-02-01 20:47:05 -0500
commita1932edf8baaf2b09ad72b119c1f9749ad4397f2 (patch)
tree486cb7da402679943d8b85b48c86c3797fe7035f /drivers/leds/leds-lp8788.c
parent08541cbcc7386fa78efb454a92ddbfb1a2859cf9 (diff)
leds-lp8788: fix a parent device in _probe()
The lp8788-keyled is a platform driver of lp8788-mfd. The platform device is allocated when mfd_add_devices() is called in lp8788-mfd. On the other hand, 'lp->dev' is the i2c client device. Therefore, this 'platform_device' is a proper parent device in case of resource managed mem alloc, registering led device and device kernel messages. Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com> Signed-off-by: Bryan Wu <cooloney@gmail.com>
Diffstat (limited to 'drivers/leds/leds-lp8788.c')
-rw-r--r--drivers/leds/leds-lp8788.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/leds/leds-lp8788.c b/drivers/leds/leds-lp8788.c
index 4353942c5fd1..7c2cb384e7ae 100644
--- a/drivers/leds/leds-lp8788.c
+++ b/drivers/leds/leds-lp8788.c
@@ -130,9 +130,10 @@ static int lp8788_led_probe(struct platform_device *pdev)
130 struct lp8788 *lp = dev_get_drvdata(pdev->dev.parent); 130 struct lp8788 *lp = dev_get_drvdata(pdev->dev.parent);
131 struct lp8788_led_platform_data *led_pdata; 131 struct lp8788_led_platform_data *led_pdata;
132 struct lp8788_led *led; 132 struct lp8788_led *led;
133 struct device *dev = &pdev->dev;
133 int ret; 134 int ret;
134 135
135 led = devm_kzalloc(lp->dev, sizeof(struct lp8788_led), GFP_KERNEL); 136 led = devm_kzalloc(dev, sizeof(struct lp8788_led), GFP_KERNEL);
136 if (!led) 137 if (!led)
137 return -ENOMEM; 138 return -ENOMEM;
138 139
@@ -154,13 +155,13 @@ static int lp8788_led_probe(struct platform_device *pdev)
154 155
155 ret = lp8788_led_init_device(led, led_pdata); 156 ret = lp8788_led_init_device(led, led_pdata);
156 if (ret) { 157 if (ret) {
157 dev_err(lp->dev, "led init device err: %d\n", ret); 158 dev_err(dev, "led init device err: %d\n", ret);
158 return ret; 159 return ret;
159 } 160 }
160 161
161 ret = led_classdev_register(lp->dev, &led->led_dev); 162 ret = led_classdev_register(dev, &led->led_dev);
162 if (ret) { 163 if (ret) {
163 dev_err(lp->dev, "led register err: %d\n", ret); 164 dev_err(dev, "led register err: %d\n", ret);
164 return ret; 165 return ret;
165 } 166 }
166 167