aboutsummaryrefslogtreecommitdiffstats
path: root/net/atm/clip.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-08-28 18:22:09 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:48:27 -0400
commit522400623e240ad134cb4101b1fddc3245d2a7ed (patch)
treefb1f341426ae7cd5c977232c8084bf45819d1bea /net/atm/clip.c
parent23f1f4eff85d3d2ec9ed589e3fdcbba59eaa083e (diff)
[ATM]: Replace DPRINTK() with pr_debug().
Get rid of using DPRINTK macro in ATM and use pr_debug (in kernel.h). Using the standard macro is cleaner and forces code to check for bad arguments and formatting. Fixes from Thomas Graf. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/atm/clip.c')
-rw-r--r--net/atm/clip.c62
1 files changed, 27 insertions, 35 deletions
diff --git a/net/atm/clip.c b/net/atm/clip.c
index ecf0f79b94ae..806ea98567c6 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -40,14 +40,6 @@
40#include "resources.h" 40#include "resources.h"
41#include <net/atmclip.h> 41#include <net/atmclip.h>
42 42
43
44#if 0
45#define DPRINTK(format,args...) printk(format,##args)
46#else
47#define DPRINTK(format,args...)
48#endif
49
50
51static struct net_device *clip_devs; 43static struct net_device *clip_devs;
52static struct atm_vcc *atmarpd; 44static struct atm_vcc *atmarpd;
53static struct neigh_table clip_tbl; 45static struct neigh_table clip_tbl;
@@ -59,7 +51,7 @@ static int to_atmarpd(enum atmarp_ctrl_type type, int itf, __be32 ip)
59 struct atmarp_ctrl *ctrl; 51 struct atmarp_ctrl *ctrl;
60 struct sk_buff *skb; 52 struct sk_buff *skb;
61 53
62 DPRINTK("to_atmarpd(%d)\n", type); 54 pr_debug("to_atmarpd(%d)\n", type);
63 if (!atmarpd) 55 if (!atmarpd)
64 return -EUNATCH; 56 return -EUNATCH;
65 skb = alloc_skb(sizeof(struct atmarp_ctrl),GFP_ATOMIC); 57 skb = alloc_skb(sizeof(struct atmarp_ctrl),GFP_ATOMIC);
@@ -79,7 +71,7 @@ static int to_atmarpd(enum atmarp_ctrl_type type, int itf, __be32 ip)
79 71
80static void link_vcc(struct clip_vcc *clip_vcc, struct atmarp_entry *entry) 72static void link_vcc(struct clip_vcc *clip_vcc, struct atmarp_entry *entry)
81{ 73{
82 DPRINTK("link_vcc %p to entry %p (neigh %p)\n", clip_vcc, entry, 74 pr_debug("link_vcc %p to entry %p (neigh %p)\n", clip_vcc, entry,
83 entry->neigh); 75 entry->neigh);
84 clip_vcc->entry = entry; 76 clip_vcc->entry = entry;
85 clip_vcc->xoff = 0; /* @@@ may overrun buffer by one packet */ 77 clip_vcc->xoff = 0; /* @@@ may overrun buffer by one packet */
@@ -134,7 +126,7 @@ static int neigh_check_cb(struct neighbour *n)
134 unsigned long exp = cv->last_use + cv->idle_timeout; 126 unsigned long exp = cv->last_use + cv->idle_timeout;
135 127
136 if (cv->idle_timeout && time_after(jiffies, exp)) { 128 if (cv->idle_timeout && time_after(jiffies, exp)) {
137 DPRINTK("releasing vcc %p->%p of entry %p\n", 129 pr_debug("releasing vcc %p->%p of entry %p\n",
138 cv, cv->vcc, entry); 130 cv, cv->vcc, entry);
139 vcc_release_async(cv->vcc, -ETIMEDOUT); 131 vcc_release_async(cv->vcc, -ETIMEDOUT);
140 } 132 }
@@ -146,7 +138,7 @@ static int neigh_check_cb(struct neighbour *n)
146 if (atomic_read(&n->refcnt) > 1) { 138 if (atomic_read(&n->refcnt) > 1) {
147 struct sk_buff *skb; 139 struct sk_buff *skb;
148 140
149 DPRINTK("destruction postponed with ref %d\n", 141 pr_debug("destruction postponed with ref %d\n",
150 atomic_read(&n->refcnt)); 142 atomic_read(&n->refcnt));
151 143
152 while ((skb = skb_dequeue(&n->arp_queue)) != NULL) 144 while ((skb = skb_dequeue(&n->arp_queue)) != NULL)
@@ -155,7 +147,7 @@ static int neigh_check_cb(struct neighbour *n)
155 return 0; 147 return 0;
156 } 148 }
157 149
158 DPRINTK("expired neigh %p\n", n); 150 pr_debug("expired neigh %p\n", n);
159 return 1; 151 return 1;
160} 152}
161 153
@@ -171,14 +163,14 @@ static int clip_arp_rcv(struct sk_buff *skb)
171{ 163{
172 struct atm_vcc *vcc; 164 struct atm_vcc *vcc;
173 165
174 DPRINTK("clip_arp_rcv\n"); 166 pr_debug("clip_arp_rcv\n");
175 vcc = ATM_SKB(skb)->vcc; 167 vcc = ATM_SKB(skb)->vcc;
176 if (!vcc || !atm_charge(vcc, skb->truesize)) { 168 if (!vcc || !atm_charge(vcc, skb->truesize)) {
177 dev_kfree_skb_any(skb); 169 dev_kfree_skb_any(skb);
178 return 0; 170 return 0;
179 } 171 }
180 DPRINTK("pushing to %p\n", vcc); 172 pr_debug("pushing to %p\n", vcc);
181 DPRINTK("using %p\n", CLIP_VCC(vcc)->old_push); 173 pr_debug("using %p\n", CLIP_VCC(vcc)->old_push);
182 CLIP_VCC(vcc)->old_push(vcc, skb); 174 CLIP_VCC(vcc)->old_push(vcc, skb);
183 return 0; 175 return 0;
184} 176}
@@ -196,9 +188,9 @@ static void clip_push(struct atm_vcc *vcc, struct sk_buff *skb)
196{ 188{
197 struct clip_vcc *clip_vcc = CLIP_VCC(vcc); 189 struct clip_vcc *clip_vcc = CLIP_VCC(vcc);
198 190
199 DPRINTK("clip push\n"); 191 pr_debug("clip push\n");
200 if (!skb) { 192 if (!skb) {
201 DPRINTK("removing VCC %p\n", clip_vcc); 193 pr_debug("removing VCC %p\n", clip_vcc);
202 if (clip_vcc->entry) 194 if (clip_vcc->entry)
203 unlink_clip_vcc(clip_vcc); 195 unlink_clip_vcc(clip_vcc);
204 clip_vcc->old_push(vcc, NULL); /* pass on the bad news */ 196 clip_vcc->old_push(vcc, NULL); /* pass on the bad news */
@@ -247,7 +239,7 @@ static void clip_pop(struct atm_vcc *vcc, struct sk_buff *skb)
247 int old; 239 int old;
248 unsigned long flags; 240 unsigned long flags;
249 241
250 DPRINTK("clip_pop(vcc %p)\n", vcc); 242 pr_debug("clip_pop(vcc %p)\n", vcc);
251 clip_vcc->old_pop(vcc, skb); 243 clip_vcc->old_pop(vcc, skb);
252 /* skb->dev == NULL in outbound ARP packets */ 244 /* skb->dev == NULL in outbound ARP packets */
253 if (!dev) 245 if (!dev)
@@ -263,7 +255,7 @@ static void clip_pop(struct atm_vcc *vcc, struct sk_buff *skb)
263 255
264static void clip_neigh_solicit(struct neighbour *neigh, struct sk_buff *skb) 256static void clip_neigh_solicit(struct neighbour *neigh, struct sk_buff *skb)
265{ 257{
266 DPRINTK("clip_neigh_solicit (neigh %p, skb %p)\n", neigh, skb); 258 pr_debug("clip_neigh_solicit (neigh %p, skb %p)\n", neigh, skb);
267 to_atmarpd(act_need, PRIV(neigh->dev)->number, NEIGH2ENTRY(neigh)->ip); 259 to_atmarpd(act_need, PRIV(neigh->dev)->number, NEIGH2ENTRY(neigh)->ip);
268} 260}
269 261
@@ -292,7 +284,7 @@ static int clip_constructor(struct neighbour *neigh)
292 struct in_device *in_dev; 284 struct in_device *in_dev;
293 struct neigh_parms *parms; 285 struct neigh_parms *parms;
294 286
295 DPRINTK("clip_constructor (neigh %p, entry %p)\n", neigh, entry); 287 pr_debug("clip_constructor (neigh %p, entry %p)\n", neigh, entry);
296 neigh->type = inet_addr_type(entry->ip); 288 neigh->type = inet_addr_type(entry->ip);
297 if (neigh->type != RTN_UNICAST) 289 if (neigh->type != RTN_UNICAST)
298 return -EINVAL; 290 return -EINVAL;
@@ -376,7 +368,7 @@ static int clip_start_xmit(struct sk_buff *skb, struct net_device *dev)
376 int old; 368 int old;
377 unsigned long flags; 369 unsigned long flags;
378 370
379 DPRINTK("clip_start_xmit (skb %p)\n", skb); 371 pr_debug("clip_start_xmit (skb %p)\n", skb);
380 if (!skb->dst) { 372 if (!skb->dst) {
381 printk(KERN_ERR "clip_start_xmit: skb->dst == NULL\n"); 373 printk(KERN_ERR "clip_start_xmit: skb->dst == NULL\n");
382 dev_kfree_skb(skb); 374 dev_kfree_skb(skb);
@@ -412,9 +404,9 @@ static int clip_start_xmit(struct sk_buff *skb, struct net_device *dev)
412 } 404 }
413 return 0; 405 return 0;
414 } 406 }
415 DPRINTK("neigh %p, vccs %p\n", entry, entry->vccs); 407 pr_debug("neigh %p, vccs %p\n", entry, entry->vccs);
416 ATM_SKB(skb)->vcc = vcc = entry->vccs->vcc; 408 ATM_SKB(skb)->vcc = vcc = entry->vccs->vcc;
417 DPRINTK("using neighbour %p, vcc %p\n", skb->dst->neighbour, vcc); 409 pr_debug("using neighbour %p, vcc %p\n", skb->dst->neighbour, vcc);
418 if (entry->vccs->encap) { 410 if (entry->vccs->encap) {
419 void *here; 411 void *here;
420 412
@@ -425,7 +417,7 @@ static int clip_start_xmit(struct sk_buff *skb, struct net_device *dev)
425 atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); 417 atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);
426 ATM_SKB(skb)->atm_options = vcc->atm_options; 418 ATM_SKB(skb)->atm_options = vcc->atm_options;
427 entry->vccs->last_use = jiffies; 419 entry->vccs->last_use = jiffies;
428 DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, vcc, vcc->dev); 420 pr_debug("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, vcc, vcc->dev);
429 old = xchg(&entry->vccs->xoff, 1); /* assume XOFF ... */ 421 old = xchg(&entry->vccs->xoff, 1); /* assume XOFF ... */
430 if (old) { 422 if (old) {
431 printk(KERN_WARNING "clip_start_xmit: XOFF->XOFF transition\n"); 423 printk(KERN_WARNING "clip_start_xmit: XOFF->XOFF transition\n");
@@ -468,7 +460,7 @@ static int clip_mkip(struct atm_vcc *vcc, int timeout)
468 clip_vcc = kmalloc(sizeof(struct clip_vcc), GFP_KERNEL); 460 clip_vcc = kmalloc(sizeof(struct clip_vcc), GFP_KERNEL);
469 if (!clip_vcc) 461 if (!clip_vcc)
470 return -ENOMEM; 462 return -ENOMEM;
471 DPRINTK("mkip clip_vcc %p vcc %p\n", clip_vcc, vcc); 463 pr_debug("mkip clip_vcc %p vcc %p\n", clip_vcc, vcc);
472 clip_vcc->vcc = vcc; 464 clip_vcc->vcc = vcc;
473 vcc->user_back = clip_vcc; 465 vcc->user_back = clip_vcc;
474 set_bit(ATM_VF_IS_CLIP, &vcc->flags); 466 set_bit(ATM_VF_IS_CLIP, &vcc->flags);
@@ -538,7 +530,7 @@ static int clip_setentry(struct atm_vcc *vcc, __be32 ip)
538 printk(KERN_ERR "hiding hidden ATMARP entry\n"); 530 printk(KERN_ERR "hiding hidden ATMARP entry\n");
539 return 0; 531 return 0;
540 } 532 }
541 DPRINTK("setentry: remove\n"); 533 pr_debug("setentry: remove\n");
542 unlink_clip_vcc(clip_vcc); 534 unlink_clip_vcc(clip_vcc);
543 return 0; 535 return 0;
544 } 536 }
@@ -552,9 +544,9 @@ static int clip_setentry(struct atm_vcc *vcc, __be32 ip)
552 entry = NEIGH2ENTRY(neigh); 544 entry = NEIGH2ENTRY(neigh);
553 if (entry != clip_vcc->entry) { 545 if (entry != clip_vcc->entry) {
554 if (!clip_vcc->entry) 546 if (!clip_vcc->entry)
555 DPRINTK("setentry: add\n"); 547 pr_debug("setentry: add\n");
556 else { 548 else {
557 DPRINTK("setentry: update\n"); 549 pr_debug("setentry: update\n");
558 unlink_clip_vcc(clip_vcc); 550 unlink_clip_vcc(clip_vcc);
559 } 551 }
560 link_vcc(clip_vcc, entry); 552 link_vcc(clip_vcc, entry);
@@ -611,7 +603,7 @@ static int clip_create(int number)
611 } 603 }
612 clip_priv->next = clip_devs; 604 clip_priv->next = clip_devs;
613 clip_devs = dev; 605 clip_devs = dev;
614 DPRINTK("registered (net:%s)\n", dev->name); 606 pr_debug("registered (net:%s)\n", dev->name);
615 return number; 607 return number;
616} 608}
617 609
@@ -631,16 +623,16 @@ static int clip_device_event(struct notifier_block *this, unsigned long event,
631 623
632 switch (event) { 624 switch (event) {
633 case NETDEV_UP: 625 case NETDEV_UP:
634 DPRINTK("clip_device_event NETDEV_UP\n"); 626 pr_debug("clip_device_event NETDEV_UP\n");
635 to_atmarpd(act_up, PRIV(dev)->number, 0); 627 to_atmarpd(act_up, PRIV(dev)->number, 0);
636 break; 628 break;
637 case NETDEV_GOING_DOWN: 629 case NETDEV_GOING_DOWN:
638 DPRINTK("clip_device_event NETDEV_DOWN\n"); 630 pr_debug("clip_device_event NETDEV_DOWN\n");
639 to_atmarpd(act_down, PRIV(dev)->number, 0); 631 to_atmarpd(act_down, PRIV(dev)->number, 0);
640 break; 632 break;
641 case NETDEV_CHANGE: 633 case NETDEV_CHANGE:
642 case NETDEV_CHANGEMTU: 634 case NETDEV_CHANGEMTU:
643 DPRINTK("clip_device_event NETDEV_CHANGE*\n"); 635 pr_debug("clip_device_event NETDEV_CHANGE*\n");
644 to_atmarpd(act_change, PRIV(dev)->number, 0); 636 to_atmarpd(act_change, PRIV(dev)->number, 0);
645 break; 637 break;
646 } 638 }
@@ -681,14 +673,14 @@ static struct notifier_block clip_inet_notifier = {
681 673
682static void atmarpd_close(struct atm_vcc *vcc) 674static void atmarpd_close(struct atm_vcc *vcc)
683{ 675{
684 DPRINTK("atmarpd_close\n"); 676 pr_debug("atmarpd_close\n");
685 677
686 rtnl_lock(); 678 rtnl_lock();
687 atmarpd = NULL; 679 atmarpd = NULL;
688 skb_queue_purge(&sk_atm(vcc)->sk_receive_queue); 680 skb_queue_purge(&sk_atm(vcc)->sk_receive_queue);
689 rtnl_unlock(); 681 rtnl_unlock();
690 682
691 DPRINTK("(done)\n"); 683 pr_debug("(done)\n");
692 module_put(THIS_MODULE); 684 module_put(THIS_MODULE);
693} 685}
694 686