Skip to content

Commit

Permalink
Staging: bcm: Remove typedef for ioctlbuffer and call directly.
Browse files Browse the repository at this point in the history
This patch removes typedef for ioctlbuffer, and
changes the name of the struct to bcm_ioctl_buffer.
In addition, any calls to typedefs IOCTL_BUFFER, or
*PIOCTL_BUFFER are changed to call the struct
directly.

Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Kevin McKinney authored and Greg Kroah-Hartman committed Nov 27, 2012
1 parent d532703 commit bac02ed
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 39 deletions.
66 changes: 33 additions & 33 deletions drivers/staging/bcm/Bcmchar.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
struct bcm_mini_adapter *Adapter = pTarang->Adapter;
INT Status = STATUS_FAILURE;
int timeout = 0;
IOCTL_BUFFER IoBuffer;
struct bcm_ioctl_buffer IoBuffer;
int bytes;

BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Parameters Passed to control IOCTL cmd=0x%X arg=0x%lX", cmd, arg);
Expand Down Expand Up @@ -209,7 +209,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
u16 temp_value;

/* Copy Ioctl Buffer structure */
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

if (IoBuffer.InputLength > sizeof(sRdmBuffer))
Expand Down Expand Up @@ -252,7 +252,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
UINT uiTempVar = 0;
/* Copy Ioctl Buffer structure */

if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

if (IoBuffer.InputLength > sizeof(sWrmBuffer))
Expand Down Expand Up @@ -299,7 +299,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
}

/* Copy Ioctl Buffer structure */
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

if (IoBuffer.InputLength > sizeof(sRdmBuffer))
Expand Down Expand Up @@ -356,7 +356,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
}

/* Copy Ioctl Buffer structure */
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

if (IoBuffer.InputLength > sizeof(sWrmBuffer))
Expand Down Expand Up @@ -411,7 +411,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
return -EACCES;
}

if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

if (IoBuffer.InputLength > sizeof(gpio_info))
Expand Down Expand Up @@ -490,7 +490,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
break;
}

if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

if (IoBuffer.InputLength > sizeof(threadReq))
Expand Down Expand Up @@ -525,7 +525,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
(Adapter->bPreparingForLowPowerMode == TRUE))
return -EACCES;

if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

if (IoBuffer.InputLength > sizeof(gpio_info))
Expand Down Expand Up @@ -562,7 +562,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
(Adapter->bPreparingForLowPowerMode == TRUE))
return -EINVAL;

if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

if (IoBuffer.InputLength > sizeof(gpio_multi_info))
Expand Down Expand Up @@ -644,7 +644,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
(Adapter->bPreparingForLowPowerMode == TRUE))
return -EINVAL;

if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

if (IoBuffer.InputLength > sizeof(gpio_multi_mode))
Expand Down Expand Up @@ -719,7 +719,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
PVOID pvBuffer = NULL;

/* Copy Ioctl Buffer structure */
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

if (IoBuffer.InputLength < sizeof(struct bcm_link_request))
Expand Down Expand Up @@ -799,7 +799,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
}

/* Copy Ioctl Buffer structure */
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER))) {
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer))) {
up(&Adapter->fw_download_sema);
return -EFAULT;
}
Expand Down Expand Up @@ -1000,7 +1000,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
ulong len;

/* Copy Ioctl Buffer structure */
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

len = min_t(ulong, IoBuffer.OutputLength, strlen(VER_FILEVERSION_STR) + 1);
Expand All @@ -1015,7 +1015,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
LINK_STATE link_state;

/* Copy Ioctl Buffer structure */
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER))) {
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer))) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "copy_from_user failed..\n");
return -EFAULT;
}
Expand All @@ -1042,7 +1042,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
UINT tracing_flag;

/* copy ioctl Buffer structure */
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

if (copy_from_user(&tracing_flag, IoBuffer.InputBuffer, sizeof(UINT)))
Expand All @@ -1057,7 +1057,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)

