From patchwork Mon Jan 9 00:47:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chris@lapa.com.au X-Patchwork-Id: 9503729 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 0FE7560757 for ; Mon, 9 Jan 2017 00:50:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F00602823E for ; Mon, 9 Jan 2017 00:50:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4A9528416; Mon, 9 Jan 2017 00:50:55 +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 70B6B2823E for ; Mon, 9 Jan 2017 00:50:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757524AbdAIAr6 (ORCPT ); Sun, 8 Jan 2017 19:47:58 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:35510 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757494AbdAIAr4 (ORCPT ); Sun, 8 Jan 2017 19:47:56 -0500 Received: by mail-pg0-f67.google.com with SMTP id 204so3213523pge.2 for ; Sun, 08 Jan 2017 16:47:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lapa-com-au.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=iZ80koAE8L+bIKf3UGzoXIRdueo8wrhM4EINtVkXMYI=; b=BuMQiUpvHm67DLSfLhNAC3CfjRUUP95VtvFprO6eOE693ki5kpXWXusahHQLZt3fe8 d/SQZafOSc6vR1Rr0gDYuechNz925yG8sPz6orfMMFbO8RX8WA/IdRgKF34esod1JVe8 S5yll9aXv/F9ZrXFtfU6nVjGNObqK3Rx+0vsamka241MhZe+EE283LSHI0Vou+bYiAH4 oIkbKvdWmsrf+8WPC2UqGZ19FYaf73qjI35fQN/V3dmcCFkcBNPsYoZNQb0cuTVnxVus /gS431BCv1YGL7lbG2ueZq5mXDiNc15ESiysFUH/sD0EgtyssDMeW1CgJ4cdRSETqzBD 5Ecw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=iZ80koAE8L+bIKf3UGzoXIRdueo8wrhM4EINtVkXMYI=; b=q1qc6RVjlY8x6tA5B8lg5Kbgb+9NESsbbevsKQ2sZbedqaNj9r9BEJL9r98afilFAL JjjVXUmTKgqJmpqx2myP0OD8utF4V0w7mQ9gYCQl2CAIyGD5XrZHav7WxcLj6bx3mwB+ mm88HieSBxhQj6WV/dgcHsS1qvXj+RjqUp7Hytm1QcGBiHRSdJ+7IfjpJO/uJ4h+F5XW 9pmSWX2IZWHlLbGKAB2GQNcwkfr4zdoczpuxQFL7Kf8/JL61VD4WAON4iBl6TazxIxqt QQnZIk+3k7wyCWoIl0/0ymseZ3JyOlcmTAZcJz7WF8wjtKDVr2gRej0ezQHlJtWXkYA2 ng/Q== X-Gm-Message-State: AIkVDXIbtMKKc4o3e+bQqH2ySKkDltB1Cfr1AHvp21KfjjqKOfAo3YSSx2fb8QeqT6L7dA== X-Received: by 10.99.110.74 with SMTP id j71mr26656010pgc.134.1483922874259; Sun, 08 Jan 2017 16:47:54 -0800 (PST) Received: from generaldeb-vm.management.cpd (163.164.70.115.static.exetel.com.au. [115.70.164.163]) by smtp.gmail.com with ESMTPSA id p127sm172366403pfg.24.2017.01.08.16.47.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 08 Jan 2017 16:47:53 -0800 (PST) From: Chris Lapa X-Google-Original-From: Chris Lapa To: pali.rohar@gmail.com, afd@ti.com, sre@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Chris Lapa Subject: [PATCH v3 01/11] power: supplies: bq275xx: move overtemp tests to a switch statement. Date: Mon, 9 Jan 2017 11:47:35 +1100 Message-Id: <1483922865-96321-2-git-send-email-chris@lapa.com.au> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1483922865-96321-1-git-send-email-chris@lapa.com.au> References: <1482369743-79764-1-git-send-email-chris@lapa.com.au> <1483922865-96321-1-git-send-email-chris@lapa.com.au> 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 From: Chris Lapa This is done for readability as the upcoming commits will add a lot of cases. tested: no Signed-off-by: Chris Lapa Reviewed-by: Andrew F. Davis --- drivers/power/supply/bq27xxx_battery.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c index 3b0dbc6..fd4cc4e 100644 --- a/drivers/power/supply/bq27xxx_battery.c +++ b/drivers/power/supply/bq27xxx_battery.c @@ -635,12 +635,17 @@ static int bq27xxx_battery_read_pwr_avg(struct bq27xxx_device_info *di) */ static bool bq27xxx_battery_overtemp(struct bq27xxx_device_info *di, u16 flags) { - if (di->chip == BQ27500 || di->chip == BQ27541 || di->chip == BQ27545) + switch (di->chip) { + case BQ27500: + case BQ27541: + case BQ27545: return flags & (BQ27XXX_FLAG_OTC | BQ27XXX_FLAG_OTD); - if (di->chip == BQ27530 || di->chip == BQ27421) + case BQ27530: + case BQ27421: return flags & BQ27XXX_FLAG_OT; - - return false; + default: + return false; + } } /*