* [PATCH] intel-oaktrail: Clean up dead code
@ 2017-10-08 22:57 Christos Gkekas
2017-10-09 10:21 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Christos Gkekas @ 2017-10-08 22:57 UTC (permalink / raw)
To: Darren Hart, Andy Shevchenko, platform-driver-x86, linux-kernel
Cc: 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.
Signed-off-by: Christos Gkekas <chris.gekas@gmail.com>
---
drivers/platform/x86/intel_oaktrail.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/platform/x86/intel_oaktrail.c b/drivers/platform/x86/intel_oaktrail.c
index 5747f63..0614d2b 100644
--- a/drivers/platform/x86/intel_oaktrail.c
+++ b/drivers/platform/x86/intel_oaktrail.c
@@ -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);
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] intel-oaktrail: Clean up dead code
2017-10-08 22:57 [PATCH] intel-oaktrail: Clean up dead code Christos Gkekas
@ 2017-10-09 10:21 ` Andy Shevchenko
2017-10-09 20:45 ` Christos Gkekas
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2017-10-09 10:21 UTC (permalink / raw)
To: Christos Gkekas
Cc: Darren Hart, Andy Shevchenko, Platform Driver, linux-kernel
On Mon, Oct 9, 2017 at 1:57 AM, Christos Gkekas <chris.gekas@gmail.com> wrote:
> 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.
> -#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.
> - 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.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] intel-oaktrail: Clean up dead code
2017-10-09 10:21 ` Andy Shevchenko
@ 2017-10-09 20:45 ` Christos Gkekas
0 siblings, 0 replies; 3+ messages in thread
From: Christos Gkekas @ 2017-10-09 20:45 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Darren Hart, Andy Shevchenko, Platform Driver, linux-kernel
On 09/10/17 13:21:17 +0300, Andy Shevchenko wrote:
> On Mon, Oct 9, 2017 at 1:57 AM, Christos Gkekas <chris.gekas@gmail.com> wrote:
> > 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.
>
> > -#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.
>
>
> > - 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.
>
> --
> With Best Regards,
> Andy Shevchenko
Fair enough, thanks for your time and feedback.
Regards,
Christos
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-09 20:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-08 22:57 [PATCH] intel-oaktrail: Clean up dead code Christos Gkekas
2017-10-09 10:21 ` Andy Shevchenko
2017-10-09 20:45 ` Christos Gkekas
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.