From patchwork Thu Sep 21 09:10:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dhruva Gole X-Patchwork-Id: 13393794 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3B907E706F8 for ; Thu, 21 Sep 2023 09:18:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=mGwjjya2UjMf3X3uqk1CDoaARbqBLWq0IMRPpqzeips=; b=2MypXzXDK/6D6g GjUh3Ath0wmIvyERzqIw9we+xmq2vqFH3Hy76RZb1dyvjVTfeH1jJcsjX56H8PWEwvzE0P6mzKnhQ zLsRUiqkXwNC59tgeW93QU6v5PzY8z/3EKOwJnMJbXbKjegWKYCKvhuZyYWOumDZ3k2QSCiLPBMlu 01q8SOyq1fi2SgpvZE51bAFTF5Y1siX/N3xGHlii92HQqt+hc00OehZdxdz3UVt7V7p4oLjASZT8s BEJ7UWiIKG52x7JUY12BBPk8pmRhjPT2fgbu/ROvlpg5BwBPXF9qjKaQrKGa3eYGqgWo+7/Skz5PQ MAWKvC0F9GTY9RY1F6Mw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjFpA-005Zak-0Y; Thu, 21 Sep 2023 09:18:16 +0000 Received: from fllv0016.ext.ti.com ([198.47.19.142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjFp6-005ZZk-2R for linux-arm-kernel@lists.infradead.org; Thu, 21 Sep 2023 09:18:14 +0000 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 38L9I5iK122575; Thu, 21 Sep 2023 04:18:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1695287885; bh=Dm1e+plwHNwqQ1PDB+fSI8pFST4Rseh0QLTTgk3amws=; h=From:To:CC:Subject:Date; b=mJDEJkkxDqWwUogPca0RSQOUUPPqKrXZiLVU9iqVAqOSdKXueqfByTY1ZJmcvh9QE 853SEgVdDUzP1gqzW9Bfmep0NKjzYOGccuigffBKF++kmmKApg38uqKcf+4ESEoWor Gi8xVGAgKicvUXJ0sXOv3pfqMcJCHIcqgwaogOx0= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 38L9I5cS030231 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 21 Sep 2023 04:18:05 -0500 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 21 Sep 2023 04:18:05 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE110.ent.ti.com (10.64.6.31) 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, 21 Sep 2023 04:18:05 -0500 Received: from dhruva.dhcp.ti.com (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 38L9I1AP079306; Thu, 21 Sep 2023 04:18:02 -0500 From: Dhruva Gole To: Nishanth Menon CC: , , Dhruva Gole , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Tero Kristo , Santosh Shilimkar , Vibhore Vardhan , Vignesh Raghavendra Subject: [PATCH V2] firmware: ti_sci: Mark driver as non removable Date: Thu, 21 Sep 2023 14:40:26 +0530 Message-ID: <20230921091025.133130-1-d-gole@ti.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230921_021812_892894_E3841165 X-CRM114-Status: GOOD ( 20.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The TI-SCI message protocol provides a way to communicate between various compute processors with a central system controller entity. It provides the fundamental device management capability and clock control in the SOCs that it's used in. The remove function failed to do all the necessary cleanup if there are registered users. Some things are freed however which likely results in an oops later on. Ensure that the driver isn't unbound by suppressing its bind and unbind sysfs attributes. As the driver is built-in there is no way to remove device once bound. We can also remove the ti_sci_remove call along with the ti_sci_debugfs_destroy as there are no callers for it any longer. Fixes: aa276781a64a ("firmware: Add basic support for TI System Control Interface (TI-SCI) protocol") Reported-by: Uwe Kleine-König Closes: https://lore.kernel.org/linux-arm-kernel/20230216083908.mvmydic5lpi3ogo7@pengutronix.de/ Suggested-by: Uwe Kleine-König Acked-by: Uwe Kleine-König Signed-off-by: Dhruva Gole --- Link to v1: https://lore.kernel.org/linux-arm-kernel/20230907171700.1922453-1-d-gole@ti.com/ Changelog: Rebased, updated the commit message and added Reported and Closes tag. Cc: Tero Kristo Cc: Santosh Shilimkar Cc: Vibhore Vardhan Cc: Vignesh Raghavendra --- drivers/firmware/ti_sci.c | 46 +-------------------------------------- 1 file changed, 1 insertion(+), 45 deletions(-) base-commit: 940fcc189c51032dd0282cbee4497542c982ac59 diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c index c288ae49f91c..ffca636cc13f 100644 --- a/drivers/firmware/ti_sci.c +++ b/drivers/firmware/ti_sci.c @@ -190,19 +190,6 @@ static int ti_sci_debugfs_create(struct platform_device *pdev, return 0; } -/** - * ti_sci_debugfs_destroy() - clean up log debug file - * @pdev: platform device pointer - * @info: Pointer to SCI entity information - */ -static void ti_sci_debugfs_destroy(struct platform_device *pdev, - struct ti_sci_info *info) -{ - if (IS_ERR(info->debug_region)) - return; - - debugfs_remove(info->d); -} #else /* CONFIG_DEBUG_FS */ static inline int ti_sci_debugfs_create(struct platform_device *dev, struct ti_sci_info *info) @@ -3445,43 +3432,12 @@ static int ti_sci_probe(struct platform_device *pdev) return ret; } -static int ti_sci_remove(struct platform_device *pdev) -{ - struct ti_sci_info *info; - struct device *dev = &pdev->dev; - int ret = 0; - - of_platform_depopulate(dev); - - info = platform_get_drvdata(pdev); - - if (info->nb.notifier_call) - unregister_restart_handler(&info->nb); - - mutex_lock(&ti_sci_list_mutex); - if (info->users) - ret = -EBUSY; - else - list_del(&info->node); - mutex_unlock(&ti_sci_list_mutex); - - if (!ret) { - ti_sci_debugfs_destroy(pdev, info); - - /* Safe to free channels since no more users */ - mbox_free_channel(info->chan_tx); - mbox_free_channel(info->chan_rx); - } - - return ret; -} - static struct platform_driver ti_sci_driver = { .probe = ti_sci_probe, - .remove = ti_sci_remove, .driver = { .name = "ti-sci", .of_match_table = of_match_ptr(ti_sci_of_match), + .suppress_bind_attrs = true, }, }; module_platform_driver(ti_sci_driver);