diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-20 13:17:32 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-20 13:17:32 -0500 |
commit | a5527c6a586537c1af7ae6db30bb444ee4abdfe8 (patch) | |
tree | f0682de5c461c270f5f58b7304fd5ea5b5d6fb38 /arch | |
parent | 4afffe5eabc4005674a1ef4f4c96f1ae9f4a979b (diff) | |
parent | 8f27489d1105c2386e6ed71c35e74e0e69603cbc (diff) |
Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-backlight
* 'for-linus' of git://git.o-hand.com/linux-rpurdie-backlight:
backlight: Remove bogus SYSFS dependency
backlight: simplify corgi_bl locking
backlight: Separate backlight properties from backlight ops pointers
backlight: Clean up pmac_backlight handling
backlight: Improve backlight selection for fbdev drivers
backlight: Rework backlight/fb interaction simplifying, lots
backlight: Remove unneeded backlight update_status calls
backlight: Remove uneeded update_status call from chipsfb.c
backlight/fbcon: Add FB_EVENT_CONBLANK
backlight: Fix Kconfig entries
backlight: Remove uneeded nvidia set_power calls
backlight: Convert semaphore -> mutex
backlight: Fix external uses of backlight internal semaphore
backlight: Minor code cleanups for hp680_bl.c
backlight: Minor code cleanups for corgi_bl.c
backlight: Remove excessive (un)likelys
backlight: Remove unneeded owner field
backlight: Fix error handling
backlight: Add Frontpath ProGear HX1050+ driver
backlight: Add maintainer entry
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/kernel/traps.c | 6 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/backlight.c | 27 |
2 files changed, 11 insertions, 22 deletions
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index dcc6f159fd94..17724fb2067f 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c | |||
@@ -107,12 +107,10 @@ int die(const char *str, struct pt_regs *regs, long err) | |||
107 | if (machine_is(powermac) && pmac_backlight) { | 107 | if (machine_is(powermac) && pmac_backlight) { |
108 | struct backlight_properties *props; | 108 | struct backlight_properties *props; |
109 | 109 | ||
110 | down(&pmac_backlight->sem); | 110 | props = &pmac_backlight->props; |
111 | props = pmac_backlight->props; | ||
112 | props->brightness = props->max_brightness; | 111 | props->brightness = props->max_brightness; |
113 | props->power = FB_BLANK_UNBLANK; | 112 | props->power = FB_BLANK_UNBLANK; |
114 | props->update_status(pmac_backlight); | 113 | backlight_update_status(pmac_backlight); |
115 | up(&pmac_backlight->sem); | ||
116 | } | 114 | } |
117 | mutex_unlock(&pmac_backlight_mutex); | 115 | mutex_unlock(&pmac_backlight_mutex); |
118 | #endif | 116 | #endif |
diff --git a/arch/powerpc/platforms/powermac/backlight.c b/arch/powerpc/platforms/powermac/backlight.c index c3a89414ddc0..de7440e62cc4 100644 --- a/arch/powerpc/platforms/powermac/backlight.c +++ b/arch/powerpc/platforms/powermac/backlight.c | |||
@@ -37,21 +37,20 @@ static int pmac_backlight_set_legacy_queued; | |||
37 | */ | 37 | */ |
38 | static atomic_t kernel_backlight_disabled = ATOMIC_INIT(0); | 38 | static atomic_t kernel_backlight_disabled = ATOMIC_INIT(0); |
39 | 39 | ||
40 | /* Protect the pmac_backlight variable */ | 40 | /* Protect the pmac_backlight variable below. |
41 | You should hold this lock when using the pmac_backlight pointer to | ||
42 | prevent its potential removal. */ | ||
41 | DEFINE_MUTEX(pmac_backlight_mutex); | 43 | DEFINE_MUTEX(pmac_backlight_mutex); |
42 | 44 | ||
43 | /* Main backlight storage | 45 | /* Main backlight storage |
44 | * | 46 | * |
45 | * Backlight drivers in this variable are required to have the "props" | 47 | * Backlight drivers in this variable are required to have the "ops" |
46 | * attribute set and to have an update_status function. | 48 | * attribute set and to have an update_status function. |
47 | * | 49 | * |
48 | * We can only store one backlight here, but since Apple laptops have only one | 50 | * We can only store one backlight here, but since Apple laptops have only one |
49 | * internal display, it doesn't matter. Other backlight drivers can be used | 51 | * internal display, it doesn't matter. Other backlight drivers can be used |
50 | * independently. | 52 | * independently. |
51 | * | 53 | * |
52 | * Lock ordering: | ||
53 | * pmac_backlight_mutex (global, main backlight) | ||
54 | * pmac_backlight->sem (backlight class) | ||
55 | */ | 54 | */ |
56 | struct backlight_device *pmac_backlight; | 55 | struct backlight_device *pmac_backlight; |
57 | 56 | ||
@@ -104,8 +103,7 @@ static void pmac_backlight_key_worker(struct work_struct *work) | |||
104 | struct backlight_properties *props; | 103 | struct backlight_properties *props; |
105 | int brightness; | 104 | int brightness; |
106 | 105 | ||
107 | down(&pmac_backlight->sem); | 106 | props = &pmac_backlight->props; |
108 | props = pmac_backlight->props; | ||
109 | 107 | ||
110 | brightness = props->brightness + | 108 | brightness = props->brightness + |
111 | ((pmac_backlight_key_queued?-1:1) * | 109 | ((pmac_backlight_key_queued?-1:1) * |
@@ -117,9 +115,7 @@ static void pmac_backlight_key_worker(struct work_struct *work) | |||
117 | brightness = props->max_brightness; | 115 | brightness = props->max_brightness; |
118 | 116 | ||
119 | props->brightness = brightness; | 117 | props->brightness = brightness; |
120 | props->update_status(pmac_backlight); | 118 | backlight_update_status(pmac_backlight); |
121 | |||
122 | up(&pmac_backlight->sem); | ||
123 | } | 119 | } |
124 | mutex_unlock(&pmac_backlight_mutex); | 120 | mutex_unlock(&pmac_backlight_mutex); |
125 | } | 121 | } |
@@ -145,8 +141,7 @@ static int __pmac_backlight_set_legacy_brightness(int brightness) | |||
145 | if (pmac_backlight) { | 141 | if (pmac_backlight) { |
146 | struct backlight_properties *props; | 142 | struct backlight_properties *props; |
147 | 143 | ||
148 | down(&pmac_backlight->sem); | 144 | props = &pmac_backlight->props; |
149 | props = pmac_backlight->props; | ||
150 | props->brightness = brightness * | 145 | props->brightness = brightness * |
151 | (props->max_brightness + 1) / | 146 | (props->max_brightness + 1) / |
152 | (OLD_BACKLIGHT_MAX + 1); | 147 | (OLD_BACKLIGHT_MAX + 1); |
@@ -156,8 +151,7 @@ static int __pmac_backlight_set_legacy_brightness(int brightness) | |||
156 | else if (props->brightness < 0) | 151 | else if (props->brightness < 0) |
157 | props->brightness = 0; | 152 | props->brightness = 0; |
158 | 153 | ||
159 | props->update_status(pmac_backlight); | 154 | backlight_update_status(pmac_backlight); |
160 | up(&pmac_backlight->sem); | ||
161 | 155 | ||
162 | error = 0; | 156 | error = 0; |
163 | } | 157 | } |
@@ -196,14 +190,11 @@ int pmac_backlight_get_legacy_brightness() | |||
196 | if (pmac_backlight) { | 190 | if (pmac_backlight) { |
197 | struct backlight_properties *props; | 191 | struct backlight_properties *props; |
198 | 192 | ||
199 | down(&pmac_backlight->sem); | 193 | props = &pmac_backlight->props; |
200 | props = pmac_backlight->props; | ||
201 | 194 | ||
202 | result = props->brightness * | 195 | result = props->brightness * |
203 | (OLD_BACKLIGHT_MAX + 1) / | 196 | (OLD_BACKLIGHT_MAX + 1) / |
204 | (props->max_brightness + 1); | 197 | (props->max_brightness + 1); |
205 | |||
206 | up(&pmac_backlight->sem); | ||
207 | } | 198 | } |
208 | mutex_unlock(&pmac_backlight_mutex); | 199 | mutex_unlock(&pmac_backlight_mutex); |
209 | 200 | ||