# \[PATCH v3 0/5\] (Set 2/2) Rid W=1 issues from Input

- Subsystems: INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN) DRIVERS, THE REST
- Maintainers: Dmitry Torokhov, Linus Torvalds
- Series: 5 patches touching 5 files, +13/-8
- Status: LANDED
- Landed in mainline.
- List: linux-input
- 11 messages, 3 authors
- Page: https://ratatoskr.run/linux-input/2021/01/6234790/t

## \[PATCH v3 0/5\] (Set 2/2) Rid W=1 issues from Input

- From: Lee Jones \<hidden\>
- Date: 2021-01-14 15:24:15 
- Message: https://ratatoskr.run/linux-input/2021/01/6234790.md

```text
This set is part of a larger effort attempting to clean-up W=1
kernel builds, which are currently overwhelmingly riddled with
niggly little warnings.

This is the second (and last) of 2 sets.

v3:
 - Make use of 'ret' instead of removing it
 - Use __always_unused instead of removing unused variables
 - Fix recent/new warning regarding undocumented 'prop' param
 
v2:
 - Replace empty if() with commentary
   - Suggested-by: Joe Perches


Lee Jones (5):
  input: mouse: synaptics: Replace NOOP with suitable commentary
  input: touchscreen: melfas_mip4: Mark a bunch of variables as
    __always_unused
  input: touchscreen: usbtouchscreen: Actually check return value of
    usb_submit_urb()
  input: touchscreen: surface3_spi: Remove set but unused variable
    'timestamp'
  input: touchscreen: stmpe-ts: Add description for 'prop' struct member

 drivers/input/mouse/synaptics.c            | 7 +++++--
 drivers/input/touchscreen/melfas_mip4.c    | 8 ++++----
 drivers/input/touchscreen/stmpe-ts.c       | 1 +
 drivers/input/touchscreen/surface3_spi.c   | 2 --
 drivers/input/touchscreen/usbtouchscreen.c | 3 +++
 5 files changed, 13 insertions(+), 8 deletions(-)

Cc: Alexandre Torgue <redacted>
Cc: Benjamin Tissoires <redacted>
Cc: Bruce Kalk <redacted>
Cc: "C. Scott Ananian" <redacted>
Cc: Daniel Ritz <redacted>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Henrik Rydberg <rydberg@bitmath.org>
Cc: James Hilliard <james.hilliard1@gmail.com>
Cc: <redacted>
Cc: <redacted>
Cc: <redacted>
Cc: Luotao Fu <redacted>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Peter Osterlund <redacted>
Cc: Sangwon Jee <redacted>
Cc: Stefan Gmeiner <redacted>
Cc: Stefan Riedmueller <redacted>
Cc: this to <redacted>
-- 
2.25.1

```

## \[PATCH 2/5\] input: touchscreen: melfas\_mip4: Mark a bunch of variables as \_\_always\_unused

- From: Lee Jones \<hidden\>
- Date: 2021-01-14 15:24:33 
- Message: https://ratatoskr.run/linux-input/2021/01/6234791.md

```text
Dmitry requested to keep these around for the purposes of documentation.

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 <redacted>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Henrik Rydberg <rydberg@bitmath.org>
Cc: <redacted>
Signed-off-by: Lee Jones <redacted>
---
 drivers/input/touchscreen/melfas_mip4.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchscreen/melfas_mip4.c
index c0050044a5a9e..225796a3f5460 100644
--- a/drivers/input/touchscreen/melfas_mip4.c
+++ b/drivers/input/touchscreen/melfas_mip4.c
@@ -465,13 +465,13 @@ 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 __always_unused hover;
+	bool __always_unused palm;
 	bool state;
 	u16 x, y;
-	u8 pressure_stage = 0;
+	u8 __always_unused pressure_stage = 0;
 	u8 pressure;
-	u8 size;
+	u8 __always_unused size;
 	u8 touch_major;
 	u8 touch_minor;
 
-- 
2.25.1

```

