ir->sub = sub; 
static int ir_probe(struct device *dev){	struct bttv_sub_device *sub = to_bttv_sub_dev(dev);	struct IR *ir;	struct input_dev *input_dev;	IR_KEYTAB_TYPE *ir_codes = NULL;	int ir_type = IR_TYPE_OTHER;	ir = kzalloc(sizeof(*ir), GFP_KERNEL);	input_dev = input_allocate_device();	if (!ir || !input_dev) {		kfree(ir);		input_free_device(input_dev);		return -ENOMEM;	}	/* detect & configure */	switch (sub->core->type) {	case BTTV_BOARD_AVERMEDIA:	case BTTV_BOARD_AVPHONE98:	case BTTV_BOARD_AVERMEDIA98:		ir_codes         = ir_codes_avermedia;		ir->mask_keycode = 0xf88000;		ir->mask_keydown = 0x010000;		ir->polling      = 50; // ms		break;	case BTTV_BOARD_AVDVBT_761:	case BTTV_BOARD_AVDVBT_771:		ir_codes         = ir_codes_avermedia_dvbt;		ir->mask_keycode = 0x0f00c0;		ir->mask_keydown = 0x000020;		ir->polling      = 50; // ms		break;	case BTTV_BOARD_PXELVWPLTVPAK:		ir_codes         = ir_codes_pixelview;		ir->mask_keycode = 0x003e00;		ir->mask_keyup   = 0x010000;		ir->polling      = 50; // ms		break;	case BTTV_BOARD_PV_BT878P_9B:	case BTTV_BOARD_PV_BT878P_PLUS:		ir_codes         = ir_codes_pixelview;		ir->mask_keycode = 0x001f00;		ir->mask_keyup   = 0x008000;		ir->polling      = 50; // ms		break;	case BTTV_BOARD_WINFAST2000:		ir_codes         = ir_codes_winfast;		ir->mask_keycode = 0x1f8;		break;	case BTTV_BOARD_MAGICTVIEW061:	case BTTV_BOARD_MAGICTVIEW063:		ir_codes         = ir_codes_winfast;		ir->mask_keycode = 0x0008e000;		ir->mask_keydown = 0x00200000;		break;	case BTTV_BOARD_APAC_VIEWCOMP:		ir_codes         = ir_codes_apac_viewcomp;		ir->mask_keycode = 0x001f00;		ir->mask_keyup   = 0x008000;		ir->polling      = 50; // ms		break;	case BTTV_BOARD_CONCEPTRONIC_CTVFMI2:		ir_codes         = ir_codes_conceptronic;		ir->mask_keycode = 0x001F00;		ir->mask_keyup   = 0x006000;		ir->polling      = 50; // ms		break;	case BTTV_BOARD_NEBULA_DIGITV:		ir_codes = ir_codes_nebula;		driver.any_irq = ir_rc5_irq;		driver.gpio_irq = NULL;		ir->rc5_gpio = 1;		 break;	}	if (NULL == ir_codes) {		kfree(ir);		input_free_device(input_dev);		return -ENODEV;	}	if (ir->rc5_gpio) {		u32 gpio;		/* enable remote irq */		bttv_gpio_inout(sub->core, (1 << 4), 1 << 4);		gpio = bttv_gpio_read(sub->core);		bttv_gpio_write(sub->core, gpio & ~(1 << 4));		bttv_gpio_write(sub->core, gpio | (1 << 4));	} else {		/* init hardware-specific stuff */		bttv_gpio_inout(sub->core, ir->mask_keycode | ir->mask_keydown, 0);	}	/* init input device */	snprintf(ir->name, sizeof(ir->name), "bttv IR (card=%d)",		 sub->core->type);	snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0",		 pci_name(sub->core->pci));	ir->sub = sub;	ir_input_init(input_dev, &ir->ir, ir_type, ir_codes);	input_dev->name = ir->name;	input_dev->phys = ir->phys;	input_dev->id.bustype = BUS_PCI;	input_dev->id.version = 1;	if (sub->core->pci->subsystem_vendor) {		input_dev->id.vendor  = sub->core->pci->subsystem_vendor;		input_dev->id.product = sub->core->pci->subsystem_device;	} else {		input_dev->id.vendor  = sub->core->pci->vendor;		input_dev->id.product = sub->core->pci->device;	}	input_dev->cdev.dev = &sub->core->pci->dev;	if (ir->polling) {		INIT_WORK(&ir->work, ir_work, ir);		init_timer(&ir->timer);		ir->timer.function = ir_timer;		ir->timer.data     = (unsigned long)ir;		schedule_work(&ir->work);	} else if (ir->rc5_gpio) {		/* set timer_end for code completion */		init_timer(&ir->timer_end);		ir->timer_end.function = ir_rc5_timer_end;		ir->timer_end.data = (unsigned long)ir;		init_timer(&ir->timer_keyup);		ir->timer_keyup.function = ir_rc5_timer_keyup;		ir->timer_keyup.data = (unsigned long)ir;	}	/* all done */	dev_set_drvdata(dev, ir);	input_register_device(ir->input);	printk(DEVNAME ": %s detected at %s\n",ir->name,ir->phys);	/* the remote isn't as bouncy as a keyboard */	ir->input->rep[REP_DELAY] = repeat_delay;	ir->input->rep[REP_PERIOD] = repeat_period;	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/d4892279d786dd11f9d6269b3029ad3340e79597/ir-kbd-gpio.c/clean/drivers/media/video/ir-kbd-gpio.c