All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christ van Willegen <cvwillegen@gmail.com>
To: Discussions about the Letux Kernel <letux-kernel@openphoenux.org>
Cc: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Benoît Cousson" <bcousson@baylibre.com>,
	"Tony Lindgren" <tony@atomide.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Michael Welling" <mwelling@ieee.org>,
	"Mika Penttilä" <mika.penttila@nextfour.com>,
	"Javier Martinez Canillas" <javier@osg.samsung.com>,
	"Igor Grinberg" <grinberg@compulab.co.il>,
	"Sebastian Reichel" <sre@kernel.org>,
	"Andrew F. Davis" <afd@ti.com>,
	devicetree@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-input@vger.kernel.org
Subject: Re: [Letux-kernel] [PATCH v3 1/8] drivers:input:tsc2007: add new common binding names, pre-calibration, flipping and rotation
Date: Fri, 30 Sep 2016 18:23:14 +0200	[thread overview]
Message-ID: <CA+Ot1Owa_evu62LJpH+TdUkLWd0n+0Dm30Q1-5KFJ6w_UBPfQQ@mail.gmail.com> (raw)
In-Reply-To: <1409ed9845f17445a8a67bd6fb16c902c3e4f69c.1474634475.git.hns@goldelico.com>

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 <hns@goldelico.com> wrote:

> 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

WARNING: multiple messages have this Message-ID (diff)
From: Christ van Willegen <cvwillegen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Discussions about the Letux Kernel
	<letux-kernel-S0jZdbWzriLCfDggNXIi3w@public.gmane.org>
Cc: "Dmitry Torokhov"
	<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"Rob Herring" <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"Mark Rutland" <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	"Benoît Cousson"
	<bcousson-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>,
	"Tony Lindgren" <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>,
	"Russell King" <linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org>,
	"Arnd Bergmann" <arnd-r2nGTMty4D4@public.gmane.org>,
	"Michael Welling" <mwelling-EkmVulN54Sk@public.gmane.org>,
	"Mika Penttilä"
	<mika.penttila-MRsr7dthA9VWk0Htik3J/w@public.gmane.org>,
	"Javier Martinez Canillas"
	<javier-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>,
	"Igor Grinberg"
	<grinberg-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>,
	"Sebastian Reichel" <sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"Andrew F. Davis" <afd-l0cyMroinI0@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [Letux-kernel] [PATCH v3 1/8] drivers:input:tsc2007: add new common binding names, pre-calibration, flipping and rotation
Date: Fri, 30 Sep 2016 18:23:14 +0200	[thread overview]
Message-ID: <CA+Ot1Owa_evu62LJpH+TdUkLWd0n+0Dm30Q1-5KFJ6w_UBPfQQ@mail.gmail.com> (raw)
In-Reply-To: <1409ed9845f17445a8a67bd6fb16c902c3e4f69c.1474634475.git.hns-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org>

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 <hns-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org> wrote:

> 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

  parent reply	other threads:[~2016-09-30 16:23 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-23 12:41 [PATCH v3 0/8] drivers: touchscreen: tsc2007 and ads7846/tsc2046 improvements (use common touchscreen bindings, pre-calibration, spi fix and provide iio raw values) H. Nikolaus Schaller
2016-09-23 12:41 ` [PATCH v3 1/8] drivers:input:tsc2007: add new common binding names, pre-calibration, flipping and rotation H. Nikolaus Schaller
2016-09-23 22:47   ` Rob Herring
2016-09-23 22:47     ` Rob Herring
2016-09-24  0:31     ` Sebastian Reichel
2016-09-24  5:55       ` H. Nikolaus Schaller
2016-09-30 14:16         ` Sebastian Reichel
2016-09-30 14:16           ` Sebastian Reichel
2016-09-30 14:40           ` H. Nikolaus Schaller
2016-09-30 14:40             ` H. Nikolaus Schaller
2016-10-17 13:57             ` H. Nikolaus Schaller
2016-10-17 13:57               ` H. Nikolaus Schaller
2016-09-24  5:28     ` H. Nikolaus Schaller
2016-09-24  5:28       ` H. Nikolaus Schaller
2016-09-24  5:28       ` H. Nikolaus Schaller
2016-09-30 16:23   ` Christ van Willegen [this message]
2016-09-30 16:23     ` [Letux-kernel] " Christ van Willegen
2016-09-30 16:36     ` H. Nikolaus Schaller
2016-09-30 16:36       ` H. Nikolaus Schaller
2016-09-30 16:36       ` H. Nikolaus Schaller
2016-09-23 12:41 ` [PATCH v3 2/8] drivers:input:tsc2007: send pendown and penup only once like ads7846(+tsc2046) driver does H. Nikolaus Schaller
2016-09-23 12:41 ` [PATCH v3 3/8] drivers:input:tsc2007: add iio interface to read external ADC input, temperature and raw conversion values H. Nikolaus Schaller
2016-09-23 12:41   ` H. Nikolaus Schaller
2016-09-24 16:07   ` Jonathan Cameron
2016-09-24 16:07     ` Jonathan Cameron
2016-09-24 17:07     ` H. Nikolaus Schaller
2016-09-24 17:07       ` H. Nikolaus Schaller
2016-09-24 17:26       ` Jonathan Cameron
2016-09-24 17:26         ` Jonathan Cameron
2016-09-24 17:42         ` H. Nikolaus Schaller
2016-09-24 17:42           ` H. Nikolaus Schaller
2016-09-24 17:44       ` Dmitry Torokhov
2016-09-24 17:44         ` Dmitry Torokhov
2016-09-24 17:51         ` H. Nikolaus Schaller
2016-09-24 17:51           ` H. Nikolaus Schaller
2016-09-23 12:41 ` [PATCH v3 4/8] drivers:input:tsc2007: check for presence and power down tsc2007 during probe H. Nikolaus Schaller
2016-09-23 12:41 ` [PATCH v3 5/8] DT:omap3+tsc2007: use new common touchscreen bindings H. Nikolaus Schaller
2016-09-23 12:41   ` H. Nikolaus Schaller
2016-09-23 12:41 ` [PATCH v3 6/8] drivers:input:ads7846(+tsc2046): add new common binding names, pre-calibration and flipping H. Nikolaus Schaller
2016-09-23 22:50   ` Rob Herring
2016-09-23 12:41 ` [PATCH v3 7/8] drivers:input:ads7846(+tsc2046): fix spi module table H. Nikolaus Schaller
2016-09-23 12:41 ` [PATCH v3 8/8] DT:omap3+ads7846: use new common touchscreen bindings H. Nikolaus Schaller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+Ot1Owa_evu62LJpH+TdUkLWd0n+0Dm30Q1-5KFJ6w_UBPfQQ@mail.gmail.com \
    --to=cvwillegen@gmail.com \
    --cc=afd@ti.com \
    --cc=arnd@arndb.de \
    --cc=bcousson@baylibre.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=grinberg@compulab.co.il \
    --cc=javier@osg.samsung.com \
    --cc=letux-kernel@openphoenux.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=mika.penttila@nextfour.com \
    --cc=mwelling@ieee.org \
    --cc=robh+dt@kernel.org \
    --cc=sre@kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.