Message ID | 20200303180917.12563-3-andriy.shevchenko@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v1,1/5] Input: of_touchscreen - explicitly choose axis | expand |
On Tue, Mar 03, 2020 at 08:09:15PM +0200, Andy Shevchenko wrote: > Explicitly show what the value we supply for the touchscreen resolution > when it can't be detected. -1 is hard to compare with when unsigned short > type is in use. The change will help to avoid signed vs. unsigned error > prone comparisons. > So, this left without comment, does it mean you are going to apply it? > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > drivers/input/touchscreen/edt-ft5x06.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c > index cb67104c6934..a05c6b597d43 100644 > --- a/drivers/input/touchscreen/edt-ft5x06.c > +++ b/drivers/input/touchscreen/edt-ft5x06.c > @@ -23,6 +23,7 @@ > #include <linux/input/touchscreen.h> > #include <linux/irq.h> > #include <linux/kernel.h> > +#include <linux/limits.h> > #include <linux/module.h> > #include <linux/ratelimit.h> > #include <linux/regulator/consumer.h> > @@ -983,8 +984,8 @@ edt_ft5x06_ts_get_parameters(struct edt_ft5x06_ts_data *tsdata) > tsdata->num_y = edt_ft5x06_register_read(tsdata, > reg_addr->reg_num_y); > } else { > - tsdata->num_x = -1; > - tsdata->num_y = -1; > + tsdata->num_x = U16_MAX; > + tsdata->num_y = U16_MAX; > } > } > > -- > 2.25.1 >
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index cb67104c6934..a05c6b597d43 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -23,6 +23,7 @@ #include <linux/input/touchscreen.h> #include <linux/irq.h> #include <linux/kernel.h> +#include <linux/limits.h> #include <linux/module.h> #include <linux/ratelimit.h> #include <linux/regulator/consumer.h> @@ -983,8 +984,8 @@ edt_ft5x06_ts_get_parameters(struct edt_ft5x06_ts_data *tsdata) tsdata->num_y = edt_ft5x06_register_read(tsdata, reg_addr->reg_num_y); } else { - tsdata->num_x = -1; - tsdata->num_y = -1; + tsdata->num_x = U16_MAX; + tsdata->num_y = U16_MAX; } }
Explicitly show what the value we supply for the touchscreen resolution when it can't be detected. -1 is hard to compare with when unsigned short type is in use. The change will help to avoid signed vs. unsigned error prone comparisons. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/input/touchscreen/edt-ft5x06.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)