diff options
author | Alan Jenkins <alan-jenkins@tuffmail.co.uk> | 2009-12-03 02:45:15 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-12-09 15:54:33 -0500 |
commit | 325fb8e9aeddf7bf8a7a892869dca00e7305c41e (patch) | |
tree | 7171a806baf28188a576b95a5682d19dc783877e /drivers/platform/x86/eeepc-laptop.c | |
parent | f90be874303eddc53c199083a37bc44d65ab8351 (diff) |
eeepc-laptop: re-add check for eeepc->backlight == NULL
As Corentin points out, we do not create a backlight device if the ACPI
video driver is able to provide equivalent functionality. So we do need
to check before we try to update the backlight device.
We now ignore brightness events completely if we have not created a
backlight device. This is slightly more cautious than the original
check.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform/x86/eeepc-laptop.c')
-rw-r--r-- | drivers/platform/x86/eeepc-laptop.c | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index 5f0eb767e8a6..d07a4c0ec7e9 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
@@ -1230,27 +1230,35 @@ static void eeepc_acpi_notify(struct acpi_device *device, u32 event) | |||
1230 | dev_name(&device->dev), event, | 1230 | dev_name(&device->dev), event, |
1231 | count); | 1231 | count); |
1232 | 1232 | ||
1233 | /* Brightness events are special */ | ||
1233 | if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX) { | 1234 | if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX) { |
1234 | int old_brightness, new_brightness; | ||
1235 | 1235 | ||
1236 | /* Update backlight device. */ | 1236 | /* Ignore them completely if the acpi video driver is used */ |
1237 | old_brightness = eeepc_backlight_notify(eeepc); | 1237 | if (eeepc->backlight_device != NULL) { |
1238 | 1238 | int old_brightness, new_brightness; | |
1239 | /* Convert brightness event to keypress (obsolescent hack). */ | 1239 | |
1240 | new_brightness = event - NOTIFY_BRN_MIN; | 1240 | /* Update the backlight device. */ |
1241 | 1241 | old_brightness = eeepc_backlight_notify(eeepc); | |
1242 | if (new_brightness < old_brightness) { | 1242 | |
1243 | event = NOTIFY_BRN_MIN; /* brightness down */ | 1243 | /* Convert event to keypress (obsolescent hack) */ |
1244 | } else if (new_brightness > old_brightness) { | 1244 | new_brightness = event - NOTIFY_BRN_MIN; |
1245 | event = NOTIFY_BRN_MAX; /* brightness up */ | 1245 | |
1246 | } else { | 1246 | if (new_brightness < old_brightness) { |
1247 | /* | 1247 | event = NOTIFY_BRN_MIN; /* brightness down */ |
1248 | * no change in brightness - already at min/max, | 1248 | } else if (new_brightness > old_brightness) { |
1249 | * event will be desired value (or else ignored). | 1249 | event = NOTIFY_BRN_MAX; /* brightness up */ |
1250 | */ | 1250 | } else { |
1251 | /* | ||
1252 | * no change in brightness - already at min/max, | ||
1253 | * event will be desired value (or else ignored) | ||
1254 | */ | ||
1255 | } | ||
1256 | eeepc_input_notify(eeepc, event); | ||
1251 | } | 1257 | } |
1258 | } else { | ||
1259 | /* Everything else is a bona-fide keypress event */ | ||
1260 | eeepc_input_notify(eeepc, event); | ||
1252 | } | 1261 | } |
1253 | eeepc_input_notify(eeepc, event); | ||
1254 | } | 1262 | } |
1255 | 1263 | ||
1256 | static void cmsg_quirk(struct eeepc_laptop *eeepc, int cm, const char *name) | 1264 | static void cmsg_quirk(struct eeepc_laptop *eeepc, int cm, const char *name) |