Thread (25 messages) 25 messages, 6 authors, 2016-10-17

Re: [Letux-kernel] [PATCH v3 1/8] drivers:input:tsc2007: add new common binding names, pre-calibration, flipping and rotation

From: Christ van Willegen <hidden>
Date: 2016-09-30 16:23:44
Also in: linux-iio, linux-input, linux-omap, lkml

Hi,

I saw this earlier, but didn't think it important to mention, but:


On Fri, Sep 23, 2016 at 2:41 PM, H. Nikolaus Schaller [off-list ref] wrote:
quoted hunk ↗ jump to hunk
diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c
index 5d0cd51..9a11509 100644
--- a/drivers/input/touchscreen/tsc2007.c
+++ b/drivers/input/touchscreen/tsc2007.c
+                       /* scale ADC values to desired output range */
+                       sx = (ts->prop.max_x * (tc.x - ts->min_x))
+                               / (ts->max_x - ts->min_x);
+                       sy = (ts->prop.max_y * (tc.y - ts->min_y))
+                               / (ts->max_y - ts->min_y);
+                       rt = (input->absinfo[ABS_PRESSURE].maximum * rt) /
+                               ts->max_rt;
If ts->max_rt is zero, or ts->max_x == ts->min_x, or ts->max_y ==
ts->min_y, these yield a division by zero error.

Ofcourse, this is under control of the DT-maintainer(s) of the device
(if I'm not mistaking), but throwing an error on DT parse if (one of)
these condition(s) is met yields better info to the DT-maintainer than
a /0 error...

If you (or others) agree, could you add this to the patch?

Regards,

Christ van Willegen
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help