* Re: [PATCH] iio: adc: qcom-spmi-adc5-gen3: Allocate unique ADC_TM aux device IDs
2026-10-08 3:11 [PATCH] iio: adc: qcom-spmi-adc5-gen3: Allocate unique ADC_TM aux device IDs Shawn Guo
@ 2026-10-08 9:58 ` Bartosz Golaszewski
2026-10-08 12:38 ` Jishnu Prakash
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2026-10-08 9:58 UTC (permalink / raw)
To: Shawn Guo
Cc: David Lechner, Nuno Sá,
Andy Shevchenko, Jishnu Prakash, Daniel Lezcano,
Danilo Krummrich, Dan Carpenter, Uwe Kleine-König,
Bartosz Golaszewski, Dhruvin Rajpura, linux-arm-msm, linux-iio,
linux-kernel, Jonathan Cameron
On Thu, 8 Oct 2026 05:11:54 +0200, Shawn Guo
<shengchao.guo@oss.qualcomm.com> said:
> adc5_gen3_add_aux_tm_device() never sets the auxiliary device id, so
> every ADC5 Gen3 instance with at least one qcom,adc-tm channel tries
> to register the same device name. With ADC_TM channels on more than
> one PMIC, the second instance to probe fails:
>
> sysfs: cannot create duplicate filename '/bus/auxiliary/devices/qcom_spmi_adc5_gen3.adc5_tm_gen3.0'
> ...
> auxiliary qcom_spmi_adc5_gen3.adc5_tm_gen3.0: adding auxiliary device failed!: -17
> qcom-spmi-adc5-gen3 c400000.spmi:pmic@8:adc@7200: error -EEXIST: Failed to add auxiliary TM device
>
> The ADC probe then fails as a whole, so that PMIC loses both its IIO
> channels and its thermal zones. This shows up on Nord, which has
> thermistor channels on two PMAU0102 PMICs.
>
> Allocate the id from a driver-wide IDA and release it from the
> auxiliary device release callback. The ADC_TM driver matches on the
> device name only, so the instance number does not affect binding.
>
> Assisted-by: LLM
> Signed-off-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>
> ---
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] iio: adc: qcom-spmi-adc5-gen3: Allocate unique ADC_TM aux device IDs
2026-10-08 3:11 [PATCH] iio: adc: qcom-spmi-adc5-gen3: Allocate unique ADC_TM aux device IDs Shawn Guo
2026-10-08 9:58 ` Bartosz Golaszewski
@ 2026-10-08 12:38 ` Jishnu Prakash
2026-10-18 18:21 ` Jonathan Cameron
2026-10-19 6:05 ` Shawn Guo
3 siblings, 0 replies; 8+ messages in thread
From: Jishnu Prakash @ 2026-10-08 12:38 UTC (permalink / raw)
To: Shawn Guo, Jonathan Cameron
Cc: David Lechner, Nuno Sá,
Andy Shevchenko, Daniel Lezcano, Danilo Krummrich, Dan Carpenter,
Uwe Kleine-König, Bartosz Golaszewski, Dhruvin Rajpura,
linux-arm-msm, linux-iio, linux-kernel
On 10/8/2026 8:41 AM, Shawn Guo wrote:
> adc5_gen3_add_aux_tm_device() never sets the auxiliary device id, so
> every ADC5 Gen3 instance with at least one qcom,adc-tm channel tries
> to register the same device name. With ADC_TM channels on more than
> one PMIC, the second instance to probe fails:
>
> sysfs: cannot create duplicate filename '/bus/auxiliary/devices/qcom_spmi_adc5_gen3.adc5_tm_gen3.0'
> ...
> auxiliary qcom_spmi_adc5_gen3.adc5_tm_gen3.0: adding auxiliary device failed!: -17
> qcom-spmi-adc5-gen3 c400000.spmi:pmic@8:adc@7200: error -EEXIST: Failed to add auxiliary TM device
>
> The ADC probe then fails as a whole, so that PMIC loses both its IIO
> channels and its thermal zones. This shows up on Nord, which has
> thermistor channels on two PMAU0102 PMICs.
>
> Allocate the id from a driver-wide IDA and release it from the
> auxiliary device release callback. The ADC_TM driver matches on the
> device name only, so the instance number does not affect binding.
>
> Assisted-by: LLM
> Signed-off-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>
> ---
> drivers/iio/adc/qcom-spmi-adc5-gen3.c | 21 ++++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/adc/qcom-spmi-adc5-gen3.c b/drivers/iio/adc/qcom-spmi-adc5-gen3.c
> index c68c6c5f6aca..f0b2544c1632 100644
> --- a/drivers/iio/adc/qcom-spmi-adc5-gen3.c
> +++ b/drivers/iio/adc/qcom-spmi-adc5-gen3.c
> @@ -15,6 +15,7 @@
> #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>
> @@ -608,7 +609,14 @@ static void adc5_gen3_delete_aux(void *data)
> auxiliary_device_delete(data);
> }
>
> -static void adc5_gen3_aux_device_release(struct device *dev) {}
> +static DEFINE_IDA(adc5_gen3_aux_ida);
> +
> +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);
> +}
>
> static int adc5_gen3_add_aux_tm_device(struct adc5_chip *adc)
> {
> @@ -642,9 +650,16 @@ static int adc5_gen3_add_aux_tm_device(struct adc5_chip *adc)
>
> aux_device->n_tm_channels = adc->n_tm_channels;
>
> - ret = auxiliary_device_init(&aux_device->aux_dev);
> - if (ret)
> + 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);
> + return ret;
> + }
Thanks, this looks right.
Reviewed-by: Jishnu Prakash <jishnu.prakash@oss.qualcomm.com>
>
> ret = devm_add_action_or_reset(adc->dev, adc5_gen3_uninit_aux,
> &aux_device->aux_dev);
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] iio: adc: qcom-spmi-adc5-gen3: Allocate unique ADC_TM aux device IDs
2026-10-08 3:11 [PATCH] iio: adc: qcom-spmi-adc5-gen3: Allocate unique ADC_TM aux device IDs Shawn Guo
2026-10-08 9:58 ` Bartosz Golaszewski
2026-10-08 12:38 ` Jishnu Prakash
@ 2026-10-18 18:21 ` Jonathan Cameron
2026-10-19 6:07 ` Shawn Guo
2026-10-19 6:05 ` Shawn Guo
3 siblings, 1 reply; 8+ messages in thread
From: Jonathan Cameron @ 2026-10-18 18:21 UTC (permalink / raw)
To: Shawn Guo
Cc: David Lechner, Nuno Sá,
Andy Shevchenko, Jishnu Prakash, Daniel Lezcano,
Danilo Krummrich, Dan Carpenter, Uwe Kleine-König,
Bartosz Golaszewski, Dhruvin Rajpura, linux-arm-msm, linux-iio,
linux-kernel
On Thu, 8 Oct 2026 11:11:54 +0800
Shawn Guo <shengchao.guo@oss.qualcomm.com> wrote:
> adc5_gen3_add_aux_tm_device() never sets the auxiliary device id, so
> every ADC5 Gen3 instance with at least one qcom,adc-tm channel tries
> to register the same device name. With ADC_TM channels on more than
> one PMIC, the second instance to probe fails:
>
> sysfs: cannot create duplicate filename '/bus/auxiliary/devices/qcom_spmi_adc5_gen3.adc5_tm_gen3.0'
> ...
> auxiliary qcom_spmi_adc5_gen3.adc5_tm_gen3.0: adding auxiliary device failed!: -17
> qcom-spmi-adc5-gen3 c400000.spmi:pmic@8:adc@7200: error -EEXIST: Failed to add auxiliary TM device
>
> The ADC probe then fails as a whole, so that PMIC loses both its IIO
> channels and its thermal zones. This shows up on Nord, which has
> thermistor channels on two PMAU0102 PMICs.
Fixes tag? Just replying to this thread is fine rather than sending
a v2 just for that.
>
> Allocate the id from a driver-wide IDA and release it from the
> auxiliary device release callback. The ADC_TM driver matches on the
> device name only, so the instance number does not affect binding.
>
> Assisted-by: LLM
> Signed-off-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>
> ---
> drivers/iio/adc/qcom-spmi-adc5-gen3.c | 21 ++++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/adc/qcom-spmi-adc5-gen3.c b/drivers/iio/adc/qcom-spmi-adc5-gen3.c
> index c68c6c5f6aca..f0b2544c1632 100644
> --- a/drivers/iio/adc/qcom-spmi-adc5-gen3.c
> +++ b/drivers/iio/adc/qcom-spmi-adc5-gen3.c
> @@ -15,6 +15,7 @@
> #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>
> @@ -608,7 +609,14 @@ static void adc5_gen3_delete_aux(void *data)
> auxiliary_device_delete(data);
> }
>
> -static void adc5_gen3_aux_device_release(struct device *dev) {}
> +static DEFINE_IDA(adc5_gen3_aux_ida);
> +
> +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);
> +}
>
> static int adc5_gen3_add_aux_tm_device(struct adc5_chip *adc)
> {
> @@ -642,9 +650,16 @@ static int adc5_gen3_add_aux_tm_device(struct adc5_chip *adc)
>
> aux_device->n_tm_channels = adc->n_tm_channels;
>
> - ret = auxiliary_device_init(&aux_device->aux_dev);
> - if (ret)
> + 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);
> + return ret;
> + }
>
> ret = devm_add_action_or_reset(adc->dev, adc5_gen3_uninit_aux,
> &aux_device->aux_dev);
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] iio: adc: qcom-spmi-adc5-gen3: Allocate unique ADC_TM aux device IDs
2026-10-18 18:21 ` Jonathan Cameron
@ 2026-10-19 6:07 ` Shawn Guo
0 siblings, 0 replies; 8+ messages in thread
From: Shawn Guo @ 2026-10-19 6:07 UTC (permalink / raw)
To: Jonathan Cameron
Cc: David Lechner, Nuno Sá,
Andy Shevchenko, Jishnu Prakash, Daniel Lezcano,
Danilo Krummrich, Dan Carpenter, Uwe Kleine-König,
Bartosz Golaszewski, Dhruvin Rajpura, linux-arm-msm, linux-iio,
linux-kernel
On Sun, Oct 18, 2026 at 07:21:51PM +0100, Jonathan Cameron wrote:
> On Thu, 8 Oct 2026 11:11:54 +0800
> Shawn Guo <shengchao.guo@oss.qualcomm.com> wrote:
>
> > adc5_gen3_add_aux_tm_device() never sets the auxiliary device id, so
> > every ADC5 Gen3 instance with at least one qcom,adc-tm channel tries
> > to register the same device name. With ADC_TM channels on more than
> > one PMIC, the second instance to probe fails:
> >
> > sysfs: cannot create duplicate filename '/bus/auxiliary/devices/qcom_spmi_adc5_gen3.adc5_tm_gen3.0'
> > ...
> > auxiliary qcom_spmi_adc5_gen3.adc5_tm_gen3.0: adding auxiliary device failed!: -17
> > qcom-spmi-adc5-gen3 c400000.spmi:pmic@8:adc@7200: error -EEXIST: Failed to add auxiliary TM device
> >
> > The ADC probe then fails as a whole, so that PMIC loses both its IIO
> > channels and its thermal zones. This shows up on Nord, which has
> > thermistor channels on two PMAU0102 PMICs.
>
> Fixes tag? Just replying to this thread is fine rather than sending
> a v2 just for that.
Replied to the patch with a hope that b4 will be able to pick up
the Fixes tag.
Thanks,
Shawn
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] iio: adc: qcom-spmi-adc5-gen3: Allocate unique ADC_TM aux device IDs
2026-10-08 3:11 [PATCH] iio: adc: qcom-spmi-adc5-gen3: Allocate unique ADC_TM aux device IDs Shawn Guo
` (2 preceding siblings ...)
2026-10-18 18:21 ` Jonathan Cameron
@ 2026-10-19 6:05 ` Shawn Guo
2026-10-21 18:54 ` Jonathan Cameron
3 siblings, 1 reply; 8+ messages in thread
From: Shawn Guo @ 2026-10-19 6:05 UTC (permalink / raw)
To: Jonathan Cameron
Cc: David Lechner, Nuno Sá,
Andy Shevchenko, Jishnu Prakash, Daniel Lezcano,
Danilo Krummrich, Dan Carpenter, Uwe Kleine-König,
Bartosz Golaszewski, Dhruvin Rajpura, linux-arm-msm, linux-iio,
linux-kernel
On Thu, Oct 08, 2026 at 11:11:54AM +0800, Shawn Guo wrote:
> adc5_gen3_add_aux_tm_device() never sets the auxiliary device id, so
> every ADC5 Gen3 instance with at least one qcom,adc-tm channel tries
> to register the same device name. With ADC_TM channels on more than
> one PMIC, the second instance to probe fails:
>
> sysfs: cannot create duplicate filename '/bus/auxiliary/devices/qcom_spmi_adc5_gen3.adc5_tm_gen3.0'
> ...
> auxiliary qcom_spmi_adc5_gen3.adc5_tm_gen3.0: adding auxiliary device failed!: -17
> qcom-spmi-adc5-gen3 c400000.spmi:pmic@8:adc@7200: error -EEXIST: Failed to add auxiliary TM device
>
> The ADC probe then fails as a whole, so that PMIC loses both its IIO
> channels and its thermal zones. This shows up on Nord, which has
> thermistor channels on two PMAU0102 PMICs.
>
> Allocate the id from a driver-wide IDA and release it from the
> auxiliary device release callback. The ADC_TM driver matches on the
> device name only, so the instance number does not affect binding.
>
Fixes: baff45179e90 ("iio: adc: Add support for QCOM PMIC5 Gen3 ADC")
> Assisted-by: LLM
> Signed-off-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] iio: adc: qcom-spmi-adc5-gen3: Allocate unique ADC_TM aux device IDs
2026-10-19 6:05 ` Shawn Guo
@ 2026-10-21 18:54 ` Jonathan Cameron
2026-10-21 19:03 ` Andy Shevchenko
0 siblings, 1 reply; 8+ messages in thread
From: Jonathan Cameron @ 2026-10-21 18:54 UTC (permalink / raw)
To: Shawn Guo
Cc: David Lechner, Nuno Sá,
Andy Shevchenko, Jishnu Prakash, Daniel Lezcano,
Danilo Krummrich, Dan Carpenter, Uwe Kleine-König,
Bartosz Golaszewski, Dhruvin Rajpura, linux-arm-msm, linux-iio,
linux-kernel
On Mon, 19 Oct 2026 14:05:10 +0800
Shawn Guo <shengchao.guo@oss.qualcomm.com> wrote:
> On Thu, Oct 08, 2026 at 11:11:54AM +0800, Shawn Guo wrote:
> > adc5_gen3_add_aux_tm_device() never sets the auxiliary device id, so
> > every ADC5 Gen3 instance with at least one qcom,adc-tm channel tries
> > to register the same device name. With ADC_TM channels on more than
> > one PMIC, the second instance to probe fails:
> >
> > sysfs: cannot create duplicate filename '/bus/auxiliary/devices/qcom_spmi_adc5_gen3.adc5_tm_gen3.0'
> > ...
> > auxiliary qcom_spmi_adc5_gen3.adc5_tm_gen3.0: adding auxiliary device failed!: -17
> > qcom-spmi-adc5-gen3 c400000.spmi:pmic@8:adc@7200: error -EEXIST: Failed to add auxiliary TM device
> >
> > The ADC probe then fails as a whole, so that PMIC loses both its IIO
> > channels and its thermal zones. This shows up on Nord, which has
> > thermistor channels on two PMAU0102 PMICs.
> >
> > Allocate the id from a driver-wide IDA and release it from the
> > auxiliary device release callback. The ADC_TM driver matches on the
> > device name only, so the instance number does not affect binding.
> >
>
> Fixes: baff45179e90 ("iio: adc: Add support for QCOM PMIC5 Gen3 ADC")
>
> > Assisted-by: LLM
> > Signed-off-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>
Applied to the fixes-togreg branch of iio.git and marked for stable.
Thanks,
Jonathan
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] iio: adc: qcom-spmi-adc5-gen3: Allocate unique ADC_TM aux device IDs
2026-10-21 18:54 ` Jonathan Cameron
@ 2026-10-21 19:03 ` Andy Shevchenko
0 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2026-10-21 19:03 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Shawn Guo, David Lechner, Nuno Sá,
Andy Shevchenko, Jishnu Prakash, Daniel Lezcano,
Danilo Krummrich, Dan Carpenter, Uwe Kleine-König,
Bartosz Golaszewski, Dhruvin Rajpura, linux-arm-msm, linux-iio,
linux-kernel
On Wed, Oct 21, 2026 at 07:54:01PM +0100, Jonathan Cameron wrote:
> On Mon, 19 Oct 2026 14:05:10 +0800
> Shawn Guo <shengchao.guo@oss.qualcomm.com> wrote:
> > On Thu, Oct 08, 2026 at 11:11:54AM +0800, Shawn Guo wrote:
...
> > > Assisted-by: LLM
>
> Applied to the fixes-togreg branch of iio.git and marked for stable.
JFYI, this tag now is killed from documentation. The idea that the use of AI is
described in the comments block or so.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 8+ messages in thread