From patchwork Tue Dec 27 23:28:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 9489913 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 8846C602A7 for ; Tue, 27 Dec 2016 23:28:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BAE31FF1D for ; Tue, 27 Dec 2016 23:28:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6052A2094F; Tue, 27 Dec 2016 23:28:37 +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 0B27325F31 for ; Tue, 27 Dec 2016 23:28:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755296AbcL0X2g (ORCPT ); Tue, 27 Dec 2016 18:28:36 -0500 Received: from bh-25.webhostbox.net ([208.91.199.152]:55692 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755115AbcL0X2g (ORCPT ); Tue, 27 Dec 2016 18:28:36 -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=QhMRUVM08W4sFb+I7BWy9VTlvT5fQFf8fq2QBz1FxkM=; b=uiIzwcU+w8aNL5 BCsc/me0yD6+fT0Y5tb5c0fAaLh8/U87svYtUQ620QCAHdm6KMA6zmftNvALiAdKxWnUrQaKitnhm BTqGesA1HwF/v32Gko8VPjkRwxa9JwO7EO+HyTj4j4E0mJUbHAn8kMq4BRtnmnFSIkiBKbf2TVPck qG1kMZZcf9DtBi+Lzh1jwsC9f4HdjK9epbMRMBSbikYBehkAw4atwVl9/Z48suvaAgH14kFXtx5EF RHjTyeFRWJQwnOc6DE/eba4uDenTN3I52ucLvrDPZ6H4OMZMLamWvGt0bLNS/JUQwBXegAuHkb+G1 MGbJK31N3c6Pms5g36MQ==; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:51568 helo=localhost) by bh-25.webhostbox.net with esmtpa (Exim 4.86_1) (envelope-from ) id 1cM1AZ-0043zH-8W; Tue, 27 Dec 2016 23:28:35 +0000 From: Guenter Roeck To: Hardware Monitoring Cc: Jean Delvare , Guenter Roeck Subject: [PATCH 02/10] hwmon: (wm831x-hwmon) Replace macros generating sensor attributes Date: Tue, 27 Dec 2016 15:28:20 -0800 Message-Id: <1482881308-13550-3-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 ease conversion to SENSOR_DEVICE_ATTR_{RO,RW}. Signed-off-by: Guenter Roeck --- drivers/hwmon/wm831x-hwmon.c | 48 ++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/drivers/hwmon/wm831x-hwmon.c b/drivers/hwmon/wm831x-hwmon.c index a16cce72e4e2..46d32ae94167 100644 --- a/drivers/hwmon/wm831x-hwmon.c +++ b/drivers/hwmon/wm831x-hwmon.c @@ -79,25 +79,35 @@ static ssize_t show_label(struct device *dev, return sprintf(buf, "%s\n", input_names[channel]); } -#define WM831X_VOLTAGE(id, name) \ - static SENSOR_DEVICE_ATTR(in##id##_input, S_IRUGO, show_voltage, \ - NULL, name) - -#define WM831X_NAMED_VOLTAGE(id, name) \ - WM831X_VOLTAGE(id, name); \ - static SENSOR_DEVICE_ATTR(in##id##_label, S_IRUGO, show_label, \ - NULL, name) - -WM831X_VOLTAGE(0, WM831X_AUX_AUX1); -WM831X_VOLTAGE(1, WM831X_AUX_AUX2); -WM831X_VOLTAGE(2, WM831X_AUX_AUX3); -WM831X_VOLTAGE(3, WM831X_AUX_AUX4); - -WM831X_NAMED_VOLTAGE(4, WM831X_AUX_SYSVDD); -WM831X_NAMED_VOLTAGE(5, WM831X_AUX_USB); -WM831X_NAMED_VOLTAGE(6, WM831X_AUX_BATT); -WM831X_NAMED_VOLTAGE(7, WM831X_AUX_WALL); -WM831X_NAMED_VOLTAGE(8, WM831X_AUX_BKUP_BATT); +static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, + WM831X_AUX_AUX1); +static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, + WM831X_AUX_AUX2); +static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, + WM831X_AUX_AUX3); +static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_voltage, NULL, + WM831X_AUX_AUX4); +static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_voltage, NULL, + WM831X_AUX_SYSVDD); +static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_voltage, NULL, + WM831X_AUX_USB); +static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, + WM831X_AUX_BATT); +static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, + WM831X_AUX_WALL); +static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, show_voltage, NULL, + WM831X_AUX_BKUP_BATT); + +static SENSOR_DEVICE_ATTR(in4_label, S_IRUGO, show_label, NULL, + WM831X_AUX_SYSVDD); +static SENSOR_DEVICE_ATTR(in5_label, S_IRUGO, show_label, NULL, + WM831X_AUX_USB); +static SENSOR_DEVICE_ATTR(in6_label, S_IRUGO, show_label, NULL, + WM831X_AUX_BATT); +static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_label, NULL, + WM831X_AUX_WALL); +static SENSOR_DEVICE_ATTR(in8_label, S_IRUGO, show_label, NULL, + WM831X_AUX_BKUP_BATT); static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_chip_temp, NULL, WM831X_AUX_CHIP_TEMP);