Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1076147pxv; Thu, 1 Jul 2021 16:46:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLm66lRbL4DEYteyjhJNj560br8oCFk/TP13c0gjMtU5atURrfjaV64DbG0IZE0fg/6Tf4 X-Received: by 2002:a50:9345:: with SMTP id n5mr3036115eda.289.1625183188129; Thu, 01 Jul 2021 16:46:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625183188; cv=none; d=google.com; s=arc-20160816; b=n4I1JzkhkY+wKXFN/RRnBQ656W9LK410XkuH0ZUOYMWelQo1X1QyDvhwWQr2UtdB9y QetswyQ1w7O6CbB1ZoNqGHMp8VbtWXNDN8rZgPofLa4HG8KlFirx5ujTsttoNeimttK8 vjEGyhe9Axt9IZx4SOgQr57BLK5+xXO7CN00CkiwoiuOQo8dyg5yLQiVVL47Gp23gt0w 8wuvmZZnhLlCWYWRMREndY0WIUi4lQur8uF73v8qOXMlYG7Hg9LZXoMaXRe3e2EjfSSk FqYywQVi0L3p7EbAra2xFZThBYKPG5QSU6zAB+cwRMcT/ufmAm60Atacds8XUmTthcE1 MWYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BFXR8UJAJfYBsWt7j+dPhOe713FxNJqHeaZ6mJiooJo=; b=mHVVeRKWYFB2fBZjV65wWwE853fyJVEkIw0ywiSv6WWlTxLGszoJHF327ZU8OlyKTo CZber0j4S8OxIEUEYSKf8rwZ6B2jv8v9rFeTKo9UsWKuY1nw4HbAknURNbaCl2i1Bx/U K8gsF09QZ/v4uiYX44eksdF0EZL1ge84GWjRNlB1rIU2iNpGFvImSlo0rIJd2Jsdg7qY bXfxuyiDjntHQ49QKy6Cku5H7uPC5A/CDyDWEpVtA8onKrrma8o81mEZLB9BYyVRinvt YgergmstZa6u9qYdThYrbKBS6KTh5rTbdUmvgnVfLTJ+T5PGBi+n2QCL8Rh7QvBHhbb/ XYJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OUfsTB8b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ay6si1194828edb.187.2021.07.01.16.46.04; Thu, 01 Jul 2021 16:46:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OUfsTB8b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234719AbhGAXq6 (ORCPT + 99 others); Thu, 1 Jul 2021 19:46:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234478AbhGAXqa (ORCPT ); Thu, 1 Jul 2021 19:46:30 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB246C0613E0; Thu, 1 Jul 2021 16:43:57 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id e3so2378832ljo.6; Thu, 01 Jul 2021 16:43:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BFXR8UJAJfYBsWt7j+dPhOe713FxNJqHeaZ6mJiooJo=; b=OUfsTB8bvlLJNIZhdqmNr++UFcXGH0jWJjdQMhOiMZDxIJ+oOW7xYX3hyo20nfWd7x 5BWpr9NRU0XmjSR2fmXHU25hPm1UCvLGJcV7cE48RUGM3OB6Oz0wne0IGFaufpDDDyX2 ynoQCzsL2SuwtC1nHLuzyfEacRFsWrlrRSmX/0d7SgPwZQgliSDy5cGoWs2ga343ZUGf gXpQ8lvGof7Lt0kVJovGC3oV0sRgxaaIjZdH5e/lqLnMKj8WZ7My78PbmOmzJYVqdwhH KJGktRs7Eux1pDN1YTotgAxSHSK65hpYUgj+fhw88UBveCjdawWFTNUi8NgZsIU4LLv7 9BsA== 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:mime-version:content-transfer-encoding; bh=BFXR8UJAJfYBsWt7j+dPhOe713FxNJqHeaZ6mJiooJo=; b=KIdXRPKFho81KmIXr3e83DJ5UBnMPHRpv4zBB9ByrIvPGVbW3yvaZA6B7iW4EwBMbK njM+ku+305DSiogTlpUau4Fgyz1haOdrkTVt3rSz3LApH/HcW75ztWw4w/Qny07Ln67R r/wqz06gx1K60FghdjZyNc3Jk3hEFj2gvIREtis72nnsQRAlhRdNpohdL+XGMwiOgeat 5qZ0NLhpc065/FdUyznXTTsbAFE0hwHz96exMbFvjwjWTAhY3JGP36tt2X7E9CVeahIn Pd0pOzkXapPOQV3NQxqe5T+TBMuVdFdD1kzJno1CGv1Lt3Oo7/Vulu55enr8jqfSR553 oKQg== X-Gm-Message-State: AOAM530uGSBYqDFhW2lNmj18vvBn2TilySQaQ/AUgi50Kty1QbeprLq7 /Wdc0DOFsU4So3mhuV6Wk9Y= X-Received: by 2002:a05:651c:2cb:: with SMTP id f11mr1539629ljo.174.1625183036211; Thu, 01 Jul 2021 16:43:56 -0700 (PDT) Received: from localhost.localdomain (94-29-37-113.dynamic.spd-mgts.ru. [94.29.37.113]) by smtp.gmail.com with ESMTPSA id e23sm60743lfq.221.2021.07.01.16.43.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 16:43:55 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Rob Herring , Sebastian Reichel , Peter Chen , Greg Kroah-Hartman , Felipe Balbi , David Heidelberg Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v2 08/12] power: supply: smb347-charger: Remove caching of charger state Date: Fri, 2 Jul 2021 02:43:13 +0300 Message-Id: <20210701234317.26393-9-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210701234317.26393-1-digetx@gmail.com> References: <20210701234317.26393-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Regmap already provides us with the caching, so remove caching of charger state to make code cleaner. Signed-off-by: Dmitry Osipenko --- drivers/power/supply/smb347-charger.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/power/supply/smb347-charger.c b/drivers/power/supply/smb347-charger.c index db1378b41f80..f81c60c679a0 100644 --- a/drivers/power/supply/smb347-charger.c +++ b/drivers/power/supply/smb347-charger.c @@ -135,7 +135,6 @@ * @id: SMB charger ID * @mains_online: is AC/DC input connected * @usb_online: is USB input connected - * @charging_enabled: is charging enabled * @irq_unsupported: is interrupt unsupported by SMB hardware * @max_charge_current: maximum current (in uA) the battery can be charged * @max_charge_voltage: maximum voltage (in uV) the battery can be charged @@ -192,7 +191,6 @@ struct smb347_charger { unsigned int id; bool mains_online; bool usb_online; - bool charging_enabled; bool irq_unsupported; unsigned int max_charge_current; @@ -358,21 +356,13 @@ static int smb347_charging_status(struct smb347_charger *smb) static int smb347_charging_set(struct smb347_charger *smb, bool enable) { - int ret = 0; - if (smb->enable_control != SMB3XX_CHG_ENABLE_SW) { dev_dbg(smb->dev, "charging enable/disable in SW disabled\n"); return 0; } - if (smb->charging_enabled != enable) { - ret = regmap_update_bits(smb->regmap, CMD_A, CMD_A_CHG_ENABLED, - enable ? CMD_A_CHG_ENABLED : 0); - if (!ret) - smb->charging_enabled = enable; - } - - return ret; + return regmap_update_bits(smb->regmap, CMD_A, CMD_A_CHG_ENABLED, + enable ? CMD_A_CHG_ENABLED : 0); } static inline int smb347_charging_enable(struct smb347_charger *smb) -- 2.30.2