static int hid_lgff_upload_effect(struct input_dev* input,				  struct ff_effect* effect){	struct hid_device *hid = input->private;	struct lgff_device *lgff = hid->ff_private;	struct lgff_effect new;	int id;	unsigned long flags;		dbg("ioctl rumble");	if (!test_bit(effect->type, input->ffbit)) return -EINVAL;	spin_lock_irqsave(&lgff->lock, flags);	if (effect->id == -1) {		int i;		for (i=0; i<LGFF_EFFECTS && test_bit(EFFECT_USED, lgff->effects[i].flags); ++i);		if (i >= LGFF_EFFECTS) {			spin_unlock_irqrestore(&lgff->lock, flags);			return -ENOSPC;		}		effect->id = i;		lgff->effects[i].owner = current->pid;		lgff->effects[i].flags[0] = 0;		set_bit(EFFECT_USED, lgff->effects[i].flags);	}	else if (!LGFF_CHECK_OWNERSHIP(effect->id, lgff)) {		spin_unlock_irqrestore(&lgff->lock, flags);		return -EACCES;	}	id = effect->id;	new = lgff->effects[id];	new.effect = *effect;	if (test_bit(EFFECT_STARTED, lgff->effects[id].flags)	    || test_bit(EFFECT_STARTED, lgff->effects[id].flags)) {		/* Changing replay parameters is not allowed (for the time		   being) */		if (new.effect.replay.delay != lgff->effects[id].effect.replay.delay		    || new.effect.replay.length != lgff->effects[id].effect.replay.length) {			spin_unlock_irqrestore(&lgff->lock, flags);			return -ENOSYS;		}		lgff->effects[id] = new;	} else {		lgff->effects[id] = new;	}	spin_unlock_irqrestore(&lgff->lock, flags);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/05f091ab4c8c1f12f8dd38ee789489904fea327d/hid-lgff.c/buggy/drivers/usb/input/hid-lgff.c