Skip to content

Commit b275bf4

Browse files
charleskeepaxvinodkoul
authored andcommitted
soundwire: debugfs: Switch to sdw_read_no_pm
It is rather inefficient to be constantly playing with the runtime PM reference for each individual register, switch to holding a PM runtime reference across the whole register output. Reviewed-by: Pierre-Louis Bossart <[email protected]> Signed-off-by: Charles Keepax <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 6726b47 commit b275bf4

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/soundwire/debugfs.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <linux/device.h>
55
#include <linux/debugfs.h>
66
#include <linux/mod_devicetable.h>
7+
#include <linux/pm_runtime.h>
78
#include <linux/slab.h>
89
#include <linux/soundwire/sdw.h>
910
#include <linux/soundwire/sdw_registers.h>
@@ -35,7 +36,7 @@ static ssize_t sdw_sprintf(struct sdw_slave *slave,
3536
{
3637
int value;
3738

38-
value = sdw_read(slave, reg);
39+
value = sdw_read_no_pm(slave, reg);
3940

4041
if (value < 0)
4142
return scnprintf(buf + pos, RD_BUF - pos, "%3x\tXX\n", reg);
@@ -55,6 +56,12 @@ static int sdw_slave_reg_show(struct seq_file *s_file, void *data)
5556
if (!buf)
5657
return -ENOMEM;
5758

59+
ret = pm_runtime_resume_and_get(&slave->dev);
60+
if (ret < 0 && ret != -EACCES) {
61+
kfree(buf);
62+
return ret;
63+
}
64+
5865
ret = scnprintf(buf, RD_BUF, "Register Value\n");
5966

6067
/* DP0 non-banked registers */
@@ -112,6 +119,10 @@ static int sdw_slave_reg_show(struct seq_file *s_file, void *data)
112119
}
113120

114121
seq_printf(s_file, "%s", buf);
122+
123+
pm_runtime_mark_last_busy(&slave->dev);
124+
pm_runtime_put(&slave->dev);
125+
115126
kfree(buf);
116127

117128
return 0;

0 commit comments

Comments
 (0)