diff options
author | 2014-11-03 16:25:44 -0800 | |
---|---|---|
committer | 2014-11-03 16:36:35 -0800 | |
commit | b5d8204d00fa3bcd1f3b4b060fb90675d00baee0 (patch) | |
tree | 1454d652f852cb4e3079725dcf084b5063d7bbfe /drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | |
parent | staging: ft1000: Whitespace neatening (diff) | |
download | linux-dev-b5d8204d00fa3bcd1f3b4b060fb90675d00baee0.tar.xz linux-dev-b5d8204d00fa3bcd1f3b4b060fb90675d00baee0.zip |
staging: ft1000: Logging message neatening
Use a more common logging style.
o Convert DEBUG macros to pr_debug
o Add pr_fmt
o Remove embedded function names from pr_debug
o Convert printks to pr_<level>
o Coalesce formats and align arguments
o Add missing terminating newlines
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/ft1000/ft1000-usb/ft1000_debug.c')
-rw-r--r-- | drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 136 |
1 files changed, 65 insertions, 71 deletions
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c index 658f3cab8e72..c8d278229940 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c @@ -26,6 +26,9 @@ * *--------------------------------------------------------------------------- */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> @@ -87,13 +90,13 @@ struct dpram_blk *ft1000_get_buffer(struct list_head *bufflist) spin_lock_irqsave(&free_buff_lock, flags); /* Check if buffer is available */ if (list_empty(bufflist)) { - DEBUG("ft1000_get_buffer: No more buffer - %d\n", numofmsgbuf); + pr_debug("No more buffer - %d\n", numofmsgbuf); ptr = NULL; } else { numofmsgbuf--; ptr = list_entry(bufflist->next, struct dpram_blk, list); list_del(&ptr->list); - /* DEBUG("ft1000_get_buffer: number of free msg buffers = %d\n", numofmsgbuf); */ + /* pr_debug("number of free msg buffers = %d\n", numofmsgbuf); */ } spin_unlock_irqrestore(&free_buff_lock, flags); @@ -125,7 +128,7 @@ void ft1000_free_buffer(struct dpram_blk *pdpram_blk, struct list_head *plist) /* Put memory back to list */ list_add_tail(&pdpram_blk->list, plist); numofmsgbuf++; - /*DEBUG("ft1000_free_buffer: number of free msg buffers = %d\n", numofmsgbuf); */ + /*pr_debug("number of free msg buffers = %d\n", numofmsgbuf); */ spin_unlock_irqrestore(&free_buff_lock, flags); } @@ -153,17 +156,17 @@ int ft1000_create_dev(struct ft1000_usb *dev) /* make a new device name */ sprintf(dev->DeviceName, "%s%d", "FT1000_", dev->CardNumber); - DEBUG("%s: number of instance = %d\n", __func__, ft1000_flarion_cnt); - DEBUG("DeviceCreated = %x\n", dev->DeviceCreated); + pr_debug("number of instance = %d\n", ft1000_flarion_cnt); + pr_debug("DeviceCreated = %x\n", dev->DeviceCreated); if (dev->DeviceCreated) { - DEBUG("%s: \"%s\" already registered\n", __func__, dev->DeviceName); + pr_debug("\"%s\" already registered\n", dev->DeviceName); return -EIO; } /* register the device */ - DEBUG("%s: \"%s\" debugfs device registration\n", __func__, dev->DeviceName); + pr_debug("\"%s\" debugfs device registration\n", dev->DeviceName); tmp = kmalloc(sizeof(struct ft1000_debug_dirs), GFP_KERNEL); if (tmp == NULL) { @@ -189,7 +192,7 @@ int ft1000_create_dev(struct ft1000_usb *dev) tmp->int_number = dev->CardNumber; list_add(&(tmp->list), &(dev->nodes.list)); - DEBUG("%s: registered debugfs directory \"%s\"\n", __func__, dev->DeviceName); + pr_debug("registered debugfs directory \"%s\"\n", dev->DeviceName); /* initialize application information */ dev->appcnt = 0; @@ -241,10 +244,6 @@ void ft1000_destroy_dev(struct net_device *netdev) struct list_head *pos, *q; struct ft1000_debug_dirs *dir; - DEBUG("%s called\n", __func__); - - - if (dev->DeviceCreated) { ft1000_flarion_cnt--; list_for_each_safe(pos, q, &dev->nodes.list) { @@ -256,8 +255,7 @@ void ft1000_destroy_dev(struct net_device *netdev) kfree(dir); } } - DEBUG("%s: unregistered device \"%s\"\n", __func__, - dev->DeviceName); + pr_debug("unregistered device \"%s\"\n", dev->DeviceName); /* Make sure we free any memory reserve for slow Queue */ for (i = 0; i < MAX_NUM_APP; i++) { @@ -303,17 +301,17 @@ static int ft1000_open(struct inode *inode, struct file *file) struct ft1000_usb *dev = (struct ft1000_usb *)inode->i_private; int i, num; - DEBUG("%s called\n", __func__); num = (MINOR(inode->i_rdev) & 0xf); - DEBUG("ft1000_open: minor number=%d\n", num); + pr_debug("minor number=%d\n", num); info = file->private_data = netdev_priv(dev->net); - DEBUG("f_owner = %p number of application = %d\n", (&file->f_owner), dev->appcnt); + pr_debug("f_owner = %p number of application = %d\n", + &file->f_owner, dev->appcnt); /* Check if maximum number of application exceeded */ if (dev->appcnt > MAX_NUM_APP) { - DEBUG("Maximum number of application exceeded\n"); + pr_debug("Maximum number of application exceeded\n"); return -EACCES; } @@ -326,7 +324,7 @@ static int ft1000_open(struct inode *inode, struct file *file) /* Fail due to lack of application info block */ if (i == MAX_NUM_APP) { - DEBUG("Could not find an application info block\n"); + pr_debug("Could not find an application info block\n"); return -EACCES; } @@ -362,33 +360,32 @@ static unsigned int ft1000_poll_dev(struct file *file, poll_table *wait) struct ft1000_usb *dev = info->priv; int i; - /* DEBUG("ft1000_poll_dev called\n"); */ if (ft1000_flarion_cnt == 0) { - DEBUG("FT1000:ft1000_poll_dev called when ft1000_flarion_cnt is zero\n"); + pr_debug("called with ft1000_flarion_cnt value zero\n"); return -EBADF; } /* Search for matching file object */ for (i = 0; i < MAX_NUM_APP; i++) { if (dev->app_info[i].fileobject == &file->f_owner) { - /* DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", dev->app_info[i].app_id); */ + /* pr_debug("Message is for AppId = %d\n", dev->app_info[i].app_id); */ break; } } /* Could not find application info block */ if (i == MAX_NUM_APP) { - DEBUG("FT1000:ft1000_ioctl:Could not find application info block\n"); + pr_debug("Could not find application info block\n"); return -EACCES; } if (list_empty(&dev->app_info[i].app_sqlist) == 0) { - DEBUG("FT1000:ft1000_poll_dev:Message detected in slow queue\n"); + pr_debug("Message detected in slow queue\n"); return(POLLIN | POLLRDNORM | POLLPRI); } poll_wait(file, &dev->app_info[i].wait_dpram_msg, wait); - /* DEBUG("FT1000:ft1000_poll_dev:Polling for data from DSP\n"); */ + /* pr_debug("Polling for data from DSP\n"); */ return 0; } @@ -429,27 +426,25 @@ static long ft1000_ioctl(struct file *file, unsigned int command, unsigned short ledStat = 0; unsigned short conStat = 0; - /* DEBUG("ft1000_ioctl called\n"); */ - if (ft1000_flarion_cnt == 0) { - DEBUG("FT1000:ft1000_ioctl called when ft1000_flarion_cnt is zero\n"); + pr_debug("called with ft1000_flarion_cnt of zero\n"); return -EBADF; } - /* DEBUG("FT1000:ft1000_ioctl:command = 0x%x argument = 0x%8x\n", command, (u32)argument); */ + /* pr_debug("command = 0x%x argument = 0x%8x\n", command, (u32)argument); */ info = file->private_data; ft1000dev = info->priv; cmd = _IOC_NR(command); - /* DEBUG("FT1000:ft1000_ioctl:cmd = 0x%x\n", cmd); */ + /* pr_debug("cmd = 0x%x\n", cmd); */ /* process the command */ switch (cmd) { case IOCTL_REGISTER_CMD: - DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_REGISTER called\n"); + pr_debug("IOCTL_FT1000_REGISTER called\n"); result = get_user(tempword, (__u16 __user *)argp); if (result) { - DEBUG("result = %d failed to get_user\n", result); + pr_debug("result = %d failed to get_user\n", result); break; } if (tempword == DSPBCMSGID) { @@ -457,7 +452,7 @@ static long ft1000_ioctl(struct file *file, unsigned int command, for (i = 0; i < MAX_NUM_APP; i++) { if (ft1000dev->app_info[i].fileobject == &file->f_owner) { ft1000dev->app_info[i].DspBCMsgFlag = 1; - DEBUG("FT1000:ft1000_ioctl:Registered for broadcast messages\n"); + pr_debug("Registered for broadcast messages\n"); break; } } @@ -465,34 +460,35 @@ static long ft1000_ioctl(struct file *file, unsigned int command, break; case IOCTL_GET_VER_CMD: - DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_VER called\n"); + pr_debug("IOCTL_FT1000_GET_VER called\n"); get_ver_data.drv_ver = FT1000_DRV_VER; if (copy_to_user(argp, &get_ver_data, sizeof(get_ver_data))) { - DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n"); + pr_debug("copy fault occurred\n"); result = -EFAULT; break; } - DEBUG("FT1000:ft1000_ioctl:driver version = 0x%x\n", (unsigned int)get_ver_data.drv_ver); + pr_debug("driver version = 0x%x\n", + (unsigned int)get_ver_data.drv_ver); break; case IOCTL_CONNECT: /* Connect Message */ - DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_CONNECT\n"); + pr_debug("IOCTL_FT1000_CONNECT\n"); ConnectionMsg[79] = 0xfc; result = card_send_command(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c); break; case IOCTL_DISCONNECT: /* Disconnect Message */ - DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_DISCONNECT\n"); + pr_debug("IOCTL_FT1000_DISCONNECT\n"); ConnectionMsg[79] = 0xfd; result = card_send_command(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c); break; case IOCTL_GET_DSP_STAT_CMD: - /* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_DSP_STAT called\n"); */ + /* pr_debug("IOCTL_FT1000_GET_DSP_STAT\n"); */ memset(&get_stat_data, 0, sizeof(get_stat_data)); memcpy(get_stat_data.DspVer, info->DspVer, DSPVERSZ); memcpy(get_stat_data.HwSerNum, info->HwSerNum, HWSERNUMSZ); @@ -502,10 +498,10 @@ static long ft1000_ioctl(struct file *file, unsigned int command, if (info->ProgConStat != 0xFF) { ft1000_read_dpram16(ft1000dev, FT1000_MAG_DSP_LED, (u8 *)&ledStat, FT1000_MAG_DSP_LED_INDX); get_stat_data.LedStat = ntohs(ledStat); - DEBUG("FT1000:ft1000_ioctl: LedStat = 0x%x\n", get_stat_data.LedStat); + pr_debug("LedStat = 0x%x\n", get_stat_data.LedStat); ft1000_read_dpram16(ft1000dev, FT1000_MAG_DSP_CON_STATE, (u8 *)&conStat, FT1000_MAG_DSP_CON_STATE_INDX); get_stat_data.ConStat = ntohs(conStat); - DEBUG("FT1000:ft1000_ioctl: ConStat = 0x%x\n", get_stat_data.ConStat); + pr_debug("ConStat = 0x%x\n", get_stat_data.ConStat); } else { get_stat_data.ConStat = 0x0f; } @@ -517,13 +513,13 @@ static long ft1000_ioctl(struct file *file, unsigned int command, get_stat_data.nRxBytes = info->stats.rx_bytes; do_gettimeofday(&tv); get_stat_data.ConTm = (u32)(tv.tv_sec - info->ConTm); - DEBUG("Connection Time = %d\n", (int)get_stat_data.ConTm); + pr_debug("Connection Time = %d\n", (int)get_stat_data.ConTm); if (copy_to_user(argp, &get_stat_data, sizeof(get_stat_data))) { - DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n"); + pr_debug("copy fault occurred\n"); result = -EFAULT; break; } - DEBUG("ft1000_chioctl: GET_DSP_STAT succeed\n"); + pr_debug("GET_DSP_STAT succeed\n"); break; case IOCTL_SET_DPRAM_CMD: { @@ -537,7 +533,7 @@ static long ft1000_ioctl(struct file *file, unsigned int command, u16 app_index; u16 status; - /* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_SET_DPRAM called\n");*/ + /* pr_debug("IOCTL_FT1000_SET_DPRAM called\n");*/ if (ft1000_flarion_cnt == 0) @@ -553,17 +549,17 @@ static long ft1000_ioctl(struct file *file, unsigned int command, if (info->CardReady) { - /* DEBUG("FT1000:ft1000_ioctl: try to SET_DPRAM \n"); */ + /* pr_debug("try to SET_DPRAM\n"); */ /* Get the length field to see how many bytes to copy */ result = get_user(msgsz, (__u16 __user *)argp); if (result) break; msgsz = ntohs(msgsz); - /* DEBUG("FT1000:ft1000_ioctl: length of message = %d\n", msgsz); */ + /* pr_debug("length of message = %d\n", msgsz); */ if (msgsz > MAX_CMD_SQSIZE) { - DEBUG("FT1000:ft1000_ioctl: bad message length = %d\n", msgsz); + pr_debug("bad message length = %d\n", msgsz); result = -EINVAL; break; } @@ -574,7 +570,7 @@ static long ft1000_ioctl(struct file *file, unsigned int command, break; if (copy_from_user(dpram_data, argp, msgsz+2)) { - DEBUG("FT1000:ft1000_ChIoctl: copy fault occurred\n"); + pr_debug("copy fault occurred\n"); result = -EFAULT; } else { /* Check if this message came from a registered application */ @@ -584,7 +580,7 @@ static long ft1000_ioctl(struct file *file, unsigned int command, } } if (i == MAX_NUM_APP) { - DEBUG("FT1000:No matching application fileobject\n"); + pr_debug("No matching application fileobject\n"); result = -EINVAL; kfree(dpram_data); break; @@ -593,13 +589,13 @@ static long ft1000_ioctl(struct file *file, unsigned int command, /* Check message qtype type which is the lower byte within qos_class */ qtype = ntohs(dpram_data->pseudohdr.qos_class) & 0xff; - /* DEBUG("FT1000_ft1000_ioctl: qtype = %d\n", qtype); */ + /* pr_debug("qtype = %d\n", qtype); */ if (qtype) { } else { /* Put message into Slow Queue */ /* Only put a message into the DPRAM if msg doorbell is available */ status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL); - /* DEBUG("FT1000_ft1000_ioctl: READ REGISTER tempword=%x\n", tempword); */ + /* pr_debug("READ REGISTER tempword=%x\n", tempword); */ if (tempword & FT1000_DB_DPRAM_TX) { /* Suspend for 2ms and try again due to DSP doorbell busy */ mdelay(2); @@ -615,7 +611,7 @@ static long ft1000_ioctl(struct file *file, unsigned int command, mdelay(3); status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL); if (tempword & FT1000_DB_DPRAM_TX) { - DEBUG("FT1000:ft1000_ioctl:Doorbell not available\n"); + pr_debug("Doorbell not available\n"); result = -ENOTTY; kfree(dpram_data); break; @@ -625,7 +621,7 @@ static long ft1000_ioctl(struct file *file, unsigned int command, } } - /*DEBUG("FT1000_ft1000_ioctl: finished reading register\n"); */ + /*pr_debug("finished reading register\n"); */ /* Make sure we are within the limits of the slow queue memory limitation */ if ((msgsz < MAX_CMD_SQSIZE) && (msgsz > PSEUDOSZ)) { @@ -642,10 +638,10 @@ static long ft1000_ioctl(struct file *file, unsigned int command, ppseudo_hdr->portsrc = ft1000dev->app_info[app_index].app_id; /* Calculate new checksum */ ppseudo_hdr->checksum = *pmsg++; - /* DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum); */ + /* pr_debug("checksum = 0x%x\n", ppseudo_hdr->checksum); */ for (i = 1; i < 7; i++) { ppseudo_hdr->checksum ^= *pmsg++; - /* DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum); */ + /* pr_debug("checksum = 0x%x\n", ppseudo_hdr->checksum); */ } pmsg++; ppseudo_hdr = (struct pseudo_hdr *)pmsg; @@ -659,7 +655,7 @@ static long ft1000_ioctl(struct file *file, unsigned int command, } } } else { - DEBUG("FT1000:ft1000_ioctl: Card not ready take messages\n"); + pr_debug("Card not ready take messages\n"); result = -EACCES; } kfree(dpram_data); @@ -672,7 +668,7 @@ static long ft1000_ioctl(struct file *file, unsigned int command, struct IOCTL_DPRAM_BLK __user *pioctl_dpram; int msglen; - /* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_DPRAM called\n"); */ + /* pr_debug("IOCTL_FT1000_GET_DPRAM called\n"); */ if (ft1000_flarion_cnt == 0) return -EBADF; @@ -680,14 +676,14 @@ static long ft1000_ioctl(struct file *file, unsigned int command, /* Search for matching file object */ for (i = 0; i < MAX_NUM_APP; i++) { if (ft1000dev->app_info[i].fileobject == &file->f_owner) { - /*DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", ft1000dev->app_info[i].app_id); */ + /*pr_debug("Message is for AppId = %d\n", ft1000dev->app_info[i].app_id); */ break; } } /* Could not find application info block */ if (i == MAX_NUM_APP) { - DEBUG("FT1000:ft1000_ioctl:Could not find application info block\n"); + pr_debug("Could not find application info block\n"); result = -EBADF; break; } @@ -695,21 +691,21 @@ static long ft1000_ioctl(struct file *file, unsigned int command, result = 0; pioctl_dpram = argp; if (list_empty(&ft1000dev->app_info[i].app_sqlist) == 0) { - /* DEBUG("FT1000:ft1000_ioctl:Message detected in slow queue\n"); */ + /* pr_debug("Message detected in slow queue\n"); */ spin_lock_irqsave(&free_buff_lock, flags); pdpram_blk = list_entry(ft1000dev->app_info[i].app_sqlist.next, struct dpram_blk, list); list_del(&pdpram_blk->list); ft1000dev->app_info[i].NumOfMsg--; - /* DEBUG("FT1000:ft1000_ioctl:NumOfMsg for app %d = %d\n", i, ft1000dev->app_info[i].NumOfMsg); */ + /* pr_debug("NumOfMsg for app %d = %d\n", i, ft1000dev->app_info[i].NumOfMsg); */ spin_unlock_irqrestore(&free_buff_lock, flags); msglen = ntohs(*(u16 *)pdpram_blk->pbuffer) + PSEUDOSZ; result = get_user(msglen, &pioctl_dpram->total_len); if (result) break; msglen = htons(msglen); - /* DEBUG("FT1000:ft1000_ioctl:msg length = %x\n", msglen); */ + /* pr_debug("msg length = %x\n", msglen); */ if (copy_to_user(&pioctl_dpram->pseudohdr, pdpram_blk->pbuffer, msglen)) { - DEBUG("FT1000:ft1000_ioctl: copy fault occurred\n"); + pr_debug("copy fault occurred\n"); result = -EFAULT; break; } @@ -717,12 +713,12 @@ static long ft1000_ioctl(struct file *file, unsigned int command, ft1000_free_buffer(pdpram_blk, &freercvpool); result = msglen; } - /* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_DPRAM no message\n"); */ + /* pr_debug("IOCTL_FT1000_GET_DPRAM no message\n"); */ } break; default: - DEBUG("FT1000:ft1000_ioctl:unknown command: 0x%x\n", command); + pr_debug("unknown command: 0x%x\n", command); result = -ENOTTY; break; } @@ -750,8 +746,6 @@ static int ft1000_release(struct inode *inode, struct file *file) int i; struct dpram_blk *pdpram_blk; - DEBUG("ft1000_release called\n"); - dev = file->private_data; info = netdev_priv(dev); ft1000dev = info->priv; @@ -764,7 +758,7 @@ static int ft1000_release(struct inode *inode, struct file *file) /* Search for matching file object */ for (i = 0; i < MAX_NUM_APP; i++) { if (ft1000dev->app_info[i].fileobject == &file->f_owner) { - /* DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", ft1000dev->app_info[i].app_id); */ + /* pr_debug("Message is for AppId = %d\n", ft1000dev->app_info[i].app_id); */ break; } } @@ -773,7 +767,7 @@ static int ft1000_release(struct inode *inode, struct file *file) return 0; while (list_empty(&ft1000dev->app_info[i].app_sqlist) == 0) { - DEBUG("Remove and free memory queue up on slow queue\n"); + pr_debug("Remove and free memory queue up on slow queue\n"); pdpram_blk = list_entry(ft1000dev->app_info[i].app_sqlist.next, struct dpram_blk, list); list_del(&pdpram_blk->list); ft1000_free_buffer(pdpram_blk, &freercvpool); @@ -781,7 +775,7 @@ static int ft1000_release(struct inode *inode, struct file *file) /* initialize application information */ ft1000dev->appcnt--; - DEBUG("ft1000_chdev:%s:appcnt = %d\n", __func__, ft1000dev->appcnt); + pr_debug("appcnt = %d\n", ft1000dev->appcnt); ft1000dev->app_info[i].fileobject = NULL; return 0; |