Re: [PATCH 1/2] drm: Create mipi_dsi_dcs_read_multi()

Doug Anderson
2025-07-25T21:16:43Z

Hi,

On Thu, Jul 24, 2025 at 1:23 PM Brigham Campbell <me@brighamcampbell.com> wrote:
>
> +void mipi_dsi_dcs_read_multi(struct mipi_dsi_multi_context *ctx, u8 cmd,
> + void *data, size_t len)
> +{
> + struct mipi_dsi_device *dsi = ctx->dsi;
> + struct device *dev = &dsi->dev;
> + struct mipi_dsi_msg msg = {
> + .channel = dsi->channel,
> + .type = MIPI_DSI_DCS_READ,
> + .tx_buf = &cmd,
> + .tx_len = 1,
> + .rx_buf = data,
> + .rx_len = len
> + };
> + ssize_t ret;
> +
> + if (ctx->accum_err)
> + return;
> +
> + ret = mipi_dsi_device_transfer(dsi, &msg);
> + if (ret < 0) {
> + ctx->accum_err = ret;
> + dev_err(dev, "transferring dcs message %xh failed: %d\n", cmd,

Format code "%xh" is probably not exactly what you want. If the error
code is 0x10 it will print 10h, which is not very standard. You
probably copied it from the write routine which uses "%*ph". There the
"h" means something. See Documentation/core-api/printk-formats.rst.
Probably you want "%#x".

I'd probably also say "dcs read with cmd" rather than "transferring
dcs message".