From patchwork Thu Jan 4 14:37:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aishwarya Pant X-Patchwork-Id: 10144803 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 08F04601A1 for ; Thu, 4 Jan 2018 14:37:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDFAA286B1 for ; Thu, 4 Jan 2018 14:37:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2B25286BA; Thu, 4 Jan 2018 14:37:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16F4D286B1 for ; Thu, 4 Jan 2018 14:37:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753119AbeADOho (ORCPT ); Thu, 4 Jan 2018 09:37:44 -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 Received: by mail-pg0-f65.google.com with SMTP id t67so761104pgc.5; Thu, 04 Jan 2018 06:37:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=+2+Ctwrep66o/4crHIPPl1Bxwe29Ha9xtklqW2SnM4s=; b=bK6Z1DZ7g6zKWrIaDyiJqKvbzRvL0vCI10lJ6QjgM/OA/RBPWYAilFV23xRSwO4kCq KSVdEtHWiEuMrQnfaTSQwIUNZt1BygUMOpNL3SbNUxx4pSDlokHf+awTP2WPb2SvEBI1 Y0GNzlmxnR3Y1HljA6nCL4XZtQ6L0W0tWb8u4Gwnlg0EFsKAC48/3YrhE8IphMoZoD5R FCb8cQ+nBImO5GQwVgvauS+OhCs1wCrXT7/ME1guwgauIqMCm7/EeCKFhp/Da3dlk4Mq qOXMPiTYSlg+naSR8rjLhRL3TBDyK51meNmKqK2jy6iJinwjGdCFyQ8T/60aAeBpbjvp diYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=+2+Ctwrep66o/4crHIPPl1Bxwe29Ha9xtklqW2SnM4s=; b=Ns24UfL/Y7TEBvJeC/ANuvDRp4pc/M52dbkRpKmVih7Igjnn2doc9EPFmpJUmQt57B zNtSsxGQ5yBeZsFtSKmhY7iK1rH20VkYJyiAbqphFUD+pyTbz47g9zCv5PiCE2IMpZ6p S+YL4oRXGEMLla0y0KM0wMx3GPzM67YL2eEBiLDJrWKQYxPsb6+9GSApXZ2N+5F0AdWn dsYKkqcQLgYvpc1WcdgdxloEWwZyGElklNflRc2gSih1HldjcTKC75IuFkpteCl+vSF3 JfmojfdWLSBxfEFvhCkT5s3yCXrgnPvQqHlOSf1igrEqjAtbj6DVvh5W0rVVZJYSatxK 5X6Q== X-Gm-Message-State: AKGB3mLJ8W1nYl9GKNl7FVJXaBIlhQ3fqVpNPF+dIu5Hv6g8dPHXCZHQ WwHBtRgmNY3OQSC+k/K0ZkM= X-Google-Smtp-Source: ACJfBos3zwo4x7pkQI1macayPtZpnxlynfN7MkDhqm/m2BsnTs6vnPkDG9AyeojXgVaYntD3ZPgIVg== X-Received: by 10.99.190.72 with SMTP id g8mr4226048pgo.148.1515076662069; Thu, 04 Jan 2018 06:37:42 -0800 (PST) Received: from mordor.localdomain ([183.82.21.239]) by smtp.gmail.com with ESMTPSA id q14sm9383362pfg.34.2018.01.04.06.37.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Jan 2018 06:37:41 -0800 (PST) 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-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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) {