From patchwork Thu Jan 4 14:37:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aishwarya Pant X-Patchwork-Id: 10144797 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 51C75601A1 for ; Thu, 4 Jan 2018 14:37:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 437142869D for ; Thu, 4 Jan 2018 14:37:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38597286B7; Thu, 4 Jan 2018 14:37:23 +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 B923D2869D for ; Thu, 4 Jan 2018 14:37:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753135AbeADOhW (ORCPT ); Thu, 4 Jan 2018 09:37:22 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:42935 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753174AbeADOhV (ORCPT ); Thu, 4 Jan 2018 09:37:21 -0500 Received: by mail-pl0-f66.google.com with SMTP id bd8so1125304plb.9; Thu, 04 Jan 2018 06:37:21 -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=u45qJOgiWfKsuTiOLXu/h3ViUX5xVRkvVcMVObADvIA=; b=euAx4APKx7hwgUyJLxzR+EYr+X1q3cF+/JVacfsX4/64gCDKqt/b1+VR54rVKHGOAy S89ioHiR7vVKVgI8GkLLJtQq9mxq26c43I2e0Z4O0J2VrAdAg9uNRJ8PQcoy7GeR1sKP 1OuAClNomKU+DaVqnMb+xX926f04zzQjW0VtjrHAPlfpR1EpktOPV6c/V0GMF1LPs/p3 BK+q/MMC2bllKIDXK2SgxV4CQ64zoiNuIXunzS7WT0cyqQfwJvjJHRJF8vpaRf17fXoO k2WWj4gT08qKFvK6IbuGTTBhVBn+AgB9CxuNY2Fkv/jQo2fvhGOtr/4tGwjojYxep0bf aUpw== 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=u45qJOgiWfKsuTiOLXu/h3ViUX5xVRkvVcMVObADvIA=; b=GMBfFPv3ceNzCA8HupZjy6yaKqvfccIo+M36DPkqiJzKyBvCF4tXntU/mxkkhQKviB X6vw3BEtOmYZAedTq6yI11iuvPc3Vh3w/nOSEoYGjTKjUebO8kOfWg1tVLo9Z8wroPpC +t/0uoj8jSbQfB2ZYSdoCiF7jXyR2v9exSvSfxMFhxtlOOh7MNv99PJp7J6R7u5mY4Nk ZyS8Ft9mpY4ZCBsBbcJdHkJhnLlvg/XqJ+fXSm4Tu85hqVkRV5H7ovjUXSU4zlq1QYt9 IkrfrDRy1sLDeiI7PIUutABsmEjbplLoI+48GcMsOVWzLYvQBZ1B8TJD3ZpiUd3virdZ zYPw== X-Gm-Message-State: AKGB3mLfD9eRaN7qtF3u3X1nai1vEjmysNMNlAwCusftkXEW5sU9KJ/k t8lc6ZcNUV5m+2TZK/6gt+A= X-Google-Smtp-Source: ACJfBoumtME6AdJqKH+7txzwj5UsTPq48nmJ/vMAuWJXnuymkjStwupXESXMXd49HYE03t+vu53gGA== X-Received: by 10.84.246.20 with SMTP id k20mr4895160pll.209.1515076640640; Thu, 04 Jan 2018 06:37:20 -0800 (PST) Received: from mordor.localdomain ([183.82.21.239]) by smtp.gmail.com with ESMTPSA id q72sm10043746pfi.42.2018.01.04.06.37.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Jan 2018 06:37:20 -0800 (PST) Date: Thu, 4 Jan 2018 20:07:14 +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 1/5] iio: buffer: 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-buffer.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index d2b465140a6b..ca565fbcff90 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -497,7 +497,7 @@ static int iio_buffer_add_channel_sysfs(struct iio_dev *indio_dev, return ret; } -static ssize_t iio_buffer_read_length(struct device *dev, +static ssize_t length_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -507,7 +507,7 @@ static ssize_t iio_buffer_read_length(struct device *dev, return sprintf(buf, "%d\n", buffer->length); } -static ssize_t iio_buffer_write_length(struct device *dev, +static ssize_t length_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { @@ -540,7 +540,7 @@ static ssize_t iio_buffer_write_length(struct device *dev, return ret ? ret : len; } -static ssize_t iio_buffer_show_enable(struct device *dev, +static ssize_t enable_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -1117,7 +1117,7 @@ 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, +static ssize_t enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) @@ -1153,7 +1153,7 @@ static ssize_t iio_buffer_store_enable(struct device *dev, static const char * const iio_scan_elements_group_name = "scan_elements"; -static ssize_t iio_buffer_show_watermark(struct device *dev, +static ssize_t watermark_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -1163,7 +1163,7 @@ static ssize_t iio_buffer_show_watermark(struct device *dev, return sprintf(buf, "%u\n", buffer->watermark); } -static ssize_t iio_buffer_store_watermark(struct device *dev, +static ssize_t watermark_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) @@ -1198,16 +1198,13 @@ static ssize_t iio_buffer_store_watermark(struct device *dev, return ret ? ret : len; } -static DEVICE_ATTR(length, S_IRUGO | S_IWUSR, iio_buffer_read_length, - iio_buffer_write_length); +static DEVICE_ATTR_RW(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); + S_IRUGO, length_show, NULL); +static DEVICE_ATTR_RW(enable); +static DEVICE_ATTR_RW(watermark); static struct device_attribute dev_attr_watermark_ro = __ATTR(watermark, - S_IRUGO, iio_buffer_show_watermark, NULL); + S_IRUGO, watermark_show, NULL); static struct attribute *iio_buffer_attrs[] = { &dev_attr_length.attr,