Commit 0bae0685 authored by Bárbara Fernandes's avatar Bárbara Fernandes Committed by Jonathan Cameron
Browse files

staging: iio: cdc: ad7150: create macro for capacitance channels



Create macro for capacitance channels in order to remove the repeated
code and improve its readability.

Signed-off-by: default avatarBárbara Fernandes <barbara.fernandes@usp.br>
Signed-off-by: default avatarWilson Sales <spoonm@spoonm.org>
Co-developed-by: default avatarWilson Sales <spoonm@spoonm.org>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 1f48d056
Loading
Loading
Loading
Loading
+12 −17
Original line number Diff line number Diff line
@@ -465,24 +465,19 @@ static const struct iio_event_spec ad7150_events[] = {
	},
};

#define AD7150_CAPACITANCE_CHAN(_chan)	{			\
		.type = IIO_CAPACITANCE,			\
		.indexed = 1,					\
		.channel = _chan,				\
		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |	\
		BIT(IIO_CHAN_INFO_AVERAGE_RAW),			\
		.event_spec = ad7150_events,			\
		.num_event_specs = ARRAY_SIZE(ad7150_events),	\
	}

static const struct iio_chan_spec ad7150_channels[] = {
	{
		.type = IIO_CAPACITANCE,
		.indexed = 1,
		.channel = 0,
		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
		BIT(IIO_CHAN_INFO_AVERAGE_RAW),
		.event_spec = ad7150_events,
		.num_event_specs = ARRAY_SIZE(ad7150_events),
	}, {
		.type = IIO_CAPACITANCE,
		.indexed = 1,
		.channel = 1,
		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
		BIT(IIO_CHAN_INFO_AVERAGE_RAW),
		.event_spec = ad7150_events,
		.num_event_specs = ARRAY_SIZE(ad7150_events),
	},
	AD7150_CAPACITANCE_CHAN(0),
	AD7150_CAPACITANCE_CHAN(1)
};

/*