dev_dbg(&pid_private->hid->dev->dev, "effect ID is %d\n.", id); 
dev_dbg(&pid_private->hid->dev->dev, "effect ID is %d.\n", id); 
static int hid_pid_upload_effect(struct input_dev *dev,				 struct ff_effect *effect){	struct hid_ff_pid *pid_private = (struct hid_ff_pid *)(dev->private);	int ret;	int is_update;	unsigned long flags;	dev_dbg(&pid_private->hid->dev->dev, "upload effect called: effect_type=%x\n", effect->type);	/* Check this effect type is supported by this device */	if (!test_bit(effect->type, dev->ffbit)) {		dev_dbg(&pid_private->hid->dev->dev,			"invalid kind of effect requested.\n");		return -EINVAL;	}	/*	 * If we want to create a new effect, get a free id	 */	if (effect->id == -1) {		int id = 0;		// Spinlock so we don`t get a race condition when choosing IDs		spin_lock_irqsave(&pid_private->lock, flags);		while (id < FF_EFFECTS_MAX)			if (!test_and_set_bit(FF_PID_FLAGS_USED, &pid_private->effects[id++].flags))				break;		if (id == FF_EFFECTS_MAX) {			spin_unlock_irqrestore(&pid_private->lock, flags);// TEMP - We need to get ff_effects_max correctly first:  || id >= dev->ff_effects_max) {			dev_dbg(&pid_private->hid->dev->dev, "Not enough device memory\n");			return -ENOMEM;		}		effect->id = id;		dev_dbg(&pid_private->hid->dev->dev, "effect ID is %d\n.", id);		pid_private->effects[id].owner = current->pid;		pid_private->effects[id].flags = (1 << FF_PID_FLAGS_USED);		spin_unlock_irqrestore(&pid_private->lock, flags);		is_update = FF_PID_FALSE;	} else {		/* We want to update an effect */		if (!CHECK_OWNERSHIP(effect->id, pid_private))			return -EACCES;		/* Parameter type cannot be updated */		if (effect->type != pid_private->effects[effect->id].effect.type)			return -EINVAL;		/* Check the effect is not already being updated */		if (test_bit(FF_PID_FLAGS_UPDATING, &pid_private->effects[effect->id].flags))			return -EAGAIN;		is_update = FF_PID_TRUE;	}	/*	 * Upload the effect	 */	switch (effect->type) {	case FF_PERIODIC:		ret = pid_upload_periodic(pid_private, effect, is_update);		break;	case FF_CONSTANT:		ret = pid_upload_constant(pid_private, effect, is_update);		break;	case FF_SPRING:	case FF_FRICTION:	case FF_DAMPER:	case FF_INERTIA:		ret = pid_upload_condition(pid_private, effect, is_update);		break;	case FF_RAMP:		ret = pid_upload_ramp(pid_private, effect, is_update);		break;	default:		dev_dbg(&pid_private->hid->dev->dev,			"invalid type of effect requested - %x.\n",			effect->type);		return -EINVAL;	}	/* If a packet was sent, forbid new updates until we are notified	 * that the packet was updated	 */	if (ret == 0)		set_bit(FF_PID_FLAGS_UPDATING, &pid_private->effects[effect->id].flags);	pid_private->effects[effect->id].effect = *effect;	return ret;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/3fa63c7d82ab9a12a5d0a299069f8df9f35aa011/pid.c/clean/drivers/usb/input/pid.c