## \[PATCH 1/5\] input: mouse: synaptics: Replace NOOP with suitable commentary

- From: Lee Jones \<hidden\>
- Date: 2021-01-14 15:24:33 
- Message: https://ratatoskr.run/linux-input/2021/01/6234792.md

```text
Fixes the following W=1 kernel build warning(s):

 drivers/input/mouse/synaptics.c: In function ‘synaptics_process_packet’:
 drivers/input/mouse/synaptics.c:1110:6: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Henrik Rydberg <rydberg@bitmath.org>
Cc: Peter Osterlund <redacted>
Cc: Stefan Gmeiner <redacted>
Cc: "C. Scott Ananian" <redacted>
Cc: Bruce Kalk <redacted>
Cc: this to <redacted>
Cc: <redacted>
Signed-off-by: Lee Jones <redacted>
---
 drivers/input/mouse/synaptics.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 8fb7b4385ded9..3cc8b76629fa2 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -1106,8 +1106,11 @@ static void synaptics_process_packet(struct psmouse *psmouse)
 					num_fingers = hw.w + 2;
 				break;
 			case 2:
-				if (SYN_MODEL_PEN(info->model_id))
-					;   /* Nothing, treat a pen as a single finger */
+				/*
+				 * Keep defaults
+				 *
+				 * SYN_MODEL_PEN: Treat pens as a single finger
+				 */
 				break;
 			case 4 ... 15:
 				if (SYN_CAP_PALMDETECT(info->capabilities))
-- 
2.25.1

```

## \[PATCH 4/5\] input: touchscreen: surface3\_spi: Remove set but unused variable 'timestamp'

- From: Lee Jones \<hidden\>
- Date: 2021-01-14 15:25:14 
- Message: https://ratatoskr.run/linux-input/2021/01/6234793.md

```text
Fixes the following W=1 kernel build warning(s):

 drivers/input/touchscreen/surface3_spi.c: In function ‘surface3_spi_process_touch’:
 drivers/input/touchscreen/surface3_spi.c:97:6: warning: variable ‘timestamp’ set but not used [-Wunused-but-set-variable]

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Henrik Rydberg <rydberg@bitmath.org>
Cc: Benjamin Tissoires <redacted>
Cc: <redacted>
Signed-off-by: Lee Jones <redacted>
---
 drivers/input/touchscreen/surface3_spi.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/input/touchscreen/surface3_spi.c b/drivers/input/touchscreen/surface3_spi.c
index 731454599fcee..1da23e5585a0d 100644
--- a/drivers/input/touchscreen/surface3_spi.c
+++ b/drivers/input/touchscreen/surface3_spi.c
@@ -94,9 +94,7 @@ static void surface3_spi_report_touch(struct surface3_ts_data *ts_data,
 
 static void surface3_spi_process_touch(struct surface3_ts_data *ts_data, u8 *data)
 {
-	u16 timestamp;
 	unsigned int i;
-	timestamp = get_unaligned_le16(&data[15]);
 
 	for (i = 0; i < 13; i++) {
 		struct surface3_ts_data_finger *finger;
-- 
2.25.1

```

## \[PATCH 3/5\] input: touchscreen: usbtouchscreen: Actually check return value of usb\_submit\_urb()

- From: Lee Jones \<hidden\>
- Date: 2021-01-14 15:25:14 
- Message: https://ratatoskr.run/linux-input/2021/01/6234794.md

