Re: [PATCH RFC 5/5] iio: sysfs: drop core-only fields from struct iio_dev_attr
From: Jonathan Cameron
Date: Fri Nov 20 2026 - 20:36:51 EST
On Fri, 20 Nov 2026 18:04:01 +0000
Rodrigo Alencar via B4 Relay <devnull+rodrigo.alencar.analog.com@xxxxxxxxxx> wrote:
> From: Rodrigo Alencar <rodrigo.alencar@xxxxxxxxxx>
>
> The list node, channel spec and buffer pointer of struct iio_dev_attr
> are now only used through struct iio_chan_attr and the types extending
> it. Remove them, so that attributes declared by drivers through
> IIO_DEVICE_ATTR*() and friends no longer carry them.
>
> On 64-bit, without lockdep, this shrinks struct iio_dev_attr from 72 to
> 40 bytes.
>
> Signed-off-by: Rodrigo Alencar <rodrigo.alencar@xxxxxxxxxx>
Trivial but I think it would be nicer to drop each element
as it stops being used in earlier patches. That would make
it obvious how things are migrating to each level of more specific
structure.
Overall I like this set. Bringing my horrible hacky mess
into the modern world :)
Core code though so I'm not going to jump on picking it up
until folk have had a good chance to look at it.
I was tempted though as it's been a long day and nice
to see something that reduces technical debt go in!
Passing comment inline. No actual changes suggested!
> ---
> include/linux/iio/sysfs.h | 9 ---------
> 1 file changed, 9 deletions(-)
>
> diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h
> index de5bb125815c..1e4122b8c13a 100644
> --- a/include/linux/iio/sysfs.h
> +++ b/include/linux/iio/sysfs.h
> @@ -9,23 +9,14 @@
> #ifndef _INDUSTRIAL_IO_SYSFS_H_
> #define _INDUSTRIAL_IO_SYSFS_H_
>
> -struct iio_buffer;
> -struct iio_chan_spec;
> -
> /**
> * struct iio_dev_attr - iio specific device attribute
> * @dev_attr: underlying device attribute
> * @address: associated register address
> - * @l: list head for maintaining list of dynamically created attrs
> - * @c: specification for the underlying channel
> - * @buffer: the IIO buffer to which this attribute belongs to (if any)
> */
> struct iio_dev_attr {
> struct device_attribute dev_attr;
> u64 address;
This is close to device_attribute_ext but I checked and there are few
if any points pushed into that address.
> - struct list_head l;
> - struct iio_chan_spec const *c;
> - struct iio_buffer *buffer;
> };
>
> #define to_iio_dev_attr(_dev_attr) \
>