On 12/5/24 2:47 PM, Christophe JAILLET wrote: > The commit in Fixes add a special case when only one possible scale is > available. > If several scales are available, it sets the .read_avail field of the > struct iio_info to ad9467_read_avail(). > > However, this field already holds this function pointer, so the code is a > no-op. > > Update ad9467_info to actually reflect the intent described in the commit > message. Keep .read_avail to NULL, unless it is changed to > ad9467_read_avail() in the probe at runtime. > > Fixes: b92f94f74826 ("iio: adc: ad9467: don't allow reading vref if not available") > Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx> > --- > This patch is compile tested only and is completely speculative. > > Another solution would be to keep ad9467_info as a const struct as it was > before and add a new ad9467_info_no_read structure. Yes, making it static const again would be best. Modifying static structs that are shared between all instances like this based on the properties of a single instance is asking for trouble down the road. > This way, instead of writing in the structure itself, we would choose at > runtime which version to use. The main benefit would be keep this structure > with function pointer const. > ---