From patchwork Sun Aug 7 23:31:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 9266589 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 1C31B6089F for ; Sun, 7 Aug 2016 23:32:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DDC4279B3 for ; Sun, 7 Aug 2016 23:32:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0395427BFF; Sun, 7 Aug 2016 23:32:40 +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 9E16B279B3 for ; Sun, 7 Aug 2016 23:32:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752136AbcHGXcO (ORCPT ); Sun, 7 Aug 2016 19:32:14 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:55675 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752070AbcHGXcN (ORCPT ); Sun, 7 Aug 2016 19:32:13 -0400 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=y6/FspV4NU22g4rOZFRgK8nutw5QDb77x0S3TCBguk8=; b=aHNsk1ClffAVlF mK8YJAEbWjp9pdFBj2KSBlsCM/hu1QXEoQjW5B0EvWB6Sp5tqxX+EkycxdgSGx0G+axhgNv7JYOm4 sCmucSIzzIIp6/REDQ8XroqwTJeUMUZpWjmdr0Y7IDzrWdrpnKv06cTG/ha3A2B1npbeD78W6D9U3 hlhWmiLR7m4Gu/rlBY0DHdS3h7HGKO4tGoixo9h8xGl2hV0ViD97QlhJHkFDzJaj0RmGJYq0JCI/j K27ocyXDPRnEIlx61asqefa9y0VIvnW1vPo6z48KlffcGTInwGVkj9MuXKwHBGxvPF3Ep/QUBls3/ lOvue5hv5xt/bJ5p8zkg==; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:42018 helo=localhost) by bh-25.webhostbox.net with esmtpa (Exim 4.86_1) (envelope-from ) id 1bWXYB-003bwK-O6; Sun, 07 Aug 2016 23:32:12 +0000 From: Guenter Roeck To: Jean Delvare Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck Subject: [PATCH 5/6] hwmon: (lm95241) Use BIT macro where appropriate Date: Sun, 7 Aug 2016 16:31:59 -0700 Message-Id: <1470612720-30165-5-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1470612720-30165-1-git-send-email-linux@roeck-us.net> References: <1470612720-30165-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 Drop some of the SHIFT defines since shift is implied with BIT(). Signed-off-by: Guenter Roeck --- drivers/hwmon/lm95241.c | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/drivers/hwmon/lm95241.c b/drivers/hwmon/lm95241.c index 507b32b67974..df94f486b21c 100644 --- a/drivers/hwmon/lm95241.c +++ b/drivers/hwmon/lm95241.c @@ -17,6 +17,7 @@ * GNU General Public License for more details. */ +#include #include #include #include @@ -50,29 +51,25 @@ static const unsigned short normal_i2c[] = { #define LM95241_REG_RW_REMOTE_MODEL 0x30 /* LM95241 specific bitfields */ -#define CFG_STOP 0x40 -#define CFG_CR0076 0x00 -#define CFG_CR0182 0x10 -#define CFG_CR1000 0x20 -#define CFG_CR2700 0x30 -#define CFG_CRMASK 0x30 -#define R1MS_SHIFT 0 -#define R2MS_SHIFT 2 -#define R1MS_MASK (0x01 << (R1MS_SHIFT)) -#define R2MS_MASK (0x01 << (R2MS_SHIFT)) -#define R1DF_SHIFT 1 -#define R2DF_SHIFT 2 -#define R1DF_MASK (0x01 << (R1DF_SHIFT)) -#define R2DF_MASK (0x01 << (R2DF_SHIFT)) -#define R1FE_MASK 0x01 -#define R2FE_MASK 0x05 -#define R1DM 0x01 -#define R2DM 0x02 -#define TT1_SHIFT 0 -#define TT2_SHIFT 4 -#define TT_OFF 0 -#define TT_ON 1 -#define TT_MASK 7 +#define CFG_STOP BIT(6) +#define CFG_CR0076 0x00 +#define CFG_CR0182 BIT(4) +#define CFG_CR1000 BIT(5) +#define CFG_CR2700 (BIT(4) | BIT(5)) +#define CFG_CRMASK (BIT(4) | BIT(5)) +#define R1MS_MASK BIT(0) +#define R2MS_MASK BIT(2) +#define R1DF_MASK BIT(1) +#define R2DF_MASK BIT(2) +#define R1FE_MASK BIT(0) +#define R2FE_MASK BIT(2) +#define R1DM BIT(0) +#define R2DM BIT(1) +#define TT1_SHIFT 0 +#define TT2_SHIFT 4 +#define TT_OFF 0 +#define TT_ON 1 +#define TT_MASK 7 #define NATSEMI_MAN_ID 0x01 #define LM95231_CHIP_ID 0xA1 #define LM95241_CHIP_ID 0xA4 @@ -148,7 +145,7 @@ static ssize_t show_input(struct device *dev, struct device_attribute *attr, int index = to_sensor_dev_attr(attr)->index; return snprintf(buf, PAGE_SIZE - 1, "%d\n", - index == 0 || (data->config & (1 << (index / 2))) ? + index == 0 || (data->config & BIT(index / 2)) ? temp_from_reg_signed(data->temp[index], data->temp[index + 1]) : temp_from_reg_unsigned(data->temp[index], data->temp[index + 1]));