]> git.hungrycats.org Git - linux/commitdiff
usb: chipidea: debug: add runtime pm for register access
authorLi Jun <jun.li@freescale.com>
Wed, 29 Jul 2015 05:11:11 +0000 (13:11 +0800)
committerSasha Levin <sasha.levin@oracle.com>
Thu, 3 Dec 2015 04:23:59 +0000 (23:23 -0500)
[ Upstream commit bc24937943d9f71a1e32b5dc4e2f0ef8fcc07b64 ]

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

Signed-off-by: Li Jun <jun.li@freescale.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
drivers/usb/chipidea/debug.c

index 795d6538d6303cff59ae49a4d2e8951897f1c008..4188cacaf100ed28af0be01dcf1c539873b11465 100644 (file)
@@ -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);
 
@@ -94,9 +96,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;
 }
@@ -312,8 +316,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;
 }