diff mbox series

[v2] Input: atmel_mxt_ts - fix -Wunused-const-variable

Message ID 20190613182326.237391-1-nhuck@google.com (mailing list archive)
State Mainlined
Commit 5cecc2bccc03f5f7b496b43a80fd5b768d44f13c
Headers show
Series [v2] Input: atmel_mxt_ts - fix -Wunused-const-variable | expand

Commit Message

Nathan Huckleberry June 13, 2019, 6:23 p.m. UTC
Clang produces the following warning

drivers/input/touchscreen/atmel_mxt_ts.c:259:42: warning: unused
variable 'mxt_video_fops' [-Wunused-const-variable]
static const struct v4l2_file_operations mxt_video_fops = {

Since mxt_video_fops is only used inside an ifdef. It should
be moved inside the ifdef.

Cc: clang-built-linux@googlegroups.com
Link: https://github.com/ClangBuiltLinux/linux/issues/527
Signed-off-by: Nathan Huckleberry <nhuck@google.com>
---
Changes from v1 -> v2
* Moved definition of mxt_video_fops into existing ifdef
 drivers/input/touchscreen/atmel_mxt_ts.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

Comments

Nick Desaulniers June 13, 2019, 6:26 p.m. UTC | #1
On Thu, Jun 13, 2019 at 11:24 AM 'Nathan Huckleberry' via Clang Built
Linux <clang-built-linux@googlegroups.com> wrote:
> Changes from v1 -> v2
> * Moved definition of mxt_video_fops into existing ifdef

Thanks for the v2.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> @@ -256,16 +256,6 @@ enum v4l_dbg_inputs {
>         MXT_V4L_INPUT_MAX,
>  };
>
> -static const struct v4l2_file_operations mxt_video_fops = {
> -       .owner = THIS_MODULE,
> -       .open = v4l2_fh_open,
> -       .release = vb2_fop_release,
> -       .unlocked_ioctl = video_ioctl2,
> -       .read = vb2_fop_read,
> -       .mmap = vb2_fop_mmap,
> -       .poll = vb2_fop_poll,
> -};
> -
>  enum mxt_suspend_mode {
>         MXT_SUSPEND_DEEP_SLEEP  = 0,
>         MXT_SUSPEND_T9_CTRL     = 1,
> @@ -2218,6 +2208,16 @@ static int mxt_init_t7_power_cfg(struct mxt_data *data)
>  }
>
>  #ifdef CONFIG_TOUCHSCREEN_ATMEL_MXT_T37
> +static const struct v4l2_file_operations mxt_video_fops = {
> +       .owner = THIS_MODULE,
> +       .open = v4l2_fh_open,
> +       .release = vb2_fop_release,
> +       .unlocked_ioctl = video_ioctl2,
> +       .read = vb2_fop_read,
> +       .mmap = vb2_fop_mmap,
> +       .poll = vb2_fop_poll,
> +};
> +
Dmitry Torokhov July 1, 2019, 8:19 a.m. UTC | #2
On Thu, Jun 13, 2019 at 11:26:41AM -0700, Nick Desaulniers wrote:
> On Thu, Jun 13, 2019 at 11:24 AM 'Nathan Huckleberry' via Clang Built
> Linux <clang-built-linux@googlegroups.com> wrote:
> > Changes from v1 -> v2
> > * Moved definition of mxt_video_fops into existing ifdef
> 
> Thanks for the v2.
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

Applied, thank you.

> 
> > --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> > +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> > @@ -256,16 +256,6 @@ enum v4l_dbg_inputs {
> >         MXT_V4L_INPUT_MAX,
> >  };
> >
> > -static const struct v4l2_file_operations mxt_video_fops = {
> > -       .owner = THIS_MODULE,
> > -       .open = v4l2_fh_open,
> > -       .release = vb2_fop_release,
> > -       .unlocked_ioctl = video_ioctl2,
> > -       .read = vb2_fop_read,
> > -       .mmap = vb2_fop_mmap,
> > -       .poll = vb2_fop_poll,
> > -};
> > -
> >  enum mxt_suspend_mode {
> >         MXT_SUSPEND_DEEP_SLEEP  = 0,
> >         MXT_SUSPEND_T9_CTRL     = 1,
> > @@ -2218,6 +2208,16 @@ static int mxt_init_t7_power_cfg(struct mxt_data *data)
> >  }
> >
> >  #ifdef CONFIG_TOUCHSCREEN_ATMEL_MXT_T37
> > +static const struct v4l2_file_operations mxt_video_fops = {
> > +       .owner = THIS_MODULE,
> > +       .open = v4l2_fh_open,
> > +       .release = vb2_fop_release,
> > +       .unlocked_ioctl = video_ioctl2,
> > +       .read = vb2_fop_read,
> > +       .mmap = vb2_fop_mmap,
> > +       .poll = vb2_fop_poll,
> > +};
> > +
> 
> -- 
> Thanks,
> ~Nick Desaulniers
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 19378f200c63..0dae381c6637 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -256,16 +256,6 @@  enum v4l_dbg_inputs {
 	MXT_V4L_INPUT_MAX,
 };
 
-static const struct v4l2_file_operations mxt_video_fops = {
-	.owner = THIS_MODULE,
-	.open = v4l2_fh_open,
-	.release = vb2_fop_release,
-	.unlocked_ioctl = video_ioctl2,
-	.read = vb2_fop_read,
-	.mmap = vb2_fop_mmap,
-	.poll = vb2_fop_poll,
-};
-
 enum mxt_suspend_mode {
 	MXT_SUSPEND_DEEP_SLEEP	= 0,
 	MXT_SUSPEND_T9_CTRL	= 1,
@@ -2218,6 +2208,16 @@  static int mxt_init_t7_power_cfg(struct mxt_data *data)
 }
 
 #ifdef CONFIG_TOUCHSCREEN_ATMEL_MXT_T37
+static const struct v4l2_file_operations mxt_video_fops = {
+	.owner = THIS_MODULE,
+	.open = v4l2_fh_open,
+	.release = vb2_fop_release,
+	.unlocked_ioctl = video_ioctl2,
+	.read = vb2_fop_read,
+	.mmap = vb2_fop_mmap,
+	.poll = vb2_fop_poll,
+};
+
 static u16 mxt_get_debug_value(struct mxt_data *data, unsigned int x,
 			       unsigned int y)
 {