From patchwork Mon Dec 10 22:08:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 10722613 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4650F6C5 for ; Mon, 10 Dec 2018 22:08:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36BC22A499 for ; Mon, 10 Dec 2018 22:08:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B0F12A4B0; Mon, 10 Dec 2018 22:08:59 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 8C1CA2A4B4 for ; Mon, 10 Dec 2018 22:08:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729065AbeLJWI5 (ORCPT ); Mon, 10 Dec 2018 17:08:57 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:46026 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729444AbeLJWI5 (ORCPT ); Mon, 10 Dec 2018 17:08:57 -0500 Received: by mail-pg1-f195.google.com with SMTP id y4so5599772pgc.12 for ; Mon, 10 Dec 2018 14:08:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=n3w1imSRR2n8q3DgcXtFYKJEMyJMeKsVEQwNVSC2Nes=; b=ptQpDCp5SSKsOeL7G92ao7+eNCPQ1Rx2klT3ZH0UMivX+qOWYzoU4aHDFqzaiw6Sqg KV1SiBZLozBEHxUqew6yOnXNzRkImplK/ya5RZUzVno/MR3T19BBSWWmF775SeI9Ix7t 6Sl7qZ66DZQHx6UBRl+lWGonbBmDaOHVKfsd9di2bM5y4P5FV8oR29SdJyls+CGLc4Nd 1sROZiPVerKVcLrVPOv6F/UIldBN1Sp3HDrTSP8PUmezNne9Mdtv26jqJVf7iTjSZYkR lNs9TXfCmezpQq8AEzYD4avhMxVvbTv4fu8jdN5goPWi3ZYRCX1X5/aR8bBI3jyFDLWx 2j5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=n3w1imSRR2n8q3DgcXtFYKJEMyJMeKsVEQwNVSC2Nes=; b=otAriBVWpjNiiECVFs4BBdF3eOybceYqqFBQ5mqvmm5dD1I2EVisAPsoMbhDEh9uiy 7gmQtrWMTTrraudlI/GhI68szJAIN3j48hp3HetjDDG1J8APOWDBuhN+5H4khIFDbbVV pY7P+691XHnEfif6xdZT1MICqYfF7P3+H8elRNJH9UFFUflQcJRT3AUTVdNDTA7oCOw8 7PMi2EApYTr8OLQqBnPESdC5cEJT8cswmrl4H/I/UXI16+kjYYXtXJThA1ok8YdSfsrB cjS63AQv1KdMifDlo4z16dYFMO7gwfWTYdTz9w18CVR+9lubmZQy4w0bbNHsU0AIWete FQBQ== X-Gm-Message-State: AA+aEWYzNCx9BHK0rCsQxiCaAuuNihKsUhUdKX5MqxAk1SXkr10AAZTT h9iat2GTOsJNTgawWKT05SsdoeH/ X-Google-Smtp-Source: AFSGD/UTb9AJrvQU02Ny7HEetyfF3GQZ63J5DOMt4NOFMVJMU4pJ6Z+tinB6f4WKBEYfKONIGCRheQ== X-Received: by 2002:a63:b218:: with SMTP id x24mr12014972pge.223.1544479736285; Mon, 10 Dec 2018 14:08:56 -0800 (PST) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id d202sm20884137pfd.58.2018.12.10.14.08.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Dec 2018 14:08:55 -0800 (PST) From: Guenter Roeck To: Hardware Monitoring Cc: Jean Delvare , Guenter Roeck Subject: [PATCH 03/30] hwmon: (ad7314) Use permission specific SENSOR[_DEVICE]_ATTR variants Date: Mon, 10 Dec 2018 14:08:21 -0800 Message-Id: <1544479728-30077-4-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544479728-30077-1-git-send-email-linux@roeck-us.net> References: <1544479728-30077-1-git-send-email-linux@roeck-us.net> Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, and to reduce the chance of inconsistencies. Also replace any remaining S_ in the driver with octal values. The conversion was done automatically with coccinelle. The semantic patches and the scripts used to generate this commit log are available at https://github.com/groeck/coccinelle-patches/hwmon/. This patch does not introduce functional changes. It was verified by compiling the old and new files and comparing text and data sizes. Signed-off-by: Guenter Roeck --- drivers/hwmon/ad7314.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/ad7314.c b/drivers/hwmon/ad7314.c index 8ea35932fbaa..be521bdae114 100644 --- a/drivers/hwmon/ad7314.c +++ b/drivers/hwmon/ad7314.c @@ -53,9 +53,9 @@ static int ad7314_spi_read(struct ad7314_data *chip) return be16_to_cpu(chip->rx); } -static ssize_t ad7314_show_temperature(struct device *dev, - struct device_attribute *attr, - char *buf) +static ssize_t ad7314_temperature_show(struct device *dev, + struct device_attribute *attr, + char *buf) { struct ad7314_data *chip = dev_get_drvdata(dev); s16 data; @@ -87,8 +87,7 @@ static ssize_t ad7314_show_temperature(struct device *dev, } } -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, - ad7314_show_temperature, NULL, 0); +static SENSOR_DEVICE_ATTR_RO(temp1_input, ad7314_temperature, 0); static struct attribute *ad7314_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr,