Merge branch 'next' into for-linus
[linux-2.6-block.git] / drivers / input / mouse / cyapa.c
index 5979deabe23d192f47debae819d1ddc488d8edc6..2f2d925a55d7a5c83166bbd8116c8c1984bb8acc 100644 (file)
@@ -1347,10 +1347,16 @@ static int cyapa_suspend(struct device *dev)
        u8 power_mode;
        int error;
 
-       error = mutex_lock_interruptible(&cyapa->state_sync_lock);
+       error = mutex_lock_interruptible(&cyapa->input->mutex);
        if (error)
                return error;
 
+       error = mutex_lock_interruptible(&cyapa->state_sync_lock);
+       if (error) {
+               mutex_unlock(&cyapa->input->mutex);
+               return error;
+       }
+
        /*
         * Runtime PM is enable only when device is in operational mode and
         * users in use, so need check it before disable it to
@@ -1385,6 +1391,8 @@ static int cyapa_suspend(struct device *dev)
                cyapa->irq_wake = (enable_irq_wake(client->irq) == 0);
 
        mutex_unlock(&cyapa->state_sync_lock);
+       mutex_unlock(&cyapa->input->mutex);
+
        return 0;
 }
 
@@ -1394,6 +1402,7 @@ static int cyapa_resume(struct device *dev)
        struct cyapa *cyapa = i2c_get_clientdata(client);
        int error;
 
+       mutex_lock(&cyapa->input->mutex);
        mutex_lock(&cyapa->state_sync_lock);
 
        if (device_may_wakeup(dev) && cyapa->irq_wake) {
@@ -1412,6 +1421,7 @@ static int cyapa_resume(struct device *dev)
        enable_irq(client->irq);
 
        mutex_unlock(&cyapa->state_sync_lock);
+       mutex_unlock(&cyapa->input->mutex);
        return 0;
 }
 
@@ -1449,8 +1459,8 @@ static const struct dev_pm_ops cyapa_pm_ops = {
 };
 
 static const struct i2c_device_id cyapa_id_table[] = {
-       { "cyapa", 0 },
-       { },
+       { "cyapa" },
+       { }
 };
 MODULE_DEVICE_TABLE(i2c, cyapa_id_table);