Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp592879rdb; Tue, 23 Jan 2024 08:40:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IGT+Igi/V0JMkJMQE5jJ0Z3+0qI/XHgis/zPKejRrdK4NKEUJGd3FcdjGTNR3/14c647eaY X-Received: by 2002:a17:902:8216:b0:1d6:c8e3:c3dd with SMTP id x22-20020a170902821600b001d6c8e3c3ddmr5844500pln.54.1706028009601; Tue, 23 Jan 2024 08:40:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706028009; cv=pass; d=google.com; s=arc-20160816; b=kFPwH2ur3bepr5pjnCDzuW0n2PsPryPuivYBE0KdF11LFiHCeL37N0eM13WWvL8bH2 fF1no+QkeX6PJwNvCTzlW19lLKnen6cymFGWg7qfDAAKC0o+4H3ZblpvDxkD1iav5Dc5 lgf9NPTV/P1ZePYAmlvhZvepKW6K4kRUme3sv/rKAJjndtwNHqXh+unxWPaEUxE/aLO5 SxMP80bsiD3lEqGwr1a6CINvS4v5lJgcUxgLDHeq9G/BlgBcQboy4Nl6vA3q10VITrZ1 rKa1FLdWIa3UlrlFxsKAx+YkObgA+RO74xHzpnyNgwiEMjOFgJhmAs3LRfIHRofUX18Q pj3g== 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=flf2OlhoLXg5wbdQwQ0WLCNrY2rfsuebbogRln7SRDo=; fh=pozOWq+Llr4uSsAlLarsoaPJ+QQ4TuIyCJyc15dU4WI=; b=w6j7t5xfjZ1zK9pf++X1UKsvj12e+XWRa8vTJV2CVpHJZtWa3zgFdFjToOhTBfYZiw uzI1rKR5wWNzhStvDVd7PwVR5z+/qrNqZhuc0MOF4r8GRr2wOraFRULmqj1ixVTE2i8J CQe38+xz2FGCjr5laS/ZlajC6j+whCFb36HIuF46iopurFXAyqOj8S5/RmdWjFiu85ka vk/PNR7/JWaeKV04zjJtnXr9h9EBotC/lJbBvLGlKdeeOivQNYflwzAYP4BZpKjjqCak xC6nB37D1BdEaUR6ByiaoWg8M22QJ3K4ivyEhlScheHNHWACl/rrWabq2X4X+Zo/bvQL A6/Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ySRq0O9w; 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-35662-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35662-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l12-20020a170902eb0c00b001d7215e9760si7636849plb.261.2024.01.23.08.40.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 08:40:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35662-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ySRq0O9w; 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-35662-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35662-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 44A6C28DD34 for ; Tue, 23 Jan 2024 16:38:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9CF8681AA0; Tue, 23 Jan 2024 16:37:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="ySRq0O9w" Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (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 EE5487FBCD; Tue, 23 Jan 2024 16:37:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.249 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706027826; cv=none; b=bK694AXz9Lxp4XuM0YydFjbVkL2HROcxzO1XtrQTTy1mgErxelkNwesn6ZtfXSqPclKIX+WYWmosN2Gb/cno6vwYfLcSiL5eZ1TfOE5TB8a864weJBDV4gip4BSTro0jGCIOxnySmY9v535xnpHHD7FHikFDPo79/sg423VbUHk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706027826; c=relaxed/simple; bh=1/jYUyeGxOHiqO1t9Fn7Rz8hO0B1uSm3eptRNSnnwpA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=n4aahRFs4Iph+rp+VKA6saYv/CFMpd3OJaHHaO88+rh4Vg8pURuRCvu2Y/pEhGjMa82BGXmnqKVofTpCl65JPIkI6nO9YRBXRteZ4dgwsTQwgnJM1gOZaPmGZX/9qcNqnrdbuiw6yLdE3oD0+GEXwFY3MpRhwyaU+xa9adXIFLQ= 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=ySRq0O9w; arc=none smtp.client-ip=198.47.23.249 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 lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 40NGatiq095559; Tue, 23 Jan 2024 10:36:55 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1706027815; bh=flf2OlhoLXg5wbdQwQ0WLCNrY2rfsuebbogRln7SRDo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ySRq0O9w+YTNjzg/jUq8KBOsl6qGh+T3xcZEQotkdUDsNnYalsuhaBNeqBShq6Dgt FBzaaeo6FW2uY3AIvVvdkJ9AKoLxGAqB2esZkmPQ0cJK3Tnpge2847FiHfAB3ZaZa4 VmS50cbGm1/hQMFufKh+GvkpfNLgrTe2cFe9PxaQ= 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 40NGatr7000549 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 23 Jan 2024 10:36:55 -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:54 -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:55 -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 40NGarro123403; Tue, 23 Jan 2024 10:36:54 -0600 From: Andrew Davis To: Sebastian Reichel , Support Opensource , Krzysztof Kozlowski , =?UTF-8?q?Pali=20Roh=C3=A1r?= CC: , , Andrew Davis Subject: [PATCH 02/21] power: supply: da9052: Use devm_power_supply_register() helper Date: Tue, 23 Jan 2024 10:36:34 -0600 Message-ID: <20240123163653.384385-3-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: 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/da9052-battery.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/power/supply/da9052-battery.c b/drivers/power/supply/da9052-battery.c index 6f7c58a41e918..0d84c42c624e0 100644 --- a/drivers/power/supply/da9052-battery.c +++ b/drivers/power/supply/da9052-battery.c @@ -622,7 +622,7 @@ static s32 da9052_bat_probe(struct platform_device *pdev) } } - bat->psy = power_supply_register(&pdev->dev, &psy_desc, &psy_cfg); + bat->psy = devm_power_supply_register(&pdev->dev, &psy_desc, &psy_cfg); if (IS_ERR(bat->psy)) { ret = PTR_ERR(bat->psy); goto err; @@ -644,8 +644,6 @@ static void da9052_bat_remove(struct platform_device *pdev) for (i = 0; i < ARRAY_SIZE(da9052_bat_irqs); i++) da9052_free_irq(bat->da9052, da9052_bat_irq_bits[i], bat); - - power_supply_unregister(bat->psy); } static struct platform_driver da9052_bat_driver = { -- 2.39.2