mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
iio: common: scmi_sensors: simplify timestamp channel definition
Use IIO_CHAN_SOFT_TIMESTAMP() to define the timestamp channel instead of manually filling in the struct iio_chan_spec fields. This makes the code less verbose and mistake-prone. In fact, there was an error here as the sign should be 's' instead of 'u' which is now changed to 's' by using IIO_CHAN_SOFT_TIMESTAMP(). If we find that this breaks userspace, we will have to revert this change, but seems unlikely since the timestamp channel is well-known to be a signed 64-bit integer globally. Signed-off-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
8a2f9c41b9
commit
c73b6d7f0b
|
|
@ -419,17 +419,6 @@ static const struct iio_chan_spec_ext_info scmi_iio_ext_info[] = {
|
|||
{ }
|
||||
};
|
||||
|
||||
static void scmi_iio_set_timestamp_channel(struct iio_chan_spec *iio_chan,
|
||||
int scan_index)
|
||||
{
|
||||
iio_chan->type = IIO_TIMESTAMP;
|
||||
iio_chan->channel = -1;
|
||||
iio_chan->scan_index = scan_index;
|
||||
iio_chan->scan_type.sign = 'u';
|
||||
iio_chan->scan_type.realbits = 64;
|
||||
iio_chan->scan_type.storagebits = 64;
|
||||
}
|
||||
|
||||
static void scmi_iio_set_data_channel(struct iio_chan_spec *iio_chan,
|
||||
enum iio_chan_type type,
|
||||
enum iio_modifier mod, int scan_index)
|
||||
|
|
@ -629,7 +618,7 @@ scmi_alloc_iiodev(struct scmi_device *sdev,
|
|||
"Error in registering sensor update notifier for sensor %s\n",
|
||||
sensor->sensor_info->name);
|
||||
|
||||
scmi_iio_set_timestamp_channel(&iio_channels[i], i);
|
||||
iio_channels[i] = IIO_CHAN_SOFT_TIMESTAMP(i);
|
||||
iiodev->channels = iio_channels;
|
||||
return iiodev;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user