*/
struct visorinput_devdata {
struct visor_device *dev;
- struct rw_semaphore lock_visor_dev; /* lock for dev */
+ struct mutex lock_visor_dev; /* lock for dev */
struct input_dev *visorinput_dev;
bool paused;
bool interrupts_enabled;
* interrupts should be enabled so when we resume, interrupts
* will really be enabled.
*/
- down_write(&devdata->lock_visor_dev);
+ mutex_lock(&devdata->lock_visor_dev);
devdata->interrupts_enabled = true;
if (devdata->paused)
goto out_unlock;
visorbus_enable_channel_interrupts(devdata->dev);
out_unlock:
- up_write(&devdata->lock_visor_dev);
+ mutex_unlock(&devdata->lock_visor_dev);
return 0;
}
* not re-enable them.
*/
- down_write(&devdata->lock_visor_dev);
+ mutex_lock(&devdata->lock_visor_dev);
devdata->interrupts_enabled = false;
if (devdata->paused)
goto out_unlock;
visorbus_disable_channel_interrupts(devdata->dev);
out_unlock:
- up_write(&devdata->lock_visor_dev);
+ mutex_unlock(&devdata->lock_visor_dev);
}
/*
devdata = kzalloc(sizeof(*devdata) + extra_bytes, GFP_KERNEL);
if (!devdata)
return NULL;
- init_rwsem(&devdata->lock_visor_dev);
- down_write(&devdata->lock_visor_dev);
+ mutex_init(&devdata->lock_visor_dev);
+ mutex_lock(&devdata->lock_visor_dev);
devdata->dev = dev;
/*
}
dev_set_drvdata(&dev->device, devdata);
- up_write(&devdata->lock_visor_dev);
+ mutex_unlock(&devdata->lock_visor_dev);
/*
* Device struct is completely set up now, with the exception of
goto err_kfree_devdata;
}
- down_write(&devdata->lock_visor_dev);
+ mutex_lock(&devdata->lock_visor_dev);
/*
* Establish calls to visorinput_channel_interrupt() if that is
* the desired state that we've kept track of in interrupts_enabled
devdata->paused = false;
if (devdata->interrupts_enabled)
visorbus_enable_channel_interrupts(dev);
- up_write(&devdata->lock_visor_dev);
+ mutex_unlock(&devdata->lock_visor_dev);
return devdata;
cleanups_register:
- up_write(&devdata->lock_visor_dev);
+ mutex_unlock(&devdata->lock_visor_dev);
err_kfree_devdata:
kfree(devdata);
return NULL;
if (!devdata)
return;
- down_write(&devdata->lock_visor_dev);
+ mutex_lock(&devdata->lock_visor_dev);
visorbus_disable_channel_interrupts(dev);
/*
*/
dev_set_drvdata(&dev->device, NULL);
- up_write(&devdata->lock_visor_dev);
+ mutex_unlock(&devdata->lock_visor_dev);
unregister_client_input(devdata->visorinput_dev);
kfree(devdata);
goto out;
}
- down_write(&devdata->lock_visor_dev);
+ mutex_lock(&devdata->lock_visor_dev);
if (devdata->paused) {
rc = -EBUSY;
goto out_locked;
complete_func(dev, 0);
rc = 0;
out_locked:
- up_write(&devdata->lock_visor_dev);
+ mutex_unlock(&devdata->lock_visor_dev);
out:
return rc;
}
rc = -ENODEV;
goto out;
}
- down_write(&devdata->lock_visor_dev);
+ mutex_lock(&devdata->lock_visor_dev);
if (!devdata->paused) {
rc = -EBUSY;
goto out_locked;
rc = 0;
out_locked:
- up_write(&devdata->lock_visor_dev);
+ mutex_unlock(&devdata->lock_visor_dev);
out:
return rc;
}