diff options
author | Frans Klaver <fransklaver@gmail.com> | 2014-10-22 15:12:41 -0400 |
---|---|---|
committer | Darren Hart <dvhart@linux.intel.com> | 2014-11-19 12:07:08 -0500 |
commit | a5de681c0cf7350fa13ccd67f1a118f1651cc2d5 (patch) | |
tree | eb2bbcdfae7a59873b03d621dc75f3176a97558e | |
parent | 792bd2a58f924fca7ed45d0cacfa5ae5cfb42e65 (diff) |
eeepc-laptop: replace magic numbers with defines
eeepc_[gs]et_fan_ctrl uses some magic numbers. These numbers mean
something more than just the number. Describe them with macros instead
of comments in one of the functions.
Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
-rw-r--r-- | drivers/platform/x86/eeepc-laptop.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index e92ea4187cdf..c1758ec3c61b 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
@@ -1005,15 +1005,19 @@ static int eeepc_get_fan_rpm(void) | |||
1005 | return high << 8 | low; | 1005 | return high << 8 | low; |
1006 | } | 1006 | } |
1007 | 1007 | ||
1008 | #define EEEPC_EC_FAN_CTRL_BIT 0x02 | ||
1009 | #define EEEPC_FAN_CTRL_MANUAL 1 | ||
1010 | #define EEEPC_FAN_CTRL_AUTO 2 | ||
1011 | |||
1008 | static int eeepc_get_fan_ctrl(void) | 1012 | static int eeepc_get_fan_ctrl(void) |
1009 | { | 1013 | { |
1010 | u8 value = 0; | 1014 | u8 value = 0; |
1011 | 1015 | ||
1012 | ec_read(EEEPC_EC_FAN_CTRL, &value); | 1016 | ec_read(EEEPC_EC_FAN_CTRL, &value); |
1013 | if (value & 0x02) | 1017 | if (value & EEEPC_EC_FAN_CTRL_BIT) |
1014 | return 1; /* manual */ | 1018 | return EEEPC_FAN_CTRL_MANUAL; |
1015 | else | 1019 | else |
1016 | return 2; /* automatic */ | 1020 | return EEEPC_FAN_CTRL_AUTO; |
1017 | } | 1021 | } |
1018 | 1022 | ||
1019 | static void eeepc_set_fan_ctrl(int manual) | 1023 | static void eeepc_set_fan_ctrl(int manual) |
@@ -1021,10 +1025,10 @@ static void eeepc_set_fan_ctrl(int manual) | |||
1021 | u8 value = 0; | 1025 | u8 value = 0; |
1022 | 1026 | ||
1023 | ec_read(EEEPC_EC_FAN_CTRL, &value); | 1027 | ec_read(EEEPC_EC_FAN_CTRL, &value); |
1024 | if (manual == 1) | 1028 | if (manual == EEEPC_FAN_CTRL_MANUAL) |
1025 | value |= 0x02; | 1029 | value |= EEEPC_EC_FAN_CTRL_BIT; |
1026 | else | 1030 | else |
1027 | value &= ~0x02; | 1031 | value &= ~EEEPC_EC_FAN_CTRL_BIT; |
1028 | ec_write(EEEPC_EC_FAN_CTRL, value); | 1032 | ec_write(EEEPC_EC_FAN_CTRL, value); |
1029 | } | 1033 | } |
1030 | 1034 | ||