From patchwork Fri Dec 19 08:55:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonghwa Lee X-Patchwork-Id: 5518311 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 65AE79F443 for ; Fri, 19 Dec 2014 08:59:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 78F382012D for ; Fri, 19 Dec 2014 08:59:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7D9702011B for ; Fri, 19 Dec 2014 08:59:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752373AbaLSI7E (ORCPT ); Fri, 19 Dec 2014 03:59:04 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:20572 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752136AbaLSIzf (ORCPT ); Fri, 19 Dec 2014 03:55:35 -0500 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NGT0031LNGKH690@mailout2.samsung.com>; Fri, 19 Dec 2014 17:55:32 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.113]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id FD.3E.11124.308E3945; Fri, 19 Dec 2014 17:55:31 +0900 (KST) X-AuditID: cbfee68e-f79b46d000002b74-90-5493e803216a Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 84.88.09430.308E3945; Fri, 19 Dec 2014 17:55:31 +0900 (KST) Received: from localhost.localdomain ([10.252.82.199]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NGT00JXJNGDRC90@mmp2.samsung.com>; Fri, 19 Dec 2014 17:55:31 +0900 (KST) From: Jonghwa Lee To: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org, sre@kernel.org, dbaryshkov@gmail.com, dwmw2@infradead.org, anton@enomsg.org, pavel@ucw.cz, myungjoo.ham@samsung.com, cw00.choi@samsung.com, Jonghwa Lee Subject: [PATCH V3 06/11] power: charger-manager: Concentrate scattered power_supply_changed() calls. Date: Fri, 19 Dec 2014 17:55:18 +0900 Message-id: <1418979323-7188-7-git-send-email-jonghwa3.lee@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1418979323-7188-1-git-send-email-jonghwa3.lee@samsung.com> References: <1418979323-7188-1-git-send-email-jonghwa3.lee@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrILMWRmVeSWpSXmKPExsWyRsSkUJf5xeQQg0tXDS0ObtW0uP7lOavF pCfvmS0mrpzMbNF59gmzxeVdc9gsPvceYbS43biCzeLuqaNsFqd3lzhweUzo/8TosXPWXXaP zSu0PDat6mTz6NuyitFjxerv7B6fN8kFsEdx2aSk5mSWpRbp2yVwZfTsvsBWsEa0YtXLs+wN jHsEuxg5OSQETCTO7LjNDmGLSVy4t56ti5GLQ0hgKaPEixtv2WCKZqyfxwKRmM4osfrKKqiq NiaJzw8+gbWzCehI/N93E8wWEVCQ2Nz7jBWkiFngCqPEzcXrmUASwgLpErc/bABKcHCwCKhK zH6pBhLmFXCX+LT1GVhYAqh3ziQbkDCngIfEn5NbwDqFgEoat3xnBxkpIbCLXeLk5bWsIAkW AQGJb5MPsUD0ykpsOsAMcbSkxMEVN1gmMAovYGRYxSiaWpBcUJyUXmSkV5yYW1yal66XnJ+7 iREYE6f/PevbwXjzgPUh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vfOZs+/j5qWXfemdB0t391s8+n97XqVZ3Oly85aFx76sWHP 4fTkFX3iNVzyoR48DrvqAx49O1tTmuadW5DGmzVrhfnlmi06CTGL7BJiW6VXhj8JUzb6u3F3 /iclluKMREMt5qLiRAAeBF31zgIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Current charger-manager calls power_suuply_changed() whenever charging status is changed. This patch removes seperated power_supply_changed() use and let it be called at end of try_charger_enable() function which is called to set charging/discharging. Signed-off-by: Jonghwa Lee --- drivers/power/charger-manager.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c index 7bbaef6..d29155d 100644 --- a/drivers/power/charger-manager.c +++ b/drivers/power/charger-manager.c @@ -382,8 +382,10 @@ static int try_charger_enable(struct charger_manager *cm, bool enable) } } - if (!err) + if (!err) { cm->charger_enabled = enable; + power_supply_changed(&cm->charger_psy); + } return err; } @@ -436,10 +438,8 @@ static void fullbatt_vchk(struct charger_manager *cm) dev_info(cm->dev, "VBATT dropped %duV after full-batt\n", diff); - if (diff > desc->fullbatt_vchkdrop_uV) { + if (diff > desc->fullbatt_vchkdrop_uV) try_charger_restart(cm); - power_supply_changed(&cm->charger_psy); - } } /** @@ -469,7 +469,6 @@ static int check_charging_duration(struct charger_manager *cm) if (duration > desc->charging_max_duration_ms) { dev_info(cm->dev, "Charging duration exceed %ums\n", desc->charging_max_duration_ms); - power_supply_changed(&cm->charger_psy); try_charger_enable(cm, false); ret = true; } @@ -480,7 +479,6 @@ static int check_charging_duration(struct charger_manager *cm) is_ext_pwr_online(cm)) { dev_info(cm->dev, "Discharging duration exceed %ums\n", desc->discharging_max_duration_ms); - power_supply_changed(&cm->charger_psy); try_charger_enable(cm, true); ret = true; } @@ -561,8 +559,7 @@ static bool _cm_monitor(struct charger_manager *cm) */ if (temp_alrt) { cm->emergency_stop = temp_alrt; - if (!try_charger_enable(cm, false)) - power_supply_changed(&cm->charger_psy); + try_charger_enable(cm, false); /* * Check whole charging duration and discharing duration @@ -587,16 +584,13 @@ static bool _cm_monitor(struct charger_manager *cm) } else if (!cm->emergency_stop && is_full_charged(cm) && cm->charger_enabled) { dev_info(cm->dev, "EVENT_HANDLE: Battery Fully Charged\n"); - power_supply_changed(&cm->charger_psy); - try_charger_enable(cm, false); fullbatt_vchk(cm); } else { cm->emergency_stop = 0; if (is_ext_pwr_online(cm)) { - if (!try_charger_enable(cm, true)) - power_supply_changed(&cm->charger_psy); + try_charger_enable(cm, true); } }