Input: atmel_mxt_ts - fix -Wunused-const-variable
Subsystems (3)
PATCH 1/1 Input: atmel_mxt_ts - fix -Wunused-const-variable
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.
--- drivers/input/touchscreen/atmel_mxt_ts.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/input/touchscreen/atmel_mxt_ts.c +2 -0
@@ -256,6 +256,7 @@ enum v4l_dbg_inputs { MXT_V4L_INPUT_MAX, }; +#ifdef CONFIG_TOUCHSCREEN_ATMEL_MXT_T37 static const struct v4l2_file_operations mxt_video_fops = { .owner =THIS_MODULE , .open = v4l2_fh_open,
@@ -265,6 +266,7 @@ static const struct v4l2_file_operations mxt_video_fops = { .mmap = vb2_fop_mmap, .poll = vb2_fop_poll, }; +#endif enum mxt_suspend_mode {MXT_SUSPEND_DEEP_SLEEP =0 ,
Signature · 1 line
2.22.0.rc2.383.gf4fbbf30c2-goog
Quoted 2 lines · Nathan Huckleberry' via Clang Built Linux
Since
mxt_video_fopsis only used inside an ifdef. It should be moved inside the ifdef.
Thanks for the patch! I agree. I think it would be better and clearer to sink the definition of mxt_video_fops down closer to its use, immediately before the definition of mxt_video_device. Then it would be closer to its use and it would also be within the existing ifdef.
Quoted 14 lines
+++
b/drivers/input/touchscreen/atmel_mxt_ts.cdrivers/input/touchscreen/atmel_mxt_ts.c +2
-0@@ -256,6 +256,7 @@ enum v4l_dbg_inputs { MXT_V4L_INPUT_MAX, }; +#ifdef CONFIG_TOUCHSCREEN_ATMEL_MXT_T37 static const struct v4l2_file_operations mxt_video_fops = { .owner =THIS_MODULE , .open = v4l2_fh_open,@@ -265,6 +266,7 @@ static const struct v4l2_file_operations mxt_video_fops = { .mmap = vb2_fop_mmap, .poll = vb2_fop_poll, }; +#endif
Signature · 2 lines
Thanks, ~Nick Desaulniers
PATCH v2 1/1 Input: atmel_mxt_ts - fix -Wunused-const-variable
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.
---
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(-)
drivers/input/touchscreen/atmel_mxt_ts.c +10 -10
@@ -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) {
Signature · 1 line
2.22.0.rc2.383.gf4fbbf30c2-goog
Quoted 2 lines · Nathan Huckleberry' via Clang Built Linux
Changes from v1 -> v2
* Moved definition ofmxt_video_fopsinto existing ifdef
Thanks for the v2.
Quoted 33 lines
drivers/input/touchscreen/atmel_mxt_ts.c +10
-10@@ -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, +}; +
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 7 lines · Nick Desaulniers
Quoted 2 lines · Nathan Huckleberry' via Clang Built Linux
Changes from v1 -> v2
* Moved definition ofmxt_video_fopsinto existing ifdefThanks for the v2.
Reviewed-by Nick Desaulniers <[email protected]>
Applied, thank you.
Quoted 38 lines
Quoted 34 lines
drivers/input/touchscreen/atmel_mxt_ts.c +10
-10@@ -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, +}; +Signature · 2 lines
Thanks, ~Nick Desaulniers
Signature · 1 line
Dmitry