X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=net%2Firda%2Firlap.c;h=f3236acc8d22e2706e5d1a643c085598cc982352;hb=ad48ce74f70a201c4c1cf3b4e8f6b6203a2e4a8d;hp=cade355ac8af51387b385d74052771ad9b6d32e4;hpb=71bc7bf045262e82c645cad48fd56dd17e75344e;p=linux-2.6-omap-h63xx.git diff --git a/net/irda/irlap.c b/net/irda/irlap.c index cade355ac8a..f3236acc8d2 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; } @@ -95,7 +95,7 @@ int __init irlap_init(void) return 0; } -void __exit irlap_cleanup(void) +void irlap_cleanup(void) { IRDA_ASSERT(irlap != NULL, return;); @@ -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); @@ -1211,7 +1210,7 @@ static int irlap_seq_show(struct seq_file *seq, void *v) return 0; } -static struct seq_operations irlap_seq_ops = { +static const struct seq_operations irlap_seq_ops = { .start = irlap_seq_start, .next = irlap_seq_next, .stop = irlap_seq_stop, @@ -1220,33 +1219,14 @@ static struct seq_operations irlap_seq_ops = { 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); - - if (!s) - goto out; - - if (irlap == NULL) { - rc = -EINVAL; - goto out_kfree; - } + if (irlap == NULL) + return -EINVAL; - rc = seq_open(file, &irlap_seq_ops); - if (rc) - goto out_kfree; - - seq = file->private_data; - seq->private = s; - memset(s, 0, sizeof(*s)); -out: - return rc; -out_kfree: - kfree(s); - goto out; + return seq_open_private(file, &irlap_seq_ops, + sizeof(struct irlap_iter_state)); } -struct file_operations irlap_seq_fops = { +const struct file_operations irlap_seq_fops = { .owner = THIS_MODULE, .open = irlap_seq_open, .read = seq_read,