diff options
author | Joe Perches <joe@perches.com> | 2013-07-23 13:45:00 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-23 14:34:52 -0700 |
commit | f724b5843431aba591a01b6988a725689cd9ebb3 (patch) | |
tree | 034c8be97807dbd4a46a3ba650ca03083331c633 /drivers/staging/ozwpan/ozcdev.c | |
parent | 30f1e5a9abd5ea83a19e8efd71089d4204e21bd4 (diff) | |
download | op-kernel-dev-f724b5843431aba591a01b6988a725689cd9ebb3.zip op-kernel-dev-f724b5843431aba591a01b6988a725689cd9ebb3.tar.gz |
staging: ozwpan: Replace oz_trace with oz_dbg
Introduce new debug macros: oz_dbg, oz_cdev_dbg, oz_pd_dbg
and then replace old oz_trace & oz_trace2 with new macro.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/ozwpan/ozcdev.c')
-rw-r--r-- | drivers/staging/ozwpan/ozcdev.c | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/drivers/staging/ozwpan/ozcdev.c b/drivers/staging/ozwpan/ozcdev.c index 284c26d..87c3131 100644 --- a/drivers/staging/ozwpan/ozcdev.c +++ b/drivers/staging/ozwpan/ozcdev.c @@ -12,6 +12,7 @@ #include <linux/poll.h> #include <linux/sched.h> #include "ozconfig.h" +#include "ozdbg.h" #include "ozprotocol.h" #include "oztrace.h" #include "ozappif.h" @@ -63,7 +64,7 @@ static struct oz_serial_ctx *oz_cdev_claim_ctx(struct oz_pd *pd) static void oz_cdev_release_ctx(struct oz_serial_ctx *ctx) { if (atomic_dec_and_test(&ctx->ref_count)) { - oz_trace("Dealloc serial context.\n"); + oz_dbg(ON, "Dealloc serial context\n"); kfree(ctx); } } @@ -72,9 +73,10 @@ static void oz_cdev_release_ctx(struct oz_serial_ctx *ctx) */ static int oz_cdev_open(struct inode *inode, struct file *filp) { - struct oz_cdev *dev; - oz_trace("major = %d minor = %d\n", imajor(inode), iminor(inode)); - dev = container_of(inode->i_cdev, struct oz_cdev, cdev); + struct oz_cdev *dev = container_of(inode->i_cdev, struct oz_cdev, cdev); + + oz_dbg(ON, "major = %d minor = %d\n", imajor(inode), iminor(inode)); + filp->private_data = dev; return 0; } @@ -249,7 +251,7 @@ static long oz_cdev_ioctl(struct file *filp, unsigned int cmd, switch (cmd) { case OZ_IOCTL_GET_PD_LIST: { struct oz_pd_list list; - oz_trace("OZ_IOCTL_GET_PD_LIST\n"); + oz_dbg(ON, "OZ_IOCTL_GET_PD_LIST\n"); memset(&list, 0, sizeof(list)); list.count = oz_get_pd_list(list.addr, OZ_MAX_PDS); if (copy_to_user((void __user *)arg, &list, @@ -259,7 +261,7 @@ static long oz_cdev_ioctl(struct file *filp, unsigned int cmd, break; case OZ_IOCTL_SET_ACTIVE_PD: { u8 addr[ETH_ALEN]; - oz_trace("OZ_IOCTL_SET_ACTIVE_PD\n"); + oz_dbg(ON, "OZ_IOCTL_SET_ACTIVE_PD\n"); if (copy_from_user(addr, (void __user *)arg, ETH_ALEN)) return -EFAULT; rc = oz_set_active_pd(addr); @@ -267,7 +269,7 @@ static long oz_cdev_ioctl(struct file *filp, unsigned int cmd, break; case OZ_IOCTL_GET_ACTIVE_PD: { u8 addr[ETH_ALEN]; - oz_trace("OZ_IOCTL_GET_ACTIVE_PD\n"); + oz_dbg(ON, "OZ_IOCTL_GET_ACTIVE_PD\n"); spin_lock_bh(&g_cdev.lock); memcpy(addr, g_cdev.active_addr, ETH_ALEN); spin_unlock_bh(&g_cdev.lock); @@ -300,7 +302,7 @@ static unsigned int oz_cdev_poll(struct file *filp, poll_table *wait) { unsigned int ret = 0; struct oz_cdev *dev = filp->private_data; - oz_trace("Poll called wait = %p\n", wait); + oz_dbg(ON, "Poll called wait = %p\n", wait); spin_lock_bh(&dev->lock); if (dev->active_pd) { struct oz_serial_ctx *ctx = oz_cdev_claim_ctx(dev->active_pd); @@ -337,8 +339,8 @@ int oz_cdev_register(void) err = alloc_chrdev_region(&g_cdev.devnum, 0, 1, "ozwpan"); if (err < 0) goto out3; - oz_trace("Alloc dev number %d:%d\n", MAJOR(g_cdev.devnum), - MINOR(g_cdev.devnum)); + oz_dbg(ON, "Alloc dev number %d:%d\n", + MAJOR(g_cdev.devnum), MINOR(g_cdev.devnum)); cdev_init(&g_cdev.cdev, &oz_fops); g_cdev.cdev.owner = THIS_MODULE; g_cdev.cdev.ops = &oz_fops; @@ -346,18 +348,18 @@ int oz_cdev_register(void) init_waitqueue_head(&g_cdev.rdq); err = cdev_add(&g_cdev.cdev, g_cdev.devnum, 1); if (err < 0) { - oz_trace("Failed to add cdev\n"); + oz_dbg(ON, "Failed to add cdev\n"); goto out2; } g_oz_class = class_create(THIS_MODULE, "ozmo_wpan"); if (IS_ERR(g_oz_class)) { - oz_trace("Failed to register ozmo_wpan class\n"); + oz_dbg(ON, "Failed to register ozmo_wpan class\n"); err = PTR_ERR(g_oz_class); goto out1; } dev = device_create(g_oz_class, NULL, g_cdev.devnum, NULL, "ozwpan"); if (IS_ERR(dev)) { - oz_trace("Failed to create sysfs entry for cdev\n"); + oz_dbg(ON, "Failed to create sysfs entry for cdev\n"); err = PTR_ERR(dev); goto out1; } @@ -405,7 +407,7 @@ int oz_cdev_start(struct oz_pd *pd, int resume) struct oz_serial_ctx *ctx; struct oz_serial_ctx *old_ctx; if (resume) { - oz_trace("Serial service resumed.\n"); + oz_dbg(ON, "Serial service resumed\n"); return 0; } ctx = kzalloc(sizeof(struct oz_serial_ctx), GFP_ATOMIC); @@ -427,10 +429,10 @@ int oz_cdev_start(struct oz_pd *pd, int resume) (memcmp(pd->mac_addr, g_cdev.active_addr, ETH_ALEN) == 0)) { oz_pd_get(pd); g_cdev.active_pd = pd; - oz_trace("Active PD arrived.\n"); + oz_dbg(ON, "Active PD arrived\n"); } spin_unlock(&g_cdev.lock); - oz_trace("Serial service started.\n"); + oz_dbg(ON, "Serial service started\n"); return 0; } /*------------------------------------------------------------------------------ @@ -440,7 +442,7 @@ void oz_cdev_stop(struct oz_pd *pd, int pause) { struct oz_serial_ctx *ctx; if (pause) { - oz_trace("Serial service paused.\n"); + oz_dbg(ON, "Serial service paused\n"); return; } spin_lock_bh(&pd->app_lock[OZ_APPID_SERIAL-1]); @@ -457,9 +459,9 @@ void oz_cdev_stop(struct oz_pd *pd, int pause) spin_unlock(&g_cdev.lock); if (pd) { oz_pd_put(pd); - oz_trace("Active PD departed.\n"); + oz_dbg(ON, "Active PD departed\n"); } - oz_trace("Serial service stopped.\n"); + oz_dbg(ON, "Serial service stopped\n"); } /*------------------------------------------------------------------------------ * Context: softirq-serialized @@ -476,7 +478,7 @@ void oz_cdev_rx(struct oz_pd *pd, struct oz_elt *elt) ctx = oz_cdev_claim_ctx(pd); if (ctx == NULL) { - oz_trace("Cannot claim serial context.\n"); + oz_dbg(ON, "Cannot claim serial context\n"); return; } @@ -486,8 +488,8 @@ void oz_cdev_rx(struct oz_pd *pd, struct oz_elt *elt) if (app_hdr->elt_seq_num != 0) { if (((ctx->rx_seq_num - app_hdr->elt_seq_num) & 0x80) == 0) { /* Reject duplicate element. */ - oz_trace("Duplicate element:%02x %02x\n", - app_hdr->elt_seq_num, ctx->rx_seq_num); + oz_dbg(ON, "Duplicate element:%02x %02x\n", + app_hdr->elt_seq_num, ctx->rx_seq_num); goto out; } } @@ -500,7 +502,7 @@ void oz_cdev_rx(struct oz_pd *pd, struct oz_elt *elt) if (space < 0) space += OZ_RD_BUF_SZ; if (len > space) { - oz_trace("Not enough space:%d %d\n", len, space); + oz_dbg(ON, "Not enough space:%d %d\n", len, space); len = space; } ix = ctx->rd_in; |