i = first_tuple(handle, &tuple, &parse); 
i = first_tuple(handle, tuple, parse); 
static int simple_config(dev_link_t *link){	static kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };	static int size_table[2] = { 8, 16 };	client_handle_t handle = link->handle;	struct serial_info *info = link->priv;	tuple_t tuple;	u_char buf[256];	cisparse_t parse;	cistpl_cftable_entry_t *cf = &parse.cftable_entry;	config_info_t config;	int i, j, try;	int s;	/* If the card is already configured, look up the port and irq */	i = pcmcia_get_configuration_info(handle, &config);	if ((i == CS_SUCCESS) && (config.Attributes & CONF_VALID_CLIENT)) {		kio_addr_t port = 0;		if ((config.BasePort2 != 0) && (config.NumPorts2 == 8)) {			port = config.BasePort2;			info->slave = 1;		} else if ((info->manfid == MANFID_OSITECH) &&			   (config.NumPorts1 == 0x40)) {			port = config.BasePort1 + 0x28;			info->slave = 1;		}		if (info->slave)			return setup_serial(handle, info, port, config.AssignedIRQ);	}	link->conf.Vcc = config.Vcc;	/* First pass: look for a config entry that looks normal. */	tuple.TupleData = (cisdata_t *) buf;	tuple.TupleOffset = 0;	tuple.TupleDataMax = 255;	tuple.Attributes = 0;	tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;	/* Two tries: without IO aliases, then with aliases */	for (s = 0; s < 2; s++) {		for (try = 0; try < 2; try++) {			i = first_tuple(handle, &tuple, &parse);			while (i != CS_NO_MORE_ITEMS) {				if (i != CS_SUCCESS)					goto next_entry;				if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))					link->conf.Vpp1 = link->conf.Vpp2 =					    cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;				if ((cf->io.nwin > 0) && (cf->io.win[0].len == size_table[s]) &&					    (cf->io.win[0].base != 0)) {					link->conf.ConfigIndex = cf->index;					link->io.BasePort1 = cf->io.win[0].base;					link->io.IOAddrLines = (try == 0) ?					    16 : cf->io.flags & CISTPL_IO_LINES_MASK;					i = pcmcia_request_io(link->handle, &link->io);					if (i == CS_SUCCESS)						goto found_port;				}next_entry:				i = next_tuple(handle, &tuple, &parse);			}		}	}	/* Second pass: try to find an entry that isn't picky about	   its base address, then try to grab any standard serial port	   address, and finally try to get any free port. */	i = first_tuple(handle, &tuple, &parse);	while (i != CS_NO_MORE_ITEMS) {		if ((i == CS_SUCCESS) && (cf->io.nwin > 0) &&		    ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {			link->conf.ConfigIndex = cf->index;			for (j = 0; j < 5; j++) {				link->io.BasePort1 = base[j];				link->io.IOAddrLines = base[j] ? 16 : 3;				i = pcmcia_request_io(link->handle, &link->io);				if (i == CS_SUCCESS)					goto found_port;			}		}		i = next_tuple(handle, &tuple, &parse);	}      found_port:	if (i != CS_SUCCESS) {		printk(KERN_NOTICE		       "serial_cs: no usable port range found, giving up\n");		cs_error(link->handle, RequestIO, i);		return -1;	}	i = pcmcia_request_irq(link->handle, &link->irq);	if (i != CS_SUCCESS) {		cs_error(link->handle, RequestIRQ, i);		link->irq.AssignedIRQ = 0;	}	if (info->multi && (info->manfid == MANFID_3COM))		link->conf.ConfigIndex &= ~(0x08);	i = pcmcia_request_configuration(link->handle, &link->conf);	if (i != CS_SUCCESS) {		cs_error(link->handle, RequestConfiguration, i);		return -1;	}	return setup_serial(handle, info, link->io.BasePort1, link->irq.AssignedIRQ);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/16f31113a614a35acc2da64f4ae39ab0ed7e194f/serial_cs.c/buggy/drivers/serial/serial_cs.c