summaryrefslogtreecommitdiff
path: root/drivers/iio/accel/bmc150-accel-core.c
diff options
context:
space:
mode:
authorMatti Vaittinen <mazziesaccount@gmail.com>2022-10-03 11:13:10 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2022-11-23 19:44:03 +0000
commitc02b2a5166a58823e8a335c486ee71ce4f22f2b7 (patch)
treef925eb47f7d7e1c3dcf257172dd073ca5b9fee8e /drivers/iio/accel/bmc150-accel-core.c
parentf7e6804509eeb27accc6625150db3f02d0b93ad7 (diff)
iio: bmc150-accel-core: Use IIO_STATIC_CONST_DEVICE_ATTR()
Slightly simplify by dropping open-coded constant data iio_dev_attr functions and using the IIO_STATIC_CONST_DEVICE_ATTR() instead. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Link: https://lore.kernel.org/r/b1b0d662705b43d68594639fb7719bc431101f79.1664782676.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/accel/bmc150-accel-core.c')
-rw-r--r--drivers/iio/accel/bmc150-accel-core.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c
index 92f8b139acce..b4a077944896 100644
--- a/drivers/iio/accel/bmc150-accel-core.c
+++ b/drivers/iio/accel/bmc150-accel-core.c
@@ -925,22 +925,9 @@ static const struct iio_chan_spec_ext_info bmc150_accel_ext_info[] = {
{ }
};
-static ssize_t hwfifo_watermark_min_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- return sysfs_emit(buf, "%s\n", "1");
-}
-
-static ssize_t hwfifo_watermark_max_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- return sysfs_emit(buf, "%s\n", __stringify(BMC150_ACCEL_FIFO_LENGTH));
-}
-
-static IIO_DEVICE_ATTR_RO(hwfifo_watermark_min, 0);
-static IIO_DEVICE_ATTR_RO(hwfifo_watermark_max, 0);
+IIO_STATIC_CONST_DEVICE_ATTR(hwfifo_watermark_min, "1");
+IIO_STATIC_CONST_DEVICE_ATTR(hwfifo_watermark_max,
+ __stringify(BMC150_ACCEL_FIFO_LENGTH));
static IIO_DEVICE_ATTR(hwfifo_enabled, S_IRUGO,
bmc150_accel_get_fifo_state, NULL, 0);
static IIO_DEVICE_ATTR(hwfifo_watermark, S_IRUGO,