diff options
author | Holger Freyther <zecke@openmoko.org> | 2008-11-19 17:09:38 +0000 |
---|---|---|
committer | Andy Green <agreen@pads.home.warmcat.com> | 2008-11-19 17:09:38 +0000 |
commit | 4c061641acc035be7df5c5f671dca5b82649f919 (patch) | |
tree | ab4c6eab677eb51929494e230e32071cf7ed0e0c /drivers/leds | |
parent | 4b705027a9d8267e80e68b3b6ab8a2d04f988979 (diff) |
[led] Misc fixes in the driver code
to_bundle returned the wrong data. The platform_device is the
parent of the class_device used by the LED device class. Return
the correct class.
num_leds was not set to the correct number of registered LEDs. All
loops using num_leds (e.g. module unloading) were not executed at
all.
On removal of the module disable all LEDs.
Signed-Off-By: Holger Freyther <zecke@openmoko.org>
Diffstat (limited to 'drivers/leds')
-rw-r--r-- | drivers/leds/leds-neo1973-gta02.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/leds/leds-neo1973-gta02.c b/drivers/leds/leds-neo1973-gta02.c index fbb62c43d6b..343550ae498 100644 --- a/drivers/leds/leds-neo1973-gta02.c +++ b/drivers/leds/leds-neo1973-gta02.c @@ -46,7 +46,7 @@ static inline struct gta02_led_priv *to_priv(struct led_classdev *led_cdev) static inline struct gta02_led_bundle *to_bundle(struct led_classdev *led_cdev) { - return dev_get_drvdata(led_cdev->dev); + return dev_get_drvdata(led_cdev->dev->parent); } static void gta02led_set(struct led_classdev *led_cdev, @@ -174,6 +174,8 @@ static int __init gta02led_probe(struct platform_device *pdev) rc = led_classdev_register(&pdev->dev, &lp->cdev); } + bundle->num_leds = i; + return 0; } @@ -186,6 +188,8 @@ static int gta02led_remove(struct platform_device *pdev) struct gta02_led_priv *lp = &bundle->led[i]; if (lp->has_pwm) s3c2410_pwm_disable(&lp->pwm); + else + gta02led_set(&lp->cdev, 0); led_classdev_unregister(&lp->cdev); mutex_destroy(&lp->mutex); |