Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc249379 authored by Li Jun's avatar Li Jun Committed by Peter Chen
Browse files

usb: chipidea: debug: add runtime pm for register access



Add runtime pm operations for registers access to avoid system hang.

Signed-off-by: default avatarLi Jun <jun.li@freescale.com>
parent 158ec071
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -66,9 +66,11 @@ static int ci_port_test_show(struct seq_file *s, void *data)
	unsigned long flags;
	unsigned mode;

	pm_runtime_get_sync(ci->dev);
	spin_lock_irqsave(&ci->lock, flags);
	mode = hw_port_test_get(ci);
	spin_unlock_irqrestore(&ci->lock, flags);
	pm_runtime_put_sync(ci->dev);

	seq_printf(s, "mode = %u\n", mode);

@@ -98,9 +100,11 @@ static ssize_t ci_port_test_write(struct file *file, const char __user *ubuf,
	if (sscanf(buf, "%u", &mode) != 1)
		return -EINVAL;

	pm_runtime_get_sync(ci->dev);
	spin_lock_irqsave(&ci->lock, flags);
	ret = hw_port_test_set(ci, mode);
	spin_unlock_irqrestore(&ci->lock, flags);
	pm_runtime_put_sync(ci->dev);

	return ret ? ret : count;
}
@@ -316,8 +320,10 @@ static ssize_t ci_role_write(struct file *file, const char __user *ubuf,
	if (role == CI_ROLE_END || role == ci->role)
		return -EINVAL;

	pm_runtime_get_sync(ci->dev);
	ci_role_stop(ci);
	ret = ci_role_start(ci, role);
	pm_runtime_put_sync(ci->dev);

	return ret ? ret : count;
}