public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>,
	Linus Walleij <linus.walleij@linaro.org>,
	Grygorii Strashko <grygorii.strashko@ti.com>,
	Santosh Shilimkar <ssantosh@kernel.org>,
	Kevin Hilman <khilman@kernel.org>,
	Alexander Sverdlin <alexander.sverdlin@siemens.com>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-omap@vger.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
	Tony Lindgren <tony@atomide.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>
Subject: Re: [PATCH 2/2] gpio: omap: save two lines by using devm_clk_get_prepared()
Date: Fri, 13 Dec 2024 14:16:08 +0200	[thread overview]
Message-ID: <a21531a7-13ae-45f5-a60d-dd80b3ef9834@gmail.com> (raw)
In-Reply-To: <20241203164143.29852-2-brgl@bgdev.pl>

Hi deeeee Ho peeps!

On 03/12/2024 18:41, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> We can drop the else branch if we get the clock already prepared using
> the relevant helper.
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---

Booting a beaglebone black with the linux-next from Today fails 
(next-20241213). Enabling earlycon + debug yields below splat to be 
printed to the console:

[    2.628019] ------------[ cut here ]------------
[    2.632793] WARNING: CPU: 0 PID: 34 at drivers/clk/clk.c:1254 
clk_core_enable+0xb4/0x1b0
[    2.641156] Enabling unprepared l4-wkup-clkctrl:0008:18
[    2.646530] Modules linked in:
[    2.649688] CPU: 0 UID: 0 PID: 34 Comm: kworker/u4:3 Not tainted 
6.13.0-rc2-next-20241213-00002-gf2d4b29c8330 #15
[    2.660256] Hardware name: Generic AM33XX (Flattened Device Tree)
[    2.666531] Workqueue: events_unbound deferred_probe_work_func
[    2.672553] Call trace:
[    2.672570]  unwind_backtrace from show_stack+0x10/0x14
[    2.680578]  show_stack from dump_stack_lvl+0x50/0x64
[  7 2.685788]  dump_stack_lvl from __warn+0xc0/0x130
[    2.690734]  __warn from warn_slowpath_fmt+0x80/0x1a0
[    2.695944]  warn_slowpath_fmt from clk_core_enable+0xb4/0x1b0
[    2.701963]  clk_core_enable from clk_core_enable_lock+0x18/0x2c
[    2.708159]  clk_core_enable_lock from 
sysc_enable_opt_clocks.part.9+0x28/0x84
[    2.715611]  sysc_enable_opt_clocks.part.9 from 
sysc_enable_module+0x254/0x2dc
[    2.723052]  sysc_enable_module from sysc_runtime_resume+0x17c/0x1c0
[    2.729599]  sysc_runtime_resume from __rpm_callback+0x4c/0x130
[    2.735709]  __rpm_callback from rpm_callback+0x50/0x54
[    2.741096]  rpm_callback from rpm_resume+0x614/0x660
[    2.746304]  rpm_resume from __pm_runtime_resume+0x4c/0x64
[    2.751960]  __pm_runtime_resume from __device_attach+0xd0/0x188
[    2.758155]  __device_attach from bus_probe_device+0x88/0x8c
or_thread from kthread+0x188/0x24c
[    2.789476]  kthread from ret_from_fork+0x14/0x20
[    2.794327] Exception stack(0xe0091fb0 to 0xe0091ff8)
[    2.799528] 1fa0:                                     00000000 
00000000 00000000 00000000
[    2.807947] 1fc0: 00000000 00000000 00000000 00000000 00000000 
00000000 00000000 00000000
[    2.816365] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    2.823173] ---[ end trace 0000000000000000 ]---
[    2.828070] ti-sysc 44e07000.target-module: Optional clocks failed 
for enable: -108
[    2.835998] ------------[ cut here ]------------

reverting
b7bbaff8c1bc ("gpio: omap: save two lines by using devm_clk_get_prepared()")

fixes the boot for me.


>   drivers/gpio/gpio-omap.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> index 54c4bfdccf568..57d299d5d0b16 100644
> --- a/drivers/gpio/gpio-omap.c
> +++ b/drivers/gpio/gpio-omap.c
> @@ -1449,13 +1449,11 @@ static int omap_gpio_probe(struct platform_device *pdev)
>   	}
>   
>   	if (bank->dbck_flag) {
> -		bank->dbck = devm_clk_get(dev, "dbclk");
> +		bank->dbck = devm_clk_get_prepared(dev, "dbclk");
>   		if (IS_ERR(bank->dbck)) {
>   			dev_err(dev,
>   				"Could not get gpio dbck. Disable debounce\n");
>   			bank->dbck_flag = false;
> -		} else {
> -			clk_prepare(bank->dbck);
>   		}
>   	}
>   

I can only spot a minor functional change. The code prior this commit 
does not check the result of clk_prepare(), and does neither set 
bank->dbck_flag = false; nor call clk_put();

Other than that, timing is likely to be changed. Not sure what is the 
thing here.

Yours,
	-- Matti





  parent reply	other threads:[~2024-12-13 12:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-03 16:41 [PATCH 1/2] gpio: omap: allow building the module with COMPILE_TEST=y Bartosz Golaszewski
2024-12-03 16:41 ` [PATCH 2/2] gpio: omap: save two lines by using devm_clk_get_prepared() Bartosz Golaszewski
2024-12-03 18:19   ` Sverdlin, Alexander
2024-12-13 12:16   ` Matti Vaittinen [this message]
2024-12-13 12:29     ` Sverdlin, Alexander
2024-12-13 13:17       ` Bartosz Golaszewski
2024-12-13 13:55       ` Matti Vaittinen
2024-12-16  8:57         ` Sverdlin, Alexander
2024-12-16 11:11           ` Matti Vaittinen
2024-12-16 11:14             ` Matti Vaittinen
2024-12-16 11:27             ` Sverdlin, Alexander
2024-12-03 18:18 ` [PATCH 1/2] gpio: omap: allow building the module with COMPILE_TEST=y Sverdlin, Alexander
2024-12-03 18:41 ` Andrew Davis
2024-12-03 20:36   ` Bartosz Golaszewski
2024-12-03 21:54     ` Andrew Davis
2024-12-05 10:27       ` Bartosz Golaszewski

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=a21531a7-13ae-45f5-a60d-dd80b3ef9834@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=alexander.sverdlin@siemens.com \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=geert+renesas@glider.be \
    --cc=grygorii.strashko@ti.com \
    --cc=khilman@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=ssantosh@kernel.org \
    --cc=tony@atomide.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