diff options
author | Li Jun <jun.li@freescale.com> | 2015-07-29 01:11:11 -0400 |
---|---|---|
committer | Peter Chen <peter.chen@freescale.com> | 2015-08-13 21:13:12 -0400 |
commit | bc24937943d9f71a1e32b5dc4e2f0ef8fcc07b64 (patch) | |
tree | edefe3e6c6b3d3e8b0086d8e439d70d713d9bf93 | |
parent | 158ec071fb5243e5c49259d2dbc4c8dbaed24c47 (diff) |
usb: chipidea: debug: add runtime pm for register access
Add runtime pm operations for registers access to avoid system hang.
Signed-off-by: Li Jun <jun.li@freescale.com>
-rw-r--r-- | drivers/usb/chipidea/debug.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c index 5b7061a33103..64b6a4735876 100644 --- a/drivers/usb/chipidea/debug.c +++ b/drivers/usb/chipidea/debug.c | |||
@@ -66,9 +66,11 @@ static int ci_port_test_show(struct seq_file *s, void *data) | |||
66 | unsigned long flags; | 66 | unsigned long flags; |
67 | unsigned mode; | 67 | unsigned mode; |
68 | 68 | ||
69 | pm_runtime_get_sync(ci->dev); | ||
69 | spin_lock_irqsave(&ci->lock, flags); | 70 | spin_lock_irqsave(&ci->lock, flags); |
70 | mode = hw_port_test_get(ci); | 71 | mode = hw_port_test_get(ci); |
71 | spin_unlock_irqrestore(&ci->lock, flags); | 72 | spin_unlock_irqrestore(&ci->lock, flags); |
73 | pm_runtime_put_sync(ci->dev); | ||
72 | 74 | ||
73 | seq_printf(s, "mode = %u\n", mode); | 75 | seq_printf(s, "mode = %u\n", mode); |
74 | 76 | ||
@@ -98,9 +100,11 @@ static ssize_t ci_port_test_write(struct file *file, const char __user *ubuf, | |||
98 | if (sscanf(buf, "%u", &mode) != 1) | 100 | if (sscanf(buf, "%u", &mode) != 1) |
99 | return -EINVAL; | 101 | return -EINVAL; |
100 | 102 | ||
103 | pm_runtime_get_sync(ci->dev); | ||
101 | spin_lock_irqsave(&ci->lock, flags); | 104 | spin_lock_irqsave(&ci->lock, flags); |
102 | ret = hw_port_test_set(ci, mode); | 105 | ret = hw_port_test_set(ci, mode); |
103 | spin_unlock_irqrestore(&ci->lock, flags); | 106 | spin_unlock_irqrestore(&ci->lock, flags); |
107 | pm_runtime_put_sync(ci->dev); | ||
104 | 108 | ||
105 | return ret ? ret : count; | 109 | return ret ? ret : count; |
106 | } | 110 | } |
@@ -316,8 +320,10 @@ static ssize_t ci_role_write(struct file *file, const char __user *ubuf, | |||
316 | if (role == CI_ROLE_END || role == ci->role) | 320 | if (role == CI_ROLE_END || role == ci->role) |
317 | return -EINVAL; | 321 | return -EINVAL; |
318 | 322 | ||
323 | pm_runtime_get_sync(ci->dev); | ||
319 | ci_role_stop(ci); | 324 | ci_role_stop(ci); |
320 | ret = ci_role_start(ci, role); | 325 | ret = ci_role_start(ci, role); |
326 | pm_runtime_put_sync(ci->dev); | ||
321 | 327 | ||
322 | return ret ? ret : count; | 328 | return ret ? ret : count; |
323 | } | 329 | } |