Num_of_ioc4_cards++;  
ioc4_serial_attach_one(struct ioc4_driver_data *idd){	unsigned long tmp_addr1;	struct ioc4_serial __iomem *serial;	struct ioc4_soft *soft;	struct ioc4_control *control;	int ret = 0;	DPRINT_CONFIG(("%s (0x%p, 0x%p)\n", __FUNCTION__, idd->idd_pdev, idd->idd_pci_id));	/* request serial registers */	tmp_addr1 = idd->idd_bar0 + IOC4_SERIAL_OFFSET;	if (!request_region(tmp_addr1, sizeof(struct ioc4_serial),					"sioc4_uart")) {		printk(KERN_WARNING			"ioc4 (%p): unable to get request region for "				"uart space\n", (void *)idd->idd_pdev);		ret = -ENODEV;		goto out1;	}	serial = ioremap(tmp_addr1, sizeof(struct ioc4_serial));	if (!serial) {		printk(KERN_WARNING			 "ioc4 (%p) : unable to remap ioc4 serial register\n",				(void *)idd->idd_pdev);		ret = -ENODEV;		goto out2;	}	DPRINT_CONFIG(("%s : mem 0x%p, serial 0x%p\n",				__FUNCTION__, (void *)idd->idd_misc_regs, (void *)serial));	/* Get memory for the new card */	control = kmalloc(sizeof(struct ioc4_control) * IOC4_NUM_SERIAL_PORTS,						GFP_KERNEL);	if (!control) {		printk(KERN_WARNING "ioc4_attach_one"		       ": unable to get memory for the IOC4\n");		ret = -ENOMEM;		goto out2;	}	memset(control, 0, sizeof(struct ioc4_control));	idd->idd_serial_data = control;	/* Allocate the soft structure */	soft = kmalloc(sizeof(struct ioc4_soft), GFP_KERNEL);	if (!soft) {		printk(KERN_WARNING		       "ioc4 (%p): unable to get memory for the soft struct\n",		       (void *)idd->idd_pdev);		ret = -ENOMEM;		goto out3;	}	memset(soft, 0, sizeof(struct ioc4_soft));	spin_lock_init(&soft->is_ir_lock);	soft->is_ioc4_misc_addr = idd->idd_misc_regs;	soft->is_ioc4_serial_addr = serial;	/* Init the IOC4 */	writel(0xf << IOC4_SIO_CR_CMD_PULSE_SHIFT,	       &idd->idd_misc_regs->sio_cr.raw);	/* Enable serial port mode select generic PIO pins as outputs */	writel(IOC4_GPCR_UART0_MODESEL | IOC4_GPCR_UART1_MODESEL		| IOC4_GPCR_UART2_MODESEL | IOC4_GPCR_UART3_MODESEL,		&idd->idd_misc_regs->gpcr_s.raw);	/* Clear and disable all serial interrupts */	write_ireg(soft, ~0, IOC4_W_IEC, IOC4_SIO_INTR_TYPE);	writel(~0, &idd->idd_misc_regs->sio_ir.raw);	write_ireg(soft, IOC4_OTHER_IR_SER_MEMERR, IOC4_W_IEC,		   IOC4_OTHER_INTR_TYPE);	writel(IOC4_OTHER_IR_SER_MEMERR, &idd->idd_misc_regs->other_ir.raw);	control->ic_soft = soft;	/* Hook up interrupt handler */	if (!request_irq(idd->idd_pdev->irq, ioc4_intr, SA_SHIRQ,				"sgi-ioc4serial", (void *)soft)) {		control->ic_irq = idd->idd_pdev->irq;	} else {		printk(KERN_WARNING		    "%s : request_irq fails for IRQ 0x%x\n ",			__FUNCTION__, idd->idd_pdev->irq);	}	ret = ioc4_attach_local(idd);	if (ret)		goto out4;	/* register port with the serial core */	if ((ret = ioc4_serial_core_attach(idd->idd_pdev)))		goto out4;	return ret;	/* error exits that give back resources */out4:	kfree(soft);out3:	kfree(control);out2:	release_region(tmp_addr1, sizeof(struct ioc4_serial));out1:	return ret;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/396dc44bcac58f464b7b23c345052e37881cccea/ioc4_serial.c/buggy/drivers/serial/ioc4_serial.c