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: Bárbara Fernandes <barbara.fernandes@usp.br>
Signed-off-by: Wilson Sales <spoonm@spoonm.org>
Co-developed-by: Wilson Sales <spoonm@spoonm.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Bárbara Fernandes 2019-05-18 19:41:36 -03:00 committed by Jonathan Cameron
parent 1f48d05628
commit 0bae068509

View File

@ -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)
};
/*