diff options
author | Frans Klaver <fransklaver@gmail.com> | 2014-11-02 16:14:58 -0500 |
---|---|---|
committer | Darren Hart <dvhart@linux.intel.com> | 2014-11-19 12:07:08 -0500 |
commit | fb1d97a2c7a6b833043003e933dc1a67dd242d5a (patch) | |
tree | 4cdd1df42ad88626b2516060f7e49c6c216f307f /drivers/platform/x86 | |
parent | 049db626beae30769501abd946055aa9014d80af (diff) |
eeepc-laptop: clean up control flow in eeepc_acpi_notify
eeepc_acpi_notify increases the indentation level to a whopping four. If
we revise the conditions a bit, we can reduce that to a more soothing
two and satisfy the indentation guidelines in Documentation/CodingStyle.
Remove an unwanted space while we're in the neighbourhood.
Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Diffstat (limited to 'drivers/platform/x86')
-rw-r--r-- | drivers/platform/x86/eeepc-laptop.c | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index 8f9dc9cf5994..e4094b40a282 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
@@ -1234,7 +1234,7 @@ static void eeepc_input_exit(struct eeepc_laptop *eeepc) | |||
1234 | static void eeepc_input_notify(struct eeepc_laptop *eeepc, int event) | 1234 | static void eeepc_input_notify(struct eeepc_laptop *eeepc, int event) |
1235 | { | 1235 | { |
1236 | if (!eeepc->inputdev) | 1236 | if (!eeepc->inputdev) |
1237 | return ; | 1237 | return; |
1238 | if (!sparse_keymap_report_event(eeepc->inputdev, event, 1, true)) | 1238 | if (!sparse_keymap_report_event(eeepc->inputdev, event, 1, true)) |
1239 | pr_info("Unknown key %x pressed\n", event); | 1239 | pr_info("Unknown key %x pressed\n", event); |
1240 | } | 1240 | } |
@@ -1242,6 +1242,7 @@ static void eeepc_input_notify(struct eeepc_laptop *eeepc, int event) | |||
1242 | static void eeepc_acpi_notify(struct acpi_device *device, u32 event) | 1242 | static void eeepc_acpi_notify(struct acpi_device *device, u32 event) |
1243 | { | 1243 | { |
1244 | struct eeepc_laptop *eeepc = acpi_driver_data(device); | 1244 | struct eeepc_laptop *eeepc = acpi_driver_data(device); |
1245 | int old_brightness, new_brightness; | ||
1245 | u16 count; | 1246 | u16 count; |
1246 | 1247 | ||
1247 | if (event > ACPI_MAX_SYS_NOTIFY) | 1248 | if (event > ACPI_MAX_SYS_NOTIFY) |
@@ -1252,34 +1253,32 @@ static void eeepc_acpi_notify(struct acpi_device *device, u32 event) | |||
1252 | count); | 1253 | count); |
1253 | 1254 | ||
1254 | /* Brightness events are special */ | 1255 | /* Brightness events are special */ |
1255 | if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX) { | 1256 | if (event < NOTIFY_BRN_MIN || event > NOTIFY_BRN_MAX) { |
1256 | |||
1257 | /* Ignore them completely if the acpi video driver is used */ | ||
1258 | if (eeepc->backlight_device != NULL) { | ||
1259 | int old_brightness, new_brightness; | ||
1260 | |||
1261 | /* Update the backlight device. */ | ||
1262 | old_brightness = eeepc_backlight_notify(eeepc); | ||
1263 | |||
1264 | /* Convert event to keypress (obsolescent hack) */ | ||
1265 | new_brightness = event - NOTIFY_BRN_MIN; | ||
1266 | |||
1267 | if (new_brightness < old_brightness) { | ||
1268 | event = NOTIFY_BRN_MIN; /* brightness down */ | ||
1269 | } else if (new_brightness > old_brightness) { | ||
1270 | event = NOTIFY_BRN_MAX; /* brightness up */ | ||
1271 | } else { | ||
1272 | /* | ||
1273 | * no change in brightness - already at min/max, | ||
1274 | * event will be desired value (or else ignored) | ||
1275 | */ | ||
1276 | } | ||
1277 | eeepc_input_notify(eeepc, event); | ||
1278 | } | ||
1279 | } else { | ||
1280 | /* Everything else is a bona-fide keypress event */ | ||
1281 | eeepc_input_notify(eeepc, event); | 1257 | eeepc_input_notify(eeepc, event); |
1258 | return; | ||
1259 | } | ||
1260 | |||
1261 | /* Ignore them completely if the acpi video driver is used */ | ||
1262 | if (!eeepc->backlight_device) | ||
1263 | return; | ||
1264 | |||
1265 | /* Update the backlight device. */ | ||
1266 | old_brightness = eeepc_backlight_notify(eeepc); | ||
1267 | |||
1268 | /* Convert event to keypress (obsolescent hack) */ | ||
1269 | new_brightness = event - NOTIFY_BRN_MIN; | ||
1270 | |||
1271 | if (new_brightness < old_brightness) { | ||
1272 | event = NOTIFY_BRN_MIN; /* brightness down */ | ||
1273 | } else if (new_brightness > old_brightness) { | ||
1274 | event = NOTIFY_BRN_MAX; /* brightness up */ | ||
1275 | } else { | ||
1276 | /* | ||
1277 | * no change in brightness - already at min/max, | ||
1278 | * event will be desired value (or else ignored) | ||
1279 | */ | ||
1282 | } | 1280 | } |
1281 | eeepc_input_notify(eeepc, event); | ||
1283 | } | 1282 | } |
1284 | 1283 | ||
1285 | static void eeepc_dmi_check(struct eeepc_laptop *eeepc) | 1284 | static void eeepc_dmi_check(struct eeepc_laptop *eeepc) |