From 8d05ffd2b8a08668cfea9e64a2991ab8ec9b494e Mon Sep 17 00:00:00 2001 From: Lukas Wunner Date: Sat, 25 Nov 2017 09:38:17 +0100 Subject: iio: Add macro to populate struct iio_map array The GPIO core provides a handy GPIO_LOOKUP() macro to populate a struct gpiod_lookup array without having to spell out attribute names (but still avoid breakage when attributes within the struct are rearranged or added). The axp288_adc.c driver uses a similar macro to populate a struct iio_map array. Make it available to others. Cc: Jacob Pan Signed-off-by: Lukas Wunner Acked-by: Chen-Yu Tsai Signed-off-by: Jonathan Cameron --- include/linux/iio/machine.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/linux/iio') diff --git a/include/linux/iio/machine.h b/include/linux/iio/machine.h index 1601a2a63a72..5e1cfa75f652 100644 --- a/include/linux/iio/machine.h +++ b/include/linux/iio/machine.h @@ -28,4 +28,11 @@ struct iio_map { void *consumer_data; }; +#define IIO_MAP(_provider_channel, _consumer_dev_name, _consumer_channel) \ +{ \ + .adc_channel_label = _provider_channel, \ + .consumer_dev_name = _consumer_dev_name, \ + .consumer_channel = _consumer_channel, \ +} + #endif -- cgit