Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1304557rwi; Thu, 13 Oct 2022 11:45:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4D9idNUE2OjKuGSicacvDBABME8nO/5F7jUaKfePuHRqUE0usRp36oKrOiGPoYuBDRrqIT X-Received: by 2002:a17:90b:4d0d:b0:1fb:a86d:e752 with SMTP id mw13-20020a17090b4d0d00b001fba86de752mr1283650pjb.120.1665686741957; Thu, 13 Oct 2022 11:45:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665686741; cv=none; d=google.com; s=arc-20160816; b=yEH4qY1gncWsbHww/7NgRsLtfOzeeAwdyDPi9WUpyL11ZUMLTC1/fckXQcwXF3EBol qISa8D/S8l3rpoye9Xth/EDe59dWeyomCrvMmuQr4eQdExcBYV7r+89wE+khsjRR8av6 V8J4KvxANndf/fdNqsg+3nL4NX51aHOz3iNXfTx5YUO/NbOQ8G+wGnv76VScp6iREm0H jS12Yfxzqcj3FzcK6iC585yeXNTZnbzXT+O4pYdYvHsxCuRyGtQ75CBfxxw/U7pbiED2 D+kCnlESoPrHBAN0Rk0udMWsNoPK6NDOgKeT5iZ1D0htW1nMrhlZlR/edF1qF0qIOEtK bqAw== 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=UZXf9vErZscCxuUp7aDEyRr4w+z3mTDlejo8wxWXKtUSuTuqHk0DhFbgGKGGfePCRO J8kJu3p3+hQnsoQCmBzolrAuVYcjnaxxKjD5Rij2wDnXrvkJ0GfNDqWuKWZZKpgaWci8 6aOpHTaRLH3dDBVP3MGjXosnCKjHE4OmoerdBWyPMXxqYjrH4r601mvTX7k5IFIj5Xl8 YZOZwD/XoI2s2ZLxeVb9yqYBrdB76ulTIzss209mLd2Uq+Pk0A7P4HqQeVSK6UIKcY1m whu/WgizcP8YlHsmsFD5QiobeVgyf+K9X/LJAiyUMu66SOHF9dOMrna/s1FkhYGPdrqo TkyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WdgiSEhR; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 70-20020a630249000000b0045f74df51e4si75876pgc.803.2022.10.13.11.45.30; Thu, 13 Oct 2022 11:45:41 -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=WdgiSEhR; 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 S229712AbiJMRx2 (ORCPT + 99 others); Thu, 13 Oct 2022 13:53:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229769AbiJMRxL (ORCPT ); Thu, 13 Oct 2022 13:53:11 -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 496AF14FD3B; Thu, 13 Oct 2022 10:53:04 -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 8421D618F6; Thu, 13 Oct 2022 17:53:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85F00C433C1; Thu, 13 Oct 2022 17:53:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665683582; bh=clqMLo8si0W5e46evh3BggiIvOUCFs2EZmoLr7MDpF8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WdgiSEhRho5NR0DsG3DiEM8xrKU1YVXuOi4nEtislT13xWw/oIgHm2pL0uFececbw b36p1q83QiKedFUi0w4dXE6fdB12i4UlzfAfMHSko2SdPV7+KYs1zecbrhz3o6l/ye 4dj8iXizDP/J2U6ltn+6kHLdVOC68xjxyFpjgBvg= 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 5.4 04/38] firmware: arm_scmi: Add SCMI PM driver remove routine Date: Thu, 13 Oct 2022 19:52:05 +0200 Message-Id: <20221013175144.417813093@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221013175144.245431424@linuxfoundation.org> References: <20221013175144.245431424@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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 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); -- 2.35.1