From patchwork Mon Oct 24 11:28:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8654 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421633wru; Mon, 24 Oct 2022 05:20:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM616mstxUfG5b43MEqatVoILiBHuQyUjXwzqpCbMVfi82k9S6YgFdTBBGmeVMaF7zueQFJI X-Received: by 2002:a17:907:802:b0:781:8017:b2df with SMTP id wv2-20020a170907080200b007818017b2dfmr27166265ejb.606.1666614055562; Mon, 24 Oct 2022 05:20:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614055; cv=none; d=google.com; s=arc-20160816; b=SQkdI2K4ZxRVflWN6hnsxcTOmu7vU43A/U7KrGOzdMX3IheS2m+JLTxD+dQKKAXVFM ZhLmIxMTXNTkazsuLPZ2po5Fcwrpwejm6FwlD0d2xBB5FCa9mXAWtEro+Jm8RCRvLRfU ABX3R4gBntZqCZcN4JZ1dUqgcKIh2qRtX6KZpTFD4ngsh/8YPnMCNDkPj/PN7z/NKXnv S5K3aKGq2lI74vqWeGAx3GvMmFCmYNA8/Iu7FB18iz04dvU5QiYc5j6XaZbGNJw2EFsP m5DSqduLHeR1u5/oj33qvee2UmtrtRAOeuhilS9L7Bndz1kzaOWBIwr8UYiwF7/IdV/y VlAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b9O1oXn1b9817mgfg1io8cP8Nz6QiWg+ZuMvRFEMec0=; b=u9mD1/jY2kEALYqqANQ1IFh9msQdJJZ+pLQxK0Sdyg+M+f15Eyr/XSny9x+K77JpmS 9ql/c5wYoC0SO4AyPngdn41c/WuTI2GZupMvL/2AqF3xkfLc7WcLPuZOIwN1QjoxsZ9N NGmcLq6QV53/H57DN9fbSYu1GIjGfe1v51wgDB2dZmD4dBQ82hh3iyLeMaIZ5RhQXXIE VTxvzZW9voAcXmtaSCV/P2kijxHxoMwnlDa5PT5ZZl1ZnPwXM7W63NNKQ5ewVssgDJWJ WjQUZkkEx3UejyAJ0McXCR28k7Y/LRUZqNuu1Fe0pI5JJW4YlQ9XjBH6oS675ANP2Yjd oyUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RkIPHnW9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d11-20020a170906370b00b007818378f560si21262977ejc.383.2022.10.24.05.20.31; Mon, 24 Oct 2022 05:20:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RkIPHnW9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233120AbiJXMQ0 (ORCPT + 99 others); Mon, 24 Oct 2022 08:16:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233297AbiJXMOp (ORCPT ); Mon, 24 Oct 2022 08:14:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C073978BC6; Mon, 24 Oct 2022 04:55:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 911A2612D5; Mon, 24 Oct 2022 11:55:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A409BC433D6; Mon, 24 Oct 2022 11:55:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612521; bh=clqMLo8si0W5e46evh3BggiIvOUCFs2EZmoLr7MDpF8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RkIPHnW9/izg0UGt7bJA7lEj6b1GCuEKqd8Z/x1L4whYVUm/TQ0e5978CCQiEb7ir W2m05JO/NrMamF0xnI32WcgmJQzu0bgEPq1gTrI6vhy1DKG1oS7MKWMW0B9wizDsgs edcFF/MoZ1EsLzvqcYgECzLzUr+mCIrBtLn2ARzc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cristian Marussi , Sudeep Holla , Sasha Levin Subject: [PATCH 4.19 005/229] firmware: arm_scmi: Add SCMI PM driver remove routine Date: Mon, 24 Oct 2022 13:28:44 +0200 Message-Id: <20221024112959.290577200@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571499873470045?= X-GMAIL-MSGID: =?utf-8?q?1747571499873470045?= From: Cristian Marussi [ Upstream commit dea796fcab0a219830831c070b8dc367d7e0f708 ] Currently, when removing the SCMI PM driver not all the resources registered with genpd subsystem are properly de-registered. As a side effect of this after a driver unload/load cycle you get a splat with a few warnings like this: | debugfs: Directory 'BIG_CPU0' with parent 'pm_genpd' already present! | debugfs: Directory 'BIG_CPU1' with parent 'pm_genpd' already present! | debugfs: Directory 'LITTLE_CPU0' with parent 'pm_genpd' already present! | debugfs: Directory 'LITTLE_CPU1' with parent 'pm_genpd' already present! | debugfs: Directory 'LITTLE_CPU2' with parent 'pm_genpd' already present! | debugfs: Directory 'LITTLE_CPU3' with parent 'pm_genpd' already present! | debugfs: Directory 'BIG_SSTOP' with parent 'pm_genpd' already present! | debugfs: Directory 'LITTLE_SSTOP' with parent 'pm_genpd' already present! | debugfs: Directory 'DBGSYS' with parent 'pm_genpd' already present! | debugfs: Directory 'GPUTOP' with parent 'pm_genpd' already present! Add a proper scmi_pm_domain_remove callback to the driver in order to take care of all the needed cleanups not handled by devres framework. Link: https://lore.kernel.org/r/20220817172731.1185305-7-cristian.marussi@arm.com Signed-off-by: Cristian Marussi Signed-off-by: Sudeep Holla Signed-off-by: Sasha Levin --- drivers/firmware/arm_scmi/scmi_pm_domain.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/firmware/arm_scmi/scmi_pm_domain.c b/drivers/firmware/arm_scmi/scmi_pm_domain.c index 177874adccf0..b0c8962b9885 100644 --- a/drivers/firmware/arm_scmi/scmi_pm_domain.c +++ b/drivers/firmware/arm_scmi/scmi_pm_domain.c @@ -106,9 +106,28 @@ static int scmi_pm_domain_probe(struct scmi_device *sdev) scmi_pd_data->domains = domains; scmi_pd_data->num_domains = num_domains; + dev_set_drvdata(dev, scmi_pd_data); + return of_genpd_add_provider_onecell(np, scmi_pd_data); } +static void scmi_pm_domain_remove(struct scmi_device *sdev) +{ + int i; + struct genpd_onecell_data *scmi_pd_data; + struct device *dev = &sdev->dev; + struct device_node *np = dev->of_node; + + of_genpd_del_provider(np); + + scmi_pd_data = dev_get_drvdata(dev); + for (i = 0; i < scmi_pd_data->num_domains; i++) { + if (!scmi_pd_data->domains[i]) + continue; + pm_genpd_remove(scmi_pd_data->domains[i]); + } +} + static const struct scmi_device_id scmi_id_table[] = { { SCMI_PROTOCOL_POWER }, { }, @@ -118,6 +137,7 @@ MODULE_DEVICE_TABLE(scmi, scmi_id_table); static struct scmi_driver scmi_power_domain_driver = { .name = "scmi-power-domain", .probe = scmi_pm_domain_probe, + .remove = scmi_pm_domain_remove, .id_table = scmi_id_table, }; module_scmi_driver(scmi_power_domain_driver);