diff options
Diffstat (limited to 'net/irda')
-rw-r--r-- | net/irda/discovery.c | 1 | ||||
-rw-r--r-- | net/irda/ircomm/ircomm_tty.c | 11 | ||||
-rw-r--r-- | net/irda/iriap.c | 12 | ||||
-rw-r--r-- | net/irda/irias_object.c | 4 | ||||
-rw-r--r-- | net/irda/irlan/irlan_common.c | 2 | ||||
-rw-r--r-- | net/irda/irlmp.c | 7 | ||||
-rw-r--r-- | net/irda/irqueue.c | 3 | ||||
-rw-r--r-- | net/irda/irttp.c | 9 |
8 files changed, 24 insertions, 25 deletions
diff --git a/net/irda/discovery.c b/net/irda/discovery.c index 3fefc822c1c0..89fd2a2cbca6 100644 --- a/net/irda/discovery.c +++ b/net/irda/discovery.c @@ -32,6 +32,7 @@ #include <linux/string.h> #include <linux/socket.h> +#include <linux/fs.h> #include <linux/seq_file.h> #include <net/irda/irda.h> diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c index d50a02030ad7..262bda808d96 100644 --- a/net/irda/ircomm/ircomm_tty.c +++ b/net/irda/ircomm/ircomm_tty.c @@ -61,7 +61,7 @@ static void ircomm_tty_flush_buffer(struct tty_struct *tty); static void ircomm_tty_send_xchar(struct tty_struct *tty, char ch); static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout); static void ircomm_tty_hangup(struct tty_struct *tty); -static void ircomm_tty_do_softint(void *private_); +static void ircomm_tty_do_softint(struct work_struct *work); static void ircomm_tty_shutdown(struct ircomm_tty_cb *self); static void ircomm_tty_stop(struct tty_struct *tty); @@ -389,7 +389,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) self->flow = FLOW_STOP; self->line = line; - INIT_WORK(&self->tqueue, ircomm_tty_do_softint, self); + INIT_WORK(&self->tqueue, ircomm_tty_do_softint); self->max_header_size = IRCOMM_TTY_HDR_UNINITIALISED; self->max_data_size = IRCOMM_TTY_DATA_UNINITIALISED; self->close_delay = 5*HZ/10; @@ -594,15 +594,16 @@ static void ircomm_tty_flush_buffer(struct tty_struct *tty) } /* - * Function ircomm_tty_do_softint (private_) + * Function ircomm_tty_do_softint (work) * * We use this routine to give the write wakeup to the user at at a * safe time (as fast as possible after write have completed). This * can be compared to the Tx interrupt. */ -static void ircomm_tty_do_softint(void *private_) +static void ircomm_tty_do_softint(struct work_struct *work) { - struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) private_; + struct ircomm_tty_cb *self = + container_of(work, struct ircomm_tty_cb, tqueue); struct tty_struct *tty; unsigned long flags; struct sk_buff *skb, *ctrl_skb; diff --git a/net/irda/iriap.c b/net/irda/iriap.c index 415cf4eec23b..8f1c6d65b247 100644 --- a/net/irda/iriap.c +++ b/net/irda/iriap.c @@ -27,6 +27,7 @@ #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> @@ -172,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; @@ -181,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; @@ -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,7 @@ static void iriap_getvaluebyclass_response(struct iriap_cb *self, { struct sk_buff *tx_skb; int n; - __u32 tmp_be32; + __be32 tmp_be32; __be16 tmp_be16; __u8 *fp; diff --git a/net/irda/irias_object.c b/net/irda/irias_object.c index 56292ab7d652..b1ee99a59c0c 100644 --- a/net/irda/irias_object.c +++ b/net/irda/irias_object.c @@ -501,13 +501,12 @@ struct ias_value *irias_new_octseq_value(__u8 *octseq , int len) len = IAS_MAX_OCTET_STRING; value->len = len; - value->t.oct_seq = kmalloc(len, GFP_ATOMIC); + value->t.oct_seq = kmemdup(octseq, len, GFP_ATOMIC); if (value->t.oct_seq == NULL){ IRDA_WARNING("%s: Unable to kmalloc!\n", __FUNCTION__); kfree(value); return NULL; } - memcpy(value->t.oct_seq, octseq , len); return value; } @@ -522,7 +521,6 @@ struct ias_value *irias_new_missing_value(void) } value->type = IAS_MISSING; - value->len = 0; return value; } diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c index 9b962f247714..2bb04ac09329 100644 --- a/net/irda/irlan/irlan_common.c +++ b/net/irda/irlan/irlan_common.c @@ -995,7 +995,7 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, { __u8 *frame; __u8 param_len; - __u16 tmp_le; /* Temporary value in little endian format */ + __le16 tmp_le; /* Temporary value in little endian format */ int n=0; if (skb == NULL) { diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c index 5073261b9d0c..7e5d12ab3b90 100644 --- a/net/irda/irlmp.c +++ b/net/irda/irlmp.c @@ -641,15 +641,13 @@ struct lsap_cb *irlmp_dup(struct lsap_cb *orig, void *instance) } /* Allocate a new instance */ - new = kmalloc(sizeof(struct lsap_cb), GFP_ATOMIC); + new = kmemdup(orig, sizeof(*new), GFP_ATOMIC); if (!new) { IRDA_DEBUG(0, "%s(), unable to kmalloc\n", __FUNCTION__); spin_unlock_irqrestore(&irlmp->unconnected_lsaps->hb_spinlock, flags); return NULL; } - /* Dup */ - memcpy(new, orig, sizeof(struct lsap_cb)); /* new->lap = orig->lap; => done in the memcpy() */ /* new->slsap_sel = orig->slsap_sel; => done in the memcpy() */ new->conn_skb = NULL; @@ -1678,7 +1676,8 @@ static int irlmp_slsap_inuse(__u8 slsap_sel) * every IrLAP connection and check every LSAP associated with each * the connection. */ - spin_lock_irqsave(&irlmp->links->hb_spinlock, flags); + spin_lock_irqsave_nested(&irlmp->links->hb_spinlock, flags, + SINGLE_DEPTH_NESTING); lap = (struct lap_cb *) hashbin_get_first(irlmp->links); while (lap != NULL) { IRDA_ASSERT(lap->magic == LMP_LAP_MAGIC, goto errlap;); diff --git a/net/irda/irqueue.c b/net/irda/irqueue.c index 1ba8c7106639..1d26cd33ea13 100644 --- a/net/irda/irqueue.c +++ b/net/irda/irqueue.c @@ -356,14 +356,13 @@ hashbin_t *hashbin_new(int type) /* * Allocate new hashbin */ - hashbin = kmalloc( sizeof(hashbin_t), GFP_ATOMIC); + hashbin = kzalloc(sizeof(*hashbin), GFP_ATOMIC); if (!hashbin) return NULL; /* * Initialize structure */ - memset(hashbin, 0, sizeof(hashbin_t)); hashbin->hb_type = type; hashbin->magic = HB_MAGIC; //hashbin->hb_current = NULL; diff --git a/net/irda/irttp.c b/net/irda/irttp.c index 3c2e70b77df1..03504f3e4990 100644 --- a/net/irda/irttp.c +++ b/net/irda/irttp.c @@ -26,6 +26,7 @@ #include <linux/skbuff.h> #include <linux/init.h> +#include <linux/fs.h> #include <linux/seq_file.h> #include <asm/byteorder.h> @@ -1099,7 +1100,7 @@ int irttp_connect_request(struct tsap_cb *self, __u8 dtsap_sel, return -ENOMEM; /* Reserve space for MUX_CONTROL and LAP header */ - skb_reserve(tx_skb, TTP_MAX_HEADER); + skb_reserve(tx_skb, TTP_MAX_HEADER + TTP_SAR_HEADER); } else { tx_skb = userdata; /* @@ -1147,7 +1148,7 @@ int irttp_connect_request(struct tsap_cb *self, __u8 dtsap_sel, frame[3] = 0x02; /* Value length */ put_unaligned(cpu_to_be16((__u16) max_sdu_size), - (__u16 *)(frame+4)); + (__be16 *)(frame+4)); } else { /* Insert plain TTP header */ frame = skb_push(tx_skb, TTP_HEADER); @@ -1348,7 +1349,7 @@ int irttp_connect_response(struct tsap_cb *self, __u32 max_sdu_size, return -ENOMEM; /* Reserve space for MUX_CONTROL and LAP header */ - skb_reserve(tx_skb, TTP_MAX_HEADER); + skb_reserve(tx_skb, TTP_MAX_HEADER + TTP_SAR_HEADER); } else { tx_skb = userdata; /* @@ -1394,7 +1395,7 @@ int irttp_connect_response(struct tsap_cb *self, __u32 max_sdu_size, frame[3] = 0x02; /* Value length */ put_unaligned(cpu_to_be16((__u16) max_sdu_size), - (__u16 *)(frame+4)); + (__be16 *)(frame+4)); } else { /* Insert TTP header */ frame = skb_push(tx_skb, TTP_HEADER); |