int slot = 0; 
int slot; 
static int get_and_decode_packet(struct grip_mp *grip, int flags){	u32 packet;	int joytype = 0;	int slot = 0;	/* Get a packet and check for validity */	flags &= IO_RESET | IO_RETRY;	flags = multiport_io(grip->gameport, flags, 0, &packet);	grip->reads++;	if (packet & PACKET_MP_DONE)		flags |= IO_DONE;	if (flags && !(flags & IO_GOT_PACKET)) {		grip->bads++;		return flags;	}	/* Ignore non-gamepad packets, e.g. multiport hardware version */	slot = ((packet >> 21) & 0xf) - 1;	if ((slot < 0) || (slot > 3))		return flags;	/*	 * Handle "reset" packets, which occur at startup, and when gamepads	 * are removed or plugged in.  May contain configuration of a new gamepad.	 */	joytype = (packet >> 16) & 0x1f;	if (!joytype) {		if (grip->registered[slot]) {			printk(KERN_INFO "grip_mp: removing %s, slot %d\n",			       grip_name[grip->mode[slot]], slot);			input_unregister_device(grip->dev + slot);			grip->registered[slot] = 0;		}		dbg("Reset: grip multiport slot %d\n", slot);		grip->mode[slot] = GRIP_MODE_RESET;		flags |= IO_SLOT_CHANGE;		return flags;	}	/* Interpret a grip pad packet */	if (joytype == 0x1f) {		int dir = (packet >> 8) & 0xf;          /* eight way directional value */		grip->buttons[slot] = (~packet) & 0xff;		grip->yaxes[slot] = ((axis_map[dir] >> 2) & 3) - 1;		grip->xaxes[slot] = (axis_map[dir] & 3) - 1;		grip->dirty[slot] = 1;		if (grip->mode[slot] == GRIP_MODE_RESET)			flags |= IO_SLOT_CHANGE;		grip->mode[slot] = GRIP_MODE_GP;		if (!grip->registered[slot]) {			dbg("New Grip pad in multiport slot %d.\n", slot);			register_slot(slot, grip);		}		return flags;	}	/* Handle non-grip device codes.  For now, just print diagnostics. */	{		static int strange_code = 0;		if (strange_code != joytype) {			printk(KERN_INFO "Possible non-grip pad/joystick detected.\n");			printk(KERN_INFO "Got joy type 0x%x and packet 0x%x.\n", joytype, packet);			strange_code = joytype;		}	}	return flags;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/17dd3f0f7aa729a042af5d3318ff9b3e7781b45b/grip_mp.c/buggy/drivers/input/joystick/grip_mp.c