```text
Fixes the following W=1 kernel build warning(s):

 drivers/input/touchscreen/usbtouchscreen.c: In function ‘nexio_read_data’:
 drivers/input/touchscreen/usbtouchscreen.c:1052:50: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Henrik Rydberg <rydberg@bitmath.org>
Cc: James Hilliard <james.hilliard1@gmail.com>
Cc: Daniel Ritz <redacted>
Cc: <redacted>
Signed-off-by: Lee Jones <redacted>
---
 drivers/input/touchscreen/usbtouchscreen.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 397cb1d3f481b..44a5454d04533 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -1044,6 +1044,7 @@ static void nexio_exit(struct usbtouch_usb *usbtouch)
 
 static int nexio_read_data(struct usbtouch_usb *usbtouch, unsigned char *pkt)
 {
+	struct device *dev = &usbtouch->interface->dev;
 	struct nexio_touch_packet *packet = (void *) pkt;
 	struct nexio_priv *priv = usbtouch->priv;
 	unsigned int data_len = be16_to_cpu(packet->data_len);
@@ -1062,6 +1063,8 @@ static int nexio_read_data(struct usbtouch_usb *usbtouch, unsigned char *pkt)
 
 	/* send ACK */
 	ret = usb_submit_urb(priv->ack, GFP_ATOMIC);
+	if (ret)
+		dev_warn(dev, "Failed to submit USB Request Block\n");
 
 	if (!usbtouch->type->max_xc) {
 		usbtouch->type->max_xc = 2 * x_len;
-- 
2.25.1

```

## \[PATCH 5/5\] input: touchscreen: stmpe-ts: Add description for 'prop' struct member

- From: Lee Jones \<hidden\>
- Date: 2021-01-14 15:25:14 
- Message: https://ratatoskr.run/linux-input/2021/01/6234795.md

```text
Fixes the following W=1 kernel build warning(s):

 drivers/input/touchscreen/stmpe-ts.c:82: warning: Function parameter or member 'prop' not described in 'stmpe_touch'

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <redacted>
Cc: Stefan Riedmueller <redacted>
Cc: Luotao Fu <redacted>
Cc: <redacted>
Cc: <redacted>
Cc: <redacted>
Signed-off-by: Lee Jones <redacted>
---
 drivers/input/touchscreen/stmpe-ts.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c
index cd747725589b1..25c45c3a35615 100644
--- a/drivers/input/touchscreen/stmpe-ts.c
+++ b/drivers/input/touchscreen/stmpe-ts.c
@@ -52,6 +52,7 @@
  * @idev: registered input device
  * @work: a work item used to scan the device
  * @dev: a pointer back to the MFD cell struct device*
+ * @prop: Touchscreen properties
  * @ave_ctrl: Sample average control
  * (0 -> 1 sample, 1 -> 2 samples, 2 -> 4 samples, 3 -> 8 samples)
  * @touch_det_delay: Touch detect interrupt delay
-- 
2.25.1

```

## Re: \[PATCH 4/5\] input: touchscreen: surface3\_spi: Remove set but unused variable 'timestamp'

- From: Benjamin Tissoires \<hidden\>
- Date: 2021-01-14 16:05:47 
- Message: https://ratatoskr.run/linux-input/2021/01/6234852.md

```text
On Thu, Jan 14, 2021 at 4:23 PM Lee Jones [ref] wrote:
>
> Fixes the following W=1 kernel build warning(s):
>
>  drivers/input/touchscreen/surface3_spi.c: In function ‘surface3_spi_process_touch’:
>  drivers/input/touchscreen/surface3_spi.c:97:6: warning: variable ‘timestamp’ set but not used [-Wunused-but-set-variable]
>
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Henrik Rydberg <rydberg@bitmath.org>
> Cc: Benjamin Tissoires <redacted>
> Cc: <redacted>
> Signed-off-by: Lee Jones <redacted>

Reviewed-by: Benjamin Tissoires <redacted>

Thanks for the cleanup :)

Cheers,
Benjamin

> ---
>  drivers/input/touchscreen/surface3_spi.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/input/touchscreen/surface3_spi.c b/drivers/input/touchscreen/surface3_spi.c
> index 731454599fcee..1da23e5585a0d 100644
> --- a/drivers/input/touchscreen/surface3_spi.c
> +++ b/drivers/input/touchscreen/surface3_spi.c
> @@ -94,9 +94,7 @@ static void surface3_spi_report_touch(struct surface3_ts_data *ts_data,
>
>  static void surface3_spi_process_touch(struct surface3_ts_data *ts_data, u8 *data)
>  {
> -       u16 timestamp;
>         unsigned int i;
> -       timestamp = get_unaligned_le16(&data[15]);
>
>         for (i = 0; i < 13; i++) {
>                 struct surface3_ts_data_finger *finger;
> --
> 2.25.1
>
```

