lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240629195411.63a72497@jic23-huawei>
Date: Sat, 29 Jun 2024 19:54:11 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Olivier Moysan <olivier.moysan@...s.st.com>
Cc: <fabrice.gasnier@...s.st.com>, Nuno Sa <nuno.sa@...log.com>, Lars-Peter
 Clausen <lars@...afoo.de>, <linux-iio@...r.kernel.org>,
 <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 3/8] iio: add child nodes support in iio backend
 framework

On Tue, 25 Jun 2024 17:07:11 +0200
Olivier Moysan <olivier.moysan@...s.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@...s.st.com>
> Reviewed-by: Nuno Sa <nuno.sa@...log.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);
>  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