Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753330AbeADOhp (ORCPT + 1 other); Thu, 4 Jan 2018 09:37:45 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:38872 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753311AbeADOhm (ORCPT ); Thu, 4 Jan 2018 09:37:42 -0500 X-Google-Smtp-Source: ACJfBos3zwo4x7pkQI1macayPtZpnxlynfN7MkDhqm/m2BsnTs6vnPkDG9AyeojXgVaYntD3ZPgIVg== Date: Thu, 4 Jan 2018 20:07:35 +0530 From: Aishwarya Pant To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Julia Lawall , Joe Perches Subject: [PATCH 2/5] iio: core: use permission specific variants of DEVICE_ATTR Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: This is a clean-up patch which replaces DEVICE_ATTR macro with the file permission specific DEVICE_ATTR_{RO/WO/RW} macros for compaction and readability. Done using coccinelle. Signed-off-by: Aishwarya Pant --- drivers/iio/industrialio-core.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 19bdf3d2962a..d2ac544f192d 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -1253,7 +1253,7 @@ void iio_free_chan_devattr_list(struct list_head *attr_list) } } -static ssize_t iio_show_dev_name(struct device *dev, +static ssize_t name_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -1261,9 +1261,9 @@ static ssize_t iio_show_dev_name(struct device *dev, return snprintf(buf, PAGE_SIZE, "%s\n", indio_dev->name); } -static DEVICE_ATTR(name, S_IRUGO, iio_show_dev_name, NULL); +static DEVICE_ATTR_RO(name); -static ssize_t iio_show_timestamp_clock(struct device *dev, +static ssize_t current_timestamp_clock_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -1309,7 +1309,7 @@ static ssize_t iio_show_timestamp_clock(struct device *dev, return sz; } -static ssize_t iio_store_timestamp_clock(struct device *dev, +static ssize_t current_timestamp_clock_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { @@ -1340,8 +1340,7 @@ static ssize_t iio_store_timestamp_clock(struct device *dev, return len; } -static DEVICE_ATTR(current_timestamp_clock, S_IRUGO | S_IWUSR, - iio_show_timestamp_clock, iio_store_timestamp_clock); +static DEVICE_ATTR_RW(current_timestamp_clock); static int iio_device_register_sysfs(struct iio_dev *indio_dev) { -- 2.15.1