mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Frank Li <Frank.li@nxp.com>
Cc: "Przemysław Gaj" <pgaj@cadence.com>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i3c: master: cdns: Simplify handling clocks in probe()
Date: Mon, 14 Jul 2025 16:40:53 +0200	[thread overview]
Message-ID: <f9157fbf-09a1-41e5-b5f2-902ca20b870d@linaro.org> (raw)
In-Reply-To: <aHUQ7Ge97/glY+s7@lizhi-Precision-Tower-5810>

On 14/07/2025 16:15, Frank Li wrote:
> On Sun, Jul 13, 2025 at 05:24:12PM +0200, Krzysztof Kozlowski wrote:
>> The two clocks, driver is getting, are not being disabled/re-enabled
>> during runtime of the device.  Eliminate one variable in state struct,
>> all error paths and a lot of code from probe() and remove() by using
>> devm_clk_get_enabled().
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>> ---
>>  drivers/i3c/master/i3c-master-cdns.c | 51 +++++++---------------------
>>  1 file changed, 12 insertions(+), 39 deletions(-)
>>
>> diff --git a/drivers/i3c/master/i3c-master-cdns.c b/drivers/i3c/master/i3c-master-cdns.c
>> index 449e85d7ba87..cc504b58013a 100644
>> --- a/drivers/i3c/master/i3c-master-cdns.c
>> +++ b/drivers/i3c/master/i3c-master-cdns.c
>> @@ -412,7 +412,6 @@ struct cdns_i3c_master {
>>  	} xferqueue;
>>  	void __iomem *regs;
>>  	struct clk *sysclk;
>> -	struct clk *pclk;
>>  	struct cdns_i3c_master_caps caps;
>>  	unsigned long i3c_scl_lim;
>>  	const struct cdns_i3c_data *devdata;
>> @@ -1566,6 +1565,7 @@ MODULE_DEVICE_TABLE(of, cdns_i3c_master_of_ids);
>>  static int cdns_i3c_master_probe(struct platform_device *pdev)
>>  {
>>  	struct cdns_i3c_master *master;
>> +	struct clk *pclk;
>>  	int ret, irq;
>>  	u32 val;
>>
>> @@ -1581,11 +1581,11 @@ static int cdns_i3c_master_probe(struct platform_device *pdev)
>>  	if (IS_ERR(master->regs))
>>  		return PTR_ERR(master->regs);
>>
>> -	master->pclk = devm_clk_get(&pdev->dev, "pclk");
>> -	if (IS_ERR(master->pclk))
>> -		return PTR_ERR(master->pclk);
>> +	pclk = devm_clk_get_enabled(&pdev->dev, "pclk");
>> +	if (IS_ERR(pclk))
>> +		return PTR_ERR(pclk);
>>
>> -	master->sysclk = devm_clk_get(&pdev->dev, "sysclk");
>> +	master->sysclk = devm_clk_get_enabled(&pdev->dev, "sysclk");
> 
> Can you use devm_clk_bulk_get_all_enabled() to simpilfy futher?

Instead of asking redundant question check yourself. On a first glance
it cannot, because it won't be simpler - you still need individual
clock. But if you find it possible which is not visible on first glance,
make a proposal instead of just random drive by comments.

Best regards,
Krzysztof

  reply	other threads:[~2025-07-14 14:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-13 15:24 Krzysztof Kozlowski
2025-07-14 14:15 ` Frank Li
2025-07-14 14:40   ` Krzysztof Kozlowski [this message]
2025-07-14 15:04     ` Frank Li
2025-07-30 23:40 ` Alexandre Belloni

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=f9157fbf-09a1-41e5-b5f2-902ca20b870d@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=Frank.li@nxp.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-i3c@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pgaj@cadence.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®