]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/irda/irda_device.c
Pull mca-cleanup into release branch
[linux-2.6-omap-h63xx.git] / net / irda / irda_device.c
index fda299e300c08f857e57e2b18c231afb23a5301f..e3debbdb67f5a0272db139cda75eef326e0db71b 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/string.h>
 #include <linux/proc_fs.h>
 #include <linux/skbuff.h>
+#include <linux/capability.h>
 #include <linux/if.h>
 #include <linux/if_ether.h>
 #include <linux/if_arp.h>
@@ -125,8 +126,15 @@ void irda_device_set_media_busy(struct net_device *dev, int status)
 
        self = (struct irlap_cb *) dev->atalk_ptr;
 
-       IRDA_ASSERT(self != NULL, return;);
-       IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
+       /* Some drivers may enable the receive interrupt before calling
+        * irlap_open(), or they may disable the receive interrupt
+        * after calling irlap_close().
+        * The IrDA stack is protected from this in irlap_driver_rcv().
+        * However, the driver calls directly the wrapper, that calls
+        * us directly. Make sure we protect ourselves.
+        * Jean II */
+       if (!self || self->magic != LAP_MAGIC)
+               return;
 
        if (status) {
                self->media_busy = TRUE;
@@ -335,12 +343,12 @@ static void irda_task_timer_expired(void *data)
 static void irda_device_setup(struct net_device *dev)
 {
         dev->hard_header_len = 0;
-        dev->addr_len        = 0;
+        dev->addr_len        = LAP_ALEN;
 
         dev->type            = ARPHRD_IRDA;
         dev->tx_queue_len    = 8; /* Window size + 1 s-frame */
 
-       memset(dev->broadcast, 0xff, 4);
+       memset(dev->broadcast, 0xff, LAP_ALEN);
 
        dev->mtu = 2048;
        dev->flags = IFF_NOARP;
@@ -463,11 +471,11 @@ void irda_device_unregister_dongle(struct dongle_reg *dongle)
 }
 EXPORT_SYMBOL(irda_device_unregister_dongle);
 
-#ifdef CONFIG_ISA
+#ifdef CONFIG_ISA_DMA_API
 /*
  * Function setup_dma (idev, buffer, count, mode)
  *
- *    Setup the DMA channel. Commonly used by ISA FIR drivers
+ *    Setup the DMA channel. Commonly used by LPC FIR drivers
  *
  */
 void irda_setup_dma(int channel, dma_addr_t buffer, int count, int mode)