LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@iki.fi>
To: Pavel Machek <pavel@ucw.cz>
Cc: Martin Kepplinger <martin.kepplinger@puri.sm>,
	devicetree@vger.kernel.org, kernel@puri.sm,
	krzysztof.kozlowski@canonical.com,
	laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org,
	linux-media@vger.kernel.org, mchehab@kernel.org,
	paul.kocialkowski@bootlin.com, phone-devel@vger.kernel.org,
	robh@kernel.org, shawnx.tu@intel.com
Subject: Re: [PATCH v8 3/4] media: i2c: add driver for the SK Hynix Hi-846 8M pixel camera
Date: Mon, 6 Sep 2021 10:53:41 +0300	[thread overview]
Message-ID: <YTXJBYb2EzR9iIzx@valkosipuli.retiisi.eu> (raw)
In-Reply-To: <20210903161742.GD2209@bug>

Hi Pavel, Martin,

On Fri, Sep 03, 2021 at 06:17:43PM +0200, Pavel Machek wrote:
> > +static void hi846_write_reg_16(struct hi846 *hi846, u16 reg, u16 val, int *err)
> > +{
> > +	struct i2c_client *client = v4l2_get_subdevdata(&hi846->sd);
> > +	u8 buf[6];
> > +	int ret;
> > +
> > +	if (*err < 0)
> > +		return;
> > +
> > +	put_unaligned_be16(reg, buf);
> > +	put_unaligned_be32(val << 8 * 2, buf + 2);
> 
> Is that obfuscated way of saying put_unaligned_be16(val, buf+2); buf[3] = 0; buf[4] = 0; ?

Good catch.

The buf should be only four u8's long, and you should use 16-bit variant
here, too.

Also the transfer should be done on sizeof(buf), not 4 (which indeed is the
same, but cleaner).

-- 
Regards,

Sakari Ailus

  parent reply	other threads:[~2021-09-06  7:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-31 13:43 [PATCH v8 0/4] Add support for the Hynix Hi-846 camera Martin Kepplinger
2021-08-31 13:43 ` [PATCH v8 1/4] dt-bindings: vendor-prefixes: Add SK Hynix Inc Martin Kepplinger
2021-08-31 13:43 ` [PATCH v8 2/4] dt-bindings: media: document SK Hynix Hi-846 MIPI CSI-2 8M pixel sensor Martin Kepplinger
2021-08-31 13:43 ` [PATCH v8 3/4] media: i2c: add driver for the SK Hynix Hi-846 8M pixel camera Martin Kepplinger
2021-09-03 16:17   ` Pavel Machek
2021-09-06  7:49     ` Martin Kepplinger
2021-09-06  7:53     ` Sakari Ailus [this message]
2021-08-31 13:43 ` [PATCH v8 4/4] Documentation: i2c-cardlist: add the Hynix hi846 sensor Martin Kepplinger

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=YTXJBYb2EzR9iIzx@valkosipuli.retiisi.eu \
    --to=sakari.ailus@iki.fi \
    --cc=devicetree@vger.kernel.org \
    --cc=kernel@puri.sm \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=martin.kepplinger@puri.sm \
    --cc=mchehab@kernel.org \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=pavel@ucw.cz \
    --cc=phone-devel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=shawnx.tu@intel.com \
    --subject='Re: [PATCH v8 3/4] media: i2c: add driver for the SK Hynix Hi-846 8M pixel camera' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).