Commit c1531e3a authored by Matti Vaittinen's avatar Matti Vaittinen Committed by Jonathan Cameron
Browse files

iio: at91-sama5d2_adc: 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: default avatarMatti Vaittinen <mazziesaccount@gmail.com>
Tested-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/4476a4ce852febb3eb863878e66751c787195b18.1664782676.git.mazziesaccount@gmail.com


Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent c02b2a51
Loading
Loading
Loading
Loading
+3 −16
Original line number Diff line number Diff line
@@ -2193,26 +2193,13 @@ static ssize_t at91_adc_get_watermark(struct device *dev,
	return scnprintf(buf, PAGE_SIZE, "%d\n", st->dma_st.watermark);
}

static ssize_t hwfifo_watermark_min_show(struct device *dev,
					 struct device_attribute *attr,
					 char *buf)
{
	return sysfs_emit(buf, "%s\n", "2");
}

static ssize_t hwfifo_watermark_max_show(struct device *dev,
					 struct device_attribute *attr,
					 char *buf)
{
	return sysfs_emit(buf, "%s\n", AT91_HWFIFO_MAX_SIZE_STR);
}

static IIO_DEVICE_ATTR(hwfifo_enabled, 0444,
		       at91_adc_get_fifo_state, NULL, 0);
static IIO_DEVICE_ATTR(hwfifo_watermark, 0444,
		       at91_adc_get_watermark, NULL, 0);
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, "2");
IIO_STATIC_CONST_DEVICE_ATTR(hwfifo_watermark_max, AT91_HWFIFO_MAX_SIZE_STR);

static const struct attribute *at91_adc_fifo_attributes[] = {
	&iio_dev_attr_hwfifo_watermark_min.dev_attr.attr,