patch-2.3.16 linux/drivers/net/irda/irport.c

Next file: linux/drivers/net/irda/irtty.c
Previous file: linux/drivers/net/irda/girbil.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.15/linux/drivers/net/irda/irport.c linux/drivers/net/irda/irport.c
@@ -6,7 +6,7 @@
  * Status:	  Experimental.
  * Author:	  Dag Brattli <dagb@cs.uit.no>
  * Created at:	  Sun Aug  3 13:49:59 1997
- * Modified at:   Tue Jun  1 10:02:42 1999
+ * Modified at:   Wed Aug 11 09:24:46 1999
  * Modified by:   Dag Brattli <dagb@cs.uit.no>
  * Sources:	  serial.c by Linus Torvalds 
  * 
@@ -272,7 +272,7 @@
  *    Set speed of IrDA port to specified baudrate
  *
  */
-void irport_change_speed(struct irda_device *idev, int speed)
+void irport_change_speed(struct irda_device *idev, __u32 speed)
 {
 	unsigned long flags;
 	int iobase; 
@@ -319,7 +319,7 @@
 	outb(fcr,		  iobase+UART_FCR); /* Enable FIFO's */
 
 	/* Turn on interrups */
-	outb(UART_IER_RLSI|UART_IER_RDI|UART_IER_THRI, iobase+UART_IER);
+	outb(/*UART_IER_RLSI|*/UART_IER_RDI/*|UART_IER_THRI*/, iobase+UART_IER);
 
 	spin_unlock_irqrestore(&idev->lock, flags);
 }
@@ -375,7 +375,7 @@
 		outb(fcr, iobase+UART_FCR);
 
 		/* Turn on receive interrupts */
-		outb(UART_IER_RLSI|UART_IER_RDI, iobase+UART_IER); 
+		outb(/* UART_IER_RLSI| */UART_IER_RDI, iobase+UART_IER);
 	}
 }
 
@@ -432,7 +432,7 @@
 	/* Lock transmit buffer */
 	if (irda_lock((void *) &dev->tbusy) == FALSE) {
 		int tickssofar = jiffies - dev->trans_start;
-		if (tickssofar < 5)
+		if ((tickssofar < 5) || !dev->start)
 			return -EBUSY;
 
 		WARNING("%s: transmit timed out\n", dev->name);
@@ -443,7 +443,7 @@
 	}
 
 	spin_lock_irqsave(&idev->lock, flags);
-	
+
 	/* Init tx buffer */
 	idev->tx_buff.data = idev->tx_buff.head;
 
@@ -465,7 +465,7 @@
 }
         
 /*
- * Function irport_receive (void)
+ * Function irport_receive (idev)
  *
  *    Receive one frame from the infrared port
  *
@@ -527,10 +527,10 @@
 
 		switch (iir) {
 		case UART_IIR_RLSI:
-			DEBUG(0, __FUNCTION__ "(), RLSI\n");
+			DEBUG(2, __FUNCTION__ "(), RLSI\n");
 			break;
 		case UART_IIR_RDI:
-			if (lsr & UART_LSR_DR)
+			//if (lsr & UART_LSR_DR)
 				/* Receive interrupt */
 				irport_receive(idev);
 			break;
@@ -545,7 +545,7 @@
 		} 
 		
 		/* Make sure we don't stay here to long */
-		if (boguscount++ > 32)
+		if (boguscount++ > 100)
 			break;
 
  	        iir = inb(iobase + UART_IIR) & UART_IIR_ID;
@@ -586,18 +586,14 @@
 		return -EAGAIN;
 
 	irport_start(idev, iobase);
-
-	MOD_INC_USE_COUNT;
-
-	/* Ready to play! */
-	dev->tbusy = 0;
-	dev->interrupt = 0;
-	dev->start = 1;
+	irda_device_net_open(dev);
 
 	/* Change speed to make sure dongles follow us again */
 	if (idev->change_speed)
 		idev->change_speed(idev, 9600);
 
+	MOD_INC_USE_COUNT;
+
 	return 0;
 }
 
@@ -612,17 +608,17 @@
 	struct irda_device *idev;
 	int iobase;
 
+	DEBUG(4, __FUNCTION__ "()\n");
+
 	ASSERT(dev != NULL, return -1;);
 	idev = (struct irda_device *) dev->priv;
 
-	DEBUG(4, __FUNCTION__ "()\n");
+	ASSERT(idev != NULL, return -1;);
+	ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return -1;)
 
 	iobase = idev->io.iobase2;
 
-	/* Stop device */
-	dev->tbusy = 1;
-	dev->start = 0;
-
+	irda_device_net_close(dev);
 	irport_stop(idev, iobase);
 
 	free_irq(idev->io.irq2, idev);
@@ -664,7 +660,7 @@
 }
 
 /*
- * Function irtty_set_dtr_rts (tty, dtr, rts)
+ * Function irport_set_dtr_rts (tty, dtr, rts)
  *
  *    This function can be used by dongles etc. to set or reset the status
  *    of the dtr and rts lines

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)