Skip to content

Commit 9d1e795

Browse files
committed
clk: Get runtime PM before walking tree for clk_summary
Similar to the previous commit, we should make sure that all devices are runtime resumed before printing the clk_summary through debugfs. Failure to do so would result in a deadlock if the thread is resuming a device to print clk state and that device is also runtime resuming in another thread, e.g the screen is turning on and the display driver is starting up. We remove the calls to clk_pm_runtime_{get,put}() in this path because they're superfluous now that we know the devices are runtime resumed. This also squashes a bug where the return value of clk_pm_runtime_get() wasn't checked, leading to an RPM count underflow on error paths. Fixes: 1bb294a ("clk: Enable/Disable runtime PM for clk_summary") Cc: Taniya Das <[email protected]> Cc: Douglas Anderson <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Douglas Anderson <[email protected]>
1 parent e581cf5 commit 9d1e795

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

drivers/clk/clk.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3340,9 +3340,7 @@ static void clk_summary_show_subtree(struct seq_file *s, struct clk_core *c,
33403340
{
33413341
struct clk_core *child;
33423342

3343-
clk_pm_runtime_get(c);
33443343
clk_summary_show_one(s, c, level);
3345-
clk_pm_runtime_put(c);
33463344

33473345
hlist_for_each_entry(child, &c->children, child_node)
33483346
clk_summary_show_subtree(s, child, level + 1);
@@ -3352,11 +3350,15 @@ static int clk_summary_show(struct seq_file *s, void *data)
33523350
{
33533351
struct clk_core *c;
33543352
struct hlist_head **lists = s->private;
3353+
int ret;
33553354

33563355
seq_puts(s, " enable prepare protect duty hardware connection\n");
33573356
seq_puts(s, " clock count count count rate accuracy phase cycle enable consumer id\n");
33583357
seq_puts(s, "---------------------------------------------------------------------------------------------------------------------------------------------\n");
33593358

3359+
ret = clk_pm_runtime_get_all();
3360+
if (ret)
3361+
return ret;
33603362

33613363
clk_prepare_lock();
33623364

@@ -3365,6 +3367,7 @@ static int clk_summary_show(struct seq_file *s, void *data)
33653367
clk_summary_show_subtree(s, c, 0);
33663368

33673369
clk_prepare_unlock();
3370+
clk_pm_runtime_put_all();
33683371

33693372
return 0;
33703373
}
@@ -3412,8 +3415,14 @@ static int clk_dump_show(struct seq_file *s, void *data)
34123415
struct clk_core *c;
34133416
bool first_node = true;
34143417
struct hlist_head **lists = s->private;
3418+
int ret;
3419+
3420+
ret = clk_pm_runtime_get_all();
3421+
if (ret)
3422+
return ret;
34153423

34163424
seq_putc(s, '{');
3425+
34173426
clk_prepare_lock();
34183427

34193428
for (; *lists; lists++) {
@@ -3426,6 +3435,7 @@ static int clk_dump_show(struct seq_file *s, void *data)
34263435
}
34273436

34283437
clk_prepare_unlock();
3438+
clk_pm_runtime_put_all();
34293439

34303440
seq_puts(s, "}\n");
34313441
return 0;

0 commit comments

Comments
 (0)