On Thu, 18 Nov 2021 16:17:09 +0200 Antoniu Miclaus <antoniu.miclaus@xxxxxxxxxx> wrote: > The shared parameter should be configurable based on its usage, and not > constrained to IIO_SHARED_BY_TYPE. > > This patch aims to improve the flexibility in using the > IIO_ENUM_AVAILABLE define and avoid redefining custom iio enums that > expose the shared parameter. > > An example is the ad5766.c driver where IIO_ENUM_AVAILABLE_SHARED was > defined in order to achieve `shared` parameter customization. > > The current state of the IIO_ENUM_AVAILABLE implementation will imply > similar redefinitions each time a driver will require access to the > `shared` parameter. An example would be admv1013 driver which will > require custom device attribute for the frequency translation modes: > Quadrature I/Q mode and Intermediate frequency mode. > > Signed-off-by: Antoniu Miclaus <antoniu.miclaus@xxxxxxxxxx> I'm fine with the change subject to comments below, Jonathan > --- > drivers/iio/accel/bma180.c | 2 +- > drivers/iio/accel/mma9553.c | 2 +- > drivers/iio/adc/ad7192.c | 2 +- > drivers/iio/adc/hi8435.c | 2 +- > drivers/iio/dac/ad5064.c | 4 ++-- > drivers/iio/dac/ad5380.c | 2 +- > drivers/iio/dac/ad5446.c | 2 +- > drivers/iio/dac/ad5504.c | 2 +- > drivers/iio/dac/ad5624r_spi.c | 2 +- > drivers/iio/dac/ad5686.c | 2 +- > drivers/iio/dac/ad5766.c | 13 ++----------- > drivers/iio/dac/ad5791.c | 2 +- > drivers/iio/dac/max5821.c | 2 +- > drivers/iio/dac/mcp4725.c | 8 ++++---- > drivers/iio/dac/stm32-dac.c | 2 +- > drivers/iio/dac/ti-dac082s085.c | 2 +- > drivers/iio/dac/ti-dac5571.c | 2 +- > drivers/iio/dac/ti-dac7311.c | 2 +- > drivers/iio/magnetometer/hmc5843_core.c | 4 ++-- > drivers/iio/trigger/stm32-timer-trigger.c | 4 ++-- > include/linux/iio/iio.h | 5 +++-- > 21 files changed, 30 insertions(+), 38 deletions(-) > > diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c > index 2edfcb4819b7..09496f358ad9 100644 > --- a/drivers/iio/accel/bma180.c > +++ b/drivers/iio/accel/bma180.c > @@ -658,7 +658,7 @@ static const struct iio_chan_spec_ext_info bma023_ext_info[] = { > > static const struct iio_chan_spec_ext_info bma180_ext_info[] = { > IIO_ENUM("power_mode", IIO_SHARED_BY_TYPE, &bma180_power_mode_enum), > - IIO_ENUM_AVAILABLE("power_mode", &bma180_power_mode_enum), > + IIO_ENUM_AVAILABLE("power_mode", IIO_SHARED_BY_TYPE, &bma180_power_mode_enum), > IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, bma180_accel_get_mount_matrix), > { } > }; > diff --git a/drivers/iio/accel/mma9553.c b/drivers/iio/accel/mma9553.c > index ba3ecb3b57dc..0570ab1cc064 100644 > --- a/drivers/iio/accel/mma9553.c > +++ b/drivers/iio/accel/mma9553.c > @@ -917,7 +917,7 @@ static const struct iio_enum mma9553_calibgender_enum = { > > static const struct iio_chan_spec_ext_info mma9553_ext_info[] = { > IIO_ENUM("calibgender", IIO_SHARED_BY_TYPE, &mma9553_calibgender_enum), > - IIO_ENUM_AVAILABLE("calibgender", &mma9553_calibgender_enum), > + IIO_ENUM_AVAILABLE("calibgender", IIO_SHARED_BY_TYPE, &mma9553_calibgender_enum), > {}, > }; > > diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c > index 2121a812b0c3..7cb1bd3ea375 100644 > --- a/drivers/iio/adc/ad7192.c > +++ b/drivers/iio/adc/ad7192.c > @@ -257,7 +257,7 @@ static const struct iio_chan_spec_ext_info ad7192_calibsys_ext_info[] = { > }, > IIO_ENUM("sys_calibration_mode", IIO_SEPARATE, > &ad7192_syscalib_mode_enum), > - IIO_ENUM_AVAILABLE("sys_calibration_mode", &ad7192_syscalib_mode_enum), > + IIO_ENUM_AVAILABLE("sys_calibration_mode", IIO_SHARED_BY_TYPE, &ad7192_syscalib_mode_enum), Please wrap the lines to 80 chars unless strong reason not to do so. > diff --git a/drivers/iio/magnetometer/hmc5843_core.c b/drivers/iio/magnetometer/hmc5843_core.c > index f08726bf5ec3..4364d7fa066e 100644 > --- a/drivers/iio/magnetometer/hmc5843_core.c > +++ b/drivers/iio/magnetometer/hmc5843_core.c > @@ -246,7 +246,7 @@ static const struct iio_enum hmc5843_meas_conf_enum = { > > static const struct iio_chan_spec_ext_info hmc5843_ext_info[] = { > IIO_ENUM("meas_conf", IIO_SHARED_BY_TYPE, &hmc5843_meas_conf_enum), > - IIO_ENUM_AVAILABLE("meas_conf", &hmc5843_meas_conf_enum), > + IIO_ENUM_AVAILABLE("meas_conf", IIO_SHARED_BY_TYPE, &hmc5843_meas_conf_enum), > IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, hmc5843_get_mount_matrix), > { } > }; > @@ -261,7 +261,7 @@ static const struct iio_enum hmc5983_meas_conf_enum = { > static const struct iio_chan_spec_ext_info hmc5983_ext_info[] = { > IIO_ENUM("meas_conf", IIO_SHARED_BY_TYPE, &hmc5983_meas_conf_enum), > IIO_ENUM_AVAILABLE("meas_conf", &hmc5983_meas_conf_enum), > - IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, hmc5843_get_mount_matrix), > + IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, IIO_SHARED_BY_TYPE, hmc5843_get_mount_matrix), Wrong macro. (I cheated on this as 0-day already spotted it :) > Thanks, Jonathan