[PATCH 2/3] gta02 led fixes

Holger Freyther zecke at openmoko.org
Wed Apr 9 23:45:54 CEST 2008


From 0ae46822c144fb639c2d716009d56df66b5edd7c Mon Sep 17 00:00:00 2001
From: Holger Freyther <zecke at openmoko.org>
Date: Wed, 9 Apr 2008 18:47:24 +0200
Subject: [PATCH] [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.
---
 drivers/leds/leds-neo1973-gta02.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/leds/leds-neo1973-gta02.c 
b/drivers/leds/leds-neo1973-gta02.c
index d7f73f1..122831c 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;
 }
 
-- 
1.5.3





More information about the openmoko-kernel mailing list