case IOCTL_BCM_GET_DSX_INDICATION: {
ULONG ulSFId = 0;
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

if (IoBuffer.OutputLength < sizeof(struct bcm_add_indication_alt)) {
Expand All @@ -1079,7 +1079,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
case IOCTL_BCM_GET_HOST_MIBS: {
PVOID temp_buff;

if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

if (IoBuffer.OutputLength != sizeof(S_MIBS_HOST_STATS_MIBS)) {
Expand Down Expand Up @@ -1132,7 +1132,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
}

/* Copy Ioctl Buffer structure */
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

if (IoBuffer.InputLength < sizeof(ULONG) * 2)
Expand Down Expand Up @@ -1180,7 +1180,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
}

case IOCTL_BCM_GET_NVM_SIZE:
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

if (Adapter->eNVMType == NVM_EEPROM || Adapter->eNVMType == NVM_FLASH) {
Expand All @@ -1194,7 +1194,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
case IOCTL_BCM_CAL_INIT: {
UINT uiSectorSize = 0 ;
if (Adapter->eNVMType == NVM_FLASH) {
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

if (copy_from_user(&uiSectorSize, IoBuffer.InputBuffer, sizeof(UINT)))
Expand Down Expand Up @@ -1231,7 +1231,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
USER_BCM_DBG_STATE sUserDebugState;

BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "In SET_DEBUG ioctl\n");
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

if (copy_from_user(&sUserDebugState, IoBuffer.InputBuffer, sizeof(USER_BCM_DBG_STATE)))
Expand Down Expand Up @@ -1284,7 +1284,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
}

/* Copy Ioctl Buffer structure */
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

if (copy_from_user(&stNVMReadWrite,
Expand Down Expand Up @@ -1418,7 +1418,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
}

BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "IOCTL_BCM_FLASH2X_SECTION_READ Called");
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

/* Reading FLASH 2.x READ structure */
Expand Down Expand Up @@ -1513,7 +1513,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)

BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "IOCTL_BCM_FLASH2X_SECTION_WRITE Called");

if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

/* Reading FLASH 2.x READ structure */
Expand Down Expand Up @@ -1607,7 +1607,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
struct bcm_flash2x_bitmap *psFlash2xBitMap;
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "IOCTL_BCM_GET_FLASH2X_SECTION_BITMAP Called");

if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

if (IoBuffer.OutputLength != sizeof(struct bcm_flash2x_bitmap))
Expand Down Expand Up @@ -1652,7 +1652,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
return -EINVAL;
}

Status = copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER));
Status = copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer));
if (Status) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy of IOCTL BUFFER failed");
return -EFAULT;
Expand Down Expand Up @@ -1702,7 +1702,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
return -EINVAL;
}

Status = copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER));
Status = copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer));
if (Status) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy of IOCTL BUFFER failed Status :%d", Status);
return -EFAULT;
Expand Down Expand Up @@ -1769,7 +1769,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
Status = STATUS_SUCCESS;
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, " IOCTL_BCM_GET_FLASH_CS_INFO Called");

Status = copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER));
Status = copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer));
if (Status) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy of IOCTL BUFFER failed");
return -EFAULT;
Expand Down Expand Up @@ -1808,7 +1808,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
return -EINVAL;
}

Status = copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER));
Status = copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer));
if (Status) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy of IOCTL BUFFER failed");
return -EFAULT;
Expand Down Expand Up @@ -1856,7 +1856,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
}

/* Copy Ioctl Buffer structure */
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER))) {
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer))) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "copy_from_user 1 failed\n");
return -EFAULT;
}
Expand Down Expand Up @@ -1933,7 +1933,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
ULONG RxCntrlMsgBitMask = 0;

/* Copy Ioctl Buffer structure */
Status = copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER));
Status = copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer));
if (Status) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "copy of Ioctl buffer is failed from user space");
return -EFAULT;
Expand Down Expand Up @@ -1965,7 +1965,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
DevInfo.u32NVMType = Adapter->eNVMType;
DevInfo.u32InterfaceType = BCM_USB;

if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

if (IoBuffer.OutputLength < sizeof(DevInfo))
Expand All @@ -1981,7 +1981,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)

BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "IOCTL_BCM_TIME_SINCE_NET_ENTRY called");

