From patchwork Fri Dec 19 02:47:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonghwa Lee X-Patchwork-Id: 5517211 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EB323BEEA8 for ; Fri, 19 Dec 2014 02:49:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2CD2720131 for ; Fri, 19 Dec 2014 02:49:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 377B12012D for ; Fri, 19 Dec 2014 02:49:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752004AbaLSCrk (ORCPT ); Thu, 18 Dec 2014 21:47:40 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:58375 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751945AbaLSCri (ORCPT ); Thu, 18 Dec 2014 21:47:38 -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 <0NGT00JSW6FDDA10@mailout2.samsung.com>; Fri, 19 Dec 2014 11:47:37 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.116]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id A2.AA.11124.8C193945; Fri, 19 Dec 2014 11:47:37 +0900 (KST) X-AuditID: cbfee68e-f79b46d000002b74-49-549391c86eeb Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id D2.E2.09430.8C193945; Fri, 19 Dec 2014 11:47:36 +0900 (KST) Received: from localhost.localdomain ([10.252.82.199]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NGT004F46F82Y30@mmp1.samsung.com>; Fri, 19 Dec 2014 11:47:36 +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 RESEND v2 05/10] power: charger-manager: Concentrate scattered power_supply_changed() calls. Date: Fri, 19 Dec 2014 11:47:25 +0900 Message-id: <1418957250-6542-6-git-send-email-jonghwa3.lee@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1418957250-6542-1-git-send-email-jonghwa3.lee@samsung.com> References: <1418957250-6542-1-git-send-email-jonghwa3.lee@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrPLMWRmVeSWpSXmKPExsWyRsSkRPfkxMkhBo8jLA5u1bS4/uU5q8Wk J++ZLSaunMxs0Xn2CbPF5V1z2Cw+9x5htLjduILN4u6po2wWp3eXOHB5TOj/xOixc9Zddo/N K7Q8Nq3qZPPo27KK0WPF6u/sHp83yQWwR3HZpKTmZJalFunbJXBlXLp0nbFgjWhF664ZrA2M ewS7GDk5JARMJFouf2GBsMUkLtxbz9bFyMUhJLCUUWLyvz/MXYwcYEW79vBCxBcxSiz7c5QR wmljklgzfxETSDebgI7E/3032UFsEQEFic29z1hBipgFrjBK3Fy8HqxIWCBPYs//PawgNouA qsTq5qfsIBt4Bdwlts4JhlimIDFnkg1IBaeAh8TTS01sILYQUMWJb29ZQEZKCOxjl3iy8B0z xBgBiW+TD7FA9MpKbDrADPGMpMTBFTdYJjAKL2BkWMUomlqQXFCclF5kpFecmFtcmpeul5yf u4kRGA+n/z3r28F484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7aeE2PWzL1cr/h5V1K/eJ7l6r79mTcmq3DlJM/n+tusIwOd8pJ Q11ny66XC18xMl28KbzkeVyI0rTfhlu2bpqaz6oT5aedcHDCjcPvj6mx/0jds+Svre0p7zvV LyuXnXJUYinOSDTUYi4qTgQArnc1b80CAAA= 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 687f109..bb44588 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); } }