Re: [PATCHv2] iio: iio-mux: use flexible array member
From: Andy Shevchenko
Date: Tue Mar 17 2026 - 03:28:12 EST
On Mon, Mar 16, 2026 at 04:29:42PM -0700, Rosen Penev wrote:
> Make it clear that there's trailing data
>
> Removes a pointer from the struct.
>
> Use array_size for the sizeof calculations. Slightly cleaner.
array_size()
sizeof()
This commit message is poorly written. Please, consult with
https://chris.beams.io/git-commit on how to write better commit
messages.
...
> struct mux {
> struct iio_channel *parent;
> struct iio_chan_spec *chan;
> struct iio_chan_spec_ext_info *ext_info;
> - struct mux_child *child;
> u32 delay_us;
> + struct mux_child child[];
> };
What's the point now to make it VLA? Again, why this and not the other one?
...
> mux = iio_priv(indio_dev);
> - mux->child = (struct mux_child *)(mux + 1);
> mux->chan = (struct iio_chan_spec *)(mux->child + children);
(This piece linked to the above comment.)
--
With Best Regards,
Andy Shevchenko