From patchwork Tue Dec 20 11:33:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 9482503 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 EDE9960772 for ; Wed, 21 Dec 2016 05:47:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE8C127E71 for ; Wed, 21 Dec 2016 05:47:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D363B27F90; Wed, 21 Dec 2016 05:47:53 +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 BBAA227E71 for ; Wed, 21 Dec 2016 05:47:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752565AbcLUFrv (ORCPT ); Wed, 21 Dec 2016 00:47:51 -0500 Received: from mail-db5eur01on0103.outbound.protection.outlook.com ([104.47.2.103]:22881 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751597AbcLUFrv (ORCPT ); Wed, 21 Dec 2016 00:47:51 -0500 Received: from DB6PR0201MB2312.eurprd02.prod.outlook.com (10.169.222.151) by DB6PR0201MB2309.eurprd02.prod.outlook.com (10.169.222.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.803.11; Tue, 20 Dec 2016 19:14:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentiatech.onmicrosoft.com; s=selector1-axentia-se; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=WrREl1WD2sBIuEKQHajw+4U7r088fbbO/7KJUwQjNo8=; b=TTHmDu4SXR4bP28V7pM/DSGP1N5hKz+8gTaQXy4DuGJ8g32Xi7c2xYicZMd3Jg60OfhFk70P/ZBJ7w2IcSrpElhaH9GLCXc/NpyLjEsjLPMKlEZ6ieVgH70uiMXNyd65u/xtABWtwTLNyXhhaXuEnW1P9IN6wfrmE82Ivhg62LI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=peda@axentia.se; Received: from localhost.localdomain (217.210.101.82) by DB6PR0201MB2312.eurprd02.prod.outlook.com (10.169.222.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.771.8; Tue, 20 Dec 2016 11:33:26 +0000 From: Peter Rosin To: linux-kernel@vger.kernel.org Cc: Peter Rosin , Sebastian Reichel , linux-pm@vger.kernel.org Subject: [PATCH 3/3] power: supply: bq24735: always check for AC adapter presence in probe Date: Tue, 20 Dec 2016 12:33:02 +0100 Message-Id: <1482233582-29770-4-git-send-email-peda@axentia.se> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1482233582-29770-1-git-send-email-peda@axentia.se> References: <1482233582-29770-1-git-send-email-peda@axentia.se> MIME-Version: 1.0 X-Originating-IP: [217.210.101.82] X-ClientProxiedBy: DB5PR0101CA0002.eurprd01.prod.exchangelabs.com (10.165.200.140) To DB6PR0201MB2312.eurprd02.prod.outlook.com (10.169.222.151) X-MS-Office365-Filtering-Correlation-Id: 85d166eb-5aeb-4960-1f66-08d428cc03cc X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DB6PR0201MB2312; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0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XGD9bX/wYNIFn7nBsnl+4eQiq86gOPYweoA== X-Microsoft-Exchange-Diagnostics: 1; DB6PR0201MB2312; 31:kI910gD9U1sg+C393HwAk9qyjGcAVD1kQe4xOxleBlQWKl0wmWStHzj0EPz104Qr/a4V0oZrW6Ux60os8qih5fXvDHBiX/lTgUBJxa3BgrpG3W4aRpJ4b69BIFOkUEBlBd+Ud37TP4yfw1mzBEE/FUGND1tmFizQ6WB4l8hpRccYoMgG2+7/VhBkEIeGs754OJJ1qfxuz39u/6WFNAiLdiyI+jPkTmHh1CPK74PiiRMIuTkzZHd/SqRuq11N5Tkgrl0ByhnmMbWKIq5w/9v70uiYigBV8s/Eqg0p8yuXzjE=; 4:sOUu+eBLJTxVQ7IykMixpR5CF/S7s5vM1eHfFerki8bJ7i1zOJymrKu1xgOvZ2aCyZlB1Bbjkx/oo3UOC13RdRYSDvrvs1pCWyvg5Q3K1vmHFRXJewhiOtB0BdrTHhRjk64KgFPmH4NODX946Kw+fDRqxFk0xZX5geGRlSAvP6nu8gBl1++HETz0+/ujIkRd/3KINOaF1cBAoZl5HQhlf5DB584/CR/mLyMH8PS5SgHGeRrtCxRwQQAAvHQ7CQoTsz4tfGXGs/M+2psYdjdHCRG3s3L4rbY2I1R0gVN1u8uxfs2nrfmrpbdH0hDmsBwhNkru2o4qYvMny9FhewSCJeWecvrWxO2IPOzPt/DO4O4f5asyrvyGh4trHPtMRbS2U/tJOmEJVRV1YOA31FrPXh1uHzJ03/1ADFaHBg/jxPlD4B1DViwQhj47EUcLfvNuqV4TG59Eq33Q0CMVdyil+lJQFSfQuYEg6V14ACL7yse2Om7WUki+OogHOgPtox2ULQNC8paW5wCH8xLtSrOUu+Rxv8JMNZZIoDOuAuWew3vADJg4DivkEypxXMYNy0MxHMyX53z7RLyDnyHHxj1RzF1GtYd8I070r7c9PHryagrTDYObFJq1xzQB qHr8Nhaa X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123562025)(20161123564025)(2016111802025)(20161123560025)(20161123555025)(6072148)(6043046); SRVR:DB6PR0201MB2312; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0201MB2312; X-Forefront-PRVS: 0162ACCC24 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6069001)(6009001)(7916002)(39830400002)(39450400003)(39410400002)(189002)(199003)(6916009)(86362001)(2351001)(97736004)(6486002)(2906002)(6506006)(101416001)(6512006)(2361001)(92566002)(7736002)(25786008)(305945005)(50226002)(68736007)(38730400001)(106356001)(8676002)(42186005)(81166006)(48376002)(50466002)(74482002)(36756003)(5660300001)(76176999)(4326007)(33646002)(81156014)(50986999)(66066001)(3846002)(189998001)(6666003)(110136003)(5003940100001)(6116002)(2950100002)(47776003)(105586002)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0201MB2312; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: axentia.se does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0201MB2312; 23:ihEk+Z6l6KFVWaGzi79o4IzTh769IQDvzZ8r8Gi?= =?us-ascii?Q?ezWFBKZS6fCWR2YQMX0WLYmLEIH7YJGV66WaLtC/SSCsYGo9JL1N4lwUzRTC?= =?us-ascii?Q?peRtYvio0onmOfBi9fhSRZ2XRwKAXuA2pCKCaHz23SxfWjjDYQz0bYvBCSls?= =?us-ascii?Q?nl2ENNHZ/2tw/8KVTKWc/r8C8XsDcnlSc7pCcOmzEJvFtxYBtZ8ltvziR7Fa?= =?us-ascii?Q?FpW1zNUBmZ0U7ujnmDOzyvvRF0wAARD9dtlzqzQjYWypnnFxlTUXZs4UqiPV?= =?us-ascii?Q?28Fxlagy1ejy8/P2q1+XVnw8UrcUGhlYzgE2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QwhgFi7lxIRf3OBDSXVd6Scz5511g0qv9ErqnInD61oc7ZFYf1X4MQycQlIkWVwrP1rLxYM1m7tdLFu+5gGhFhP5shOIGzamBF9v/n2Tvo4hrjmmRowZpRbB4avp3KNuPOSn7FcYCKW0kmuI5gvACFNKX3EuCHlOBB3XUjhvDNjzB9vq4ow9zU72mijn9HeSMq8BZsFRG7PghIsWQ8ddEeDqFglZBSujXx07k9XI0Dy+hwOXz4/+GtXezgFKD9Xz2Gm6paaEoizbDnRHj24SDF9CM1fv99U+Nanu72QeCSg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2016 11:33:26.1905 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0201MB2312 X-Microsoft-Exchange-Diagnostics: 1; DB6PR0201MB2309; 23:KD9NhH/YygP5SBUc5pfQnoSqM70y63qPeX7njH2z5+tCVNZSIuPgsTfOJOy707i6n/vYalBl6Ky+mUknCG3B3jWgSOCGZZqGBwk1a9ccYpBiWsbGy+2DVj1wQpcMRLRx9smx4msslyMB2b2i4z+mbA== X-OriginatorOrg: axentia.se 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 So what if there is a status_gpio specified? bq24735_charger_is_present() do have a working fallback for the case of no status_gpio. Simplify this by not special casing setups w/o status_gpio, folding two consecutive if-blocks in the process. Signed-off-by: Peter Rosin --- drivers/power/supply/bq24735-charger.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/power/supply/bq24735-charger.c b/drivers/power/supply/bq24735-charger.c index 71f977d055d7..4f6275e5cf1c 100644 --- a/drivers/power/supply/bq24735-charger.c +++ b/drivers/power/supply/bq24735-charger.c @@ -416,7 +416,7 @@ static int bq24735_charger_probe(struct i2c_client *client, return ret; } - if (!charger->status_gpio || bq24735_charger_is_present(charger)) { + if (bq24735_charger_is_present(charger)) { ret = bq24735_read_word(client, BQ24735_MANUFACTURER_ID); if (ret < 0) { dev_err(&client->dev, "Failed to read manufacturer id : %d\n", @@ -437,10 +437,7 @@ static int bq24735_charger_probe(struct i2c_client *client, "device id mismatch. 0x000b != 0x%04x\n", ret); return -ENODEV; } - } - /* check for AC adapter presence */ - if (bq24735_charger_is_present(charger)) { ret = bq24735_enable_charging(charger); if (ret < 0) { dev_err(&client->dev, "Failed to enable charging\n");