current->state = TASK_INTERRUPTIBLE; schedule_timeout(HZ/10); 
msleep_interruptible(100); 
static int streamer_reset(struct net_device *dev){	struct streamer_private *streamer_priv;	__u8 __iomem *streamer_mmio;	unsigned long t;	unsigned int uaa_addr;	struct sk_buff *skb = NULL;	__u16 misr;	streamer_priv = (struct streamer_private *) dev->priv;	streamer_mmio = streamer_priv->streamer_mmio;	writew(readw(streamer_mmio + BCTL) | BCTL_SOFTRESET, streamer_mmio + BCTL);	t = jiffies;	/* Hold soft reset bit for a while */	current->state = TASK_UNINTERRUPTIBLE;	schedule_timeout(HZ);		writew(readw(streamer_mmio + BCTL) & ~BCTL_SOFTRESET,	       streamer_mmio + BCTL);#if STREAMER_DEBUG	printk("BCTL: %x\n", readw(streamer_mmio + BCTL));	printk("GPR: %x\n", readw(streamer_mmio + GPR));	printk("SISRMASK: %x\n", readw(streamer_mmio + SISR_MASK));#endif	writew(readw(streamer_mmio + BCTL) | (BCTL_RX_FIFO_8 | BCTL_TX_FIFO_8), streamer_mmio + BCTL );	if (streamer_priv->streamer_ring_speed == 0) {	/* Autosense */		writew(readw(streamer_mmio + GPR) | GPR_AUTOSENSE,		       streamer_mmio + GPR);		if (streamer_priv->streamer_message_level)			printk(KERN_INFO "%s: Ringspeed autosense mode on\n",			       dev->name);	} else if (streamer_priv->streamer_ring_speed == 16) {		if (streamer_priv->streamer_message_level)			printk(KERN_INFO "%s: Trying to open at 16 Mbps as requested\n",			       dev->name);		writew(GPR_16MBPS, streamer_mmio + GPR);	} else if (streamer_priv->streamer_ring_speed == 4) {		if (streamer_priv->streamer_message_level)			printk(KERN_INFO "%s: Trying to open at 4 Mbps as requested\n",			       dev->name);		writew(0, streamer_mmio + GPR);	}	skb = dev_alloc_skb(streamer_priv->pkt_buf_sz);	if (!skb) {		printk(KERN_INFO "%s: skb allocation for diagnostics failed...proceeding\n",		       dev->name);	} else {	        struct streamer_rx_desc *rx_ring;                u8 *data;		rx_ring=(struct streamer_rx_desc *)skb->data;		data=((u8 *)skb->data)+sizeof(struct streamer_rx_desc);		rx_ring->forward=0;		rx_ring->status=0;		rx_ring->buffer=cpu_to_le32(pci_map_single(streamer_priv->pci_dev, data, 							512, PCI_DMA_FROMDEVICE));		rx_ring->framelen_buflen=512; 		writel(cpu_to_le32(pci_map_single(streamer_priv->pci_dev, rx_ring, 512, PCI_DMA_FROMDEVICE)),			streamer_mmio+RXBDA);	}#if STREAMER_DEBUG	printk("GPR = %x\n", readw(streamer_mmio + GPR));#endif	/* start solo init */	writew(SISR_MI, streamer_mmio + SISR_MASK_SUM);	while (!((readw(streamer_mmio + SISR)) & SISR_SRB_REPLY)) {		current->state = TASK_INTERRUPTIBLE;		schedule_timeout(HZ/10);		if (jiffies - t > 40 * HZ) {			printk(KERN_ERR			       "IBM PCI tokenring card not responding\n");			release_region(dev->base_addr, STREAMER_IO_SPACE);			if (skb)				dev_kfree_skb(skb);			return -1;		}	}	writew(~SISR_SRB_REPLY, streamer_mmio + SISR_RUM);	misr = readw(streamer_mmio + MISR_RUM);	writew(~misr, streamer_mmio + MISR_RUM);	if (skb)		dev_kfree_skb(skb);	/* release skb used for diagnostics */#if STREAMER_DEBUG	printk("LAPWWO: %x, LAPA: %x LAPE:  %x\n",	       readw(streamer_mmio + LAPWWO), readw(streamer_mmio + LAPA),	       readw(streamer_mmio + LAPE));#endif#if STREAMER_DEBUG	{		int i;		writew(readw(streamer_mmio + LAPWWO),		       streamer_mmio + LAPA);		printk("initialization response srb dump: ");		for (i = 0; i < 10; i++)			printk("%x:",			       ntohs(readw(streamer_mmio + LAPDINC)));		printk("\n");	}#endif	writew(readw(streamer_mmio + LAPWWO) + 6, streamer_mmio + LAPA);	if (readw(streamer_mmio + LAPD)) {		printk(KERN_INFO "tokenring card initialization failed. errorcode : %x\n",		       ntohs(readw(streamer_mmio + LAPD)));		release_region(dev->base_addr, STREAMER_IO_SPACE);		return -1;	}	writew(readw(streamer_mmio + LAPWWO) + 8, streamer_mmio + LAPA);	uaa_addr = ntohs(readw(streamer_mmio + LAPDINC));	readw(streamer_mmio + LAPDINC);	/* skip over Level.Addr field */	streamer_priv->streamer_addr_table_addr = ntohs(readw(streamer_mmio + LAPDINC));	streamer_priv->streamer_parms_addr = ntohs(readw(streamer_mmio + LAPDINC));#if STREAMER_DEBUG	printk("UAA resides at %x\n", uaa_addr);#endif	/* setup uaa area for access with LAPD */	{		int i;		__u16 addr;		writew(uaa_addr, streamer_mmio + LAPA);		for (i = 0; i < 6; i += 2) {		        addr=ntohs(readw(streamer_mmio+LAPDINC));			dev->dev_addr[i]= (addr >> 8) & 0xff;			dev->dev_addr[i+1]= addr & 0xff;		}#if STREAMER_DEBUG		printk("Adapter address: ");		for (i = 0; i < 6; i++) {			printk("%02x:", dev->dev_addr[i]);		}		printk("\n");#endif	}	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/4f2ad81104a18946c64215adffce50c2a659fddd/lanstreamer.c/buggy/drivers/net/tokenring/lanstreamer.c