/* Erases the effect if the requester is also the effect owner. The mutex should already be locked before calling this function.  */
static int erase_effect(struct input_dev *dev, int effect_id, struct file *file)
/* Erases the effect if the requester is also the effect owner. The mutex should already be locked before calling this function.  */
static int erase_effect(struct input_dev *dev, int effect_id, struct file *file)
{
	struct ff_device *ff = dev->ff;
	int error;
	error = check_effect_access(ff, effect_id, file);
	if (error)
		return error;
	spin_lock_irq(&dev->event_lock);
	ff->playback(dev, effect_id, 0);
	ff->effect_owners[effect_id] = NULL;
	spin_unlock_irq(&dev->event_lock);
	if (ff->erase) {
		error = ff->erase(dev, effect_id);
		if (error) {
			spin_lock_irq(&dev->event_lock);
			ff->effect_owners[effect_id] = file;
			spin_unlock_irq(&dev->event_lock);
			return error;
		}
	}
	return 0;
}