From patchwork Wed Mar 21 15:50:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ladislav Michl X-Patchwork-Id: 10299739 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 1D86160385 for ; Wed, 21 Mar 2018 15:50:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16CB0298C5 for ; Wed, 21 Mar 2018 15:50:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1530F29907; Wed, 21 Mar 2018 15:50:15 +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.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 220EA298A1 for ; Wed, 21 Mar 2018 15:50:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751714AbeCUPuI (ORCPT ); Wed, 21 Mar 2018 11:50:08 -0400 Received: from eddie.linux-mips.org ([148.251.95.138]:45424 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752201AbeCUPuD (ORCPT ); Wed, 21 Mar 2018 11:50:03 -0400 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23992966AbeCUPuA4vBM0 (ORCPT ); Wed, 21 Mar 2018 16:50:00 +0100 Date: Wed, 21 Mar 2018 16:50:00 +0100 From: Ladislav Michl To: linux-pm@vger.kernel.org Cc: Sebastian Reichel , Krzysztof Kozlowski Subject: [PATCH] power: supply: charger-manager: Verify polling interval only when polling requested Message-ID: <20180321155000.GA7528@lenoch> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Driver bails out with -EINVAL when no polling specififaion is requested. Fix that by verifing polling interval only if polling_mode is different from CM_POLL_DISABLE. Signed-off-by: Ladislav Michl --- drivers/power/supply/charger-manager.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c index 1de4b4493824..2a50b4654793 100644 --- a/drivers/power/supply/charger-manager.c +++ b/drivers/power/supply/charger-manager.c @@ -1700,8 +1700,9 @@ static int charger_manager_probe(struct platform_device *pdev) power_supply_put(psy); } - if (desc->polling_interval_ms == 0 || - msecs_to_jiffies(desc->polling_interval_ms) <= CM_JIFFIES_SMALL) { + if (cm->desc->polling_mode != CM_POLL_DISABLE && + (desc->polling_interval_ms == 0 || + msecs_to_jiffies(desc->polling_interval_ms) <= CM_JIFFIES_SMALL)) { dev_err(&pdev->dev, "polling_interval_ms is too small\n"); return -EINVAL; }