[kernel] generic-2.6/2.6.28: add missing Kconfig option
[openwrt.git] / target / linux / s3c24xx / patches-2.6.26 / 1206-From-3a32be40f78404d5f1185f0b3d6b5632381cb33f-Mon-Se.patch
1 From 8279b4e4862b148b10e7d4d2967ac92eaae0f129 Mon Sep 17 00:00:00 2001
2 From: Holger Freyther <zecke@openmoko.org>
3 Date: Fri, 25 Jul 2008 23:06:18 +0100
4 Subject: [PATCH] From 3a32be40f78404d5f1185f0b3d6b5632381cb33f Mon Sep 17 00:00:00 2001
5 Subject: [PATCH] [neo1973 leds] Move from mutex to spinlock because we may not use mutexes
6 The led triggers may call set_brightness from atomic contexts. As
7 mutex_lock calls might_sleep and sleeping is not allowed in atomic contexts
8 we have to switch to spinlocks here.
9
10 Signed-Off-By: Holger Freyther <zecke@openmoko.org>
11 ---
12 drivers/leds/leds-neo1973-gta02.c | 10 +++++-----
13 1 files changed, 5 insertions(+), 5 deletions(-)
14
15 diff --git a/drivers/leds/leds-neo1973-gta02.c b/drivers/leds/leds-neo1973-gta02.c
16 index 952ad69..8fe817b 100644
17 --- a/drivers/leds/leds-neo1973-gta02.c
18 +++ b/drivers/leds/leds-neo1973-gta02.c
19 @@ -27,7 +27,7 @@
20
21 struct gta02_led_priv
22 {
23 - struct mutex mutex;
24 + spinlock_t lock;
25 struct led_classdev cdev;
26 struct s3c2410_pwm pwm;
27 unsigned int gpio;
28 @@ -53,6 +53,7 @@ static inline struct gta02_led_bundle *to_bundle(struct led_classdev *led_cdev)
29 static void gta02led_set(struct led_classdev *led_cdev,
30 enum led_brightness value)
31 {
32 + unsigned long flags;
33 struct gta02_led_priv *lp = to_priv(led_cdev);
34
35 /*
36 @@ -60,7 +61,7 @@ static void gta02led_set(struct led_classdev *led_cdev,
37 * value == 128 -> 50% duty cycle (medium power)
38 * value == 0 -> 0% duty cycle (zero power)
39 */
40 - mutex_lock(&lp->mutex);
41 + spin_lock_irqsave(&lp->lock, flags);
42
43 if (lp->has_pwm) {
44 s3c2410_pwm_duty_cycle(value, &lp->pwm);
45 @@ -68,7 +69,7 @@ static void gta02led_set(struct led_classdev *led_cdev,
46 neo1973_gpb_setpin(lp->gpio, value ? 1 : 0);
47 }
48
49 - mutex_unlock(&lp->mutex);
50 + spin_unlock_irqrestore(&lp->lock, flags);
51 }
52
53 #ifdef CONFIG_PM
54 @@ -170,7 +171,7 @@ static int __init gta02led_probe(struct platform_device *pdev)
55 break;
56 }
57
58 - mutex_init(&lp->mutex);
59 + spin_lock_init(&lp->lock);
60 rc = led_classdev_register(&pdev->dev, &lp->cdev);
61 }
62
63 @@ -192,7 +193,6 @@ static int gta02led_remove(struct platform_device *pdev)
64 gta02led_set(&lp->cdev, 0);
65
66 led_classdev_unregister(&lp->cdev);
67 - mutex_destroy(&lp->mutex);
68 }
69
70 platform_set_drvdata(pdev, NULL);
71 --
72 1.5.6.3
73
This page took 0.04953 seconds and 5 git commands to generate.