public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: petr.hodina@protonmail.com
Cc: "Song Qiang" <songqiang1304521@gmail.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"David Heidelberg" <david@ixit.cz>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] iio: proximity: vl53l0x-i2c: Use raw I2C access and read full device ID
Date: Mon, 19 Jan 2026 20:44:31 +0200	[thread overview]
Message-ID: <aW57j-zfhKGp1VTm@smile.fi.intel.com> (raw)
In-Reply-To: <20260119-vl53l0x-v1-4-cf71715a1353@protonmail.com>

On Mon, Jan 19, 2026 at 06:19:58PM +0100, Petr Hodina via B4 Relay wrote:

> Replace SMBus byte reads with raw I2C transfers when reading the device
> identification registers.
> 
> The VL53L0X exposes its model and revision as 16-bit registers, which are
> more accurately accessed using standard I2C send/receive operations.
> This also avoids depending on SMBus byte data support, which is not
> guaranteed on all I2C adapters.
> 
> Read and log both model and revision IDs, and validate the model ID
> during probe to ensure the expected device is present.

...

>  };
>  
> +

Stray blank line addition.

> +static int vl53l0x_read_word(struct i2c_client *client, u8 reg, u16 *val)
> +{
> +	int ret;
> +	u8 buf[2];

Here and everywhere else, please, keep the reversed xmas tree ordering.

> +	ret = i2c_master_send(client, &reg, 1);
> +	if (ret < 0)
> +		return ret;
> +	if (ret != 1)
> +		return -EIO;
> +
> +	ret = i2c_master_recv(client, buf, 2);

sizeof(buf)

> +	if (ret < 0)
> +		return ret;
> +	if (ret != 2)

Ditto.

> +		return -EIO;
> +
> +	*val = (buf[0] << 8) | buf[1];

Actually define

	__be16 buf;

and use

	*val = be16_to_cpu(buf);

> +	return 0;
> +}

...

>  static int vl53l0x_probe(struct i2c_client *client)
>  {
>  	struct vl53l0x_data *data;
>  	struct iio_dev *indio_dev;
>  	int ret;
> +	u16 model, rev;
>  

Use reversed xmas tree ordering.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-01-19 18:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-19 17:19 [PATCH 0/4] iio: proximity: vl53l0x: power sequencing, optional VDDIO, raw I2C ID read Petr Hodina via B4 Relay
2026-01-19 17:19 ` [PATCH 1/4] iio: proximity: vl53l0x-i2c: Add optional vddio regulator Petr Hodina via B4 Relay
2026-01-20 10:35   ` Krzysztof Kozlowski
2026-01-20 10:41   ` Krzysztof Kozlowski
2026-01-19 17:19 ` [PATCH 2/4] iio: proximity: vl53l0x-i2c: Add optional vddio supply Petr Hodina via B4 Relay
2026-01-23  9:13   ` Jonathan Cameron
2026-01-19 17:19 ` [PATCH 3/4] iio: proximity: vl53l0x-i2c: Fix reset sequence Petr Hodina via B4 Relay
2026-01-19 18:22   ` Andy Shevchenko
2026-01-20 10:33   ` Krzysztof Kozlowski
2026-01-19 17:19 ` [PATCH 4/4] iio: proximity: vl53l0x-i2c: Use raw I2C access and read full device ID Petr Hodina via B4 Relay
2026-01-19 18:44   ` Andy Shevchenko [this message]
2026-01-20 10:42   ` Krzysztof Kozlowski
2026-01-23  9:25   ` Jonathan Cameron

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=aW57j-zfhKGp1VTm@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=david@ixit.cz \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=petr.hodina@protonmail.com \
    --cc=robh@kernel.org \
    --cc=songqiang1304521@gmail.com \
    /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