devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Marco Felsch <m.felsch@pengutronix.de>
Cc: puranjay12@gmail.com, lars@metafoo.de, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, linux-iio@vger.kernel.org,
	devicetree@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH v2 3/4] iio: temperature: tmp117: add TI TMP116 support
Date: Fri, 23 Dec 2022 17:16:47 +0000	[thread overview]
Message-ID: <20221223171647.43a6153e@jic23-huawei> (raw)
In-Reply-To: <20221223161359.wla6l5kd5gddloid@pengutronix.de>

On Fri, 23 Dec 2022 17:13:59 +0100
Marco Felsch <m.felsch@pengutronix.de> wrote:

> On 22-12-23, Jonathan Cameron wrote:
> 
> ...
> 
> > > > > @@ -118,27 +127,28 @@ static int tmp117_identify(struct i2c_client *client)
> > > > >  	int dev_id;
> > > > >  
> > > > >  	dev_id = i2c_smbus_read_word_swapped(client, TMP117_REG_DEVICE_ID);
> > > > > -	if (dev_id < 0)    
> > > > 
> > > > Keep this handling of the smbus read returning an error.
> > > > Otherwise, you end up replacing the error code with -ENODEV rather than
> > > > returning what actually happened.
> > > > 
> > > > 	if (dev_id < 0)
> > > > 		return dev_id;    
> > > 
> > > You're right, I will change this thanks.
> > >   
> > > > 	switch (dev_id) {
> > > > ...
> > > >     
> > > > > +	switch (dev_id) {
> > > > > +	case TMP116_DEVICE_ID:
> > > > > +	case TMP117_DEVICE_ID:
> > > > >  		return dev_id;
> > > > > -	if (dev_id != TMP117_DEVICE_ID) {
> > > > > -		dev_err(&client->dev, "TMP117 not found\n");
> > > > > +	default:
> > > > > +		dev_err(&client->dev, "TMP116/117 not found\n");
> > > > >  		return -ENODEV;  
> >
> > As per the other branch of this thread.  This isn't an error.
> > If we want fallback compatibles to work in their role of allowing
> > for newer devices that are actually compatible, the most we should
> > do here is warn.
> > 
> > Say a new tmp117b device is released. It's fully backwards compatible
> > with the exception of an ID - or supports only new features + backwards
> > compatibility then that would have a fallback to tmp117 and we need
> > it to work.  
> 
> This isn't part of this patchset and IMHO implementing something which
> may happen in the future is not the way we should go.

I held a similar view, but the response I got from the DT maintainers was
that a driver should not reject a DTS that says it is compatible based
on an unknown ID - because it prevents that case of an old kernel working
absolutely fine with a completely compatible newer part.

Jonathan


> 
> Regards,
>   Marco


  reply	other threads:[~2022-12-23 17:03 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-21  9:27 [PATCH v2 0/4] Add TI TMP116 Support Marco Felsch
2022-12-21  9:27 ` [PATCH v2 1/4] dt-bindings: iio: ti,tmp117: fix documentation link Marco Felsch
2022-12-21  9:27 ` [PATCH v2 2/4] dt-bindings: iio: ti,tmp117: add binding for the TMP116 Marco Felsch
2022-12-21  9:46   ` Krzysztof Kozlowski
2022-12-23 15:08   ` Jonathan Cameron
2022-12-23 15:03     ` Marco Felsch
2022-12-23 15:37       ` Jonathan Cameron
2022-12-23 16:10         ` Marco Felsch
2022-12-23 17:14           ` Jonathan Cameron
2022-12-23 17:13             ` Marco Felsch
2022-12-27  8:40               ` Krzysztof Kozlowski
2022-12-30 17:59                 ` Jonathan Cameron
2023-01-16  9:23                   ` Marco Felsch
2022-12-21  9:28 ` [PATCH v2 3/4] iio: temperature: tmp117: add TI TMP116 support Marco Felsch
2022-12-23 15:10   ` Jonathan Cameron
2022-12-23 15:07     ` Marco Felsch
2022-12-23 15:39       ` Jonathan Cameron
2022-12-23 16:13         ` Marco Felsch
2022-12-23 17:16           ` Jonathan Cameron [this message]
2022-12-27  8:30             ` Krzysztof Kozlowski
2022-12-30 17:55               ` Jonathan Cameron
2022-12-21  9:28 ` [PATCH v2 4/4] iio: temperature: tmp117: cosmetic alignment cleanup Marco Felsch

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=20221223171647.43a6153e@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=m.felsch@pengutronix.de \
    --cc=puranjay12@gmail.com \
    --cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).