From patchwork Thu Jan 4 14:38:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aishwarya Pant X-Patchwork-Id: 10144847 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 EB17F601A1 for ; Thu, 4 Jan 2018 14:41:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C609D286D1 for ; Thu, 4 Jan 2018 14:41:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB252286D3; Thu, 4 Jan 2018 14:41:52 +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=unavailable 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 69485286D1 for ; Thu, 4 Jan 2018 14:41:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753307AbeADOkq (ORCPT ); Thu, 4 Jan 2018 09:40:46 -0500 Received: from mail-pl0-f65.google.com ([209.85.160.65]:37092 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753275AbeADOiN (ORCPT ); Thu, 4 Jan 2018 09:38:13 -0500 Received: by mail-pl0-f65.google.com with SMTP id s3so1128353plp.4; Thu, 04 Jan 2018 06:38:13 -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=ys+yFroPKHNX/WYus61kEWZ4i/L3RyGQ6wV0yt0FeEU=; b=V6nlpZZzrZTmOS07CklndI8cZtTgweZ3S4yjHhm3nKN9l9QuSz3beWbbLMiQkqNWCb JII8qLMzxjAsjdBuPvzRa1BWeMvGO0j2iBTz8m30tpfTG3eSk29ScjxWDaimwyJvPWk1 LVSKUVqS9y3oMNoyjAndlF7w/7sjdX1QW5h95q1/ZLOz6d7emXkvUaP3FzYots16Kgg8 /nlfebnU85fiywOFflZEIewgLG9eOlku9f/oI4FNPbJr8CibuOQ07lIZsLCYyAEno9Ru o6/bqOxP618AcZqSaBgUuYW+u7RsDAlFQaeX5Tbjx9s0gtvtpoQ6BEgWBqPU/vGUCgWN cNAQ== 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=ys+yFroPKHNX/WYus61kEWZ4i/L3RyGQ6wV0yt0FeEU=; b=hiwBhr7Q/xdMsyXCYY8RHJevrTUm8Q6tSIz+1yJOpczBynNQN55EQhscQSet9fv9Ys IUNn866Qe1jMGV3QjyEHBGfOy3o7miBpRuEeP908aqnloyZUXZxzjUwSLGYFjKKbHQJn L0z6DCTY7CqgTSGzfzWZVU31JVZDqAVvBV78iQKqHRX1Zh/2OL6GomeQwMf3I3hnmBIr 84sUO6zu5l9OzC/4GuN5fF3D9zUVQsykLM9T3EPg9BPLErIn9Th87weGMaGu94VRzFmW lPetxJRvQpk5gGTTRIyLoO/YBiI7xS1nfE6ji+vxpilCd0yjYRQB8mXixkuvbvydF3PE IJeA== X-Gm-Message-State: AKGB3mK7Rmq2qL3VyRTEe+bTREYRRlBKCmfGUqIZASNSxv6bt/HQBKat H1HeFdBpeWFwehKVPD5Vdys= X-Google-Smtp-Source: ACJfBovu22Fb0k2vpQ1Bmo5cxCu0HSmFmh/X4RyiUSx2IQ6kZxrJGLbZNvqTNdHk5XQ5Ga9ev9g8uA== X-Received: by 10.159.197.5 with SMTP id bj5mr4900792plb.219.1515076692862; Thu, 04 Jan 2018 06:38:12 -0800 (PST) Received: from mordor.localdomain ([183.82.21.239]) by smtp.gmail.com with ESMTPSA id r86sm8997721pfk.114.2018.01.04.06.38.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Jan 2018 06:38:12 -0800 (PST) Date: Thu, 4 Jan 2018 20:08:06 +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 3/5] iio: trigger: 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-trigger.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c index ce66699c7fcc..d24e49a4bdcc 100644 --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c @@ -39,7 +39,7 @@ static LIST_HEAD(iio_trigger_list); static DEFINE_MUTEX(iio_trigger_list_lock); /** - * iio_trigger_read_name() - retrieve useful identifying name + * name_show() - retrieve useful identifying name * @dev: device associated with the iio_trigger * @attr: pointer to the device_attribute structure that is * being processed @@ -48,7 +48,7 @@ static DEFINE_MUTEX(iio_trigger_list_lock); * Return: a negative number on failure or the number of written * characters on success. */ -static ssize_t iio_trigger_read_name(struct device *dev, +static ssize_t name_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -56,7 +56,7 @@ static ssize_t iio_trigger_read_name(struct device *dev, return sprintf(buf, "%s\n", trig->name); } -static DEVICE_ATTR(name, S_IRUGO, iio_trigger_read_name, NULL); +static DEVICE_ATTR_RO(name); static struct attribute *iio_trig_dev_attrs[] = { &dev_attr_name.attr, @@ -358,7 +358,7 @@ void iio_dealloc_pollfunc(struct iio_poll_func *pf) EXPORT_SYMBOL_GPL(iio_dealloc_pollfunc); /** - * iio_trigger_read_current() - trigger consumer sysfs query current trigger + * current_trigger_show() - trigger consumer sysfs query current trigger * @dev: device associated with an industrial I/O device * @attr: pointer to the device_attribute structure that * is being processed @@ -370,7 +370,7 @@ EXPORT_SYMBOL_GPL(iio_dealloc_pollfunc); * Return: a negative number on failure, the number of characters written * on success or 0 if no trigger is available */ -static ssize_t iio_trigger_read_current(struct device *dev, +static ssize_t current_trigger_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -382,7 +382,7 @@ static ssize_t iio_trigger_read_current(struct device *dev, } /** - * iio_trigger_write_current() - trigger consumer sysfs set current trigger + * current_trigger_store() - trigger consumer sysfs set current trigger * @dev: device associated with an industrial I/O device * @attr: device attribute that is being processed * @buf: string buffer that holds the name of the trigger @@ -395,7 +395,7 @@ static ssize_t iio_trigger_read_current(struct device *dev, * Return: negative error code on failure or length of the buffer * on success */ -static ssize_t iio_trigger_write_current(struct device *dev, +static ssize_t current_trigger_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) @@ -456,9 +456,7 @@ static ssize_t iio_trigger_write_current(struct device *dev, return ret; } -static DEVICE_ATTR(current_trigger, S_IRUGO | S_IWUSR, - iio_trigger_read_current, - iio_trigger_write_current); +static DEVICE_ATTR_RW(current_trigger); static struct attribute *iio_trigger_consumer_attrs[] = { &dev_attr_current_trigger.attr,