X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=net%2Firda%2Firlap.c;h=d93ebd11431e86b2c82f65fc220e7e1316abfc50;hb=3960208f9ca0cf6bdb31c21c59ac0526303f8b34;hp=cade355ac8af51387b385d74052771ad9b6d32e4;hpb=b20e481ab595e9667c33e2393bdfe9a31870d11f;p=powerpc.git diff --git a/net/irda/irlap.c b/net/irda/irlap.c index cade355ac8..d93ebd1143 100644 --- a/net/irda/irlap.c +++ b/net/irda/irlap.c @@ -87,7 +87,7 @@ int __init irlap_init(void) /* Allocate master array */ irlap = hashbin_new(HB_LOCK); if (irlap == NULL) { - IRDA_ERROR("%s: can't allocate irlap hashbin!\n", + IRDA_ERROR("%s: can't allocate irlap hashbin!\n", __FUNCTION__); return -ENOMEM; } @@ -116,11 +116,10 @@ struct irlap_cb *irlap_open(struct net_device *dev, struct qos_info *qos, IRDA_DEBUG(4, "%s()\n", __FUNCTION__); /* Initialize the irlap structure. */ - self = kmalloc(sizeof(struct irlap_cb), GFP_KERNEL); + self = kzalloc(sizeof(struct irlap_cb), GFP_KERNEL); if (self == NULL) return NULL; - memset(self, 0, sizeof(struct irlap_cb)); self->magic = LAP_MAGIC; /* Make a binding between the layers */ @@ -702,8 +701,8 @@ void irlap_update_nr_received(struct irlap_cb *self, int nr) int count = 0; /* - * Remove all the ack-ed frames from the window queue. - */ + * Remove all the ack-ed frames from the window queue. + */ /* * Optimize for the common case. It is most likely that the receiver @@ -882,7 +881,7 @@ static void irlap_change_speed(struct irlap_cb *self, __u32 speed, int now) /* Change speed now, or just piggyback speed on frames */ if (now) { /* Send down empty frame to trigger speed change */ - skb = dev_alloc_skb(0); + skb = alloc_skb(0, GFP_ATOMIC); if (skb) irlap_queue_xmit(self, skb); } @@ -1110,13 +1109,13 @@ static void *irlap_seq_start(struct seq_file *seq, loff_t *pos) spin_lock_irq(&irlap->hb_spinlock); iter->id = 0; - for (self = (struct irlap_cb *) hashbin_get_first(irlap); + for (self = (struct irlap_cb *) hashbin_get_first(irlap); self; self = (struct irlap_cb *) hashbin_get_next(irlap)) { if (iter->id == *pos) break; ++iter->id; } - + return self; } @@ -1138,7 +1137,7 @@ static int irlap_seq_show(struct seq_file *seq, void *v) { const struct irlap_iter_state *iter = seq->private; const struct irlap_cb *self = v; - + IRDA_ASSERT(self->magic == LAP_MAGIC, return -EINVAL;); seq_printf(seq, "irlap%d ", iter->id); @@ -1222,8 +1221,8 @@ static int irlap_seq_open(struct inode *inode, struct file *file) { struct seq_file *seq; int rc = -ENOMEM; - struct irlap_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL); - + struct irlap_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); + if (!s) goto out; @@ -1238,7 +1237,6 @@ static int irlap_seq_open(struct inode *inode, struct file *file) seq = file->private_data; seq->private = s; - memset(s, 0, sizeof(*s)); out: return rc; out_kfree: @@ -1246,7 +1244,7 @@ out_kfree: goto out; } -struct file_operations irlap_seq_fops = { +const struct file_operations irlap_seq_fops = { .owner = THIS_MODULE, .open = irlap_seq_open, .read = seq_read,