The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Erikas Bitovtas <xerikasxx@gmail.com>
To: jic23@kernel.org
Cc: andy@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org,
	dlechner@baylibre.com, krzk+dt@kernel.org,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	nuno.sa@analog.com, phone-devel@vger.kernel.org,
	pmeerw@pmeerw.net, robh@kernel.org, xerikasxx@gmail.com,
	~postmarketos/upstreaming@lists.sr.ht
Subject: Re: [PATCH v4 2/2] iio: light: vcnl4000: add support for Capella CM36686 and CM36672P
Date: Sun, 15 Feb 2026 19:28:56 +0200	[thread overview]
Message-ID: <20260215172856.34702-1-xerikasxx@gmail.com> (raw)
In-Reply-To: <20260214180919.72389701@jic23-huawei>

On 2/14/26 8:09 PM, Jonathan Cameron wrote:
>> ---
>>  drivers/iio/light/vcnl4000.c | 40 ++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 40 insertions(+)
>>
>> diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
>> index a36c23813679..1f8f4e4586f4 100644
>> --- a/drivers/iio/light/vcnl4000.c
>> +++ b/drivers/iio/light/vcnl4000.c
>> @@ -185,6 +185,7 @@ static const int vcnl4040_ps_oversampling_ratio[] = {1, 2, 4, 8};
>>  #define VCNL4000_SLEEP_DELAY_MS	2000 /* before we enter pm_runtime_suspend */
>>  
>>  enum vcnl4000_device_ids {
>> +	CM36672P,
>>  	VCNL4000,
>>  	VCNL4010,
>>  	VCNL4040,
>> @@ -235,6 +236,8 @@ struct vcnl4000_chip_spec {
>>  };
>>  
>>  static const struct i2c_device_id vcnl4000_id[] = {
>> +	{ "cm36672p", CM36672P },
>> +	{ "cm36686", VCNL4040 },
>>  	{ "vcnl4000", VCNL4000 },
>>  	{ "vcnl4010", VCNL4010 },
>>  	{ "vcnl4020", VCNL4010 },
>> @@ -1842,6 +1845,22 @@ static const struct iio_chan_spec vcnl4040_channels[] = {
>>  	}
>>  };
> 
> ...
> 
>>  	[VCNL4000] = {
>>  		.prod = "VCNL4000",
>>  		.init = vcnl4000_init,
>> @@ -2033,6 +2065,14 @@ static int vcnl4000_probe(struct i2c_client *client)
>>  }
>>  
>>  static const struct of_device_id vcnl_4000_of_match[] = {
>> +	{
>> +		.compatible = "capella,cm36672p",
>> +		.data = (void *)CM36672P,
>> +	},
>> +	{
>> +		.compatible = "capella,cm36686",
>> +		.data = (void *)VCNL4040,
> 
> Is this necessary? I 'think' if you drop it we'll match instead
> on the vcnl4040 fallback and then the access to the data will be
> through the stripped name only bit of the compatible (first entry, not
> the fallback so cm36686 in this case). So you do need the cm36686
> entry in the i2c_device_id table above. Probably better to keep
> this here to avoid having to reason this out - but perhaps a
> comment to that affect would be useful (assuming you verify my
> reasoning).
>
After I removed the entry for "capella,cm36686", I received the "Unable
to handle kernel NULL pointer dereference" error in dmesg. And at least
stk3310 driver includes a compatible entry both for the device (stk3013)
and for the fallback (stk3310). So my assumption is that this entry is
needed.
I could include a comment explaining that cm36686 is fully compatible
with vcnl4040, however, if that is necessary.
> As Andy suggested moving away from enum values an towards
> direct pointers to the chip_info structures + drop the
> i2c_client_get_device_id() in favour of i2c_get_match_data() which
> uses the right firmware entry to get the data in all cases is the
> right long term solution and avoids an association being necessary
> between the two tables.
> 
> Jonathan
> 
> 
> 
> 
>> +	},
>>  	{
>>  		.compatible = "vishay,vcnl4000",
>>  		.data = (void *)VCNL4000,
>>
> 

  reply	other threads:[~2026-02-15 17:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-12 14:42 [PATCH v4 0/2] iio: light: Add support for Capella cm36686 and cm36672p sensors Erikas Bitovtas
2026-02-12 14:42 ` [PATCH v4 1/2] dt-bindings: iio: light: vcnl4000: add Capella CM36686 and CM36672P Erikas Bitovtas
2026-02-13  7:54   ` Krzysztof Kozlowski
2026-02-13  8:29     ` Erikas Bitovtas
2026-02-13  8:51       ` Krzysztof Kozlowski
2026-02-13  8:56         ` Erikas Bitovtas
2026-02-14 16:44           ` David Lechner
2026-02-15 16:16             ` Erikas Bitovtas
2026-02-15 19:35               ` Jonathan Cameron
2026-02-16  7:27               ` Krzysztof Kozlowski
2026-02-16  8:49                 ` Erikas Bitovtas
2026-02-16  9:03                   ` Krzysztof Kozlowski
2026-02-15 17:49             ` Jonathan Cameron
2026-02-15 18:00               ` Erikas Bitovtas
2026-02-15 19:38                 ` Jonathan Cameron
2026-02-12 14:42 ` [PATCH v4 2/2] iio: light: vcnl4000: add support for " Erikas Bitovtas
2026-02-12 16:20   ` Andy Shevchenko
2026-02-14 18:09   ` Jonathan Cameron
2026-02-15 17:28     ` Erikas Bitovtas [this message]
2026-02-15 19:31       ` Jonathan Cameron
2026-02-15 20:06         ` Erikas Bitovtas
2026-02-15 21:55           ` Jonathan Cameron
2026-02-16  8:21             ` Erikas Bitovtas
2026-02-18 19:32               ` 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=20260215172856.34702-1-xerikasxx@gmail.com \
    --to=xerikasxx@gmail.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=phone-devel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=robh@kernel.org \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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