[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4ee7d979736bb9e1518ce78ccb4a5b1a3766289c.camel@gmail.com>
Date: Wed, 19 Jun 2024 07:31:10 +0200
From: Nuno Sá <noname.nuno@...il.com>
To: Olivier Moysan <olivier.moysan@...s.st.com>, Nuno Sa
<nuno.sa@...log.com>, Jonathan Cameron <jic23@...nel.org>, Lars-Peter
Clausen <lars@...afoo.de>
Cc: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/8] iio: add child nodes support in iio backend
framework
On Tue, 2024-06-18 at 18:08 +0200, Olivier Moysan 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_subnode_get() to allow an IIO device
> backend consumer to configure backend phandles in its
> child nodes.
>
> Signed-off-by: Olivier Moysan <olivier.moysan@...s.st.com>
> ---
Again small notes nits. With it:
Reviewed-by: Nuno Sa <nuno.sa@...log.com>
> drivers/iio/industrialio-backend.c | 48 ++++++++++++++++++++++--------
> include/linux/iio/backend.h | 2 ++
> 2 files changed, 38 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-
> backend.c
> index d3db048c086b..e9d29131634d 100644
> --- a/drivers/iio/industrialio-backend.c
> +++ b/drivers/iio/industrialio-backend.c
> @@ -575,17 +575,8 @@ 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_node_get(struct device *dev, const
> char *name,
> + struct fwnode_handle *node)
I would call it __devm_iio_backend_fwnode_get(). Also the parameter node -> fwnode.
> {
> struct fwnode_handle *fwnode;
> struct iio_backend *back;
> @@ -602,7 +593,7 @@ 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);
> + fwnode = fwnode_find_reference(node, "io-backends", index);
> if (IS_ERR(fwnode)) {
> dev_err_probe(dev, PTR_ERR(fwnode),
> "Cannot get Firmware reference\n");
> @@ -625,8 +616,41 @@ struct iio_backend *devm_iio_backend_get(struct device *dev,
> const char *name)
> fwnode_handle_put(fwnode);
> return ERR_PTR(-EPROBE_DEFER);
> }
> +
> +/**
> + * 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)
> +{
> + return __devm_iio_backend_node_get(dev, name, dev_fwnode(dev));
> +}
> EXPORT_SYMBOL_NS_GPL(devm_iio_backend_get, IIO_BACKEND);
>
> +/**
> + * devm_iio_backend_subnode_get - Device managed backend device get
> + * @dev: Consumer device for the backend
> + * @name: Backend name
> + * @node: Firmware node of the backend consumer
> + *
> + * Get's the backend associated with @dev.
> + *
> + * RETURNS:
> + * A backend pointer, negative error pointer otherwise.
> + */
> +struct iio_backend *devm_iio_backend_subnode_get(struct device *dev, const char
> *name,
> + struct fwnode_handle *node)
Again, for consistency devm_iio_backend_fwnode_get(). And node -> fwnode
- Nuno Sá
Powered by blists - more mailing lists