From patchwork Tue Dec 27 23:28:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 9489923 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 49947602A7 for ; Tue, 27 Dec 2016 23:28:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2CB951FF1D for ; Tue, 27 Dec 2016 23:28:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1FF722094F; Tue, 27 Dec 2016 23:28:41 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 C760E1FF1D for ; Tue, 27 Dec 2016 23:28:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932763AbcL0X2k (ORCPT ); Tue, 27 Dec 2016 18:28:40 -0500 Received: from bh-25.webhostbox.net ([208.91.199.152]:55745 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932719AbcL0X2k (ORCPT ); Tue, 27 Dec 2016 18:28:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=References:In-Reply-To:Message-Id:Date:Subject: Cc:To:From; bh=m/J+XY6AYmuWfLmHh9BgrPrZ8mVIM1b1xG+EXvhal30=; b=OvJ2EbdhWI8qYD AtlcoZXPAJNrEK7RVeQrFYlpwdDiRFkHCFnDth3Sx3eyLZ0K4fNsVPi/yLzrl5Mb/1T68NKspVRkG RW1y6bTVCfZmoaZ0Zi89oTq45WB3xogrrnhCksJbjzIAUyAJ3r7dKRuaZyj8GelfAN/S9McagL3OX JoP6ZdRE9XWeV0MXP5h159zARvavSJw9/CfTZ5lMGHHcjywbgmr97LPsFvJf3EIAmw7ekBg528HWn hQZAbdKMdQscb7DfhaZYIbVu94LDU392MZ+PL+wjbyJ1EL3PN3WEt0/xUFSZeYcFYVOs/u6tYQjwd smmXZPboV19P2hd/Ssnw==; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:51578 helo=localhost) by bh-25.webhostbox.net with esmtpa (Exim 4.86_1) (envelope-from ) id 1cM1Ad-0044AU-7J; Tue, 27 Dec 2016 23:28:39 +0000 From: Guenter Roeck To: Hardware Monitoring Cc: Jean Delvare , Guenter Roeck Subject: [PATCH 06/10] hwmon: (ultra45_env) Replace macros generating sensor attributes Date: Tue, 27 Dec 2016 15:28:24 -0800 Message-Id: <1482881308-13550-7-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482881308-13550-1-git-send-email-linux@roeck-us.net> References: <1482881308-13550-1-git-send-email-linux@roeck-us.net> X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: 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 Replace macros generating sensor attributes with explicit code to simplify conversion to SENSOR_DEVICE_ATTR_{RO,RW}. Signed-off-by: Guenter Roeck --- drivers/hwmon/ultra45_env.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/hwmon/ultra45_env.c b/drivers/hwmon/ultra45_env.c index f2816c7c918f..a74f21d6e0bc 100644 --- a/drivers/hwmon/ultra45_env.c +++ b/drivers/hwmon/ultra45_env.c @@ -144,17 +144,25 @@ static ssize_t show_fan_fault(struct device *dev, struct device_attribute *attr, return sprintf(buf, "%d\n", (val & (1 << fan_nr)) ? 1 : 0); } -#define fan(index) \ -static SENSOR_DEVICE_ATTR(fan##index##_speed, S_IRUGO | S_IWUSR, \ - show_fan_speed, set_fan_speed, index); \ -static SENSOR_DEVICE_ATTR(fan##index##_fault, S_IRUGO, \ - show_fan_fault, NULL, index) - -fan(0); -fan(1); -fan(2); -fan(3); -fan(4); +static SENSOR_DEVICE_ATTR(fan0_speed, S_IRUGO | S_IWUSR, + show_fan_speed, set_fan_speed, 0); +static SENSOR_DEVICE_ATTR(fan0_fault, S_IRUGO, show_fan_fault, NULL, 0); + +static SENSOR_DEVICE_ATTR(fan1_speed, S_IRUGO | S_IWUSR, + show_fan_speed, set_fan_speed, 1); +static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, show_fan_fault, NULL, 1); + +static SENSOR_DEVICE_ATTR(fan2_speed, S_IRUGO | S_IWUSR, + show_fan_speed, set_fan_speed, 2); +static SENSOR_DEVICE_ATTR(fan2_fault, S_IRUGO, show_fan_fault, NULL, 2); + +static SENSOR_DEVICE_ATTR(fan3_speed, S_IRUGO | S_IWUSR, + show_fan_speed, set_fan_speed, 3); +static SENSOR_DEVICE_ATTR(fan3_fault, S_IRUGO, show_fan_fault, NULL, 3); + +static SENSOR_DEVICE_ATTR(fan4_speed, S_IRUGO | S_IWUSR, + show_fan_speed, set_fan_speed, 4); +static SENSOR_DEVICE_ATTR(fan4_fault, S_IRUGO, show_fan_fault, NULL, 4); static SENSOR_DEVICE_ATTR(psu_fan_fault, S_IRUGO, show_fan_fault, NULL, 6);