gc->dev[i].private = gc; gc->dev[i].open = gc_open; gc->dev[i].close = gc_close;  gc->dev[i].evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);  for (j = 0; j < 2; j++) { set_bit(ABS_X + j, gc->dev[i].absbit); gc->dev[i].absmin[ABS_X + j] = -1; gc->dev[i].absmax[ABS_X + j] =  1; }  gc->pads[0] |= gc_status_bit[i]; gc->pads[config[i + 1]] |= gc_status_bit[i];  switch(config[i + 1]) {  case GC_N64: for (j = 0; j < 10; j++) set_bit(gc_n64_btn[j], gc->dev[i].keybit);  for (j = 0; j < 2; j++) { set_bit(ABS_X + j, gc->dev[i].absbit); gc->dev[i].absmin[ABS_X + j] = -127; gc->dev[i].absmax[ABS_X + j] =  126; gc->dev[i].absflat[ABS_X + j] = 2; set_bit(ABS_HAT0X + j, gc->dev[i].absbit); gc->dev[i].absmin[ABS_HAT0X + j] = -1; gc->dev[i].absmax[ABS_HAT0X + j] =  1; }  break;  case GC_SNES: for (j = 4; j < 8; j++) set_bit(gc_snes_btn[j], gc->dev[i].keybit); case GC_NES: for (j = 0; j < 4; j++) set_bit(gc_snes_btn[j], gc->dev[i].keybit); break;  case GC_MULTI2: set_bit(BTN_THUMB, gc->dev[i].keybit); case GC_MULTI: set_bit(BTN_TRIGGER, gc->dev[i].keybit); break;  case GC_PSX: case GC_DDR: if(config[i + 1] == GC_DDR) { for (j = 0; j < 4; j++) set_bit(gc_psx_ddr_btn[j], gc->dev[i].keybit); } else { for (j = 0; j < 6; j++) { set_bit(gc_psx_abs[j], gc->dev[i].absbit); gc->dev[i].absmin[gc_psx_abs[j]] = 4; gc->dev[i].absmax[gc_psx_abs[j]] = 252; gc->dev[i].absflat[gc_psx_abs[j]] = 2; } }  for (j = 0; j < 12; j++) set_bit(gc_psx_btn[j], gc->dev[i].keybit);  break; }  sprintf(gc->phys[i], "%s/input%d", gc->pd->port->name, i);  gc->dev[i].name = gc_names[config[i + 1]]; gc->dev[i].phys = gc->phys[i]; gc->dev[i].id.bustype = BUS_PARPORT; gc->dev[i].id.vendor = 0x0001; gc->dev[i].id.product = config[i + 1]; gc->dev[i].id.version = 0x0100; 
input_register_device(gc->dev[i]); 
static struct gc __init *gc_probe(int *config, int nargs){	struct gc *gc;	struct parport *pp;	int i, j;	if (config[0] < 0)		return NULL;	if (nargs < 2) {		printk(KERN_ERR "gamecon.c: at least one device must be specified\n");		return NULL;	}	pp = parport_find_number(config[0]);	if (!pp) {		printk(KERN_ERR "gamecon.c: no such parport\n");		return NULL;	}	if (!(gc = kzalloc(sizeof(struct gc), GFP_KERNEL))) {		parport_put_port(pp);		return NULL;	}	init_MUTEX(&gc->sem);	gc->pd = parport_register_device(pp, "gamecon", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL);	parport_put_port(pp);	if (!gc->pd) {		printk(KERN_ERR "gamecon.c: parport busy already - lp.o loaded?\n");		kfree(gc);		return NULL;	}	parport_claim(gc->pd);	init_timer(&gc->timer);	gc->timer.data = (long) gc;	gc->timer.function = gc_timer;	for (i = 0; i < nargs - 1; i++) {		if (!config[i + 1])			continue;		if (config[i + 1] < 1 || config[i + 1] > GC_MAX) {			printk(KERN_WARNING "gamecon.c: Pad type %d unknown\n", config[i + 1]);			continue;		}                gc->dev[i].private = gc;                gc->dev[i].open = gc_open;                gc->dev[i].close = gc_close;                gc->dev[i].evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);		for (j = 0; j < 2; j++) {			set_bit(ABS_X + j, gc->dev[i].absbit);			gc->dev[i].absmin[ABS_X + j] = -1;			gc->dev[i].absmax[ABS_X + j] =  1;		}		gc->pads[0] |= gc_status_bit[i];		gc->pads[config[i + 1]] |= gc_status_bit[i];		switch(config[i + 1]) {			case GC_N64:				for (j = 0; j < 10; j++)					set_bit(gc_n64_btn[j], gc->dev[i].keybit);				for (j = 0; j < 2; j++) {					set_bit(ABS_X + j, gc->dev[i].absbit);					gc->dev[i].absmin[ABS_X + j] = -127;					gc->dev[i].absmax[ABS_X + j] =  126;					gc->dev[i].absflat[ABS_X + j] = 2;					set_bit(ABS_HAT0X + j, gc->dev[i].absbit);					gc->dev[i].absmin[ABS_HAT0X + j] = -1;					gc->dev[i].absmax[ABS_HAT0X + j] =  1;				}				break;			case GC_SNES:				for (j = 4; j < 8; j++)					set_bit(gc_snes_btn[j], gc->dev[i].keybit);			case GC_NES:				for (j = 0; j < 4; j++)					set_bit(gc_snes_btn[j], gc->dev[i].keybit);				break;			case GC_MULTI2:				set_bit(BTN_THUMB, gc->dev[i].keybit);			case GC_MULTI:				set_bit(BTN_TRIGGER, gc->dev[i].keybit);				break;			case GC_PSX:			case GC_DDR:				if(config[i + 1] == GC_DDR) {					for (j = 0; j < 4; j++)						set_bit(gc_psx_ddr_btn[j], gc->dev[i].keybit);				} else {					for (j = 0; j < 6; j++) {						set_bit(gc_psx_abs[j], gc->dev[i].absbit);						gc->dev[i].absmin[gc_psx_abs[j]] = 4;						gc->dev[i].absmax[gc_psx_abs[j]] = 252;						gc->dev[i].absflat[gc_psx_abs[j]] = 2;					}				}				for (j = 0; j < 12; j++)					set_bit(gc_psx_btn[j], gc->dev[i].keybit);				break;		}		sprintf(gc->phys[i], "%s/input%d", gc->pd->port->name, i);                gc->dev[i].name = gc_names[config[i + 1]];		gc->dev[i].phys = gc->phys[i];                gc->dev[i].id.bustype = BUS_PARPORT;                gc->dev[i].id.vendor = 0x0001;                gc->dev[i].id.product = config[i + 1];                gc->dev[i].id.version = 0x0100;	}	parport_release(gc->pd);	if (!gc->pads[0]) {		parport_unregister_device(gc->pd);		kfree(gc);		return NULL;	}	for (i = 0; i < 5; i++)		if (gc->pads[0] & gc_status_bit[i]) {			input_register_device(gc->dev + i);			printk(KERN_INFO "input: %s on %s\n", gc->dev[i].name, gc->pd->port->name);		}	return gc;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/17dd3f0f7aa729a042af5d3318ff9b3e7781b45b/gamecon.c/clean/drivers/input/joystick/gamecon.c