if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;

if (IoBuffer.OutputLength < sizeof(struct bcm_time_elapsed))
Expand Down
12 changes: 6 additions & 6 deletions drivers/staging/bcm/Ioctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ typedef struct wrmbuffer {
unsigned char Data[4];
} __packed WRM_BUFFER, *PWRM_BUFFER;

typedef struct ioctlbuffer {
struct bcm_ioctl_buffer {
void __user *InputBuffer;
unsigned long InputLength;
void __user *OutputBuffer;
unsigned long OutputLength;
} __packed IOCTL_BUFFER, *PIOCTL_BUFFER;
} __packed;

typedef struct stGPIOInfo {
unsigned int uiGpioNumber; /* valid numbers 0-15 */
Expand Down Expand Up @@ -53,7 +53,7 @@ struct bcm_user_thread_req {
#define IOCTL_CLASSIFICATION_RULE _IOW(BCM_IOCTL, 0x813, char)
#define IOCTL_CLOSE_NOTIFICATION _IO(BCM_IOCTL, 0x814)
#define IOCTL_LINK_UP _IO(BCM_IOCTL, 0x815)
#define IOCTL_LINK_DOWN _IO(BCM_IOCTL, 0x816, IOCTL_BUFFER)
#define IOCTL_LINK_DOWN _IO(BCM_IOCTL, 0x816, struct bcm_ioctl_buffer)
#define IOCTL_CHIP_RESET _IO(BCM_IOCTL, 0x816)
#define IOCTL_CINR_LEVEL_REQ _IOW(BCM_IOCTL, 0x817, char)
#define IOCTL_WTM_CONTROL_REQ _IOW(BCM_IOCTL, 0x817, char)
Expand All @@ -72,7 +72,7 @@ struct bcm_user_thread_req {
#define IOCTL_BCM_BUFFER_DOWNLOAD_STOP _IOW(BCM_IOCTL, 0x857, int)
#define IOCTL_BCM_REGISTER_WRITE_PRIVATE _IOW(BCM_IOCTL, 0x826, char)
#define IOCTL_BCM_REGISTER_READ_PRIVATE _IOW(BCM_IOCTL, 0x827, char)
#define IOCTL_BCM_SET_DEBUG _IOW(BCM_IOCTL, 0x824, IOCTL_BUFFER)
#define IOCTL_BCM_SET_DEBUG _IOW(BCM_IOCTL, 0x824, struct bcm_ioctl_buffer)
#define IOCTL_BCM_EEPROM_REGISTER_WRITE _IOW(BCM_IOCTL, 0x858, int)
#define IOCTL_BCM_EEPROM_REGISTER_READ _IOR(BCM_IOCTL, 0x859, int)
#define IOCTL_BCM_WAKE_UP_DEVICE_FROM_IDLE _IOR(BCM_IOCTL, 0x860, int)
Expand All @@ -96,8 +96,8 @@ struct bcm_user_thread_req {
#define IOCTL_BCM_GET_DEVICE_DRIVER_INFO _IOR(BCM_IOCTL, 0x877, int)
#define IOCTL_BCM_TIME_SINCE_NET_ENTRY _IOR(BCM_IOCTL, 0x876, int)
#define BCM_LED_THREAD_STATE_CHANGE_REQ _IOW(BCM_IOCTL, 0x878, int)
#define IOCTL_BCM_GPIO_MULTI_REQUEST _IOW(BCM_IOCTL, 0x82D, IOCTL_BUFFER)
#define IOCTL_BCM_GPIO_MODE_REQUEST _IOW(BCM_IOCTL, 0x82E, IOCTL_BUFFER)
#define IOCTL_BCM_GPIO_MULTI_REQUEST _IOW(BCM_IOCTL, 0x82D, struct bcm_ioctl_buffer)
#define IOCTL_BCM_GPIO_MODE_REQUEST _IOW(BCM_IOCTL, 0x82E, struct bcm_ioctl_buffer)

enum bcm_interface_type {
BCM_MII,
Expand Down

0 comments on commit bac02ed

Please sign in to comment.