iforce->core_effects[id].flags[0] = (1<<FF_CORE_IS_USED);	/* Only IS_USED bit must be set */ 
iforce->core_effects[id].flags[0] = (1 << FF_CORE_IS_USED);	/* Only IS_USED bit must be set */ 
static int iforce_upload_effect(struct input_dev *dev, struct ff_effect *effect){	struct iforce* iforce = (struct iforce*)(dev->private);	int id;	int ret;	int is_update;/* Check this effect type is supported by this device */	if (!test_bit(effect->type, iforce->dev.ffbit))		return -EINVAL;/* * If we want to create a new effect, get a free id */	if (effect->id == -1) {		for (id=0; id < FF_EFFECTS_MAX; ++id)			if (!test_and_set_bit(FF_CORE_IS_USED, iforce->core_effects[id].flags)) break;		if ( id == FF_EFFECTS_MAX || id >= iforce->dev.ff_effects_max)			return -ENOMEM;		effect->id = id;		iforce->core_effects[id].owner = current->pid;		iforce->core_effects[id].flags[0] = (1<<FF_CORE_IS_USED);	/* Only IS_USED bit must be set */		is_update = FALSE;	}	else {		/* We want to update an effect */		if (!CHECK_OWNERSHIP(effect->id, iforce)) return -EACCES;		/* Parameter type cannot be updated */		if (effect->type != iforce->core_effects[effect->id].effect.type)			return -EINVAL;		/* Check the effect is not already being updated */		if (test_bit(FF_CORE_UPDATE, iforce->core_effects[effect->id].flags)) {			return -EAGAIN;		}		is_update = TRUE;	}/* * Upload the effect */	switch (effect->type) {		case FF_PERIODIC:			ret = iforce_upload_periodic(iforce, effect, is_update);			break;		case FF_CONSTANT:			ret = iforce_upload_constant(iforce, effect, is_update);			break;		case FF_SPRING:		case FF_DAMPER:			ret = iforce_upload_condition(iforce, effect, is_update);			break;		default:			return -EINVAL;	}	if (ret == 0) {		/* A packet was sent, forbid new updates until we are notified		 * that the packet was updated		 */		set_bit(FF_CORE_UPDATE, iforce->core_effects[effect->id].flags);	}	iforce->core_effects[effect->id].effect = *effect;	return ret;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/17dd3f0f7aa729a042af5d3318ff9b3e7781b45b/iforce-main.c/clean/drivers/input/joystick/iforce/iforce-main.c