## Re: \[PATCH 2/5\] input: touchscreen: melfas\_mip4: Mark a bunch of variables as \_\_always\_unused

- From: Dmitry Torokhov \<dmitry.torokhov@gmail.com\>
- Date: 2021-01-20 02:19:57 
- Message: https://ratatoskr.run/linux-input/2021/01/6240618.md

```text
On Thu, Jan 14, 2021 at 03:23:20PM +0000, Lee Jones wrote:
> Dmitry requested to keep these around for the purposes of documentation.
> 
> 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 <redacted>
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Henrik Rydberg <rydberg@bitmath.org>
> Cc: <redacted>
> Signed-off-by: Lee Jones <redacted>

Applied, thank you.

-- 
Dmitry
```

## Re: \[PATCH 3/5\] input: touchscreen: usbtouchscreen: Actually check return value of usb\_submit\_urb()

- From: Dmitry Torokhov \<dmitry.torokhov@gmail.com\>
- Date: 2021-01-20 02:23:08 
- Message: https://ratatoskr.run/linux-input/2021/01/6240623.md

```text
On Thu, Jan 14, 2021 at 03:23:21PM +0000, Lee Jones wrote:
> Fixes the following W=1 kernel build warning(s):
> 
>  drivers/input/touchscreen/usbtouchscreen.c: In function ‘nexio_read_data’:
>  drivers/input/touchscreen/usbtouchscreen.c:1052:50: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
> 
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Henrik Rydberg <rydberg@bitmath.org>
> Cc: James Hilliard <james.hilliard1@gmail.com>
> Cc: Daniel Ritz <redacted>
> Cc: <redacted>
> Signed-off-by: Lee Jones <redacted>

Applied, thank you.

-- 
Dmitry
```

## Re: \[PATCH 4/5\] input: touchscreen: surface3\_spi: Remove set but unused variable 'timestamp'

- From: Dmitry Torokhov \<dmitry.torokhov@gmail.com\>
- Date: 2021-01-20 02:24:20 
- Message: https://ratatoskr.run/linux-input/2021/01/6240624.md

```text
On Thu, Jan 14, 2021 at 03:23:22PM +0000, Lee Jones wrote:
> Fixes the following W=1 kernel build warning(s):
> 
>  drivers/input/touchscreen/surface3_spi.c: In function ‘surface3_spi_process_touch’:
>  drivers/input/touchscreen/surface3_spi.c:97:6: warning: variable ‘timestamp’ set but not used [-Wunused-but-set-variable]
> 
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Henrik Rydberg <rydberg@bitmath.org>
> Cc: Benjamin Tissoires <redacted>
> Cc: <redacted>
> Signed-off-by: Lee Jones <redacted>

Applied, thank you.

-- 
Dmitry
```

## Re: \[PATCH 5/5\] input: touchscreen: stmpe-ts: Add description for 'prop' struct member

- From: Dmitry Torokhov \<dmitry.torokhov@gmail.com\>
- Date: 2021-01-20 02:25:01 
- Message: https://ratatoskr.run/linux-input/2021/01/6240625.md

```text
On Thu, Jan 14, 2021 at 03:23:23PM +0000, Lee Jones wrote:
> Fixes the following W=1 kernel build warning(s):
> 
>  drivers/input/touchscreen/stmpe-ts.c:82: warning: Function parameter or member 'prop' not described in 'stmpe_touch'
> 
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> Cc: Alexandre Torgue <redacted>
> Cc: Stefan Riedmueller <redacted>
> Cc: Luotao Fu <redacted>
> Cc: <redacted>
> Cc: <redacted>
> Cc: <redacted>
> Signed-off-by: Lee Jones <redacted>

Applied, thank you.

-- 
Dmitry
```
