Skip to contentSkip to conversation

Input: tsc2007 - drop unnecessary cast in tsc2007_calculate_resistance()

PATCH In review Dmitry Torokhov 2 participants 6 messages Nov 14

Subsystems (2)
lore
Share & tools
lore

Dmitry Torokhov

author maintainer
#0 lore raw

PATCH 1/3 Input: tsc2007 - drop unnecessary cast in tsc2007_calculate_resistance()

The resistance value is already bounds-checked against U32_MAX before returning from a function returning u32, so the explicit cast is unnecessary. Drop it.

---
 drivers/input/touchscreen/tsc2007_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/touchscreen/tsc2007_core.c +1 -1
index 7660504f58ff..fc707e672424 100644
@@ -82,7 +82,7 @@ u32 tsc2007_calculate_resistance(struct tsc2007 *tsc, struct ts_event *tc)
 
 	if (rt > U32_MAX)
 		return U32_MAX;
-	return (u32)rt;
+	return rt;
 }
 
 bool tsc2007_is_pen_down(struct tsc2007 *ts)
Signature · 1 line
2.56.0.679.gc527c65306-goog
author maintainer
#1 lore raw

PATCH 2/3 Input: tsc2007 - use scnprintf() when formatting phys string

Use scnprintf() instead of snprintf() when constructing the physical device path string to follow kernel string formatting conventions.

---
 drivers/input/touchscreen/tsc2007_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/touchscreen/tsc2007_core.c +1 -1
index fc707e672424..d55034914808 100644
@@ -252,7 +252,7 @@ static int tsc2007_input_configure(struct tsc2007 *ts)
 
 	ts->input = input_dev;
 
-	snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(dev));
+	scnprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(dev));
 
 	input_dev->name = "TSC2007 Touchscreen";
 	input_dev->phys = ts->phys;
Signature · 1 line
2.56.0.679.gc527c65306-goog
Reviewed-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] Input: tsc2007 - use scnprintf() when formatting phys string

Quoted 3 lines · Dmitry Torokhov

Use scnprintf() instead of snprintf() when constructing the physical device path string to follow kernel string formatting conventions.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#3 lore raw

PATCH 3/3 Input: tsc2007 - drop redundant error message on IRQ request failure

In reply to Dmitry Torokhov

devm_request_threaded_irq() already logs an error message when requesting the interrupt fails, so the additional dev_err() call in tsc2007_input_configure() is redundant. Remove it.

---
 drivers/input/touchscreen/tsc2007_core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/input/touchscreen/tsc2007_core.c +1 -3
index d55034914808..3597f71f6c33 100644
@@ -276,10 +276,8 @@ static int tsc2007_input_configure(struct tsc2007 *ts)
 					NULL, tsc2007_soft_irq,
 					IRQF_ONESHOT | IRQF_NO_AUTOEN,
 					dev->driver->name, ts);
-	if (err) {
-		dev_err(dev, "Failed to request irq %d: %d\n", ts->irq, err);
+	if (err)
 		return err;
-	}
 
 	err = input_register_device(input_dev);
 	if (err) {
Signature · 1 line
2.56.0.679.gc527c65306-goog
Reviewed-by on v1 3/3
#4 lore raw

Re: [PATCH 3/3] Input: tsc2007 - drop redundant error message on IRQ request failure

Quoted 4 lines · Dmitry Torokhov

devm_request_threaded_irq() already logs an error message when requesting the interrupt fails, so the additional dev_err() call in tsc2007_input_configure() is redundant. Remove it.

Signature · 2 lines
With Best Regards,
Andy Shevchenko