USB: gadget: f_accessory: Clear disconnected flag when driver file is opened
authorMike Lockwood <lockwood@android.com>
Sun, 13 Mar 2011 02:35:28 +0000 (21:35 -0500)
committerMike Lockwood <lockwood@android.com>
Sun, 13 Mar 2011 02:35:28 +0000 (21:35 -0500)
Fixes a race condition that can occur when entering accessory mode.

Signed-off-by: Mike Lockwood <lockwood@android.com>
drivers/usb/gadget/f_accessory.c

index f6a5922e8c3b7f4621c69df3152f3e43ad0bc6b5..baeae5976b66194bb660a63fd4833d711765fe9e 100644 (file)
@@ -521,6 +521,7 @@ static int acc_open(struct inode *ip, struct file *fp)
        if (atomic_xchg(&_acc_dev->open_excl, 1))
                return -EBUSY;
 
+       _acc_dev->disconnected = 0;
        fp->private_data = _acc_dev;
        return 0;
 }