Commit 1c55e381 authored by Dave Jones's avatar Dave Jones Committed by Greg Kroah-Hartman

staging/bcm: move IOCTL_BCM_GET_NVM_SIZE case out to its own function.

bcm_char_ioctl is one of the longest non-generated functions in the kernel,
at 1906 lines.  Splitting it up into multiple functions should simplify
this a lot.
Signed-off-by: default avatarDave Jones <davej@fedoraproject.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b32384b4
...@@ -1197,6 +1197,20 @@ static int bcm_char_ioctl_bulk_wrm(void __user *argp, struct bcm_mini_adapter *A ...@@ -1197,6 +1197,20 @@ static int bcm_char_ioctl_bulk_wrm(void __user *argp, struct bcm_mini_adapter *A
return Status; return Status;
} }
static int bcm_char_ioctl_get_nvm_size(void __user *argp, struct bcm_mini_adapter *Adapter)
{
struct bcm_ioctl_buffer IoBuffer;
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;
if (Adapter->eNVMType == NVM_EEPROM || Adapter->eNVMType == NVM_FLASH) {
if (copy_to_user(IoBuffer.OutputBuffer, &Adapter->uiNVMDSDSize, sizeof(UINT)))
return -EFAULT;
}
return STATUS_SUCCESS;
}
static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
{ {
...@@ -1378,16 +1392,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) ...@@ -1378,16 +1392,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
return Status; return Status;
case IOCTL_BCM_GET_NVM_SIZE: case IOCTL_BCM_GET_NVM_SIZE:
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer))) Status = bcm_char_ioctl_get_nvm_size(argp, Adapter);
return -EFAULT; return Status;
if (Adapter->eNVMType == NVM_EEPROM || Adapter->eNVMType == NVM_FLASH) {
if (copy_to_user(IoBuffer.OutputBuffer, &Adapter->uiNVMDSDSize, sizeof(UINT)))
return -EFAULT;
}
Status = STATUS_SUCCESS;
break;
case IOCTL_BCM_CAL_INIT: { case IOCTL_BCM_CAL_INIT: {
UINT uiSectorSize = 0; UINT uiSectorSize = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment