From patchwork Tue Jun 28 01:22:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenyou Yang X-Patchwork-Id: 9201629 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 8522060752 for ; Tue, 28 Jun 2016 01:37:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 758B3285CE for ; Tue, 28 Jun 2016 01:37:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A875285D7; Tue, 28 Jun 2016 01:37:50 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7B57C285D4 for ; Tue, 28 Jun 2016 01:37:49 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bHhx7-00062W-E7; Tue, 28 Jun 2016 01:36:37 +0000 Received: from nasmtp01.atmel.com ([192.199.1.245] helo=ussmtp01.atmel.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bHhx4-0005yB-UN for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2016 01:36:35 +0000 Received: from apsmtp01.atmel.com (10.168.254.30) by DVREDG01.corp.atmel.com (10.42.103.30) with Microsoft SMTP Server (TLS) id 14.3.235.1; Mon, 27 Jun 2016 19:36:11 -0600 Received: from shaarm01.corp.atmel.com (10.168.254.13) by apsmtp01.corp.atmel.com (10.168.254.30) with Microsoft SMTP Server id 14.3.235.1; Tue, 28 Jun 2016 09:38:59 +0800 From: Wenyou Yang To: Sebastian Reichel , Dmitry Eremin-Solenikov , David Woodhouse , Rob Herring , Pawel Moll , Mark Brown , Ian Campbell , "Kumar Gala" Subject: [PATCH v2 1/7] power: act8945a_charger: Remove "battery_temperature" Date: Tue, 28 Jun 2016 09:22:44 +0800 Message-ID: <1467076970-12206-2-git-send-email-wenyou.yang@atmel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1467076970-12206-1-git-send-email-wenyou.yang@atmel.com> References: <1467076970-12206-1-git-send-email-wenyou.yang@atmel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160627_183635_099136_9B649511 X-CRM114-Status: GOOD ( 12.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org, Nicolas Ferre , linux-kernel@vger.kernel.org, Wenyou Yang , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Remove "battery_temperature" member, it is redundant, it is the hardware's responsibility to handle TH pin properly. It is unnecessary to use the dt property to check if there is a battery temperature monitor or not. Signed-off-by: Wenyou Yang --- Changes in v2: None drivers/power/act8945a_charger.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/power/act8945a_charger.c b/drivers/power/act8945a_charger.c index b5c00e4..72d39ba 100644 --- a/drivers/power/act8945a_charger.c +++ b/drivers/power/act8945a_charger.c @@ -76,7 +76,6 @@ static const char *act8945a_charger_manufacturer = "Active-semi"; struct act8945a_charger { struct regmap *regmap; - bool battery_temperature; }; static int act8945a_get_charger_state(struct regmap *regmap, int *val) @@ -138,8 +137,7 @@ static int act8945a_get_charge_type(struct regmap *regmap, int *val) return 0; } -static int act8945a_get_battery_health(struct act8945a_charger *charger, - struct regmap *regmap, int *val) +static int act8945a_get_battery_health(struct regmap *regmap, int *val) { int ret; unsigned int status; @@ -148,7 +146,7 @@ static int act8945a_get_battery_health(struct act8945a_charger *charger, if (ret < 0) return ret; - if (charger->battery_temperature && !(status & APCH_STATUS_TEMPDAT)) + if (status & APCH_STATUS_TEMPDAT) *val = POWER_SUPPLY_HEALTH_OVERHEAT; else if (!(status & APCH_STATUS_INDAT)) *val = POWER_SUPPLY_HEALTH_OVERVOLTAGE; @@ -188,8 +186,7 @@ static int act8945a_charger_get_property(struct power_supply *psy, val->intval = POWER_SUPPLY_TECHNOLOGY_LION; break; case POWER_SUPPLY_PROP_HEALTH: - ret = act8945a_get_battery_health(charger, - regmap, &val->intval); + ret = act8945a_get_battery_health(regmap, &val->intval); break; case POWER_SUPPLY_PROP_MODEL_NAME: val->strval = act8945a_charger_model; @@ -235,9 +232,6 @@ static int act8945a_charger_config(struct device *dev, return -EINVAL; } - charger->battery_temperature = of_property_read_bool(np, - "active-semi,check-battery-temperature"); - chglev_pin = of_get_named_gpio_flags(np, "active-semi,chglev-gpios", 0, &flags);