summaryrefslogtreecommitdiff
path: root/drivers/iio/industrialio-buffer.c
diff options
context:
space:
mode:
authorJoe Simmons-Talbott <joetalbott@gmail.com>2022-06-01 21:54:14 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2022-06-16 00:07:10 +0300
commit9cf0b618599487f456ef5596dd30b5c162291e3c (patch)
treef8105bdd5eb404979f316b50b54d5f3ed112d0cd /drivers/iio/industrialio-buffer.c
parent79b584ed12a08392baa4c498be1396c504b1e071 (diff)
downloadlinux-9cf0b618599487f456ef5596dd30b5c162291e3c.tar.xz
iio: Use octal permissions and DEVICE_ATTR_{RO,RW}.
As reported by checkpatch.pl. Where possible use DEVICE_ATTR_RO(), DEVICE_ATTR_RW(), and __ATTR_RO(). Change function names to be <var>_show() for read and <var>_store() for write. Suggested-by: Joe Perches <joe@perches.com> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Joe Simmons-Talbott <joetalbott@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20220601185414.251571-1-joetalbott@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/industrialio-buffer.c')
-rw-r--r--drivers/iio/industrialio-buffer.c56
1 files changed, 21 insertions, 35 deletions
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index 06141ca27e1f..3d2b7712a8e6 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -630,18 +630,16 @@ static int iio_buffer_add_channel_sysfs(struct iio_dev *indio_dev,
return ret;
}
-static ssize_t iio_buffer_read_length(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t length_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
{
struct iio_buffer *buffer = to_iio_dev_attr(attr)->buffer;
return sysfs_emit(buf, "%d\n", buffer->length);
}
-static ssize_t iio_buffer_write_length(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t len)
+static ssize_t length_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t len)
{
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct iio_buffer *buffer = to_iio_dev_attr(attr)->buffer;
@@ -672,9 +670,8 @@ out:
return ret ? ret : len;
}
-static ssize_t iio_buffer_show_enable(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t enable_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
{
struct iio_buffer *buffer = to_iio_dev_attr(attr)->buffer;
@@ -1292,10 +1289,8 @@ void iio_disable_all_buffers(struct iio_dev *indio_dev)
iio_buffer_deactivate_all(indio_dev);
}
-static ssize_t iio_buffer_store_enable(struct device *dev,
- struct device_attribute *attr,
- const char *buf,
- size_t len)
+static ssize_t enable_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t len)
{
int ret;
bool requested_state;
@@ -1325,19 +1320,17 @@ done:
return (ret < 0) ? ret : len;
}
-static ssize_t iio_buffer_show_watermark(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t watermark_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
{
struct iio_buffer *buffer = to_iio_dev_attr(attr)->buffer;
return sysfs_emit(buf, "%u\n", buffer->watermark);
}
-static ssize_t iio_buffer_store_watermark(struct device *dev,
- struct device_attribute *attr,
- const char *buf,
- size_t len)
+static ssize_t watermark_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t len)
{
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct iio_buffer *buffer = to_iio_dev_attr(attr)->buffer;
@@ -1369,9 +1362,8 @@ out:
return ret ? ret : len;
}
-static ssize_t iio_dma_show_data_available(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t data_available_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
struct iio_buffer *buffer = to_iio_dev_attr(attr)->buffer;
@@ -1394,18 +1386,12 @@ static ssize_t direction_show(struct device *dev,
}
}
-static DEVICE_ATTR(length, S_IRUGO | S_IWUSR, iio_buffer_read_length,
- iio_buffer_write_length);
-static struct device_attribute dev_attr_length_ro = __ATTR(length,
- S_IRUGO, iio_buffer_read_length, NULL);
-static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR,
- iio_buffer_show_enable, iio_buffer_store_enable);
-static DEVICE_ATTR(watermark, S_IRUGO | S_IWUSR,
- iio_buffer_show_watermark, iio_buffer_store_watermark);
-static struct device_attribute dev_attr_watermark_ro = __ATTR(watermark,
- S_IRUGO, iio_buffer_show_watermark, NULL);
-static DEVICE_ATTR(data_available, S_IRUGO,
- iio_dma_show_data_available, NULL);
+static DEVICE_ATTR_RW(length);
+static struct device_attribute dev_attr_length_ro = __ATTR_RO(length);
+static DEVICE_ATTR_RW(enable);
+static DEVICE_ATTR_RW(watermark);
+static struct device_attribute dev_attr_watermark_ro = __ATTR_RO(watermark);
+static DEVICE_ATTR_RO(data_available);
static DEVICE_ATTR_RO(direction);
/*