Linux Input/HID development
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Aibing Chen <chenaibing@cmss.chinamobile.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	sashiko-bot <sashiko-bot@kernel.org>
Subject: Re: [PATCH] Input: ili210x - widen firmware address types to u32
Date: Mon, 30 Nov 2026 12:21:21 -0800	[thread overview]
Message-ID: <1ca7055b40b6f0c6e71f2d2582c4c5ad@gmail.com> (raw)
In-Reply-To: <20261129090341.1179-1-chenaibing@cmss.chinamobile.com>

Hi Aibing,

On Sun, Nov 29, 2026 at 05:03:41PM +0800, Aibing Chen wrote:
> Widen the address types to u32 so that the full 3-byte address range
> is usable and the upper byte in the write command reflects the actual
> address.  For the CRC field, write 0x00 for the upper byte directly:
> CRC-CCITT always produces a 16-bit value, so the upper byte is
> constant, which also silences the Smatch warning about shifting a
> 16-bit value by 16.
>
> Suggested-by: sashiko-bot <sashiko-bot@kernel.org>
> Signed-off-by: Aibing Chen <chenaibing@cmss.chinamobile.com>

Please address the two issues Sashiko pointed out: widen ac_end and
df_end to u32 in ili210x_firmware_update() as well (otherwise 0x10000 is
still truncated back to 0 before reaching ili210x_do_firmware_update()),
and add the Fixes tag:

  Fixes: c6ac8f0b4ca9 ("Input: ili210x - add ili251x firmware update support")

Please also keep the Reported-by and Closes tags for the kernel test
robot Smatch report from your earlier patch, and mark the respin as v2
so it is clear it supersedes the previous submission.

...
> @@ -717,7 +717,7 @@ static int ili251x_firmware_write_to_ic(struct device *dev, const u8 *fwbuf,
>  	u8 cmd_wr[10] = {
>  		REG_WRITE_ENABLE, 0x5a, 0xa5, dataflash,
>  		(end >> 16) & 0xff, (end >> 8) & 0xff, end & 0xff,
> -		(crc >> 16) & 0xff, (crc >> 8) & 0xff, crc & 0xff
> +		0x00, (crc >> 8) & 0xff, crc & 0xff
>  	};

Please use put_unaligned_be24() instead of open-coding the byte shifts:

	u8 cmd_wr[10] = { REG_WRITE_ENABLE, 0x5a, 0xa5, dataflash };

	put_unaligned_be24(end, &cmd_wr[4]);
	put_unaligned_be24(crc, &cmd_wr[7]);

Separately, as a follow-up cleanup patch, could you also update the
firmware update and cached-state helpers to take "struct ili210x *priv"
directly (starting from ili210x_firmware_update_store() and
ili210x_i2c_probe()) instead of bouncing between dev, client, and priv
and repeating to_i2c_client() / i2c_get_clientdata()? While at it,
ili210x_firmware_update() and the four ili251x_firmware_update_*()
helpers returning ssize_t can switch to int. (Keep
ili210x_hardware_reset() taking reset_gpio since probe calls it before
priv is allocated.)

Thanks.

-- 
Dmitry

      parent reply	other threads:[~2026-11-30 20:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29  9:03 [PATCH] Input: ili210x - widen firmware address types to u32 Aibing Chen
2026-11-29  9:11 ` sashiko-bot
2026-11-30 20:21 ` Dmitry Torokhov [this message]

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=1ca7055b40b6f0c6e71f2d2582c4c5ad@gmail.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=chenaibing@cmss.chinamobile.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashiko-bot@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox