All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: dongxuyang@eswincomputing.com, mturquette@baylibre.com,
	sboyd@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, linux-clk@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: ningyu@eswincomputing.com, linmin@eswincomputing.com,
	huangyifeng@eswincomputing.com
Subject: Re: [PATCH 2/2] clock: eswin: Add eic7700 clock driver
Date: Fri, 16 May 2025 15:23:27 +0200	[thread overview]
Message-ID: <87874bd2-2fcb-42b3-9e92-cccaa4eaa148@kernel.org> (raw)
In-Reply-To: <20250514002626.348-1-dongxuyang@eswincomputing.com>

On 14/05/2025 02:26, dongxuyang@eswincomputing.com wrote:
>> +static int eswin_cpu_clk_init(struct platform_device *pdev)
> +{
> +	struct clk *cpu_clk;
> +	struct device *dev = &pdev->dev;
> +	struct device_node *np = dev->of_node;
> +	u32 default_freq;
> +	int ret = 0;
> +	int numa_id;
> +	char name[128] = { 0 };
> +
> +	ret = of_property_read_u32(np, "cpu-default-frequency", &default_freq);

NAK, undocumented ABI.

You already got such comments. All your patches repeat the same mistakes.

> +	if (ret) {
> +		dev_info(dev, "cpu-default-frequency not set\n");
> +		return ret;
> +	}
> +	numa_id = dev_to_node(dev->parent);
> +	if (numa_id < 0)
> +		sprintf(name, "%s", "clk_cpu_ext_src_core_clk_0");
> +	else
> +		sprintf(name, "d%d_%s", numa_id, "clk_cpu_ext_src_core_clk_0");
> +
> +	cpu_clk = __clk_lookup(name);
> +	if (!cpu_clk) {
> +		dev_err(dev, "Failed to lookup CPU clock\n");
> +		return -EINVAL;
> +	}
> +	ret = clk_set_rate(cpu_clk, default_freq);
> +	if (ret) {
> +		dev_err(dev, "Failed to set CPU frequency: %d\n", ret);
> +		return ret;
> +	}
> +	dev_info(dev, "CPU frequency set to %u Hz\n", default_freq);

Drop, this is supposed to be silent.

> +	return 0;
> +}
> +
> +static int eswin_clk_probe(struct platform_device *pdev)
> +{
> +	struct eswin_clock_data *clk_data;
> +
> +	clk_data = eswin_clk_init(pdev, EIC7700_NR_CLKS);
> +	if (!clk_data)
> +		return -EAGAIN;
> +
> +	special_div_table_init(u_3_bit_special_div_table,
> +			       ARRAY_SIZE(u_3_bit_special_div_table));
> +	special_div_table_init(u_4_bit_special_div_table,
> +			       ARRAY_SIZE(u_4_bit_special_div_table));
> +	special_div_table_init(u_6_bit_special_div_table,
> +			       ARRAY_SIZE(u_6_bit_special_div_table));
> +	special_div_table_init(u_7_bit_special_div_table,
> +			       ARRAY_SIZE(u_7_bit_special_div_table));
> +	special_div_table_init(u_8_bit_special_div_table,
> +			       ARRAY_SIZE(u_8_bit_special_div_table));
> +	special_div_table_init(u_11_bit_special_div_table,
> +			       ARRAY_SIZE(u_11_bit_special_div_table));
> +	special_div_table_init(u_16_bit_special_div_table,
> +			       ARRAY_SIZE(u_16_bit_special_div_table));
> +
> +	eswin_clk_register_fixed_rate(eic7700_fixed_rate_clks,
> +				      ARRAY_SIZE(eic7700_fixed_rate_clks),
> +				      clk_data);
> +	eswin_clk_register_pll(eic7700_pll_clks, ARRAY_SIZE(eic7700_pll_clks),
> +			       clk_data, &pdev->dev);
> +
> +	eswin_clk_register_fixed_factor(eic7700_fixed_factor_clks,
> +					ARRAY_SIZE(eic7700_fixed_factor_clks),
> +					clk_data);
> +	eswin_clk_register_mux(eic7700_mux_clks, ARRAY_SIZE(eic7700_mux_clks),
> +			       clk_data);
> +	eswin_clk_register_clk(eic7700_clks_early_0,
> +			       ARRAY_SIZE(eic7700_clks_early_0), clk_data);
> +	eswin_clk_register_divider(eic7700_div_clks,
> +				   ARRAY_SIZE(eic7700_div_clks), clk_data);
> +	eswin_clk_register_clk(eic7700_clks_early_1,
> +			       ARRAY_SIZE(eic7700_clks_early_1), clk_data);
> +	eswin_clk_register_gate(eic7700_gate_clks,
> +				ARRAY_SIZE(eic7700_gate_clks), clk_data);
> +	eswin_clk_register_clk(eic7700_clks, ARRAY_SIZE(eic7700_clks),
> +			       clk_data);
> +
> +	eswin_cpu_clk_init(pdev);
> +
> +	return 0;



...

> +int eswin_clk_register_clk(const struct eswin_clock *clks, int nums,
> +			   struct eswin_clock_data *data)
> +{
> +	struct clk *clk;
> +	int i;
> +
> +	for (i = 0; i < nums; i++) {
> +		char *name = kzalloc(strlen(clks[i].name) + 2 * sizeof(char) +
> +					     sizeof(int),
> +				     GFP_KERNEL);
> +		char *parent_name =
> +			kzalloc(strlen(clks[i].parent_name) + 2 * sizeof(char) +
> +					sizeof(int),
> +				GFP_KERNEL);
> +		if (data->numa_id < 0) {
> +			sprintf(name, "%s", clks[i].name);
> +			sprintf(parent_name, "%s", clks[i].parent_name);
> +		} else {
> +			sprintf(name, "d%d_%s", data->numa_id, clks[i].name);
> +			sprintf(parent_name, "d%d_%s", data->numa_id,
> +				clks[i].parent_name);
> +		}
> +		clk = eswin_register_clk(data, NULL, name, parent_name,
> +					 clks[i].flags, &data->lock);
> +		if (IS_ERR(clk)) {
> +			pr_err("%s: failed to register clock %s\n", __func__,

Same comments apply as for all other patches.

> +			       clks[i].name);
> +			kfree(name);
> +			kfree(parent_name);
> +			goto err;
> +		}
> +
> +		if (clks[i].alias)
> +			clk_register_clkdev(clk, clks[i].alias, NULL);
> +
> +		data->clk_data.clks[clks[i].id] = clk;
> +		kfree(name);
> +		kfree(parent_name);
> +	}
> +	return 0;
> +err:
> +	while (i--)
> +		clk_unregister_gate(data->clk_data.clks[clks[i].id]);
> +
> +	return PTR_ERR(clk);
> +}
> +EXPORT_SYMBOL_GPL(eswin_clk_register_clk);

That's not a module.

> diff --git a/drivers/clk/eswin/clk.h b/drivers/clk/eswin/clk.h
> new file mode 100644
> index 000000000000..1c0d0b771229
> --- /dev/null
> +++ b/drivers/clk/eswin/clk.h
> @@ -0,0 +1,209 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
Best regards,
Krzysztof

  reply	other threads:[~2025-05-16 13:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-14  0:22 [PATCH 0/2] Add driver support for ESWIN eic700 SoC clock controller dongxuyang
2025-05-14  0:25 ` [PATCH 1/2] dt-bindings: clock: eswin: Documentation for eic7700 SoC dongxuyang
2025-05-14  1:20   ` Rob Herring (Arm)
2025-05-15  9:30     ` 董绪洋
2025-05-14 12:43   ` Rob Herring
2025-05-14  0:26 ` [PATCH 2/2] clock: eswin: Add eic7700 clock driver dongxuyang
2025-05-16 13:23   ` Krzysztof Kozlowski [this message]
2025-05-23  9:15     ` Krzysztof Kozlowski

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=87874bd2-2fcb-42b3-9e92-cccaa4eaa148@kernel.org \
    --to=krzk@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dongxuyang@eswincomputing.com \
    --cc=huangyifeng@eswincomputing.com \
    --cc=krzk+dt@kernel.org \
    --cc=linmin@eswincomputing.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=ningyu@eswincomputing.com \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    /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.