Skip to content

Commit b3405ec

Browse files
dlechjic23
authored andcommitted
iio: common: cros_ec_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. Also drop obvious comment while we're at it. Signed-off-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
1 parent 404edaf commit b3405ec

2 files changed

Lines changed: 2 additions & 14 deletions

File tree

drivers/iio/common/cros_ec_sensors/cros_ec_activity.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,7 @@ static int cros_ec_sensors_probe(struct platform_device *pdev)
279279
channel++;
280280
}
281281

282-
/* Timestamp */
283-
channel->scan_index = index;
284-
channel->type = IIO_TIMESTAMP;
285-
channel->channel = -1;
286-
channel->scan_type.sign = 's';
287-
channel->scan_type.realbits = 64;
288-
channel->scan_type.storagebits = 64;
282+
*channel = IIO_CHAN_SOFT_TIMESTAMP(index);
289283

290284
indio_dev->channels = st->channels;
291285
indio_dev->num_channels = index + 1;

drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,7 @@ static int cros_ec_sensors_probe(struct platform_device *pdev)
279279
}
280280
}
281281

282-
/* Timestamp */
283-
channel->type = IIO_TIMESTAMP;
284-
channel->channel = -1;
285-
channel->scan_index = CROS_EC_SENSOR_MAX_AXIS;
286-
channel->scan_type.sign = 's';
287-
channel->scan_type.realbits = 64;
288-
channel->scan_type.storagebits = 64;
282+
*channel = IIO_CHAN_SOFT_TIMESTAMP(CROS_EC_SENSOR_MAX_AXIS);
289283

290284
indio_dev->channels = state->channels;
291285
indio_dev->num_channels = CROS_EC_SENSORS_MAX_CHANNELS;

0 commit comments

Comments
 (0)