Re: [PATCH 06/15] input: touchscreen: melfas_mip4: Remove a bunch of unused variables

Dmitry Torokhov
2020-11-20T03:09:37Z

On Fri, Nov 13, 2020 at 07:55:25AM +0000, Lee Jones wrote:
> On Thu, 12 Nov 2020, Dmitry Torokhov wrote:
>
> > On Thu, Nov 12, 2020 at 11:01:55AM +0000, Lee Jones wrote:
> > > Fixes the following W=1 kernel build warning(s):
> > >
> > > drivers/input/touchscreen/melfas_mip4.c: In function ‘mip4_report_touch’:
> > > drivers/input/touchscreen/melfas_mip4.c:474:5: warning: variable ‘size’ set but not used [-Wunused-but-set-variable]
> > > drivers/input/touchscreen/melfas_mip4.c:472:5: warning: variable ‘pressure_stage’ set but not used [-Wunused-but-set-variable]
> > > drivers/input/touchscreen/melfas_mip4.c:469:7: warning: variable ‘palm’ set but not used [-Wunused-but-set-variable]
> > > drivers/input/touchscreen/melfas_mip4.c:468:7: warning: variable ‘hover’ set but not used [-Wunused-but-set-variable]
> > >
> > > Cc: Sangwon Jee <jeesw@melfas.com>
> > > Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > > Cc: Henrik Rydberg <rydberg@bitmath.org>
> > > Cc: linux-input@vger.kernel.org
> > > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> > > ---
> > > drivers/input/touchscreen/melfas_mip4.c | 11 -----------
> > > 1 file changed, 11 deletions(-)
> > >
> > > diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchscreen/melfas_mip4.c
> > > index f67efdd040b24..9c98759098c7a 100644
> > > --- a/drivers/input/touchscreen/melfas_mip4.c
> > > +++ b/drivers/input/touchscreen/melfas_mip4.c
> > > @@ -465,13 +465,9 @@ static void mip4_report_keys(struct mip4_ts *ts, u8 *packet)
> > > static void mip4_report_touch(struct mip4_ts *ts, u8 *packet)
> > > {
> > > int id;
> > > - bool hover;
> > > - bool palm;
> > > bool state;
> > > u16 x, y;
> > > - u8 pressure_stage = 0;
> > > u8 pressure;
> > > - u8 size;
> > > u8 touch_major;
> > > u8 touch_minor;
> > >
> > > @@ -480,14 +476,11 @@ static void mip4_report_touch(struct mip4_ts *ts, u8 *packet)
> > > case 1:
> > > /* Touch only */
> > > state = packet[0] & BIT(7);
> > > - hover = packet[0] & BIT(5);
> > > - palm = packet[0] & BIT(4);
> >
> > No really happy that we'd be losing information about protocol. Is there
> > a better way to suppress the warning while keeping this info?
>
> Yes. We can either convert the information to comments, or mark the
> variables as __always_unused.

If __always unused suppresses this warning that would be my preference.

Thanks!

--
Dmitry