return; 
serio_set_drvdata(serio, NULL); return -ENODEV; 
static void hil_ptr_connect(struct serio *serio, struct serio_driver *driver){	struct hil_ptr	*ptr;	char		*txt;	unsigned int	i, naxsets, btntype;	uint8_t		did, *idd;	if (serio->type != (SERIO_HIL_MLC | SERIO_HIL)) return;	if (!(ptr = kmalloc(sizeof(struct hil_ptr), GFP_KERNEL))) return;	memset(ptr, 0, sizeof(struct hil_ptr));	if (serio_open(serio, driver)) goto bail0;	serio->private = ptr;	ptr->serio = serio;	ptr->dev.private = ptr;	init_MUTEX_LOCKED(&(ptr->sem));	/* Get device info.  MLC driver supplies devid/status/etc. */	serio->write(serio, 0);	serio->write(serio, 0);	serio->write(serio, HIL_PKT_CMD >> 8);	serio->write(serio, HIL_CMD_IDD);	down(&(ptr->sem));	serio->write(serio, 0);	serio->write(serio, 0);	serio->write(serio, HIL_PKT_CMD >> 8);	serio->write(serio, HIL_CMD_RSC);	down(&(ptr->sem));	serio->write(serio, 0);	serio->write(serio, 0);	serio->write(serio, HIL_PKT_CMD >> 8);	serio->write(serio, HIL_CMD_RNM);	down(&(ptr->sem));	serio->write(serio, 0);	serio->write(serio, 0);	serio->write(serio, HIL_PKT_CMD >> 8);	serio->write(serio, HIL_CMD_EXD);	down(&(ptr->sem));	up(&(ptr->sem));	init_input_dev(&ptr->dev);	did = ptr->idd[0];	idd = ptr->idd + 1;	txt = "unknown";	if ((did & HIL_IDD_DID_TYPE_MASK) == HIL_IDD_DID_TYPE_REL) {		ptr->dev.evbit[0] = BIT(EV_REL);		txt = "relative";	}	if ((did & HIL_IDD_DID_TYPE_MASK) == HIL_IDD_DID_TYPE_ABS) {		ptr->dev.evbit[0] = BIT(EV_ABS);		txt = "absolute";	}	if (!ptr->dev.evbit[0]) {		goto bail1;	}	ptr->nbtn = HIL_IDD_NUM_BUTTONS(idd);	if (ptr->nbtn) ptr->dev.evbit[0] |= BIT(EV_KEY);	naxsets = HIL_IDD_NUM_AXSETS(*idd);	ptr->naxes = HIL_IDD_NUM_AXES_PER_SET(*idd);	printk(KERN_INFO PREFIX "HIL pointer device found (did: 0x%02x, axis: %s)\n",			did, txt);	printk(KERN_INFO PREFIX "HIL pointer has %i buttons and %i sets of %i axes\n",			ptr->nbtn, naxsets, ptr->naxes);		btntype = BTN_MISC;	if ((did & HIL_IDD_DID_ABS_TABLET_MASK) == HIL_IDD_DID_ABS_TABLET)#ifdef TABLET_SIMULATES_MOUSE		btntype = BTN_TOUCH;#else		btntype = BTN_DIGI;#endif	if ((did & HIL_IDD_DID_ABS_TSCREEN_MASK) == HIL_IDD_DID_ABS_TSCREEN)		btntype = BTN_TOUCH;			if ((did & HIL_IDD_DID_REL_MOUSE_MASK) == HIL_IDD_DID_REL_MOUSE)		btntype = BTN_MOUSE;	for (i = 0; i < ptr->nbtn; i++) {		set_bit(btntype | i, ptr->dev.keybit);		ptr->btnmap[i] = btntype | i;	}	if (btntype == BTN_MOUSE) {		/* Swap buttons 2 and 3 */		ptr->btnmap[1] = BTN_MIDDLE;		ptr->btnmap[2] = BTN_RIGHT;	}	if ((did & HIL_IDD_DID_TYPE_MASK) == HIL_IDD_DID_TYPE_REL) {		for (i = 0; i < ptr->naxes; i++) {			set_bit(REL_X + i, ptr->dev.relbit);		}		for (i = 3; (i < ptr->naxes + 3) && (naxsets > 1); i++) {			set_bit(REL_X + i, ptr->dev.relbit);		}	} else {		for (i = 0; i < ptr->naxes; i++) {	  		set_bit(ABS_X + i, ptr->dev.absbit);			ptr->dev.absmin[ABS_X + i] = 0;			ptr->dev.absmax[ABS_X + i] = 				HIL_IDD_AXIS_MAX((ptr->idd + 1), i);		}		for (i = 3; (i < ptr->naxes + 3) && (naxsets > 1); i++) {			set_bit(ABS_X + i, ptr->dev.absbit);			ptr->dev.absmin[ABS_X + i] = 0;			ptr->dev.absmax[ABS_X + i] = 				HIL_IDD_AXIS_MAX((ptr->idd + 1), (i - 3));		}#ifdef TABLET_AUTOADJUST		for (i = 0; i < ABS_MAX; i++) {			int diff = ptr->dev.absmax[ABS_X + i] / 10;			ptr->dev.absmin[ABS_X + i] += diff;			ptr->dev.absmax[ABS_X + i] -= diff;		}#endif	}	ptr->dev.name = strlen(ptr->rnm) ? ptr->rnm : HIL_GENERIC_NAME;	ptr->dev.id.bustype	= BUS_HIL;	ptr->dev.id.vendor	= PCI_VENDOR_ID_HP;	ptr->dev.id.product	= 0x0001; /* TODO: get from ptr->rsc */	ptr->dev.id.version	= 0x0100; /* TODO: get from ptr->rsc */	ptr->dev.dev		= &serio->dev;	input_register_device(&ptr->dev);	printk(KERN_INFO "input: %s (%s), ID: %d\n",                ptr->dev.name, 		(btntype == BTN_MOUSE) ? "HIL mouse":"HIL tablet or touchpad",		did);	return; bail1:	serio_close(serio); bail0:	kfree(ptr);	return;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/6ab0f5cd364476fe5cb329fd46ee41bea6d4c69c/hil_ptr.c/clean/drivers/input/mouse/hil_ptr.c