mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	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 <pierre-louis.bossart@linux.intel.com> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20221125142028.1118618-4-ckeepax@opensource.cirrus.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
		
							parent
							
								
									6726b47a2a
								
							
						
					
					
						commit
						b275bf45ba
					
				
					 1 changed files with 12 additions and 1 deletions
				
			
		| 
						 | 
					@ -4,6 +4,7 @@
 | 
				
			||||||
#include <linux/device.h>
 | 
					#include <linux/device.h>
 | 
				
			||||||
#include <linux/debugfs.h>
 | 
					#include <linux/debugfs.h>
 | 
				
			||||||
#include <linux/mod_devicetable.h>
 | 
					#include <linux/mod_devicetable.h>
 | 
				
			||||||
 | 
					#include <linux/pm_runtime.h>
 | 
				
			||||||
#include <linux/slab.h>
 | 
					#include <linux/slab.h>
 | 
				
			||||||
#include <linux/soundwire/sdw.h>
 | 
					#include <linux/soundwire/sdw.h>
 | 
				
			||||||
#include <linux/soundwire/sdw_registers.h>
 | 
					#include <linux/soundwire/sdw_registers.h>
 | 
				
			||||||
| 
						 | 
					@ -35,7 +36,7 @@ static ssize_t sdw_sprintf(struct sdw_slave *slave,
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int value;
 | 
						int value;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	value = sdw_read(slave, reg);
 | 
						value = sdw_read_no_pm(slave, reg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (value < 0)
 | 
						if (value < 0)
 | 
				
			||||||
		return scnprintf(buf + pos, RD_BUF - pos, "%3x\tXX\n", reg);
 | 
							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)
 | 
				
			||||||
	if (!buf)
 | 
						if (!buf)
 | 
				
			||||||
		return -ENOMEM;
 | 
							return -ENOMEM;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ret = pm_runtime_resume_and_get(&slave->dev);
 | 
				
			||||||
 | 
						if (ret < 0 && ret != -EACCES) {
 | 
				
			||||||
 | 
							kfree(buf);
 | 
				
			||||||
 | 
							return ret;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = scnprintf(buf, RD_BUF, "Register  Value\n");
 | 
						ret = scnprintf(buf, RD_BUF, "Register  Value\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* DP0 non-banked registers */
 | 
						/* DP0 non-banked registers */
 | 
				
			||||||
| 
						 | 
					@ -112,6 +119,10 @@ static int sdw_slave_reg_show(struct seq_file *s_file, void *data)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	seq_printf(s_file, "%s", buf);
 | 
						seq_printf(s_file, "%s", buf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pm_runtime_mark_last_busy(&slave->dev);
 | 
				
			||||||
 | 
						pm_runtime_put(&slave->dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	kfree(buf);
 | 
						kfree(buf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue