mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Dileep Kumar Nagavarapu <dileepkumar.nagavarapu@amd.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Michal Simek" <michal.simek@amd.com>,
	"Conall O'Griofa" <conall.ogriofa@amd.com>,
	linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, git@amd.com,
	"Sai Krishna Potthuri" <sai.krishna.potthuri@amd.com>
Subject: Re: [PATCH v5 13/16] iio: adc: xilinx-xadc: Add helper functions for the device setup
Date: Tue, 10 Nov 2026 18:25:12 +0200	[thread overview]
Message-ID: <avNFaNki0m47M80d@ashevche-desk.local> (raw)
In-Reply-To: <20261110050201.1850399-14-dileepkumar.nagavarapu@amd.com>

On Tue, Nov 10, 2026 at 10:31:58AM +0530, Dileep Kumar Nagavarapu wrote:
> Refactor the platform driver probe function by extracting device
> setup and configuration logic into reusable helper functions:
> xadc_device_setup(): handles IIO device allocation and basic setup
> xadc_device_configure(): handles device tree parsing and bipolar mask
> configuration
> 
> Move the bipolar channel mask calculation immediately after
> xadc_parse_dt(), as the channel information used to build
> the mask is populated there and remains unchanged before it is consumed.
> 
> This refactoring reduces code duplication and prepares for sharing the
> common setup logic between platform and I2C drivers.

...

> +	if (irq <= 0)
> +		return 0;

When == 0 is true?

...

> +static int xadc_device_configure(struct iio_dev *indio_dev, int irq,
> +				 unsigned int *conf0, unsigned int *bipolar_mask)
> +{
> +	int ret;
> +
> +	ret = xadc_parse_dt(indio_dev, conf0, irq);
> +	if (ret)
> +		return ret;
> +
> +	*bipolar_mask = 0;
> +	for (unsigned int i = 0; i < indio_dev->num_channels; i++) {
> +		if (indio_dev->channels[i].scan_type.sign == 's')

Wasn't that changed to format?

> +			*bipolar_mask |= BIT(indio_dev->channels[i].scan_index);
> +	}
> +
> +	return 0;

Don't we have a specific for_each type of macro to iterate over all channels?

> +}

...

>  	irq = platform_get_irq_optional(pdev, 0);
>  	if (irq < 0 && (irq != -ENXIO || !(ops->flags & XADC_FLAGS_IRQ_OPTIONAL)))

Side note, this conditional is wrong. It doesn't handle properly deferred probe.

>  		return irq;

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-11-10 16:25 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10  5:01 [PATCH v5 00/16] iio: adc: xilinx-xadc: Add I2C interface support for System Management Wizard Dileep Kumar Nagavarapu
2026-11-10  5:01 ` [PATCH v5 01/16] iio: adc: xilinx-xadc: Correct write edge in CFG Dileep Kumar Nagavarapu
2026-11-10  5:01 ` [PATCH v5 02/16] iio: adc: xilinx-xadc: Fix coding style issues Dileep Kumar Nagavarapu
2026-11-10  5:01 ` [PATCH v5 03/16] iio: adc: xilinx-xadc: Use kernel integer types Dileep Kumar Nagavarapu
2026-11-10 11:15   ` Joshua Crofts
2026-11-10  5:01 ` [PATCH v5 04/16] iio: adc: xilinx-xadc: Drop unnecessary masking and dead code Dileep Kumar Nagavarapu
2026-11-10  5:01 ` [PATCH v5 05/16] iio: adc: xilinx-xadc: Use bitfield helpers and bit macros Dileep Kumar Nagavarapu
2026-11-10  5:01 ` [PATCH v5 06/16] iio: adc: xilinx-xadc: Use guard()/scoped_guard() for spinlock locking Dileep Kumar Nagavarapu
2026-11-10  5:01 ` [PATCH v5 07/16] iio: adc: xilinx-xadc: Use guard() for mutex locking Dileep Kumar Nagavarapu
2026-11-10 16:13   ` Andy Shevchenko
2026-11-10  5:01 ` [PATCH v5 08/16] iio: adc: xilinx-xadc: Simplify common coding patterns Dileep Kumar Nagavarapu
2026-11-10  5:01 ` [PATCH v5 09/16] iio: adc: xilinx-xadc: Add unit suffixes to macro names Dileep Kumar Nagavarapu
2026-11-10 16:18   ` Andy Shevchenko
2026-11-10  5:01 ` [PATCH v5 10/16] iio: adc: xilinx-xadc: Include appropriate header files Dileep Kumar Nagavarapu
2026-11-10  5:01 ` [PATCH v5 11/16] iio: adc: xilinx-xadc: Add clarifying comments Dileep Kumar Nagavarapu
2026-11-10  5:01 ` [PATCH v5 12/16] iio: adc: xilinx-xadc: Refine Zynq read/write error handling on timeout/interrupt Dileep Kumar Nagavarapu
2026-11-10 16:21   ` Andy Shevchenko
2026-11-10  5:01 ` [PATCH v5 13/16] iio: adc: xilinx-xadc: Add helper functions for the device setup Dileep Kumar Nagavarapu
2026-11-10 16:25   ` Andy Shevchenko [this message]
2026-11-10  5:01 ` [PATCH v5 14/16] iio: adc: xilinx-xadc: Split driver into core and platform files Dileep Kumar Nagavarapu
2026-11-10 16:29   ` Andy Shevchenko
2026-11-10  5:02 ` [PATCH v5 15/16] iio: adc: xilinx-xadc: Add .setup_channels() to struct xadc_ops Dileep Kumar Nagavarapu
2026-11-10  5:02 ` [PATCH v5 16/16] iio: adc: xilinx-xadc: Add I2C interface support Dileep Kumar Nagavarapu
2026-11-10 16:34   ` Andy Shevchenko

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=avNFaNki0m47M80d@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=conall.ogriofa@amd.com \
    --cc=dileepkumar.nagavarapu@amd.com \
    --cc=dlechner@baylibre.com \
    --cc=git@amd.com \
    --cc=jic23@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=nuno.sa@analog.com \
    --cc=sai.krishna.potthuri@amd.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®