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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <921b457e-fc3c-450f-a00c-1912ef9abae1@vaisala.com>
Date: Thu, 15 Jan 2026 09:48:51 +0200
From: Tomas Melin <tomas.melin@...sala.com>
To: Jonathan Cameron <jonathan.cameron@...wei.com>
Cc: Michael Hennerich <Michael.Hennerich@...log.com>,
 Nuno Sa <nuno.sa@...log.com>, Lars-Peter Clausen <lars@...afoo.de>,
 Jonathan Cameron <jic23@...nel.org>, David Lechner <dlechner@...libre.com>,
 Andy Shevchenko <andy@...nel.org>,
 Olivier Moysan <olivier.moysan@...s.st.com>, linux-iio@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/4] iio: industrialio-backend: support backend
 capabilities

Hi,

On 14/01/2026 14:28, Jonathan Cameron wrote:
> On Wed, 14 Jan 2026 10:45:51 +0000
> Tomas Melin <tomas.melin@...sala.com> wrote:
> 
>> Not all backends support the full set of capabilities provided by the
>> industrialio-backend framework. Capability bits can be used in frontends
>> and backends for checking for a certain feature set, or if using
>> related functions can be expected to fail.
>>
>> Capability bits should be set by a compatible backend and provided when
>> registering the backend.
>>
>> Signed-off-by: Tomas Melin <tomas.melin@...sala.com>
> Hi Tomas,
> 
> One thing inline.
> 
> Thanks
> 
> Jonathan
> 
> 
>> ---
>>  drivers/iio/industrialio-backend.c | 17 +++++++++++++++++
>>  include/linux/iio/backend.h        | 17 +++++++++++++++++
>>  2 files changed, 34 insertions(+)
>>
>> diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c
>> index 447b694d6d5f72dc6f018b1697fdb88e555bd61e..0a98fdd5df9db6cc233af819ac5243ba8cd5266f 100644
>> --- a/drivers/iio/industrialio-backend.c
>> +++ b/drivers/iio/industrialio-backend.c
>> @@ -56,6 +56,7 @@ struct iio_backend {
>>  	void *priv;
>>  	const char *name;
>>  	unsigned int cached_reg_addr;
>> +	u32 caps;
>>  	/*
>>  	 * This index is relative to the frontend. Meaning that for
>>  	 * frontends with multiple backends, this will be the index of this
>> @@ -774,6 +775,21 @@ int iio_backend_extend_chan_spec(struct iio_backend *back,
>>  }
>>  EXPORT_SYMBOL_NS_GPL(iio_backend_extend_chan_spec, "IIO_BACKEND");
>>  
>> +/**
>> + * iio_backend_has_caps - Check if backend has specific capabilities
>> + * @back: Backend device
>> + * @caps: Capabilities to check
>> + *
>> + * RETURNS:
>> + * Non-zero value if backend has all the requested capabilities,
> 
> It doesn't...   back->caps = 0x1, caps = 0x3 returns 0x1 which
> is non-zero.   I'd do
> return (back->caps & caps) == caps;
> 
> Though that also rather strongly indicates this would be better returning
> a bool.

Thanks for pointing this out, will fix and change to boolean return value.

Thanks,
Tomas


> 
> 
>> + * 0 otherwise.
>> + */
>> +int iio_backend_has_caps(struct iio_backend *back, u32 caps)
>> +{
>> +	return back->caps & caps;
>> +}
>> +EXPORT_SYMBOL_NS_GPL(iio_backend_has_caps, "IIO_BACKEND");
> 
> 
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