devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Ciprian Regus <ciprian.regus@analog.com>
Cc: <robh+dt@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>,
	<linux-iio@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 5/5] drivers: iio: adc: Rename the LTC2499 iio device
Date: Sun, 4 Sep 2022 16:09:51 +0100	[thread overview]
Message-ID: <20220904160951.7de30240@jic23-huawei> (raw)
In-Reply-To: <20220901121700.1325733-5-ciprian.regus@analog.com>

On Thu, 1 Sep 2022 15:17:00 +0300
Ciprian Regus <ciprian.regus@analog.com> wrote:

> Set the iio device's name based on the chip used for the
> LTC2499 only. The most common way for IIO clients to interact
> with a device is to address it based on it's name. By using
> the dev_name() function, the name will be set based on a
> i2c_client's kobj name, which has the format i2c_instance-i2c_address
> (1-0076 for example). This is not ideal, since it makes a
> requirement for userspace to have knowledge about the hardware
> connections of the device.
> 
> The name field is set to NULL for the LTC2497 and LTC2496, so
> that the old name can kept as it is, since changing it will
> result in an ABI breakage.
> 
> Signed-off-by: Ciprian Regus <ciprian.regus@analog.com>
Other than the issue with the split between patches 4 and 5 that
the robot found this looks good to me.

Jonathan

> ---
> changes in v2:
>  - updated the patch title (LTC249x -> LTC2499), since the name change only
>    affects the LTC2499.
>  - updated the commit description to better explain what is being done.
>  - only changed the iio_dev's name for the LTC2499.
>  - added a comment to explain difference in naming.
>  - added the const qualifier to the name field.
>  drivers/iio/adc/ltc2496.c      |  1 +
>  drivers/iio/adc/ltc2497-core.c | 10 +++++++++-
>  drivers/iio/adc/ltc2497.h      |  1 +
>  3 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ltc2496.c b/drivers/iio/adc/ltc2496.c
> index bf89d5ae19af..2593fa4322eb 100644
> --- a/drivers/iio/adc/ltc2496.c
> +++ b/drivers/iio/adc/ltc2496.c
> @@ -89,6 +89,7 @@ static void ltc2496_remove(struct spi_device *spi)
>  
>  static const struct ltc2497_chip_info ltc2496_info = {
>  	.resolution = 16,
> +	.name = NULL,
>  };
>  
>  static const struct of_device_id ltc2496_of_match[] = {
> diff --git a/drivers/iio/adc/ltc2497-core.c b/drivers/iio/adc/ltc2497-core.c
> index b2752399402c..f52d37af4d1f 100644
> --- a/drivers/iio/adc/ltc2497-core.c
> +++ b/drivers/iio/adc/ltc2497-core.c
> @@ -169,7 +169,15 @@ int ltc2497core_probe(struct device *dev, struct iio_dev *indio_dev)
>  	struct ltc2497core_driverdata *ddata = iio_priv(indio_dev);
>  	int ret;
>  
> -	indio_dev->name = dev_name(dev);
> +	/*
> +	 * Keep using dev_name() for the iio_dev's name on some of the parts,
> +	 * since updating it would result in a ABI breakage.
> +	 */
> +	if (ddata->chip_info->name)
> +		indio_dev->name = ddata->chip_info->name;
> +	else
> +		indio_dev->name = dev_name(dev);
> +
>  	indio_dev->info = &ltc2497core_info;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
>  	indio_dev->channels = ltc2497core_channel;
> diff --git a/drivers/iio/adc/ltc2497.h b/drivers/iio/adc/ltc2497.h
> index 95f6a5f4d4a6..fd3dfd491060 100644
> --- a/drivers/iio/adc/ltc2497.h
> +++ b/drivers/iio/adc/ltc2497.h
> @@ -12,6 +12,7 @@ enum ltc2497_chip_type {
>  
>  struct ltc2497_chip_info {
>  	u32 resolution;
> +	const char *name;
>  };
>  
>  struct ltc2497core_driverdata {


  reply	other threads:[~2022-09-04 15:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-01 12:16 [PATCH v2 1/5] dt-bindings: iio: adc: Add docs for LTC2499 Ciprian Regus
2022-09-01 12:16 ` [PATCH v2 2/5] Add the LTC2496 MAINTAINERS entry Ciprian Regus
2022-09-04 14:54   ` Jonathan Cameron
2022-09-01 12:16 ` [PATCH v2 3/5] Remove duplicate matching entry Ciprian Regus
2022-09-01 12:16 ` [PATCH v2 4/5] drivers: iio: adc: LTC2499 support Ciprian Regus
2022-09-01 13:23   ` Krzysztof Kozlowski
2022-09-02 11:06     ` Jonathan Cameron
2022-09-02 11:37       ` Andy Shevchenko
2022-09-04 14:55         ` Jonathan Cameron
2022-09-05  8:58           ` Krzysztof Kozlowski
2022-09-01 20:00   ` kernel test robot
2022-09-04 15:08     ` Jonathan Cameron
2022-09-01 20:10   ` kernel test robot
2022-09-04 15:06   ` Jonathan Cameron
2022-09-01 12:17 ` [PATCH v2 5/5] drivers: iio: adc: Rename the LTC2499 iio device Ciprian Regus
2022-09-04 15:09   ` Jonathan Cameron [this message]
2022-09-01 13:27 ` [PATCH v2 1/5] dt-bindings: iio: adc: Add docs for LTC2499 Krzysztof Kozlowski
2022-09-04 14:53 ` 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=20220904160951.7de30240@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=ciprian.regus@analog.com \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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).