Message ID | 20240123163653.384385-9-afd@ti.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-35661-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp462481dyi; Tue, 23 Jan 2024 08:47:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IHEJmViLhf+0fyyDEOXdMGKAwnOMlazOHxjVRWIBxUAiHbtZA+bZd0m0vBL0ualoobiEO1y X-Received: by 2002:a17:903:8d0:b0:1d7:757c:9180 with SMTP id lk16-20020a17090308d000b001d7757c9180mr722565plb.18.1706028422336; Tue, 23 Jan 2024 08:47:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706028422; cv=pass; d=google.com; s=arc-20160816; b=eWxlfKaXZ+Y/e0hiSYz5M7ANLavFYqjBMaT61ofBUZm3KQQcWCGsL/FJu9tFQLi9z3 m5YAtGmb/wvo1EtmdxJ0/2Iyg9MSlhBvXWpV+bhNbV6c9Jm6/N5QYa6HkxRZrdwrjpru 8PpHG8qFsOXhAKppHwlyiIxNXKn9hkAwiT3PVuq5MSN/K3X8HGawL00sT9ZtB+V37okx IRaPJfZi3Io3KJ3e6i+GHCQNoBKBN5bfqKZzmvvNRcfjvgRSTkJ5NjNNfCVsqXkrJwwC iw6Mz1Dm4UZDeZnEcJU/x7n7DEU/VzikhLogjXt5IOsnjrDqG7ZUsmd3wuFywntK3sT/ liAA== 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=zX2Ey45x6SziOonwBIm+VHIBL+95dJLGekCQr6w7tY4=; fh=pozOWq+Llr4uSsAlLarsoaPJ+QQ4TuIyCJyc15dU4WI=; b=ITNodRgKmNFwrA2QjPLOIqY8FrBYszLBo59PZs+fDfP5o+gMeqqQkoZ9/50IiWbb3R 6G5ykvVLWHOAgKLKsL6kO+YSGzvJVgjrqTrWqYOq5UmP5RBN3R/bTn0mWXe70Xu8lVyB HDdeOBFydoFCKFeChjC7gu5tBBX9Td8xUbaAYF66mJ7GkoaERnv5gTyTHPLTuEAQzOWx dRus0gbUIS7p/HKanDusBTYVShnFbQpVYR7oTaXQbR0sd1Fyvlp0CaacBw6mJFJmzXEz EGIiMs7hQNhLBo18fHcioGZKIISBiEWSxdz+uAoQ3LSiX90oetBDy0ixnR7/LwLJmE8f 3afw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="kTnhR/Yx"; 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-35661-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35661-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i15-20020a17090332cf00b001d73d3cc804si5340880plr.147.2024.01.23.08.47.02 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 08:47:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35661-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="kTnhR/Yx"; 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-35661-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35661-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 7843B28D00C for <ouuuleilei@gmail.com>; Tue, 23 Jan 2024 16:40:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BF68182D88; Tue, 23 Jan 2024 16:37:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="kTnhR/Yx" Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (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 C356D7F7E3; Tue, 23 Jan 2024 16:37:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706027826; cv=none; b=YOR/yxmMNPuWFvt67P4hI4mBHup90j2a7MhPW9LJUtBMEYlbm/IpGcnISEZ1x9gHNZYoTgUE4LKo4ObLIcIWyxpXyWHopYmsS/9sDk7ooei/HN4GyShQpzOkZtTuiPzTSwFDvHYmuDp2of1Zp/CvKZgH+Y1PCZn9pM+nHU6cnIM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706027826; c=relaxed/simple; bh=j03f6RirHCv9dDLa3rzJLikeTc7jyeColyXtSlKWQhU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VuMd8tR9mdwlMbQHPdTQ7hZfBdK3+MJS17vJH+WbPX9PIx5spX/z2aKFIePaLMvZEG1F7eAWD/RnnY6JG4X1acQ5C0pYnVdLy1CAiZNdF6O1lAgYd8CO5asgjz3IP51ppL8zpNL2GB2smPQfd6RNO+ykoSFL25FukkqmtEVFGw8= 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=kTnhR/Yx; arc=none smtp.client-ip=198.47.19.141 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 lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 40NGavmm077083; Tue, 23 Jan 2024 10:36:57 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1706027817; bh=zX2Ey45x6SziOonwBIm+VHIBL+95dJLGekCQr6w7tY4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=kTnhR/YxtEPDkdBSY2sK+TB9g/rmNtnOnMNsmuKlkoD/6a1mvc9Nsunt9Ewcwxrxk c//FGL7Itlk4b4FxNdmcqaLUXjoLInUh2q0mS+3/3KikuVO9wW0UXBUZT2sJkLPyzT KxS5IsxSl55MXVchDSfr+xaMqAnwCfEF4BA1Qb/w= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 40NGavgq000578 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 23 Jan 2024 10:36:57 -0600 Received: from DFLE100.ent.ti.com (10.64.6.21) by DFLE109.ent.ti.com (10.64.6.30) 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 10:36:56 -0600 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE100.ent.ti.com (10.64.6.21) 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 10:36:57 -0600 Received: from lelvsmtp6.itg.ti.com ([10.249.42.149]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 40NGarru123403; Tue, 23 Jan 2024 10:36:56 -0600 From: Andrew Davis <afd@ti.com> To: Sebastian Reichel <sre@kernel.org>, Support Opensource <support.opensource@diasemi.com>, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>, =?utf-8?q?Pali_Roh?= =?utf-8?q?=C3=A1r?= <pali@kernel.org> CC: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>, Andrew Davis <afd@ti.com> Subject: [PATCH 08/21] power: supply: max77693: Use devm_power_supply_register() helper Date: Tue, 23 Jan 2024 10:36:40 -0600 Message-ID: <20240123163653.384385-9-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240123163653.384385-1-afd@ti.com> References: <20240123163653.384385-1-afd@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788900458803033891 X-GMAIL-MSGID: 1788900458803033891 |
Series |
Power supply register with devm
|
|
Commit Message
Andrew Davis
Jan. 23, 2024, 4:36 p.m. UTC
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 <afd@ti.com>
---
drivers/power/supply/max77693_charger.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
Comments
Hi Andrew,
kernel test robot noticed the following build warnings:
[auto build test WARNING on sre-power-supply/for-next]
[also build test WARNING on linus/master v6.8-rc1 next-20240125]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Andrew-Davis/power-supply-da9030-Use-devm_power_supply_register-helper/20240124-004253
base: https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next
patch link: https://lore.kernel.org/r/20240123163653.384385-9-afd%40ti.com
patch subject: [PATCH 08/21] power: supply: max77693: Use devm_power_supply_register() helper
config: i386-buildonly-randconfig-006-20240126 (https://download.01.org/0day-ci/archive/20240126/202401261917.tA05PFDO-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240126/202401261917.tA05PFDO-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401261917.tA05PFDO-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/power/supply/max77693_charger.c:733:27: warning: unused variable 'chg' [-Wunused-variable]
733 | struct max77693_charger *chg = platform_get_drvdata(pdev);
| ^~~
1 warning generated.
vim +/chg +733 drivers/power/supply/max77693_charger.c
87c2d9067893cd drivers/power/max77693_charger.c Krzysztof Kozlowski 2015-01-20 730
1d138270d2963b drivers/power/supply/max77693_charger.c Uwe Kleine-König 2023-09-18 731 static void max77693_charger_remove(struct platform_device *pdev)
87c2d9067893cd drivers/power/max77693_charger.c Krzysztof Kozlowski 2015-01-20 732 {
87c2d9067893cd drivers/power/max77693_charger.c Krzysztof Kozlowski 2015-01-20 @733 struct max77693_charger *chg = platform_get_drvdata(pdev);
87c2d9067893cd drivers/power/max77693_charger.c Krzysztof Kozlowski 2015-01-20 734
87c2d9067893cd drivers/power/max77693_charger.c Krzysztof Kozlowski 2015-01-20 735 device_remove_file(&pdev->dev, &dev_attr_top_off_timer);
87c2d9067893cd drivers/power/max77693_charger.c Krzysztof Kozlowski 2015-01-20 736 device_remove_file(&pdev->dev, &dev_attr_top_off_threshold_current);
87c2d9067893cd drivers/power/max77693_charger.c Krzysztof Kozlowski 2015-01-20 737 device_remove_file(&pdev->dev, &dev_attr_fast_charge_timer);
87c2d9067893cd drivers/power/max77693_charger.c Krzysztof Kozlowski 2015-01-20 738 }
87c2d9067893cd drivers/power/max77693_charger.c Krzysztof Kozlowski 2015-01-20 739
diff --git a/drivers/power/supply/max77693_charger.c b/drivers/power/supply/max77693_charger.c index d0157e63b8b50..9ad6cc6500fcc 100644 --- a/drivers/power/supply/max77693_charger.c +++ b/drivers/power/supply/max77693_charger.c @@ -709,9 +709,9 @@ static int max77693_charger_probe(struct platform_device *pdev) goto err; } - chg->charger = power_supply_register(&pdev->dev, - &max77693_charger_desc, - &psy_cfg); + chg->charger = devm_power_supply_register(&pdev->dev, + &max77693_charger_desc, + &psy_cfg); if (IS_ERR(chg->charger)) { dev_err(&pdev->dev, "failed: power supply register\n"); ret = PTR_ERR(chg->charger); @@ -735,8 +735,6 @@ static void max77693_charger_remove(struct platform_device *pdev) device_remove_file(&pdev->dev, &dev_attr_top_off_timer); device_remove_file(&pdev->dev, &dev_attr_top_off_threshold_current); device_remove_file(&pdev->dev, &dev_attr_fast_charge_timer); - - power_supply_unregister(chg->charger); } static const struct platform_device_id max77693_charger_id[] = {