From patchwork Thu Feb 8 16:51:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 198483 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp302744dyd; Thu, 8 Feb 2024 08:52:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWTNepl7SkJgKSusN3u4FQ5pTaWceJoCTZLWo2kl/DNSVTrXJnf6iNfTolEjpUnDSA+U26Bogx4Wai4WvDJuLYfnvTStA== X-Google-Smtp-Source: AGHT+IGzqmTzAlCE2NaRvdPQHqYZ19wEZW10XhODFFKu5+ef6D8TPoyaaW1UDC+es35xkEbdwJjo X-Received: by 2002:a05:620a:1b81:b0:785:8b9b:fc47 with SMTP id dv1-20020a05620a1b8100b007858b9bfc47mr40687qkb.48.1707411129589; Thu, 08 Feb 2024 08:52:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707411129; cv=pass; d=google.com; s=arc-20160816; b=ReUhWeFkLSYcqc3lTP2PIr41siAYpaQR5VRrwlfbRsIMfm8ibdaq+G4G0DeQZVli1v BQakx4RXUcJorTlwKYeoW8erJnUSopSwhRyr8b9qCkUmu21aoMrsSjJwzJKHEd2iHf43 WXZG9mMjDxUBNnDYjfP/cZFV2doy2w0Awc3r+8/iZr+1pD61NUPqSk9KRVe55AaxIw+j jgE5sheSUzN9XkmvYyrjw5ndnjiLF3LkNT2UV+gKNADG2Tda1vjKFLv3sdX9fCI2jrRg g/ndwE5nqAZgRWk8r/ZQPgxrEdw5CF9Yd2xmPFHh0jRrXH9cTCJ5OUpJd8HS0dV+euYT uvnw== 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=djSA4+7Ibdz7Va5HFpgHql2bnc9z2IocCEFA1yBcywI=; fh=yNEqaKPOE5bNwOXRw8mkwZJxmw1EXzWP6r/d1e33qY8=; b=Y/Kwy3vjfQwi1zqJ0t7DFs15B+kMUnY+bdLpfhYplAgx+Dfvy+Yf8ZMjvCdeNnX8Bj OjsDB0ff9dRn88St5b4ESv+XqvEBfKcw9I5t82cwXV4SEGY0Gx5tGd9pZoyA9uzK9OQ3 mwdXCvzmXmpiH37f9XEJRbzN3sW1y4k4vXhHmFYJ/WwC41h3miR8/eX57igSGejoWLh2 gRIcv977yvnE86/Qhe4eCu/3x/ang5p7TP26ACH6ydYmLlqeQA+0LU40wVmEOJyIxLT2 S0XAjT7XUaYI1TbRix1lTB/cYQeG8V7XvnJ7mkV2iDrJb2+PDY+I5q2ivW717IeZaA/v QTKQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=lHTrH5qw; 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-58379-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58379-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCUVqjyYv9vJEc4TjW1evczkuzIBkwbocOMHhf+1yKFKpCbGPGVRpB6o/TXOIeyxb9/imKuo1mgtNfXqltn0exW5MMd9JA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id dt45-20020a05620a47ad00b007855175ffcbsi358575qkb.264.2024.02.08.08.52.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 08:52:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58379-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=lHTrH5qw; 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-58379-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58379-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5E5EC1C21490 for ; Thu, 8 Feb 2024 16:52:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A196E823B4; Thu, 8 Feb 2024 16:51:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="lHTrH5qw" 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 2D8917FBCA; Thu, 8 Feb 2024 16:51:24 +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=1707411086; cv=none; b=hRNSvB2xL3DFn2W4SkgUE5hIH+VqduV2VqeYqdigWCxXcfpljP3nq0ZqJ/PHcraNGCJba5zJG6wLTgFz6Fde60lvitXwR9jkoS3zIsq+7+JJWfuWrR0gIww5zg09Dm1G74px5yEzPWhxqC4pliPRrhQjAm2P5n5G5edEyZiE2Hk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707411086; c=relaxed/simple; bh=tIaW3xLuqH8lm17q2qqTiYMsh2SjIZu10Kn5Jet9CqY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UHJmx8Q7r6i+4KMwBB9i+sFwzXEAx5snrTI/nmR+1BHi23NZbdUMhom9nOKCUnXf9b1aiaeMx51LGgSIIl2yij3vnX7pyjfDiGvSxqUVnM+3cfhZuB2kweWTvld+vCGn6B2SVe1+nCss2Y/i6e9+V29kncxd/OEcQUBkoZQg8VE= 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=lHTrH5qw; 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 fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 418GpGTA002555; Thu, 8 Feb 2024 10:51:16 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707411076; bh=djSA4+7Ibdz7Va5HFpgHql2bnc9z2IocCEFA1yBcywI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=lHTrH5qwf6zZcD9wa8FJDcRIJs39q2djIwnzu2/c+Z1iMyY9ez4a0jOE0uUyXHzcF ysUjAs8xwz/C1/Bs+NrlWbXnDmB96OH23gSI41T+bNcjVlW1NPSUcayjr3NV+J1XzX qz+3Jb4qCTPtQp+ikRgg4lOYbZD5UiSC9/Zgv2Qo= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 418GpGCC021887 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 8 Feb 2024 10:51:16 -0600 Received: from DFLE109.ent.ti.com (10.64.6.30) 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; Thu, 8 Feb 2024 10:51:16 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) 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 via Frontend Transport; Thu, 8 Feb 2024 10:51:16 -0600 Received: from lelvsmtp5.itg.ti.com ([10.249.42.149]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 418GpFwE063394; Thu, 8 Feb 2024 10:51:16 -0600 From: Andrew Davis To: Bjorn Andersson , Baolin Wang CC: , , , Andrew Davis Subject: [PATCH v2 3/4] hwspinlock: omap: Use devm_hwspin_lock_register() helper Date: Thu, 8 Feb 2024 10:51:13 -0600 Message-ID: <20240208165114.63148-3-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208165114.63148-1-afd@ti.com> References: <20240208165114.63148-1-afd@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790350332743232300 X-GMAIL-MSGID: 1790350332743232300 This will unregister the HW spinlock on module exit automatically for us, currently we manually unregister which can be error-prone if not done in the right order. This also allows us to remove the remove callback. Do that here. Signed-off-by: Andrew Davis --- Changes for v2: - Clarify commit message drivers/hwspinlock/omap_hwspinlock.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/drivers/hwspinlock/omap_hwspinlock.c b/drivers/hwspinlock/omap_hwspinlock.c index 3bd3ffab92100..fe73da80018b1 100644 --- a/drivers/hwspinlock/omap_hwspinlock.c +++ b/drivers/hwspinlock/omap_hwspinlock.c @@ -117,27 +117,13 @@ static int omap_hwspinlock_probe(struct platform_device *pdev) if (!bank) return -ENOMEM; - platform_set_drvdata(pdev, bank); - for (i = 0, hwlock = &bank->lock[0]; i < num_locks; i++, hwlock++) hwlock->priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i; - return hwspin_lock_register(bank, &pdev->dev, &omap_hwspinlock_ops, + return devm_hwspin_lock_register(&pdev->dev, bank, &omap_hwspinlock_ops, base_id, num_locks); } -static void omap_hwspinlock_remove(struct platform_device *pdev) -{ - struct hwspinlock_device *bank = platform_get_drvdata(pdev); - int ret; - - ret = hwspin_lock_unregister(bank); - if (ret) { - dev_err(&pdev->dev, "%s failed: %d\n", __func__, ret); - return; - } -} - static const struct of_device_id omap_hwspinlock_of_match[] = { { .compatible = "ti,omap4-hwspinlock", }, { .compatible = "ti,am64-hwspinlock", }, @@ -148,7 +134,6 @@ MODULE_DEVICE_TABLE(of, omap_hwspinlock_of_match); static struct platform_driver omap_hwspinlock_driver = { .probe = omap_hwspinlock_probe, - .remove_new = omap_hwspinlock_remove, .driver = { .name = "omap_hwspinlock", .of_match_table = omap_hwspinlock_of_match,