Re: [PATCH v5 2/2] Input: add support for the Samsung S6SY761 touchscreen

From: Dmitry Torokhov
Date: Fri Nov 03 2017 - 19:57:53 EST


Hi Andi,

On Thu, Nov 02, 2017 at 03:07:26PM +0900, Andi Shyti wrote:
> +
> + err = s6sy761_hw_init(sdata);
> + if (err)
> + return err;
> +
> + sdata->input = devm_input_allocate_device(&client->dev);
> + if (!sdata->input)
> + return -ENOMEM;
> +
> + sdata->input->name = S6SY761_DEV_NAME;
> + sdata->input->id.bustype = BUS_I2C;
> + sdata->input->open = s6sy761_input_open;
> + sdata->input->close = s6sy761_input_close;
> +
> + /* the range has been previously read in hw_init */
> + if (sdata->prop.max_x && sdata->prop.max_y) {

You do not need make this a conditional, if sdata->prop.max_x or
sdata->prop.max_y is 0 is it OK.

However, there is a slight problem: you call hw_init() on resume,
potentially updating prop.max_x and prop.max_y and taking them out of
sync if they have been overridden by the DT data and
touchscreen_parse_properties(). I think it would be best if
s6sy761_hw_init() had 2 additional arguments for max_x and max_y and you
passed them to input_set_abs_params() and left sdata->prop to be managed
solely by touchscreen_parse_properties().

Also, is everything in s6sy761_hw_init() needed at resume time?

Thanks.

--
Dmitry