Re: [PATCH v3 1/3] Input: ili210x - use resolution from ili251x firmware

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Marek,

On Tue, Aug 31, 2021 at 10:25:04PM +0200, Marek Vasut wrote:
> +static int ili251x_firmware_update_resolution(struct device *dev)
> +{
> +	struct i2c_client *client = to_i2c_client(dev);
> +	struct ili210x *priv = i2c_get_clientdata(client);
> +	__le16 resx, resy;

These are normal variables, so I changed it to u16, otherwise sparse is
rightfully unhappy.

> +	u8 rs[10];
> +	int error;
> +
> +	/* The firmware update blob might have changed the resolution. */
> +	error = priv->chip->read_reg(client, REG_PANEL_INFO, &rs, sizeof(rs));
> +	if (error)
> +		return error;
> +
> +	resx = le16_to_cpup((__le16 *)rs);
> +	resy = le16_to_cpup((__le16 *)(rs + 2));
> +
> +	/* The value reported by the firmware is invalid. */
> +	if (!resx || resx == 0xffff || !resy || resy == 0xffff)
> +		return -EINVAL;
> +
> +	input_abs_set_max(priv->input, ABS_X, resx - 1);
> +	input_abs_set_max(priv->input, ABS_Y, resy - 1);
> +	input_abs_set_max(priv->input, ABS_MT_POSITION_X, resx - 1);
> +	input_abs_set_max(priv->input, ABS_MT_POSITION_Y, resy - 1);
> +
> +	return 0;
> +}
> +
> +static int ili251x_firmware_update_cached_state(struct device *dev)
> +{
> +	struct i2c_client *client = to_i2c_client(dev);
> +	struct ili210x *priv = i2c_get_clientdata(client);
> +	int ret;

Changed this to "error" and applied, thank you.

-- 
Dmitry



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux