Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Olivier Moysan <olivier.moysan@foss.st.com>
Cc: <fabrice.gasnier@foss.st.com>, Nuno Sa <nuno.sa@analog.com>,
	Lars-Peter Clausen <lars@metafoo.de>, <linux-iio@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 3/8] iio: add child nodes support in iio backend framework
Date: Sat, 29 Jun 2024 19:54:11 +0100	[thread overview]
Message-ID: <20240629195411.63a72497@jic23-huawei> (raw)
In-Reply-To: <20240625150717.1038212-4-olivier.moysan@foss.st.com>

On Tue, 25 Jun 2024 17:07:11 +0200
Olivier Moysan <olivier.moysan@foss.st.com> wrote:

> Add an API to support IIO generic channels binding:
> http://devicetree.org/schemas/iio/adc/adc.yaml#
> This new API is needed, as generic channel DT node isn't populated as a
> device.
> Add devm_iio_backend_fwnode_get() to allow an IIO device backend
> consumer to reference backend phandles in its child nodes.
> 
> Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
> Reviewed-by: Nuno Sa <nuno.sa@analog.com>

A passing comment inline. I'm not asking for any changes in this
series (unless you want to make it more complex ;)

> ---
>  drivers/iio/industrialio-backend.c | 62 +++++++++++++++++++++---------
>  include/linux/iio/backend.h        |  2 +
>  2 files changed, 45 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c
> index 6be1fa9a960b..8cc959ac278a 100644
> --- a/drivers/iio/industrialio-backend.c
> +++ b/drivers/iio/industrialio-backend.c
> @@ -577,19 +577,10 @@ static int __devm_iio_backend_get(struct device *dev, struct iio_backend *back)
>  	return 0;
>  }
>  
> -/**
> - * devm_iio_backend_get - Device managed backend device get
> - * @dev: Consumer device for the backend
> - * @name: Backend name
> - *
> - * Get's the backend associated with @dev.
> - *
> - * RETURNS:
> - * A backend pointer, negative error pointer otherwise.
> - */
> -struct iio_backend *devm_iio_backend_get(struct device *dev, const char *name)
> +static struct iio_backend *__devm_iio_backend_fwnode_get(struct device *dev, const char *name,
> +							 struct fwnode_handle *fwnode)
>  {
> -	struct fwnode_handle *fwnode;
> +	struct fwnode_handle *fwnode_back;
>  	struct iio_backend *back;
>  	unsigned int index;
>  	int ret;
> @@ -604,19 +595,19 @@ struct iio_backend *devm_iio_backend_get(struct device *dev, const char *name)
>  		index = 0;
>  	}
>  
> -	fwnode = fwnode_find_reference(dev_fwnode(dev), "io-backends", index);
> -	if (IS_ERR(fwnode)) {
> -		dev_err_probe(dev, PTR_ERR(fwnode),
> +	fwnode_back = fwnode_find_reference(fwnode, "io-backends", index);

Not really related, but this looks 'ripe' for some cleanup.h magic.

> +	if (IS_ERR(fwnode_back)) {
> +		dev_err_probe(dev, PTR_ERR(fwnode_back),
>  			      "Cannot get Firmware reference\n");
> -		return ERR_CAST(fwnode);
> +		return ERR_CAST(fwnode_back);
>  	}
>  
>  	guard(mutex)(&iio_back_lock);
>  	list_for_each_entry(back, &iio_back_list, entry) {
> -		if (!device_match_fwnode(back->dev, fwnode))
> +		if (!device_match_fwnode(back->dev, fwnode_back))
>  			continue;
>  
> -		fwnode_handle_put(fwnode);
> +		fwnode_handle_put(fwnode_back);
>  		ret = __devm_iio_backend_get(dev, back);
>  		if (ret)
>  			return ERR_PTR(ret);
> @@ -624,11 +615,44 @@ struct iio_backend *devm_iio_backend_get(struct device *dev, const char *name)
>  		return back;
>  	}
>  
> -	fwnode_handle_put(fwnode);
> +	fwnode_handle_put(fwnode_back);
>  	return ERR_PTR(-EPROBE_DEFER);
>  }

  parent reply	other threads:[~2024-06-29 18:54 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25 15:07 [PATCH v2 0/8] iio: adc: dfsdm: add scaling support Olivier Moysan
2024-06-25 15:07 ` [PATCH v2 1/8] iio: add read raw service to iio backend framework Olivier Moysan
2024-06-26  8:50   ` Nuno Sá
2024-06-26 16:12     ` Olivier MOYSAN
2024-06-29 18:48   ` Jonathan Cameron
2024-06-25 15:07 ` [PATCH v2 2/8] iio: add enable and disable services " Olivier Moysan
2024-06-25 15:07 ` [PATCH v2 3/8] iio: add child nodes support in " Olivier Moysan
2024-06-26  8:53   ` Nuno Sá
2024-06-29 18:54   ` Jonathan Cameron [this message]
2024-06-25 15:07 ` [PATCH v2 4/8] dt-bindings: iio: dfsdm: move to " Olivier Moysan
2024-06-28 21:35   ` Rob Herring
2024-07-03  8:28     ` Olivier MOYSAN
2024-06-25 15:07 ` [PATCH v2 5/8] dt-bindings: iio: add sigma delta modulator backend Olivier Moysan
2024-06-25 15:34   ` Conor Dooley
2024-06-26 16:40     ` Olivier MOYSAN
2024-06-27 16:13       ` Conor Dooley
2024-07-03  7:06         ` Olivier MOYSAN
2024-07-03  7:22         ` Olivier MOYSAN
2024-06-25 15:07 ` [PATCH v2 6/8] iio: adc: stm32-dfsdm: adopt generic channels bindings Olivier Moysan
2024-06-29 19:03   ` Jonathan Cameron
2024-06-25 15:07 ` [PATCH v2 7/8] iio: add sd modulator generic iio backend Olivier Moysan
2024-06-26  8:55   ` Nuno Sá
2024-06-25 15:07 ` [PATCH v2 8/8] iio: adc: stm32-dfsdm: add scaling support to dfsdm Olivier Moysan
2024-06-26  8:59   ` Nuno Sá
2024-06-26 16:15     ` Olivier MOYSAN

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=20240629195411.63a72497@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=fabrice.gasnier@foss.st.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=olivier.moysan@foss.st.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