Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1bb3673 authored by Stefan Agner's avatar Stefan Agner Committed by Greg Kroah-Hartman
Browse files

soc: imx: gpc: de-register power domains only if initialized



[ Upstream commit 7801c545e706674aeed40256eb806ad37b18ad71 ]

If power domain information are missing in the device tree, no
power domains get initialized. However, imx_gpc_remove tries to
remove power domains always in the old DT binding case. Only
remove power domains when imx_gpc_probe initialized them in
first place.

Fixes: 721cabf6 ("soc: imx: move PGC handling to a new GPC driver")
Signed-off-by: default avatarStefan Agner <stefan@agner.ch>
Reviewed-by: default avatarLucas Stach <l.stach@pengutronix.de>
Reviewed-by: default avatarFabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e65cd9a2
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -456,13 +456,21 @@ static int imx_gpc_probe(struct platform_device *pdev)

static int imx_gpc_remove(struct platform_device *pdev)
{
	struct device_node *pgc_node;
	int ret;

	pgc_node = of_get_child_by_name(pdev->dev.of_node, "pgc");

	/* bail out if DT too old and doesn't provide the necessary info */
	if (!of_property_read_bool(pdev->dev.of_node, "#power-domain-cells") &&
	    !pgc_node)
		return 0;

	/*
	 * If the old DT binding is used the toplevel driver needs to
	 * de-register the power domains
	 */
	if (!of_get_child_by_name(pdev->dev.of_node, "pgc")) {
	if (!pgc_node) {
		of_genpd_del_provider(pdev->dev.of_node);

		ret = pm_genpd_remove(&imx_gpc_domains[GPC_PGC_DOMAIN_PU].base);