Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp535423rdb; Tue, 23 Jan 2024 07:10:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IH1KX9KJeoGoHBc2aXVYzyF7/BN99mJF+7f7FZWq28+UHghvrwy10gNT5ttmFEod8gqOYSq X-Received: by 2002:a17:907:2917:b0:a30:ad90:22a with SMTP id eq23-20020a170907291700b00a30ad90022amr174670ejc.94.1706022631136; Tue, 23 Jan 2024 07:10:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706022631; cv=pass; d=google.com; s=arc-20160816; b=x3hhOSEJNIafUk2BBdX696VR3o0Xv3x6WuRuqRBT70Ss+Aiip5STpR4yRunpP6Cbt3 Qak7/ItS7X9PLFaUrFxfYiFZBjric0zZQ/NdRxQRChYMrsguqPhZCUM1vMJ3iBIawUoB znSSxIPEuEcpES5hlqkBOAohnr/l6UaumMpme5ZbIrA2akkt0EBQT2qPnUbypL07SgOn Bfyco0qv+Tw1Cj5/ZfZQ7bz9iiTpSRDFPy6ZUfoCpHsWPq2D+X6XYXohJmVVsAs+/8YF wLjmRArdWRZYGIu24o+T8/BA1WpBiaVedrTmYRFgMtsMtfGZhHIxlQdY15n6UVJXoe64 KrJg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=XBxIuTPwoOzGfB8OHKOyASLbyJf1pzgDv1spHNZWZnA=; fh=6h784S57cSWbC/QCurcAvBvZChdyzW5HGNlWMF29gjU=; b=XJe8JNqXFwl5QzBpxrqu1VVUISPb4ZJ7wwzpUAVm7FlseOepWY3n6NKbwck6QJh3vq 1hpF0Iw0qA7C/a9mCFkgYWahuN+or3214nDWzKXvk4S7L1e60m75YO3SCmJmuRv1xXO7 xAu5tF+KlrRf/7b/zv2KtjbigHmNwaPDv75NXGwHV/gG9xliPRpxn9HYfZcIplJl7ifu Ye5MEO+1/cpkcdsoHEeKhVgE6t3O6D1rRNiaoXIZz8H/kgyLBciVgEjWlxlrvwv22bE5 qPWyIGw35x2vljjUWXzVzTqSkGxpGoNuYEWauUA12gRvC9+lfbfE7u+jvvrGVmL/lncg 6ygA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=NtZoKrAz; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-35509-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35509-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v24-20020a170906181800b00a28ceda55b5si11928334eje.361.2024.01.23.07.10.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 07:10:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35509-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=NtZoKrAz; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-35509-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35509-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E001B1F2911E for ; Tue, 23 Jan 2024 15:10:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CC52D60266; Tue, 23 Jan 2024 15:09:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="NtZoKrAz" Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A15435FEFF; Tue, 23 Jan 2024 15:09:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.142 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706022573; cv=none; b=cdPX6AhALA1zVXAD2T/U0fvxfXDc6AkUOrnbEcWOOm/P+iSbhOicy7vJMp7K/WV23QypW7H3+JUyRAybhl1Xc0q4TLuV8pCCjqqU3raWGwn7XVLD9t1lTiYqWIzGfIWDVsWly5kUH4WVebzlYinvzK8M/a6FLFgTpzqSi4WRJcI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706022573; c=relaxed/simple; bh=TR+JZ2LAe+2IY3y6XWtBU3J7Q30KfFb19RmcJWo9PP4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uC8NTff8/5jKMgwAB5LaY2y7Y5LnB17IdNIYBcWf0+cdvE2mKpy+HJRcfpybXQIloWGDHTCsBHK1+0yqPrTK1l3RVszVsraXRD4dAUEz2+TDpWr4uV4LBWFj5Z8rH9bj50kAO6sT52up4oMqpQQ27/EKuM1RLJIAkr9U1Hocr+k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=NtZoKrAz; arc=none smtp.client-ip=198.47.19.142 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 40NF9Hlr057182; Tue, 23 Jan 2024 09:09:17 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1706022557; bh=XBxIuTPwoOzGfB8OHKOyASLbyJf1pzgDv1spHNZWZnA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=NtZoKrAzdeflXcYyaO4MnxJWiDUedOzLGDYD+cHGriwdfFifV1VzWWxS3l9/CXAxV rUT6ss1YkQQMq/jsZLUE6ubRXXBEeSZ9jTikXLJmQERnucifNazjGWjjrpRMYQfx1C xXdcMLzRtqzrrY0eSQDrBWtzMAp808iOyVyyVjqk= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 40NF9H8O075316 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 23 Jan 2024 09:09:17 -0600 Received: from DFLE112.ent.ti.com (10.64.6.33) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 23 Jan 2024 09:09:16 -0600 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Tue, 23 Jan 2024 09:09:16 -0600 Received: from lelvsmtp5.itg.ti.com ([10.249.42.149]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 40NF9FE7128205; Tue, 23 Jan 2024 09:09:16 -0600 From: Andrew Davis To: =?UTF-8?q?Pali=20Roh=C3=A1r?= , Sebastian Reichel CC: , , Andrew Davis Subject: [PATCH 4/5] power: supply: bq27xxx: Use devm_power_supply_register() helper Date: Tue, 23 Jan 2024 09:09:13 -0600 Message-ID: <20240123150914.308510-4-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240123150914.308510-1-afd@ti.com> References: <20240123150914.308510-1-afd@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Use the device lifecycle managed register function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths. Signed-off-by: Andrew Davis --- drivers/power/supply/bq27xxx_battery.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c index d3b6327b16b56..2bf5e007f16b2 100644 --- a/drivers/power/supply/bq27xxx_battery.c +++ b/drivers/power/supply/bq27xxx_battery.c @@ -2140,7 +2140,7 @@ int bq27xxx_battery_setup(struct bq27xxx_device_info *di) psy_desc->get_property = bq27xxx_battery_get_property; psy_desc->external_power_changed = bq27xxx_external_power_changed; - di->bat = power_supply_register_no_ws(di->dev, psy_desc, &psy_cfg); + di->bat = devm_power_supply_register_no_ws(di->dev, psy_desc, &psy_cfg); if (IS_ERR(di->bat)) return dev_err_probe(di->dev, PTR_ERR(di->bat), "failed to register battery\n"); @@ -2168,8 +2168,6 @@ void bq27xxx_battery_teardown(struct bq27xxx_device_info *di) mutex_unlock(&di->lock); cancel_delayed_work_sync(&di->work); - - power_supply_unregister(di->bat); } EXPORT_SYMBOL_GPL(bq27xxx_battery_teardown); -- 2.39.2