intel-oaktrail: Clean up dead code
PATCH 1/1 intel-oaktrail: Clean up dead code
A couple of macros are unused and need to be removed.
Also variable percent is unsigned so checking whether it is less than zero is redundant.
--- drivers/platform/x86/intel_oaktrail.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/platform/x86/intel_oaktrail.c +1 -3
@@ -68,12 +68,10 @@*/ #define OT_EC_DEVICE_STATE_ADDRESS 0xD6 -#define OT_EC_CAMERA_MASK (1 << 0)#define OT_EC_BT_MASK (1 << 1)#define OT_EC_GPS_MASK (1 << 2)#define OT_EC_WIFI_MASK (1 << 3)#define OT_EC_WWAN_MASK (1 << 4) -#define OT_EC_TS_MASK (1 << 5)/* * This is the address in EC space and commands used to control LCD backlight:
@@ -228,7 +226,7 @@ static int get_backlight_brightness(struct backlight_device *b)static int set_backlight_brightness (struct backlight_device *b) {u8 percent = (u8 ) b->props.brightness; -if (percent <0 || percent >OT_EC_BL_BRIGHTNESS_MAX ) +if (percent >OT_EC_BL_BRIGHTNESS_MAX )return -EINVAL ;ec_write (OT_EC_BL_BRIGHTNESS_ADDRESS , percent);
Signature · 1 line
2.7.4
drivers/platform/x86/intel_oaktrail.c line 76
Quoted 10 lines · Christos Gkekas
A couple of macros are unused and need to be removed.
Also variable percent is unsigned so checking whether it is less than zero is redundant.drivers/platform/x86/intel_oaktrail.c +0
-2-#define OT_EC_CAMERA_MASK (1 << 0)#define OT_EC_BT_MASK (1 << 1)#define OT_EC_GPS_MASK (1 << 2)#define OT_EC_WIFI_MASK (1 << 3)#define OT_EC_WWAN_MASK (1 << 4) -#define OT_EC_TS_MASK (1 << 5)
While they are unused they won't bring any additional code to the binary. The rationale to leave them is to have a bit descriptions in the code, so, anyone who is in possession of that old and rare hardware can do some tests or amendments without searching looking to documentation.
drivers/platform/x86/intel_oaktrail.c static int get_backlight_brightness(struct backlight_device *b) · line 230
Quoted 3 lines
drivers/platform/x86/intel_oaktrail.c +1
-1-if (percent <0 || percent >OT_EC_BL_BRIGHTNESS_MAX ) +if (percent >OT_EC_BL_BRIGHTNESS_MAX )return -EINVAL ;
While it's true, doesn't compiler take care about that?
https://lkml.org/lkml/2006/11/28/206
So, unfortunately I have no reason to take it.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 22 lines · Andy Shevchenko
drivers/platform/x86/intel_oaktrail.c line 76
Quoted 10 lines · Christos Gkekas
A couple of macros are unused and need to be removed.
Also variable percent is unsigned so checking whether it is less than zero is redundant.drivers/platform/x86/intel_oaktrail.c +0
-2-#define OT_EC_CAMERA_MASK (1 << 0)#define OT_EC_BT_MASK (1 << 1)#define OT_EC_GPS_MASK (1 << 2)#define OT_EC_WIFI_MASK (1 << 3)#define OT_EC_WWAN_MASK (1 << 4) -#define OT_EC_TS_MASK (1 << 5)While they are unused they won't bring any additional code to the binary. The rationale to leave them is to have a bit descriptions in the code, so, anyone who is in possession of that old and rare hardware can do some tests or amendments without searching looking to documentation.
drivers/platform/x86/intel_oaktrail.c static int get_backlight_brightness(struct backlight_device *b) · line 230
Quoted 3 lines
drivers/platform/x86/intel_oaktrail.c +1
-1-if (percent <0 || percent >OT_EC_BL_BRIGHTNESS_MAX ) +if (percent >OT_EC_BL_BRIGHTNESS_MAX )return -EINVAL ;
Quoted 9 lines
While it's true, doesn't compiler take care about that?
https://lkml.org/lkml/2006/11/28/206
So, unfortunately I have no reason to take it.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Fair enough, thanks for your time and feedback.
Regards,
Christos