diff options
author | Dave Jones <davej@redhat.com> | 2014-02-13 14:46:57 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-13 13:10:10 -0800 |
commit | 1c55e38104fdb9b60efb1db13f82f120b86e55eb (patch) | |
tree | 162d1a7d68b83fa8b8f811eceb9f52085df43a39 /drivers/staging/bcm | |
parent | b32384b43d12a72ffd1493c8f60803d023b96726 (diff) |
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: Dave Jones <davej@fedoraproject.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/bcm')
-rw-r--r-- | drivers/staging/bcm/Bcmchar.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index e67e73ae3072..064fc5173dc5 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -1197,6 +1197,20 @@ static int bcm_char_ioctl_bulk_wrm(void __user *argp, struct bcm_mini_adapter *A 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) { @@ -1378,16 +1392,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) return Status; case IOCTL_BCM_GET_NVM_SIZE: - 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; - } - - Status = STATUS_SUCCESS; - break; + Status = bcm_char_ioctl_get_nvm_size(argp, Adapter); + return Status; case IOCTL_BCM_CAL_INIT: { UINT uiSectorSize = 0; |