From: Jonathan Cameron <jic23@kernel.org>
To: Loic Poulain <loic.poulain@oss.qualcomm.com>
Cc: "David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux-arm-msm@vger.kernel.org, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Shawn Guo" <shengchao.guo@oss.qualcomm.com>
Subject: Re: [PATCH] iio: adc: qcom-spmi-adc5-gen3: Reuse IIO device ID for ADC_TM auxiliary device
Date: Sun, 1 Nov 2026 02:00:47 +0000 [thread overview]
Message-ID: <20261101020047.66034613@jic23-hlaptop> (raw)
In-Reply-To: <20261028-fix-adc5-tm-v1-1-0018aabc06c5@oss.qualcomm.com>
On Wed, 28 Oct 2026 15:09:47 +0100
Loic Poulain <loic.poulain@oss.qualcomm.com> wrote:
Hi Loic,
> A recent fix in ADC5 Gen3 driver allocates a dedicated auxiliary-device
> ID through an IDA to ensure that ADC_TM auxiliary devices receive unique
> names on the auxiliary bus.
When talking about another patch I'd refer to it by name and ideally
also add a Link tag to the lore.kernel.org for it to the tags block.
I think you mean:
iio: adc: qcom-spmi-adc5-gen3: Allocate unique ADC_TM aux device IDs
Link: https://lore.kernel.org/all/20261008031154.3440632-1-shengchao.guo@oss.qualcomm.com/
>
> However, each ADC instance is already assigned a unique IIO device ID.
> Reuse that existing identifier when registering the ADC_TM auxiliary
> device instead of maintaining a separate IDA solely for auxiliary device
> naming.
>
> This removes the custom ID allocation and release handling while
> preserving unique auxiliary device names across multiple ADC instances.
>
> Signed-off-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
The fix hasn't gone upstream yet (assuming it is the patch I think
it is!). Would it be better to just squash this onto that patch
and avoid having to care about a version of the intermediate code?
+CC Shawn.
Thanks,
Jonathan
> ---
> drivers/iio/adc/qcom-spmi-adc5-gen3.c | 24 +++++-------------------
> 1 file changed, 5 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/iio/adc/qcom-spmi-adc5-gen3.c b/drivers/iio/adc/qcom-spmi-adc5-gen3.c
> index f0b2544c16322374644ac3a2eda63322f318e25f..a23eb5c9096d765af7d76ad66b50ed895782b256 100644
> --- a/drivers/iio/adc/qcom-spmi-adc5-gen3.c
> +++ b/drivers/iio/adc/qcom-spmi-adc5-gen3.c
> @@ -15,7 +15,6 @@
> #include <linux/dev_printk.h>
> #include <linux/err.h>
> #include <linux/export.h>
> -#include <linux/idr.h>
> #include <linux/iio/adc/qcom-adc5-gen3-common.h>
> #include <linux/iio/iio.h>
> #include <linux/interrupt.h>
> @@ -609,16 +608,9 @@ static void adc5_gen3_delete_aux(void *data)
> auxiliary_device_delete(data);
> }
>
> -static DEFINE_IDA(adc5_gen3_aux_ida);
> +static void adc5_gen3_aux_device_release(struct device *dev) {}
>
> -static void adc5_gen3_aux_device_release(struct device *dev)
> -{
> - struct auxiliary_device *adev = to_auxiliary_dev(dev);
> -
> - ida_free(&adc5_gen3_aux_ida, adev->id);n
> -}
> -
> -static int adc5_gen3_add_aux_tm_device(struct adc5_chip *adc)
> +static int adc5_gen3_add_aux_tm_device(struct adc5_chip *adc, int id)
> {
> struct tm5_aux_dev_wrapper *aux_device;
> int i, ret, i_tm = 0;
> @@ -628,6 +620,7 @@ static int adc5_gen3_add_aux_tm_device(struct adc5_chip *adc)
> return -ENOMEM;
>
> aux_device->aux_dev.name = "adc5_tm_gen3";
> + aux_device->aux_dev.id = id;
> aux_device->aux_dev.dev.parent = adc->dev;
> aux_device->aux_dev.dev.release = adc5_gen3_aux_device_release;
>
> @@ -650,16 +643,9 @@ static int adc5_gen3_add_aux_tm_device(struct adc5_chip *adc)
>
> aux_device->n_tm_channels = adc->n_tm_channels;
>
> - ret = ida_alloc(&adc5_gen3_aux_ida, GFP_KERNEL);
> - if (ret < 0)
> - return ret;
> - aux_device->aux_dev.id = ret;
> -
> ret = auxiliary_device_init(&aux_device->aux_dev);
> - if (ret) {
> - ida_free(&adc5_gen3_aux_ida, aux_device->aux_dev.id);
> + if (ret)
> return ret;
> - }
>
> ret = devm_add_action_or_reset(adc->dev, adc5_gen3_uninit_aux,
> &aux_device->aux_dev);
> @@ -814,7 +800,7 @@ static int adc5_gen3_probe(struct platform_device *pdev)
> return ret;
>
> if (adc->n_tm_channels > 0) {
> - ret = adc5_gen3_add_aux_tm_device(adc);
> + ret = adc5_gen3_add_aux_tm_device(adc, iio_device_id(indio_dev));
> if (ret)
> dev_err_probe(dev, ret,
> "Failed to add auxiliary TM device\n");
>
> ---
> base-commit: f1ac44c32cba88ad65dcecd4a279661d14e93651
> change-id: 20261028-fix-adc5-tm-c96b13a4f442
>
> Best regards,
next prev parent reply other threads:[~2026-11-01 2:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 14:09 Loic Poulain
2026-11-01 2:00 ` Jonathan Cameron [this message]
2026-11-01 3:15 ` Shawn Guo
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=20261101020047.66034613@jic23-hlaptop \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loic.poulain@oss.qualcomm.com \
--cc=nuno.sa@analog.com \
--cc=shengchao.guo@oss.qualcomm.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
all inboxes | Powered by JetHome®