All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: "irving.ch.lin" <irving-ch.lin@mediatek.com>
Cc: Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Richard Cochran <richardcochran@gmail.com>,
	Qiqi Wang <qiqi.wang@mediatek.com>,
	linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-pm@vger.kernel.org,
	netdev@vger.kernel.org,
	Project_Global_Chrome_Upstream_Group@mediatek.com,
	sirius.wang@mediatek.com, vince-wl.liu@mediatek.com,
	jh.hsu@mediatek.com
Subject: Re: [PATCH v2 4/4] pmdomain: mediatek: Add power domain driver for MT8189 SoC
Date: Sat, 13 Sep 2025 10:16:04 +0100	[thread overview]
Message-ID: <20250913091604.GK224143@horms.kernel.org> (raw)
In-Reply-To: <20250912120508.3180067-5-irving-ch.lin@mediatek.com>

On Fri, Sep 12, 2025 at 08:04:53PM +0800, irving.ch.lin wrote:
> From: Irving-ch Lin <irving-ch.lin@mediatek.com>
> 
> Introduce a new power domain (pmd) driver for the MediaTek mt8189 SoC.
> This driver ports and refines the power domain framework, dividing
> hardware blocks (CPU, GPU, peripherals, etc.) into independent power
> domains for precise and energy-efficient power management.
> 
> Signed-off-by: Irving-ch Lin <irving-ch.lin@mediatek.com>

...

> diff --git a/drivers/pmdomain/mediatek/mtk-scpsys.c b/drivers/pmdomain/mediatek/mtk-scpsys.c

...

> @@ -419,54 +848,145 @@ static void init_clks(struct platform_device *pdev, struct clk **clk)
>  		clk[i] = devm_clk_get(&pdev->dev, clk_names[i]);
>  }
>  
> +static int init_subsys_clks(struct platform_device *pdev,
> +			    const char *prefix, struct clk **clk)
> +{
> +	struct device_node *node = pdev->dev.of_node;
> +	u32 prefix_len, sub_clk_cnt = 0;
> +	struct property *prop;
> +	const char *clk_name;
> +
> +	if (!node) {
> +		dev_err(&pdev->dev, "Cannot find scpsys node: %ld\n",
> +			PTR_ERR(node));
> +		return PTR_ERR(node);

Hi Irving-ch,

Here node is NULL. So PTR_ERR(node) will be zero.
This is probably not what you are after here.

Flagged by Smatch

> +	}
> +
> +	prefix_len = strlen(prefix);
> +
> +	of_property_for_each_string(node, "clock-names", prop, clk_name) {
> +		if (!strncmp(clk_name, prefix, prefix_len) &&
> +		    (strlen(clk_name) > prefix_len + 1) &&
> +		    (clk_name[prefix_len] == '-')) {
> +			if (sub_clk_cnt >= MAX_SUBSYS_CLKS) {
> +				dev_err(&pdev->dev,
> +					"subsys clk out of range %d\n",
> +					sub_clk_cnt);
> +				return -EINVAL;
> +			}
> +
> +			clk[sub_clk_cnt] = devm_clk_get(&pdev->dev, clk_name);
> +
> +			if (IS_ERR(clk[sub_clk_cnt])) {
> +				dev_err(&pdev->dev,
> +					"Subsys clk get fail %ld\n",
> +					PTR_ERR(clk[sub_clk_cnt]));
> +				return PTR_ERR(clk[sub_clk_cnt]);
> +			}
> +			sub_clk_cnt++;
> +		}
> +	}
> +
> +	return sub_clk_cnt;
> +}

...


  reply	other threads:[~2025-09-13  9:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-12 12:04 [PATCH v2 0/4] Add support for MT8189 clock/power controller irving.ch.lin
2025-09-12 12:04 ` [PATCH v2 1/4] dt-bindings: clock: mediatek: Add MT8189 clock definitions irving.ch.lin
2025-09-14 12:03   ` Krzysztof Kozlowski
2025-09-12 12:04 ` [PATCH v2 2/4] dt-bindings: power: mediatek: Add MT8189 power domain definitions irving.ch.lin
2025-09-14 12:05   ` Krzysztof Kozlowski
2025-09-12 12:04 ` [PATCH v2 3/4] clk: mediatek: Add clock drivers for MT8189 SoC irving.ch.lin
2025-09-15  7:54   ` Peng Fan
2025-09-12 12:04 ` [PATCH v2 4/4] pmdomain: mediatek: Add power domain driver " irving.ch.lin
2025-09-13  9:16   ` Simon Horman [this message]
2025-09-15  8:18   ` Peng Fan
2025-09-17  9:40   ` AngeloGioacchino Del Regno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250913091604.GK224143@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=irving-ch.lin@mediatek.com \
    --cc=jh.hsu@mediatek.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mturquette@baylibre.com \
    --cc=netdev@vger.kernel.org \
    --cc=qiqi.wang@mediatek.com \
    --cc=richardcochran@gmail.com \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=sirius.wang@mediatek.com \
    --cc=ulf.hansson@linaro.org \
    --cc=vince-wl.liu@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.