fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / net / irda / iriap.c
index 254f907..8f1c6d6 100644 (file)
  *
  ********************************************************************/
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/skbuff.h>
+#include <linux/fs.h>
 #include <linux/string.h>
 #include <linux/init.h>
 #include <linux/seq_file.h>
@@ -173,7 +173,7 @@ struct iriap_cb *iriap_open(__u8 slsap_sel, int mode, void *priv,
 
        IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
 
-       self = kmalloc(sizeof(struct iriap_cb), GFP_ATOMIC);
+       self = kzalloc(sizeof(*self), GFP_ATOMIC);
        if (!self) {
                IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
                return NULL;
@@ -182,7 +182,6 @@ struct iriap_cb *iriap_open(__u8 slsap_sel, int mode, void *priv,
        /*
         *  Initialize instance
         */
-       memset(self, 0, sizeof(struct iriap_cb));
 
        self->magic = IAS_MAGIC;
        self->mode = mode;
@@ -346,10 +345,11 @@ static void iriap_disconnect_request(struct iriap_cb *self)
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IAS_MAGIC, return;);
 
-       tx_skb = dev_alloc_skb(64);
+       tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
        if (tx_skb == NULL) {
-               IRDA_DEBUG(0, "%s(), Could not allocate an sk_buff of length %d\n", 
-                       __FUNCTION__, 64);
+               IRDA_DEBUG(0,
+                          "%s(), Could not allocate an sk_buff of length %d\n",
+                          __FUNCTION__, LMP_MAX_HEADER);
                return;
        }
 
@@ -397,7 +397,7 @@ int iriap_getvaluebyclass_request(struct iriap_cb *self,
        attr_len = strlen(attr);        /* Up to IAS_MAX_ATTRIBNAME = 60 */
 
        skb_len = self->max_header_size+2+name_len+1+attr_len+4;
-       tx_skb = dev_alloc_skb(skb_len);
+       tx_skb = alloc_skb(skb_len, GFP_ATOMIC);
        if (!tx_skb)
                return -ENOMEM;
 
@@ -451,12 +451,12 @@ static void iriap_getvaluebyclass_confirm(struct iriap_cb *self,
        n = 2;
 
        /* Get length, MSB first */
-       len = be16_to_cpu(get_unaligned((__u16 *)(fp+n))); n += 2;
+       len = be16_to_cpu(get_unaligned((__be16 *)(fp+n))); n += 2;
 
        IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__, len);
 
        /* Get object ID, MSB first */
-       obj_id = be16_to_cpu(get_unaligned((__u16 *)(fp+n))); n += 2;
+       obj_id = be16_to_cpu(get_unaligned((__be16 *)(fp+n))); n += 2;
 
        type = fp[n++];
        IRDA_DEBUG(4, "%s(), Value type = %d\n", __FUNCTION__, type);
@@ -506,7 +506,7 @@ static void iriap_getvaluebyclass_confirm(struct iriap_cb *self,
                value = irias_new_string_value(fp+n);
                break;
        case IAS_OCT_SEQ:
-               value_len = be16_to_cpu(get_unaligned((__u16 *)(fp+n)));
+               value_len = be16_to_cpu(get_unaligned((__be16 *)(fp+n)));
                n += 2;
 
                /* Will truncate to IAS_MAX_OCTET_STRING bytes */
@@ -544,7 +544,8 @@ static void iriap_getvaluebyclass_response(struct iriap_cb *self,
 {
        struct sk_buff *tx_skb;
        int n;
-       __u32 tmp_be32, tmp_be16;
+       __be32 tmp_be32;
+       __be16 tmp_be16;
        __u8 *fp;
 
        IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
@@ -562,7 +563,8 @@ static void iriap_getvaluebyclass_response(struct iriap_cb *self,
         *  value. We add 32 bytes because of the 6 bytes for the frame and
         *  max 5 bytes for the value coding.
         */
-       tx_skb = dev_alloc_skb(value->len + self->max_header_size + 32);
+       tx_skb = alloc_skb(value->len + self->max_header_size + 32,
+                          GFP_ATOMIC);
        if (!tx_skb)
                return;
 
@@ -700,7 +702,7 @@ void iriap_send_ack(struct iriap_cb *self)
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IAS_MAGIC, return;);
 
-       tx_skb = dev_alloc_skb(64);
+       tx_skb = alloc_skb(LMP_MAX_HEADER + 1, GFP_ATOMIC);
        if (!tx_skb)
                return;