Staging: bcm: Bcmchar: Fix style issues on bcm_char_read()
Signed-off-by: Javier Martinez Canillas <martinez.javier@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
a7d3976edc
commit
7227ba0647
@ -96,59 +96,63 @@ static int bcm_char_release(struct inode *inode, struct file *filp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t bcm_char_read(struct file *filp, char __user *buf, size_t size, loff_t *f_pos)
|
static ssize_t bcm_char_read(struct file *filp, char __user *buf, size_t size,
|
||||||
|
loff_t *f_pos)
|
||||||
{
|
{
|
||||||
PPER_TARANG_DATA pTarang = filp->private_data;
|
PPER_TARANG_DATA pTarang = filp->private_data;
|
||||||
PMINI_ADAPTER Adapter = pTarang->Adapter;
|
PMINI_ADAPTER Adapter = pTarang->Adapter;
|
||||||
struct sk_buff* Packet = NULL;
|
struct sk_buff *Packet = NULL;
|
||||||
ssize_t PktLen = 0;
|
ssize_t PktLen = 0;
|
||||||
int wait_ret_val=0;
|
int wait_ret_val = 0;
|
||||||
|
unsigned long ret = 0;
|
||||||
|
|
||||||
wait_ret_val = wait_event_interruptible(Adapter->process_read_wait_queue,
|
wait_ret_val = wait_event_interruptible(Adapter->process_read_wait_queue,
|
||||||
(pTarang->RxAppControlHead || Adapter->device_removed));
|
(pTarang->RxAppControlHead ||
|
||||||
if((wait_ret_val == -ERESTARTSYS))
|
Adapter->device_removed));
|
||||||
{
|
if ((wait_ret_val == -ERESTARTSYS)) {
|
||||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Exiting as i've been asked to exit!!!\n");
|
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
|
||||||
|
"Exiting as i've been asked to exit!!!\n");
|
||||||
return wait_ret_val;
|
return wait_ret_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Adapter->device_removed)
|
if (Adapter->device_removed) {
|
||||||
{
|
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
|
||||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Device Removed... Killing the Apps...\n");
|
"Device Removed... Killing the Apps...\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(FALSE == Adapter->fw_download_done)
|
if (FALSE == Adapter->fw_download_done)
|
||||||
return -EACCES;
|
return -EACCES;
|
||||||
|
|
||||||
down( &Adapter->RxAppControlQueuelock);
|
down(&Adapter->RxAppControlQueuelock);
|
||||||
|
|
||||||
if(pTarang->RxAppControlHead)
|
if (pTarang->RxAppControlHead) {
|
||||||
{
|
|
||||||
Packet = pTarang->RxAppControlHead;
|
Packet = pTarang->RxAppControlHead;
|
||||||
DEQUEUEPACKET(pTarang->RxAppControlHead,pTarang->RxAppControlTail);
|
DEQUEUEPACKET(pTarang->RxAppControlHead,
|
||||||
|
pTarang->RxAppControlTail);
|
||||||
pTarang->AppCtrlQueueLen--;
|
pTarang->AppCtrlQueueLen--;
|
||||||
}
|
}
|
||||||
|
|
||||||
up(&Adapter->RxAppControlQueuelock);
|
up(&Adapter->RxAppControlQueuelock);
|
||||||
|
|
||||||
if(Packet)
|
if (Packet) {
|
||||||
{
|
|
||||||
PktLen = Packet->len;
|
PktLen = Packet->len;
|
||||||
if(copy_to_user(buf, Packet->data, min_t(size_t, PktLen, size)))
|
ret = copy_to_user(buf, Packet->data,
|
||||||
{
|
min_t(size_t, PktLen, size));
|
||||||
|
if (ret) {
|
||||||
dev_kfree_skb(Packet);
|
dev_kfree_skb(Packet);
|
||||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "\nReturning from copy to user failure \n");
|
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
|
||||||
|
"Returning from copy to user failure\n");
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
|
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
|
||||||
"Read %zd Bytes From Adapter packet = %p by process %d!\n",
|
"Read %zd Bytes From Adapter packet = %p by process %d!\n",
|
||||||
PktLen, Packet, current->pid);
|
PktLen, Packet, current->pid);
|
||||||
dev_kfree_skb(Packet);
|
dev_kfree_skb(Packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "<====\n");
|
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "<\n");
|
||||||
return PktLen;
|
return PktLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
||||||
|
Loading…
Reference in New Issue
Block a user