From 547b5b2256a6d32ffb7f4f87af38f3dda207e694 Mon Sep 17 00:00:00 2001 From: Kelley Nielsen Date: Wed, 30 Oct 2013 11:48:34 -0700 Subject: [PATCH 001/238] staging: ft1000: STATUS_ defines removed from ft1000_download.c Two files in the ft1000 usb driver ignore expected Linux error codes, and instead use two STATUS_SUCCESS 0, and STATUS_FAILURE 0x1001. This patch removes all remaining occurrences of these from the file ft1000_download.c. All occurrences of STATUS_SUCCESS have been replaced by 0, and occurrences of STATUS_FAILURE have been replaced by -1. One occurence of STATUS_FAILURE has been completely removed: get_handshake collects either a local #define or 0 from its helper function, check_usb_db, and immediately sets the collecting variable to STATUS_FAILURE if the #define is returned. check_usb_db has been modified to return -1 instead of the #define. Signed-off-by: Kelley Nielsen Suggested-by: Greg Kroah-Hartman Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- .../ft1000/ft1000-usb/ft1000_download.c | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c index 68ded17c0f5c..b2643b780971 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c @@ -151,7 +151,7 @@ static int check_usb_db(struct ft1000_usb *ft1000dev) } } - return HANDSHAKE_MAG_TIMEOUT_VALUE; + return -1; } /* gets the handshake and compares it with the expected value */ @@ -172,9 +172,8 @@ static u16 get_handshake(struct ft1000_usb *ft1000dev, u16 expected_value) ft1000dev->fcodeldr); ft1000dev->fcodeldr = 0; status = check_usb_db(ft1000dev); - if (status != STATUS_SUCCESS) { + if (status != 0) { DEBUG("get_handshake: check_usb_db failed\n"); - status = STATUS_FAILURE; break; } status = ft1000_write_register(ft1000dev, @@ -450,7 +449,7 @@ static int write_dpram32_and_check(struct ft1000_usb *ft1000dev, static int write_blk(struct ft1000_usb *ft1000dev, u16 **pUsFile, u8 **pUcFile, long word_length) { - int status = STATUS_SUCCESS; + int status = 0; u16 dpram; int loopcnt, i; u16 tempword; @@ -499,7 +498,7 @@ static int write_blk(struct ft1000_usb *ft1000dev, u16 **pUsFile, u8 **pUcFile, } else { status = write_dpram32_and_check(ft1000dev, tempbuffer, dpram); - if (status != STATUS_SUCCESS) { + if (status != 0) { DEBUG("FT1000:download:Write failed tempbuffer[31] = 0x%x\n", tempbuffer[31]); break; } @@ -523,7 +522,7 @@ static void usb_dnld_complete (struct urb *urb) static int write_blk_fifo(struct ft1000_usb *ft1000dev, u16 **pUsFile, u8 **pUcFile, long word_length) { - int Status = STATUS_SUCCESS; + int Status = 0; int byte_length; byte_length = word_length * 4; @@ -586,12 +585,12 @@ static int request_code_segment(struct ft1000_usb *ft1000dev, u16 **s_file, /*NdisMSleep (100); */ if (word_length > MAX_LENGTH) { DEBUG("FT1000:download:Download error: Max length exceeded\n"); - return STATUS_FAILURE; + return -1; } if ((word_length * 2 + (long)c_file) > (long)endpoint) { /* Error, beyond boot code range.*/ DEBUG("FT1000:download:Download error: Requested len=%d exceeds BOOT code boundary.\n", (int)word_length); - return STATUS_FAILURE; + return -1; } if (word_length & 0x1) word_length++; @@ -615,7 +614,7 @@ static int request_code_segment(struct ft1000_usb *ft1000dev, u16 **s_file, int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, u32 FileLength) { - int status = STATUS_SUCCESS; + int status = 0; u32 state; u16 handshake; struct pseudo_hdr *pseudo_header; @@ -670,7 +669,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, loader_code_size = file_hdr->loader_code_size; correct_version = false; - while ((status == STATUS_SUCCESS) && (state != STATE_DONE_FILE)) { + while ((status == 0) && (state != STATE_DONE_FILE)) { switch (state) { case STATE_START_DWNLD: status = scram_start_dwnld(ft1000dev, &handshake, @@ -717,7 +716,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, DEBUG ("FT1000:download:Download error: Bad request type=%d in BOOT download state.\n", request); - status = STATUS_FAILURE; + status = -1; break; } if (ft1000dev->usbboot) @@ -729,7 +728,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, } else { DEBUG ("FT1000:download:Download error: Handshake failed\n"); - status = STATUS_FAILURE; + status = -1; } break; @@ -773,7 +772,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, } else { DEBUG ("FT1000:download:Download error: Got Run address request before image offset request.\n"); - status = STATUS_FAILURE; + status = -1; break; } break; @@ -789,7 +788,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, } else { DEBUG ("FT1000:download:Download error: Got Size request before image offset request.\n"); - status = STATUS_FAILURE; + status = -1; break; } break; @@ -809,7 +808,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, if (!correct_version) { DEBUG ("FT1000:download:Download error: Got Code Segment request before image offset request.\n"); - status = STATUS_FAILURE; + status = -1; break; } @@ -948,7 +947,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, DEBUG ("FT1000:download:Download error: Bad Version Request = 0x%x.\n", (int)requested_version); - status = STATUS_FAILURE; + status = -1; break; } break; @@ -957,7 +956,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, DEBUG ("FT1000:download:Download error: Bad request type=%d in CODE download state.\n", request); - status = STATUS_FAILURE; + status = -1; break; } if (ft1000dev->usbboot) @@ -969,7 +968,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, } else { DEBUG ("FT1000:download:Download error: Handshake failed\n"); - status = STATUS_FAILURE; + status = -1; } break; @@ -1026,14 +1025,14 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, } } else { kfree(pbuffer); - status = STATUS_FAILURE; + status = -1; } } else { - status = STATUS_FAILURE; + status = -1; } } else { /* Checksum did not compute */ - status = STATUS_FAILURE; + status = -1; } DEBUG ("ft1000:download: after STATE_SECTION_PROV, state = %d, status= %d\n", @@ -1046,11 +1045,11 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, break; default: - status = STATUS_FAILURE; + status = -1; break; } /* End Switch */ - if (status != STATUS_SUCCESS) + if (status != 0) break; /**** From da3ab48bb8357729a780d63d5d5b8983fc91b769 Mon Sep 17 00:00:00 2001 From: Kelley Nielsen Date: Wed, 30 Oct 2013 18:04:41 -0700 Subject: [PATCH 002/238] staging: ft1000: remove formal function headers from ft1000_hw.c The file ft1000_hw.c contains formal C99 style function headers that waste space and convey little to no useful information. This patch converts the headers to either one line standard /* */ style comments or shorter standard style headers with parameter lists (if the parameter list seemed helpful), or eliminates them entirely. Besides needing to be made of its own accord, this change is in preparation to eliminate the nonstandard STATUS_* #defines from the driver since they were cited in most of the headers. Signed-off-by: Kelley Nielsen Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 422 +++--------------- 1 file changed, 56 insertions(+), 366 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c index 0d4931b2c2e2..73b0c4fa59eb 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c @@ -1,11 +1,9 @@ -//===================================================== -// CopyRight (C) 2007 Qualcomm Inc. All Rights Reserved. -// -// -// This file is part of Express Card USB Driver -// -// $Id: -//==================================================== +/* CopyRight (C) 2007 Qualcomm Inc. All Rights Reserved. +* +* +* This file is part of Express Card USB Driver +*/ + #include #include #include @@ -35,27 +33,17 @@ static u8 tempbuffer[1600]; #define MAX_RCV_LOOP 100 -//--------------------------------------------------------------------------- -// Function: ft1000_control -// -// Parameters: ft1000_usb - device structure -// pipe - usb control message pipe -// request - control request -// requesttype - control message request type -// value - value to be written or 0 -// index - register index -// data - data buffer to hold the read/write values -// size - data size -// timeout - control message time out value -// -// Returns: STATUS_SUCCESS - success -// STATUS_FAILURE - failure -// -// Description: This function sends a control message via USB interface synchronously -// -// Notes: -// -//--------------------------------------------------------------------------- +/* send a control message via USB interface synchronously +* Parameters: ft1000_usb - device structure +* pipe - usb control message pipe +* request - control request +* requesttype - control message request type +* value - value to be written or 0 +* index - register index +* data - data buffer to hold the read/write values +* size - data size +* timeout - control message time out value +*/ static int ft1000_control(struct ft1000_usb *ft1000dev, unsigned int pipe, u8 request, u8 requesttype, u16 value, u16 index, void *data, u16 size, int timeout) @@ -76,22 +64,7 @@ static int ft1000_control(struct ft1000_usb *ft1000dev, unsigned int pipe, return ret; } -//--------------------------------------------------------------------------- -// Function: ft1000_read_register -// -// Parameters: ft1000_usb - device structure -// Data - data buffer to hold the value read -// nRegIndex - register index -// -// Returns: STATUS_SUCCESS - success -// STATUS_FAILURE - failure -// -// Description: This function returns the value in a register -// -// Notes: -// -//--------------------------------------------------------------------------- - +/* returns the value in a register */ int ft1000_read_register(struct ft1000_usb *ft1000dev, u16* Data, u16 nRegIndx) { @@ -110,21 +83,7 @@ int ft1000_read_register(struct ft1000_usb *ft1000dev, u16* Data, return ret; } -//--------------------------------------------------------------------------- -// Function: ft1000_write_register -// -// Parameters: ft1000_usb - device structure -// value - value to write into a register -// nRegIndex - register index -// -// Returns: STATUS_SUCCESS - success -// STATUS_FAILURE - failure -// -// Description: This function writes the value in a register -// -// Notes: -// -//--------------------------------------------------------------------------- +/* writes the value in a register */ int ft1000_write_register(struct ft1000_usb *ft1000dev, u16 value, u16 nRegIndx) { @@ -143,23 +102,7 @@ int ft1000_write_register(struct ft1000_usb *ft1000dev, u16 value, return ret; } -//--------------------------------------------------------------------------- -// Function: ft1000_read_dpram32 -// -// Parameters: ft1000_usb - device structure -// indx - starting address to read -// buffer - data buffer to hold the data read -// cnt - number of byte read from DPRAM -// -// Returns: STATUS_SUCCESS - success -// STATUS_FAILURE - failure -// -// Description: This function read a number of bytes from DPRAM -// -// Notes: -// -//--------------------------------------------------------------------------- - +/* read a number of bytes from DPRAM */ int ft1000_read_dpram32(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer, u16 cnt) { @@ -178,22 +121,7 @@ int ft1000_read_dpram32(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer, return ret; } -//--------------------------------------------------------------------------- -// Function: ft1000_write_dpram32 -// -// Parameters: ft1000_usb - device structure -// indx - starting address to write the data -// buffer - data buffer to write into DPRAM -// cnt - number of bytes to write -// -// Returns: STATUS_SUCCESS - success -// STATUS_FAILURE - failure -// -// Description: This function writes into DPRAM a number of bytes -// -// Notes: -// -//--------------------------------------------------------------------------- +/* writes into DPRAM a number of bytes */ int ft1000_write_dpram32(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer, u16 cnt) { @@ -215,22 +143,7 @@ int ft1000_write_dpram32(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer, return ret; } -//--------------------------------------------------------------------------- -// Function: ft1000_read_dpram16 -// -// Parameters: ft1000_usb - device structure -// indx - starting address to read -// buffer - data buffer to hold the data read -// hightlow - high or low 16 bit word -// -// Returns: STATUS_SUCCESS - success -// STATUS_FAILURE - failure -// -// Description: This function read 16 bits from DPRAM -// -// Notes: -// -//--------------------------------------------------------------------------- +/* read 16 bits from DPRAM */ int ft1000_read_dpram16(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer, u8 highlow) { @@ -255,22 +168,7 @@ int ft1000_read_dpram16(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer, return ret; } -//--------------------------------------------------------------------------- -// Function: ft1000_write_dpram16 -// -// Parameters: ft1000_usb - device structure -// indx - starting address to write the data -// value - 16bits value to write -// hightlow - high or low 16 bit word -// -// Returns: STATUS_SUCCESS - success -// STATUS_FAILURE - failure -// -// Description: This function writes into DPRAM a number of bytes -// -// Notes: -// -//--------------------------------------------------------------------------- +/* write into DPRAM a number of bytes */ int ft1000_write_dpram16(struct ft1000_usb *ft1000dev, u16 indx, u16 value, u8 highlow) { int ret = STATUS_SUCCESS; @@ -294,22 +192,7 @@ int ft1000_write_dpram16(struct ft1000_usb *ft1000dev, u16 indx, u16 value, u8 h return ret; } -//--------------------------------------------------------------------------- -// Function: fix_ft1000_read_dpram32 -// -// Parameters: ft1000_usb - device structure -// indx - starting address to read -// buffer - data buffer to hold the data read -// -// -// Returns: STATUS_SUCCESS - success -// STATUS_FAILURE - failure -// -// Description: This function read DPRAM 4 words at a time -// -// Notes: -// -//--------------------------------------------------------------------------- +/* read DPRAM 4 words at a time */ int fix_ft1000_read_dpram32(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer) { @@ -338,22 +221,7 @@ int fix_ft1000_read_dpram32(struct ft1000_usb *ft1000dev, u16 indx, } -//--------------------------------------------------------------------------- -// Function: fix_ft1000_write_dpram32 -// -// Parameters: ft1000_usb - device structure -// indx - starting address to write -// buffer - data buffer to write -// -// -// Returns: STATUS_SUCCESS - success -// STATUS_FAILURE - failure -// -// Description: This function write to DPRAM 4 words at a time -// -// Notes: -// -//--------------------------------------------------------------------------- +/* Description: This function write to DPRAM 4 words at a time */ int fix_ft1000_write_dpram32(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer) { u16 pos1; @@ -410,17 +278,7 @@ int fix_ft1000_write_dpram32(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer) return ret; } - -//------------------------------------------------------------------------ -// -// Function: card_reset_dsp -// -// Synopsis: This function is called to reset or activate the DSP -// -// Arguments: value - reset or activate -// -// Returns: None -//----------------------------------------------------------------------- +/* reset or activate the DSP */ static void card_reset_dsp(struct ft1000_usb *ft1000dev, bool value) { u16 status = STATUS_SUCCESS; @@ -457,21 +315,11 @@ static void card_reset_dsp(struct ft1000_usb *ft1000dev, bool value) } } -//--------------------------------------------------------------------------- -// Function: card_send_command -// -// Parameters: ft1000_usb - device structure -// ptempbuffer - command buffer -// size - command buffer size -// -// Returns: STATUS_SUCCESS - success -// STATUS_FAILURE - failure -// -// Description: This function sends a command to ASIC -// -// Notes: -// -//--------------------------------------------------------------------------- +/* send a command to ASIC +* Parameters: ft1000_usb - device structure +* ptempbuffer - command buffer +* size - command buffer size +*/ void card_send_command(struct ft1000_usb *ft1000dev, void *ptempbuffer, int size) { @@ -509,16 +357,7 @@ void card_send_command(struct ft1000_usb *ft1000dev, void *ptempbuffer, } -//-------------------------------------------------------------------------- -// -// Function: dsp_reload -// -// Synopsis: This function is called to load or reload the DSP -// -// Arguments: ft1000dev - device structure -// -// Returns: None -//----------------------------------------------------------------------- +/* load or reload the DSP */ int dsp_reload(struct ft1000_usb *ft1000dev) { int status; @@ -569,17 +408,7 @@ int dsp_reload(struct ft1000_usb *ft1000dev) return 0; } -//--------------------------------------------------------------------------- -// -// Function: ft1000_reset_asic -// Description: This function will call the Card Service function to reset the -// ASIC. -// Input: -// dev - device structure -// Output: -// none -// -//--------------------------------------------------------------------------- +/* call the Card Service function to reset the ASIC. */ static void ft1000_reset_asic(struct net_device *dev) { struct ft1000_info *info = netdev_priv(dev); @@ -607,18 +436,6 @@ static void ft1000_reset_asic(struct net_device *dev) DEBUG("ft1000_hw: interrupt status register = 0x%x\n", tempword); } - -//--------------------------------------------------------------------------- -// -// Function: ft1000_reset_card -// Description: This function will reset the card -// Input: -// dev - device structure -// Output: -// status - FALSE (card reset fail) -// TRUE (card reset successful) -// -//--------------------------------------------------------------------------- static int ft1000_reset_card(struct net_device *dev) { struct ft1000_info *info = netdev_priv(dev); @@ -666,19 +483,7 @@ static int ft1000_reset_card(struct net_device *dev) return TRUE; } -//--------------------------------------------------------------------------- -// Function: ft1000_usb_transmit_complete -// -// Parameters: urb - transmitted usb urb -// -// -// Returns: none -// -// Description: This is the callback function when a urb is transmitted -// -// Notes: -// -//--------------------------------------------------------------------------- +/* callback function when a urb is transmitted */ static void ft1000_usb_transmit_complete(struct urb *urb) { @@ -690,21 +495,9 @@ static void ft1000_usb_transmit_complete(struct urb *urb) netif_wake_queue(ft1000dev->net); } -//--------------------------------------------------------------------------- -// -// Function: ft1000_copy_down_pkt -// Description: This function will take an ethernet packet and convert it to -// a Flarion packet prior to sending it to the ASIC Downlink -// FIFO. -// Input: -// dev - device structure -// packet - address of ethernet packet -// len - length of IP packet -// Output: -// status - FAILURE -// SUCCESS -// -//--------------------------------------------------------------------------- +/* take an ethernet packet and convert it to a Flarion +* packet prior to sending it to the ASIC Downlink FIFO. +*/ static int ft1000_copy_down_pkt(struct net_device *netdev, u8 * packet, u16 len) { struct ft1000_info *pInfo = netdev_priv(netdev); @@ -769,20 +562,10 @@ static int ft1000_copy_down_pkt(struct net_device *netdev, u8 * packet, u16 len) return 0; } -//--------------------------------------------------------------------------- -// Function: ft1000_start_xmit -// -// Parameters: skb - socket buffer to be sent -// dev - network device -// -// -// Returns: none -// -// Description: transmit a ethernet packet -// -// Notes: -// -//--------------------------------------------------------------------------- +/* transmit an ethernet packet +* Parameters: skb - socket buffer to be sent +* dev - network device +*/ static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct ft1000_info *pInfo = netdev_priv(dev); @@ -827,20 +610,7 @@ err: return NETDEV_TX_OK; } -//--------------------------------------------------------------------------- -// Function: ft1000_open -// -// Parameters: -// dev - network device -// -// -// Returns: none -// -// Description: open the network driver -// -// Notes: -// -//--------------------------------------------------------------------------- +/* open the network driver */ static int ft1000_open(struct net_device *dev) { struct ft1000_info *pInfo = netdev_priv(dev); @@ -879,21 +649,7 @@ static const struct net_device_ops ftnet_ops = .ndo_get_stats = &ft1000_netdev_stats, }; -//--------------------------------------------------------------------------- -// Function: init_ft1000_netdev -// -// Parameters: ft1000dev - device structure -// -// -// Returns: STATUS_SUCCESS - success -// STATUS_FAILURE - failure -// -// Description: This function initialize the network device -// -// Notes: -// -//--------------------------------------------------------------------------- - +/* initialize the network device */ static int ft1000_reset(void *dev) { ft1000_reset_card(dev); @@ -1014,20 +770,7 @@ err_net: return ret_val; } -//--------------------------------------------------------------------------- -// Function: reg_ft1000_netdev -// -// Parameters: ft1000dev - device structure -// -// -// Returns: STATUS_SUCCESS - success -// STATUS_FAILURE - failure -// -// Description: This function register the network driver -// -// Notes: -// -//--------------------------------------------------------------------------- +/* register the network driver */ int reg_ft1000_netdev(struct ft1000_usb *ft1000dev, struct usb_interface *intf) { @@ -1060,19 +803,9 @@ int reg_ft1000_netdev(struct ft1000_usb *ft1000dev, return 0; } -//--------------------------------------------------------------------------- -// -// Function: ft1000_copy_up_pkt -// Description: This function will take a packet from the FIFO up link and -// convert it into an ethernet packet and deliver it to the IP stack -// Input: -// urb - the receiving usb urb -// -// Output: -// status - FAILURE -// SUCCESS -// -//--------------------------------------------------------------------------- +/* take a packet from the FIFO up link and +* convert it into an ethernet packet and deliver it to the IP stack +*/ static int ft1000_copy_up_pkt(struct urb *urb) { struct ft1000_info *info = urb->context; @@ -1155,19 +888,7 @@ static int ft1000_copy_up_pkt(struct urb *urb) } -//--------------------------------------------------------------------------- -// -// Function: ft1000_submit_rx_urb -// Description: the receiving function of the network driver -// -// Input: -// info - a private structure contains the device information -// -// Output: -// status - FAILURE -// SUCCESS -// -//--------------------------------------------------------------------------- +/* the receiving function of the network driver */ static int ft1000_submit_rx_urb(struct ft1000_info *info) { int result; @@ -1196,20 +917,7 @@ static int ft1000_submit_rx_urb(struct ft1000_info *info) return 0; } -//--------------------------------------------------------------------------- -// Function: ft1000_close -// -// Parameters: -// net - network device -// -// -// Returns: none -// -// Description: close the network driver -// -// Notes: -// -//--------------------------------------------------------------------------- +/* close the network driver */ int ft1000_close(struct net_device *net) { struct ft1000_info *pInfo = netdev_priv(net); @@ -1227,18 +935,7 @@ int ft1000_close(struct net_device *net) return 0; } -//--------------------------------------------------------------------------- -// -// Function: ft1000_chkcard -// Description: This function will check if the device is presently available on -// the system. -// Input: -// dev - device structure -// Output: -// status - FALSE (device is not present) -// TRUE (device is present) -// -//--------------------------------------------------------------------------- +/* check if the device is presently available on the system. */ static int ft1000_chkcard(struct ft1000_usb *dev) { u16 tempword; @@ -1271,19 +968,12 @@ static int ft1000_chkcard(struct ft1000_usb *dev) return TRUE; } -//--------------------------------------------------------------------------- -// -// Function: ft1000_receive_cmd -// Description: This function will read a message from the dpram area. -// Input: -// dev - network device structure -// pbuffer - caller supply address to buffer -// pnxtph - pointer to next pseudo header -// Output: -// Status = 0 (unsuccessful) -// = 1 (successful) -// -//--------------------------------------------------------------------------- +/* read a message from the dpram area. +* Input: +* dev - network device structure +* pbuffer - caller supply address to buffer +* pnxtph - pointer to next pseudo header +*/ static bool ft1000_receive_cmd(struct ft1000_usb *dev, u16 *pbuffer, int maxsz, u16 *pnxtph) { From 46d981557b7429b2d03c56634f11cffe5cd8ed97 Mon Sep 17 00:00:00 2001 From: Kelley Nielsen Date: Wed, 30 Oct 2013 18:05:16 -0700 Subject: [PATCH 003/238] staging: ft1000: STATUS defines completely removed The ft1000 driver ignores the normal Linux error codes, using its own macros, STATUS, STATUS_SUCCESS, and STATUS_FAILURE, instead. Unsigned variables (u16 and u32) are sometimes used to hold them. This patch converts all occurences of these macros to 0, 0 and -1, respectively. It also changes the last remaining status variables (mostly called status and ret) to ints, and removes the declarations of the macros. This patch does not correct the whitespace issues in the lines where the changes were made. Signed-off-by: Kelley Nielsen Suggested-by: Greg Kroah-Hartman Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 73 ++++++++++--------- .../staging/ft1000/ft1000-usb/ft1000_usb.c | 4 +- .../staging/ft1000/ft1000-usb/ft1000_usb.h | 5 -- 3 files changed, 39 insertions(+), 43 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c index 73b0c4fa59eb..84bdc6c647cb 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c @@ -48,7 +48,7 @@ static int ft1000_control(struct ft1000_usb *ft1000dev, unsigned int pipe, u8 request, u8 requesttype, u16 value, u16 index, void *data, u16 size, int timeout) { - u16 ret; + int ret; if ((ft1000dev == NULL) || (ft1000dev->dev == NULL)) { DEBUG("ft1000dev or ft1000dev->dev == NULL, failure\n"); @@ -68,7 +68,7 @@ static int ft1000_control(struct ft1000_usb *ft1000dev, unsigned int pipe, int ft1000_read_register(struct ft1000_usb *ft1000dev, u16* Data, u16 nRegIndx) { - int ret = STATUS_SUCCESS; + int ret = 0; ret = ft1000_control(ft1000dev, usb_rcvctrlpipe(ft1000dev->dev, 0), @@ -87,7 +87,7 @@ int ft1000_read_register(struct ft1000_usb *ft1000dev, u16* Data, int ft1000_write_register(struct ft1000_usb *ft1000dev, u16 value, u16 nRegIndx) { - int ret = STATUS_SUCCESS; + int ret = 0; ret = ft1000_control(ft1000dev, usb_sndctrlpipe(ft1000dev->dev, 0), @@ -106,7 +106,7 @@ int ft1000_write_register(struct ft1000_usb *ft1000dev, u16 value, int ft1000_read_dpram32(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer, u16 cnt) { - int ret = STATUS_SUCCESS; + int ret = 0; ret = ft1000_control(ft1000dev, usb_rcvctrlpipe(ft1000dev->dev, 0), @@ -125,7 +125,7 @@ int ft1000_read_dpram32(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer, int ft1000_write_dpram32(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer, u16 cnt) { - int ret = STATUS_SUCCESS; + int ret = 0; if (cnt % 4) cnt += cnt - (cnt % 4); @@ -147,7 +147,7 @@ int ft1000_write_dpram32(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer, int ft1000_read_dpram16(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer, u8 highlow) { - int ret = STATUS_SUCCESS; + int ret = 0; u8 request; if (highlow == 0) @@ -171,7 +171,7 @@ int ft1000_read_dpram16(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer, /* write into DPRAM a number of bytes */ int ft1000_write_dpram16(struct ft1000_usb *ft1000dev, u16 indx, u16 value, u8 highlow) { - int ret = STATUS_SUCCESS; + int ret = 0; u8 request; if (highlow == 0) @@ -198,12 +198,12 @@ int fix_ft1000_read_dpram32(struct ft1000_usb *ft1000dev, u16 indx, { u8 buf[16]; u16 pos; - int ret = STATUS_SUCCESS; + int ret = 0; pos = (indx / 4) * 4; ret = ft1000_read_dpram32(ft1000dev, pos, buf, 16); - if (ret == STATUS_SUCCESS) { + if (ret == 0) { pos = (indx % 4) * 4; *buffer++ = buf[pos++]; *buffer++ = buf[pos++]; @@ -230,13 +230,13 @@ int fix_ft1000_write_dpram32(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer) u8 buf[32]; u8 resultbuffer[32]; u8 *pdata; - int ret = STATUS_SUCCESS; + int ret = 0; pos1 = (indx / 4) * 4; pdata = buffer; ret = ft1000_read_dpram32(ft1000dev, pos1, buf, 16); - if (ret == STATUS_SUCCESS) { + if (ret == 0) { pos2 = (indx % 4)*4; buf[pos2++] = *buffer++; buf[pos2++] = *buffer++; @@ -250,24 +250,24 @@ int fix_ft1000_write_dpram32(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer) ret = ft1000_read_dpram32(ft1000dev, pos1, (u8 *)&resultbuffer[0], 16); - if (ret == STATUS_SUCCESS) { + if (ret == 0) { buffer = pdata; for (i = 0; i < 16; i++) { if (buf[i] != resultbuffer[i]) - ret = STATUS_FAILURE; + ret = -1; } } - if (ret == STATUS_FAILURE) { + if (ret == -1) { ret = ft1000_write_dpram32(ft1000dev, pos1, (u8 *)&tempbuffer[0], 16); ret = ft1000_read_dpram32(ft1000dev, pos1, (u8 *)&resultbuffer[0], 16); - if (ret == STATUS_SUCCESS) { + if (ret == 0) { buffer = pdata; for (i = 0; i < 16; i++) { if (tempbuffer[i] != resultbuffer[i]) { - ret = STATUS_FAILURE; + ret = -1; DEBUG("%s Failed to write\n", __func__); } @@ -281,7 +281,7 @@ int fix_ft1000_write_dpram32(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer) /* reset or activate the DSP */ static void card_reset_dsp(struct ft1000_usb *ft1000dev, bool value) { - u16 status = STATUS_SUCCESS; + int status = 0; u16 tempword; status = ft1000_write_register(ft1000dev, HOST_INTF_BE, @@ -398,7 +398,7 @@ int dsp_reload(struct ft1000_usb *ft1000dev) /* call codeloader */ status = scram_dnldr(ft1000dev, pFileStart, FileLength); - if (status != STATUS_SUCCESS) + if (status != 0) return -EIO; msleep(1000); @@ -823,7 +823,7 @@ static int ft1000_copy_up_pkt(struct urb *urb) if (ft1000dev->status & FT1000_STATUS_CLOSING) { DEBUG("network driver is closed, return\n"); - return STATUS_SUCCESS; + return 0; } // Read length len = urb->transfer_buffer_length; @@ -838,7 +838,7 @@ static int ft1000_copy_up_pkt(struct urb *urb) if (tempword != *chksum) { info->stats.rx_errors++; ft1000_submit_rx_urb(info); - return STATUS_FAILURE; + return -1; } skb = dev_alloc_skb(len + 12 + 2); @@ -847,7 +847,7 @@ static int ft1000_copy_up_pkt(struct urb *urb) DEBUG("ft1000_copy_up_pkt: No Network buffers available\n"); info->stats.rx_errors++; ft1000_submit_rx_urb(info); - return STATUS_FAILURE; + return -1; } pbuffer = (u8 *) skb_put(skb, len + 12); @@ -884,7 +884,7 @@ static int ft1000_copy_up_pkt(struct urb *urb) ft1000_submit_rx_urb(info); - return SUCCESS; + return 0; } @@ -939,7 +939,7 @@ int ft1000_close(struct net_device *net) static int ft1000_chkcard(struct ft1000_usb *dev) { u16 tempword; - u16 status; + int status; if (dev->fCondResetPend) { DEBUG @@ -977,7 +977,8 @@ static int ft1000_chkcard(struct ft1000_usb *dev) static bool ft1000_receive_cmd(struct ft1000_usb *dev, u16 *pbuffer, int maxsz, u16 *pnxtph) { - u16 size, ret; + u16 size; + int ret; u16 *ppseudohdr; int i; u16 tempword; @@ -1049,7 +1050,7 @@ static int ft1000_dsp_prov(void *arg) struct prov_record *ptr; struct pseudo_hdr *ppseudo_hdr; u16 *pmsg; - u16 status; + int status; u16 TempShortBuf[256]; DEBUG("*** DspProv Entered\n"); @@ -1071,7 +1072,7 @@ static int ft1000_dsp_prov(void *arg) i++; if (i == 10) { DEBUG("FT1000:ft1000_dsp_prov:message drop\n"); - return STATUS_FAILURE; + return -1; } ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL); @@ -1125,7 +1126,7 @@ static int ft1000_dsp_prov(void *arg) dev->fProvComplete = true; info->CardReady = 1; - return STATUS_SUCCESS; + return 0; } static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size) @@ -1139,7 +1140,7 @@ static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size) u16 i; struct pseudo_hdr *ppseudo_hdr; u16 *pmsg; - u16 status; + int status; union { u8 byte[2]; u16 wrd; @@ -1147,7 +1148,7 @@ static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size) char *cmdbuffer = kmalloc(1600, GFP_KERNEL); if (!cmdbuffer) - return STATUS_FAILURE; + return -1; status = ft1000_read_dpram32(dev, 0x200, cmdbuffer, size); @@ -1250,7 +1251,7 @@ static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size) if (list_empty(&info->prov_list) == 0) { dev->fProvComplete = false; status = ft1000_dsp_prov(dev); - if (status != STATUS_SUCCESS) + if (status != 0) goto out; } else { dev->fProvComplete = true; @@ -1425,7 +1426,7 @@ static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size) break; } - status = STATUS_SUCCESS; + status = 0; out: kfree(cmdbuffer); DEBUG("return from ft1000_proc_drvmsg\n"); @@ -1438,7 +1439,7 @@ int ft1000_poll(void* dev_id) struct ft1000_info *info = netdev_priv(dev->net); u16 tempword; - u16 status; + int status; u16 size; int i; u16 data; @@ -1451,7 +1452,7 @@ int ft1000_poll(void* dev_id) if (ft1000_chkcard(dev) == FALSE) { DEBUG("ft1000_poll::ft1000_chkcard: failed\n"); - return STATUS_FAILURE; + return -1; } status = ft1000_read_register (dev, &tempword, FT1000_REG_DOORBELL); @@ -1477,7 +1478,7 @@ int ft1000_poll(void* dev_id) DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_DB_DPRAM_RX : portid DRIVERID\n"); status = ft1000_proc_drvmsg (dev, size); - if (status != STATUS_SUCCESS ) + if (status != 0 ) return status; break; case DSPBCMSGID: @@ -1577,7 +1578,7 @@ int ft1000_poll(void* dev_id) } if (i==100) { DEBUG("Unable to reset ASIC\n"); - return STATUS_SUCCESS; + return 0; } msleep(10); // Program WMARK register @@ -1624,6 +1625,6 @@ int ft1000_poll(void* dev_id) } - return STATUS_SUCCESS; + return 0; } diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c index a8dd1e54878c..da6cc370c535 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c @@ -45,13 +45,13 @@ static int ft1000_poll_thread(void *arg) msleep(10); if (!gPollingfailed) { ret = ft1000_poll(arg); - if (ret != STATUS_SUCCESS) { + if (ret != 0) { DEBUG("ft1000_poll_thread: polling failed\n"); gPollingfailed = true; } } } - return STATUS_SUCCESS; + return 0; } static int ft1000_probe(struct usb_interface *interface, diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h index e8d00a930dc6..a6fdd524ee6f 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h @@ -11,8 +11,6 @@ #define PSEUDOSZ 16 -#define SUCCESS 0x00 - struct app_info_block { u32 nTxMsg; /* DPRAM msg sent to DSP with app_id */ u32 nRxMsg; /* DPRAM msg rcv from dsp with app_id */ @@ -31,9 +29,6 @@ struct app_info_block { #define FALSE 0 #define TRUE 1 -#define STATUS_SUCCESS 0 -#define STATUS_FAILURE 0x1001 - #define FT1000_STATUS_CLOSING 0x01 #define DSPBCMSGID 0x10 From d5ae3c482df04a74e03ed944f33209178adaf03f Mon Sep 17 00:00:00 2001 From: Kelley Nielsen Date: Tue, 5 Nov 2013 21:36:55 -0800 Subject: [PATCH 004/238] staging: ft1000: remove unused variable nxtph The function ft1000_poll, in ft1000_hw.c, is overly complex, with at least five different levels of nesting. While preparing to extract one of the cases to its own function, I discovered that the variable nxtph is not used. It is declared and assigned a value in ft1000_poll(), then passed by reference to the helper function ft1000_receive_command(), which receives it as parameter. pnxtph does not appear in the body of this function. Remove all occurrences of nxtph and pnxtph. Signed-off-by: Kelley Nielsen Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c index 84bdc6c647cb..e9ef27f8e19d 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c @@ -972,10 +972,9 @@ static int ft1000_chkcard(struct ft1000_usb *dev) * Input: * dev - network device structure * pbuffer - caller supply address to buffer -* pnxtph - pointer to next pseudo header */ static bool ft1000_receive_cmd(struct ft1000_usb *dev, u16 *pbuffer, - int maxsz, u16 *pnxtph) + int maxsz) { u16 size; int ret; @@ -1445,7 +1444,6 @@ int ft1000_poll(void* dev_id) u16 data; u16 modulo; u16 portid; - u16 nxtph; struct dpram_blk *pdpram_blk; struct pseudo_hdr *ppseudo_hdr; unsigned long flags; @@ -1489,10 +1487,9 @@ int ft1000_poll(void* dev_id) if ( (dev->app_info[i].DspBCMsgFlag) && (dev->app_info[i].fileobject) && (dev->app_info[i].NumOfMsg < MAX_MSG_LIMIT) ) { - nxtph = FT1000_DPRAM_RX_BASE + 2; pdpram_blk = ft1000_get_buffer (&freercvpool); if (pdpram_blk != NULL) { - if ( ft1000_receive_cmd(dev, pdpram_blk->pbuffer, MAX_CMD_SQSIZE, &nxtph) ) { + if ( ft1000_receive_cmd(dev, pdpram_blk->pbuffer, MAX_CMD_SQSIZE) ) { ppseudo_hdr = (struct pseudo_hdr *)pdpram_blk->pbuffer; // Put message into the appropriate application block dev->app_info[i].nRxMsg++; @@ -1520,7 +1517,7 @@ int ft1000_poll(void* dev_id) pdpram_blk = ft1000_get_buffer (&freercvpool); if (pdpram_blk != NULL) { - if ( ft1000_receive_cmd(dev, pdpram_blk->pbuffer, MAX_CMD_SQSIZE, &nxtph) ) { + if ( ft1000_receive_cmd(dev, pdpram_blk->pbuffer, MAX_CMD_SQSIZE) ) { ppseudo_hdr = (struct pseudo_hdr *)pdpram_blk->pbuffer; // Search for correct application block for (i=0; i Date: Tue, 5 Nov 2013 21:39:10 -0800 Subject: [PATCH 005/238] staging: ft1000: extract dsp_broadcast_msg_id() The function ft1000_poll, in ft1000_hw.c, is overly complex, with at least five levels of nesting. Extract the lines in switch case DSPBCMSGID into their own function, called dsp_broadcast_msg_id(). Pass one parameter, struct ft1000_usb *dev. Make a copy of struct dpram_blk *pdpram_blk local to the new function, since it is initialized at the top of each case in which it appears. Make unsigned long flags local to the new function. Remove the assignment to struct pseudo_hdr *ppseudo_hdr, which is otherwise unused in the switch case, and receives the same assignment at the top of each case in which it appears. Return an int, 0 for success and -1 for error. Correct style issues in the extracted lines. Signed-off-by: Kelley Nielsen Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 85 +++++++++++-------- 1 file changed, 50 insertions(+), 35 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c index e9ef27f8e19d..52e6b187d0cb 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c @@ -1432,6 +1432,54 @@ out: return status; } +/* Check which application has registered for dsp broadcast messages */ +static int dsp_broadcast_msg_id(struct ft1000_usb *dev) +{ + struct dpram_blk *pdpram_blk; + unsigned long flags; + int i; + + for (i = 0; i < MAX_NUM_APP; i++) { + if ((dev->app_info[i].DspBCMsgFlag) + && (dev->app_info[i].fileobject) + && (dev->app_info[i].NumOfMsg + < MAX_MSG_LIMIT)) { + pdpram_blk = ft1000_get_buffer(&freercvpool); + if (pdpram_blk != NULL) { + if (ft1000_receive_cmd(dev, + pdpram_blk->pbuffer, + MAX_CMD_SQSIZE)) { + /* Put message into the + * appropriate application block + * */ + dev->app_info[i].nRxMsg++; + spin_lock_irqsave(&free_buff_lock, + flags); + list_add_tail(&pdpram_blk->list, + &dev->app_info[i] + .app_sqlist); + dev->app_info[i].NumOfMsg++; + spin_unlock_irqrestore(&free_buff_lock, + flags); + wake_up_interruptible(&dev->app_info[i] + .wait_dpram_msg); + } else { + dev->app_info[i].nRxMsgMiss++; + ft1000_free_buffer(pdpram_blk, + &freercvpool); + DEBUG("pdpram_blk::ft1000_get_buffer NULL\n"); + return -1; + } + } else { + DEBUG("Out of memory in free receive command pool\n"); + dev->app_info[i].nRxMsgMiss++; + return -1; + } + } + } + return 0; +} + int ft1000_poll(void* dev_id) { struct ft1000_usb *dev = (struct ft1000_usb *)dev_id; @@ -1446,8 +1494,6 @@ int ft1000_poll(void* dev_id) u16 portid; struct dpram_blk *pdpram_blk; struct pseudo_hdr *ppseudo_hdr; - unsigned long flags; - if (ft1000_chkcard(dev) == FALSE) { DEBUG("ft1000_poll::ft1000_chkcard: failed\n"); return -1; @@ -1480,39 +1526,8 @@ int ft1000_poll(void* dev_id) return status; break; case DSPBCMSGID: - // This is a dsp broadcast message - // Check which application has registered for dsp broadcast messages - - for (i=0; iapp_info[i].DspBCMsgFlag) && (dev->app_info[i].fileobject) && - (dev->app_info[i].NumOfMsg < MAX_MSG_LIMIT) ) - { - pdpram_blk = ft1000_get_buffer (&freercvpool); - if (pdpram_blk != NULL) { - if ( ft1000_receive_cmd(dev, pdpram_blk->pbuffer, MAX_CMD_SQSIZE) ) { - ppseudo_hdr = (struct pseudo_hdr *)pdpram_blk->pbuffer; - // Put message into the appropriate application block - dev->app_info[i].nRxMsg++; - spin_lock_irqsave(&free_buff_lock, flags); - list_add_tail(&pdpram_blk->list, &dev->app_info[i].app_sqlist); - dev->app_info[i].NumOfMsg++; - spin_unlock_irqrestore(&free_buff_lock, flags); - wake_up_interruptible(&dev->app_info[i].wait_dpram_msg); - } - else { - dev->app_info[i].nRxMsgMiss++; - // Put memory back to free pool - ft1000_free_buffer(pdpram_blk, &freercvpool); - DEBUG("pdpram_blk::ft1000_get_buffer NULL\n"); - } - } - else { - DEBUG("Out of memory in free receive command pool\n"); - dev->app_info[i].nRxMsgMiss++; - } - } - } - break; + status = dsp_broadcast_msg_id(dev); + break; default: pdpram_blk = ft1000_get_buffer (&freercvpool); From 8a58cad260bd37b7d20d222b083b4844d086b2d7 Mon Sep 17 00:00:00 2001 From: Kelley Nielsen Date: Wed, 6 Nov 2013 05:08:11 -0800 Subject: [PATCH 006/238] staging: ft1000: extract helper handle_misc_portid() The function ft1000_poll, in ft1000_hw.c, is complex, with deep levels of nesting, unnecessary variables, and style issues. Extract the default case of the switch statement to its own function, handle_misc_portid. Make the variable struct dpram_blk *pdpram_blk local to the new function and remove it from the old. The variable struct pseudo_hdr *ppseudo_hdr is used only once, to access a member of another struct, so eliminate it and access the member directly. Return -1 in all the places where the code fails, and 0 on successful completion. Fix coding style errors. Signed-off-by: Kelley Nielsen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 92 ++++++++++--------- 1 file changed, 51 insertions(+), 41 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c index 52e6b187d0cb..95ea5c4b501f 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c @@ -1480,6 +1480,54 @@ static int dsp_broadcast_msg_id(struct ft1000_usb *dev) return 0; } +static int handle_misc_portid(struct ft1000_usb *dev) +{ + struct dpram_blk *pdpram_blk; + int i; + + pdpram_blk = ft1000_get_buffer(&freercvpool); + if (pdpram_blk != NULL) { + if (ft1000_receive_cmd(dev, pdpram_blk->pbuffer, + MAX_CMD_SQSIZE)) { + /* Search for correct application block */ + for (i = 0; i < MAX_NUM_APP; i++) { + if (dev->app_info[i].app_id + == ((struct pseudo_hdr *) + pdpram_blk->pbuffer) + ->portdest) + break; + return -1; + } + if (i == MAX_NUM_APP) { + DEBUG("FT1000:ft1000_parse_dpram_msg: No application matching id = %d\n", ((struct pseudo_hdr *)pdpram_blk->pbuffer)->portdest); + ft1000_free_buffer(pdpram_blk, &freercvpool); + } else { + if (dev->app_info[i].NumOfMsg > MAX_MSG_LIMIT) { + ft1000_free_buffer(pdpram_blk, + &freercvpool); + return -1; + } else { + dev->app_info[i].nRxMsg++; + /* Put message into the appropriate + * application block + * */ + list_add_tail(&pdpram_blk->list, + &dev->app_info[i] + .app_sqlist); + dev->app_info[i].NumOfMsg++; + } + } + } else { + ft1000_free_buffer(pdpram_blk, &freercvpool); + return -1; + } + } else { + DEBUG("Out of memory in free receive command pool\n"); + return -1; + } + return 0; +} + int ft1000_poll(void* dev_id) { struct ft1000_usb *dev = (struct ft1000_usb *)dev_id; @@ -1492,8 +1540,7 @@ int ft1000_poll(void* dev_id) u16 data; u16 modulo; u16 portid; - struct dpram_blk *pdpram_blk; - struct pseudo_hdr *ppseudo_hdr; + if (ft1000_chkcard(dev) == FALSE) { DEBUG("ft1000_poll::ft1000_chkcard: failed\n"); return -1; @@ -1529,45 +1576,8 @@ int ft1000_poll(void* dev_id) status = dsp_broadcast_msg_id(dev); break; default: - pdpram_blk = ft1000_get_buffer (&freercvpool); - - if (pdpram_blk != NULL) { - if ( ft1000_receive_cmd(dev, pdpram_blk->pbuffer, MAX_CMD_SQSIZE) ) { - ppseudo_hdr = (struct pseudo_hdr *)pdpram_blk->pbuffer; - // Search for correct application block - for (i=0; iapp_info[i].app_id == ppseudo_hdr->portdest) { - break; - } - } - - if (i == MAX_NUM_APP) { - DEBUG("FT1000:ft1000_parse_dpram_msg: No application matching id = %d\n", ppseudo_hdr->portdest); - // Put memory back to free pool - ft1000_free_buffer(pdpram_blk, &freercvpool); - } - else { - if (dev->app_info[i].NumOfMsg > MAX_MSG_LIMIT) { - // Put memory back to free pool - ft1000_free_buffer(pdpram_blk, &freercvpool); - } - else { - dev->app_info[i].nRxMsg++; - // Put message into the appropriate application block - list_add_tail(&pdpram_blk->list, &dev->app_info[i].app_sqlist); - dev->app_info[i].NumOfMsg++; - } - } - } - else { - // Put memory back to free pool - ft1000_free_buffer(pdpram_blk, &freercvpool); - } - } - else { - DEBUG("Out of memory in free receive command pool\n"); - } - break; + status = handle_misc_portid(dev); + break; } } else { From f3802bdb15f7bea68ca330d8d909c56ac1e15119 Mon Sep 17 00:00:00 2001 From: Kelley Nielsen Date: Wed, 6 Nov 2013 05:08:58 -0800 Subject: [PATCH 007/238] staging: ft1000: flatten nesting in handle_misc_portid The newly extracted function handle_misc_portid still has several unnecessary levels of nesting, having inherited its logic from the original extracted lines. Move handling for failed memory allocation (of *pdpram_blk) to the top of the function, and return -1 from within it. This eliminates the if statement around the body of the function. Change two levels of nested if/else to an if/else-if/else. Create a label, exit_failure, at the end of the function with the cleanup code, and goto it at all points of failure. Also, goto it if the call to ft1000_receive_cmd() fails, instead of descending into an if block if it succeeds. Pull all lines from inside the former if blocks to the left, and rejoin lines to take advantage of reclaimed horizontal space. Signed-off-by: Kelley Nielsen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 61 ++++++++----------- 1 file changed, 25 insertions(+), 36 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c index 95ea5c4b501f..2a23b4427ded 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c @@ -1486,46 +1486,35 @@ static int handle_misc_portid(struct ft1000_usb *dev) int i; pdpram_blk = ft1000_get_buffer(&freercvpool); - if (pdpram_blk != NULL) { - if (ft1000_receive_cmd(dev, pdpram_blk->pbuffer, - MAX_CMD_SQSIZE)) { - /* Search for correct application block */ - for (i = 0; i < MAX_NUM_APP; i++) { - if (dev->app_info[i].app_id - == ((struct pseudo_hdr *) - pdpram_blk->pbuffer) - ->portdest) - break; - return -1; - } - if (i == MAX_NUM_APP) { - DEBUG("FT1000:ft1000_parse_dpram_msg: No application matching id = %d\n", ((struct pseudo_hdr *)pdpram_blk->pbuffer)->portdest); - ft1000_free_buffer(pdpram_blk, &freercvpool); - } else { - if (dev->app_info[i].NumOfMsg > MAX_MSG_LIMIT) { - ft1000_free_buffer(pdpram_blk, - &freercvpool); - return -1; - } else { - dev->app_info[i].nRxMsg++; - /* Put message into the appropriate - * application block - * */ - list_add_tail(&pdpram_blk->list, - &dev->app_info[i] - .app_sqlist); - dev->app_info[i].NumOfMsg++; - } - } - } else { - ft1000_free_buffer(pdpram_blk, &freercvpool); - return -1; - } - } else { + if (pdpram_blk == NULL) { DEBUG("Out of memory in free receive command pool\n"); return -1; } + if (!ft1000_receive_cmd(dev, pdpram_blk->pbuffer, MAX_CMD_SQSIZE)) + goto exit_failure; + + /* Search for correct application block */ + for (i = 0; i < MAX_NUM_APP; i++) { + if (dev->app_info[i].app_id == ((struct pseudo_hdr *) + pdpram_blk->pbuffer)->portdest) + break; + } + if (i == MAX_NUM_APP) { + DEBUG("FT1000:ft1000_parse_dpram_msg: No application matching id = %d\n", ((struct pseudo_hdr *)pdpram_blk->pbuffer)->portdest); + goto exit_failure; + } else if (dev->app_info[i].NumOfMsg > MAX_MSG_LIMIT) { + goto exit_failure; + } else { + dev->app_info[i].nRxMsg++; + /* Put message into the appropriate application block */ + list_add_tail(&pdpram_blk->list, &dev->app_info[i].app_sqlist); + dev->app_info[i].NumOfMsg++; + } return 0; + +exit_failure: + ft1000_free_buffer(pdpram_blk, &freercvpool); + return -1; } int ft1000_poll(void* dev_id) From 9a1261f317110e2b139a35fe7acf7fa04ca1bf97 Mon Sep 17 00:00:00 2001 From: Kelley Nielsen Date: Wed, 6 Nov 2013 05:09:30 -0800 Subject: [PATCH 008/238] staging: ft1000: fix checkpatch issues in ft1000_poll() The function ft1000_poll(), in ft1000_hw.c, has many miscellaneous coding style issues, such as improper indentation, C99 comments, use of msleep(), and lines over 80 characters. Changes all spaces at the start of lines to the proper number of tabs. Convert C99 comments to standard /* */ style. Change calls to msleep(10) to usleep_range(9000, 11000). Break lines over 80 characters, unless they are user visible strings. Remove space before open paren in function calls. Fix any other issues that checkpatch finds. Signed-off-by: Kelley Nielsen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 244 +++++++++--------- 1 file changed, 126 insertions(+), 118 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c index 2a23b4427ded..2f54c2a23fe7 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c @@ -1517,125 +1517,133 @@ exit_failure: return -1; } -int ft1000_poll(void* dev_id) +int ft1000_poll(void *dev_id) { - struct ft1000_usb *dev = (struct ft1000_usb *)dev_id; + struct ft1000_usb *dev = (struct ft1000_usb *)dev_id; struct ft1000_info *info = netdev_priv(dev->net); + u16 tempword; + int status; + u16 size; + int i; + u16 data; + u16 modulo; + u16 portid; - u16 tempword; - int status; - u16 size; - int i; - u16 data; - u16 modulo; - u16 portid; - - if (ft1000_chkcard(dev) == FALSE) { - DEBUG("ft1000_poll::ft1000_chkcard: failed\n"); - return -1; - } - - status = ft1000_read_register (dev, &tempword, FT1000_REG_DOORBELL); - - if ( !status ) - { - - if (tempword & FT1000_DB_DPRAM_RX) { - - status = ft1000_read_dpram16(dev, 0x200, (u8 *)&data, 0); - size = ntohs(data) + 16 + 2; - if (size % 4) { - modulo = 4 - (size % 4); - size = size + modulo; - } - status = ft1000_read_dpram16(dev, 0x201, (u8 *)&portid, 1); - portid &= 0xff; - - if (size < MAX_CMD_SQSIZE) { - switch (portid) - { - case DRIVERID: - DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_DB_DPRAM_RX : portid DRIVERID\n"); - - status = ft1000_proc_drvmsg (dev, size); - if (status != 0 ) - return status; - break; - case DSPBCMSGID: - status = dsp_broadcast_msg_id(dev); - break; - default: - status = handle_misc_portid(dev); - break; - } - } - else { - DEBUG("FT1000:dpc:Invalid total length for SlowQ = %d\n", size); - } - status = ft1000_write_register (dev, FT1000_DB_DPRAM_RX, FT1000_REG_DOORBELL); - } - else if (tempword & FT1000_DSP_ASIC_RESET) { - - // Let's reset the ASIC from the Host side as well - status = ft1000_write_register (dev, ASIC_RESET_BIT, FT1000_REG_RESET); - status = ft1000_read_register (dev, &tempword, FT1000_REG_RESET); - i = 0; - while (tempword & ASIC_RESET_BIT) { - status = ft1000_read_register (dev, &tempword, FT1000_REG_RESET); - msleep(10); - i++; - if (i==100) - break; - } - if (i==100) { - DEBUG("Unable to reset ASIC\n"); - return 0; - } - msleep(10); - // Program WMARK register - status = ft1000_write_register (dev, 0x600, FT1000_REG_MAG_WATERMARK); - // clear ASIC reset doorbell - status = ft1000_write_register (dev, FT1000_DSP_ASIC_RESET, FT1000_REG_DOORBELL); - msleep(10); - } - else if (tempword & FT1000_ASIC_RESET_REQ) { - DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_ASIC_RESET_REQ\n"); - - // clear ASIC reset request from DSP - status = ft1000_write_register (dev, FT1000_ASIC_RESET_REQ, FT1000_REG_DOORBELL); - status = ft1000_write_register (dev, HOST_INTF_BE, FT1000_REG_SUP_CTRL); - // copy dsp session record from Adapter block - status = ft1000_write_dpram32 (dev, 0, (u8 *)&info->DSPSess.Rec[0], 1024); - // Program WMARK register - status = ft1000_write_register (dev, 0x600, FT1000_REG_MAG_WATERMARK); - // ring doorbell to tell DSP that ASIC is out of reset - status = ft1000_write_register (dev, FT1000_ASIC_RESET_DSP, FT1000_REG_DOORBELL); - } - else if (tempword & FT1000_DB_COND_RESET) { - DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_DB_COND_RESET\n"); - - if (!dev->fAppMsgPend) { - // Reset ASIC and DSP - - status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER0, (u8 *)&(info->DSP_TIME[0]), FT1000_MAG_DSP_TIMER0_INDX); - status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER1, (u8 *)&(info->DSP_TIME[1]), FT1000_MAG_DSP_TIMER1_INDX); - status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER2, (u8 *)&(info->DSP_TIME[2]), FT1000_MAG_DSP_TIMER2_INDX); - status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER3, (u8 *)&(info->DSP_TIME[3]), FT1000_MAG_DSP_TIMER3_INDX); - info->CardReady = 0; - info->DrvErrNum = DSP_CONDRESET_INFO; - DEBUG("ft1000_hw:DSP conditional reset requested\n"); - info->ft1000_reset(dev->net); - } - else { - dev->fProvComplete = false; - dev->fCondResetPend = true; - } - - ft1000_write_register(dev, FT1000_DB_COND_RESET, FT1000_REG_DOORBELL); - } - - } - - return 0; - + if (ft1000_chkcard(dev) == FALSE) { + DEBUG("ft1000_poll::ft1000_chkcard: failed\n"); + return -1; + } + status = ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL); + if (!status) { + if (tempword & FT1000_DB_DPRAM_RX) { + status = ft1000_read_dpram16(dev, + 0x200, (u8 *)&data, 0); + size = ntohs(data) + 16 + 2; + if (size % 4) { + modulo = 4 - (size % 4); + size = size + modulo; + } + status = ft1000_read_dpram16(dev, 0x201, + (u8 *)&portid, 1); + portid &= 0xff; + if (size < MAX_CMD_SQSIZE) { + switch (portid) { + case DRIVERID: + DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_DB_DPRAM_RX : portid DRIVERID\n"); + status = ft1000_proc_drvmsg(dev, size); + if (status != 0) + return status; + break; + case DSPBCMSGID: + status = dsp_broadcast_msg_id(dev); + break; + default: + status = handle_misc_portid(dev); + break; + } + } else + DEBUG("FT1000:dpc:Invalid total length for SlowQ = %d\n", size); + status = ft1000_write_register(dev, + FT1000_DB_DPRAM_RX, + FT1000_REG_DOORBELL); + } else if (tempword & FT1000_DSP_ASIC_RESET) { + /* Let's reset the ASIC from the Host side as well */ + status = ft1000_write_register(dev, ASIC_RESET_BIT, + FT1000_REG_RESET); + status = ft1000_read_register(dev, &tempword, + FT1000_REG_RESET); + i = 0; + while (tempword & ASIC_RESET_BIT) { + status = ft1000_read_register(dev, &tempword, + FT1000_REG_RESET); + usleep_range(9000, 11000); + i++; + if (i == 100) + break; + } + if (i == 100) { + DEBUG("Unable to reset ASIC\n"); + return 0; + } + usleep_range(9000, 11000); + /* Program WMARK register */ + status = ft1000_write_register(dev, 0x600, + FT1000_REG_MAG_WATERMARK); + /* clear ASIC reset doorbell */ + status = ft1000_write_register(dev, + FT1000_DSP_ASIC_RESET, + FT1000_REG_DOORBELL); + usleep_range(9000, 11000); + } else if (tempword & FT1000_ASIC_RESET_REQ) { + DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_ASIC_RESET_REQ\n"); + /* clear ASIC reset request from DSP */ + status = ft1000_write_register(dev, + FT1000_ASIC_RESET_REQ, + FT1000_REG_DOORBELL); + status = ft1000_write_register(dev, HOST_INTF_BE, + FT1000_REG_SUP_CTRL); + /* copy dsp session record from Adapter block */ + status = ft1000_write_dpram32(dev, 0, + (u8 *)&info->DSPSess.Rec[0], 1024); + status = ft1000_write_register(dev, 0x600, + FT1000_REG_MAG_WATERMARK); + /* ring doorbell to tell DSP that + * ASIC is out of reset + * */ + status = ft1000_write_register(dev, + FT1000_ASIC_RESET_DSP, + FT1000_REG_DOORBELL); + } else if (tempword & FT1000_DB_COND_RESET) { + DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_DB_COND_RESET\n"); + if (!dev->fAppMsgPend) { + /* Reset ASIC and DSP */ + status = ft1000_read_dpram16(dev, + FT1000_MAG_DSP_TIMER0, + (u8 *)&(info->DSP_TIME[0]), + FT1000_MAG_DSP_TIMER0_INDX); + status = ft1000_read_dpram16(dev, + FT1000_MAG_DSP_TIMER1, + (u8 *)&(info->DSP_TIME[1]), + FT1000_MAG_DSP_TIMER1_INDX); + status = ft1000_read_dpram16(dev, + FT1000_MAG_DSP_TIMER2, + (u8 *)&(info->DSP_TIME[2]), + FT1000_MAG_DSP_TIMER2_INDX); + status = ft1000_read_dpram16(dev, + FT1000_MAG_DSP_TIMER3, + (u8 *)&(info->DSP_TIME[3]), + FT1000_MAG_DSP_TIMER3_INDX); + info->CardReady = 0; + info->DrvErrNum = DSP_CONDRESET_INFO; + DEBUG("ft1000_hw:DSP conditional reset requested\n"); + info->ft1000_reset(dev->net); + } else { + dev->fProvComplete = false; + dev->fCondResetPend = true; + } + ft1000_write_register(dev, FT1000_DB_COND_RESET, + FT1000_REG_DOORBELL); + } + } + return 0; } From a3220b89bd396ff5b83ede05d7925564d277a9ea Mon Sep 17 00:00:00 2001 From: Kelley Nielsen Date: Wed, 6 Nov 2013 05:09:56 -0800 Subject: [PATCH 009/238] staging: ft1000: flatten nesting in dsp_broadcast_msg_id() The function dsp_broadcast_msg_id() has four levels of nesting. Move the handling for failed allocation for *dpram_blk from the else block at the end to the block immediately following the test, reverse the sense of the test, and exit with an error code if the allocation fails. This eliminates descending into an if block if the allocation is successful. Move all lines inside the removed block one tab to the left, and join lines that will fall under the 80 char limit. Signed-off-by: Kelley Nielsen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 46 ++++++++----------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c index 2f54c2a23fe7..c071f61d0b8f 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c @@ -1445,36 +1445,30 @@ static int dsp_broadcast_msg_id(struct ft1000_usb *dev) && (dev->app_info[i].NumOfMsg < MAX_MSG_LIMIT)) { pdpram_blk = ft1000_get_buffer(&freercvpool); - if (pdpram_blk != NULL) { - if (ft1000_receive_cmd(dev, - pdpram_blk->pbuffer, - MAX_CMD_SQSIZE)) { - /* Put message into the - * appropriate application block - * */ - dev->app_info[i].nRxMsg++; - spin_lock_irqsave(&free_buff_lock, - flags); - list_add_tail(&pdpram_blk->list, - &dev->app_info[i] - .app_sqlist); - dev->app_info[i].NumOfMsg++; - spin_unlock_irqrestore(&free_buff_lock, - flags); - wake_up_interruptible(&dev->app_info[i] - .wait_dpram_msg); - } else { - dev->app_info[i].nRxMsgMiss++; - ft1000_free_buffer(pdpram_blk, - &freercvpool); - DEBUG("pdpram_blk::ft1000_get_buffer NULL\n"); - return -1; - } - } else { + if (pdpram_blk == NULL) { DEBUG("Out of memory in free receive command pool\n"); dev->app_info[i].nRxMsgMiss++; return -1; } + if (ft1000_receive_cmd(dev, pdpram_blk->pbuffer, + MAX_CMD_SQSIZE)) { + /* Put message into the + * appropriate application block + */ + dev->app_info[i].nRxMsg++; + spin_lock_irqsave(&free_buff_lock, flags); + list_add_tail(&pdpram_blk->list, + &dev->app_info[i] .app_sqlist); + dev->app_info[i].NumOfMsg++; + spin_unlock_irqrestore(&free_buff_lock, flags); + wake_up_interruptible(&dev->app_info[i] + .wait_dpram_msg); + } else { + dev->app_info[i].nRxMsgMiss++; + ft1000_free_buffer(pdpram_blk, &freercvpool); + DEBUG("pdpram_blk::ft1000_get_buffer NULL\n"); + return -1; + } } } return 0; From 8d6c558557ee8538732188a7d2dd8c87da9000b6 Mon Sep 17 00:00:00 2001 From: Kelley Nielsen Date: Wed, 6 Nov 2013 05:10:19 -0800 Subject: [PATCH 010/238] staging: ft1000: fix remaining checkpatch issues in ft1000_hw.c The file ft1000_hw.c is still full of coding style problems that make it challenging to read and understand. The lines inside the switch cases in ft1000_proc_drvmsg() are indented too deeply, so remove one leading tab. Join lines that are now able to fit in the 80 character limit. This will take care of the "too many leading tabs" issue. Run checkpatch.pl on the file, and correct all other issues it reports (except lines with user visible strings over 80 chars). Signed-off-by: Kelley Nielsen Suggested-by: Waskiewicz Jr, Peter P Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 426 ++++++++---------- 1 file changed, 194 insertions(+), 232 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c index c071f61d0b8f..0d6c1d12170d 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c @@ -25,7 +25,9 @@ #define HARLEY_READ_OPERATION 0xc1 #define HARLEY_WRITE_OPERATION 0x41 -//#define JDEBUG +#if 0 +#define JDEBUG +#endif static int ft1000_submit_rx_urb(struct ft1000_info *info); @@ -65,7 +67,7 @@ static int ft1000_control(struct ft1000_usb *ft1000dev, unsigned int pipe, } /* returns the value in a register */ -int ft1000_read_register(struct ft1000_usb *ft1000dev, u16* Data, +int ft1000_read_register(struct ft1000_usb *ft1000dev, u16 *Data, u16 nRegIndx) { int ret = 0; @@ -169,7 +171,8 @@ int ft1000_read_dpram16(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer, } /* write into DPRAM a number of bytes */ -int ft1000_write_dpram16(struct ft1000_usb *ft1000dev, u16 indx, u16 value, u8 highlow) +int ft1000_write_dpram16(struct ft1000_usb *ft1000dev, u16 indx, u16 value, + u8 highlow) { int ret = 0; u8 request; @@ -334,7 +337,7 @@ void card_send_command(struct ft1000_usb *ft1000dev, void *ptempbuffer, ft1000_read_register(ft1000dev, &temp, FT1000_REG_DOORBELL); if (temp & 0x0100) - msleep(10); + usleep_range(900, 1100); /* check for odd word */ size = size + 2; @@ -344,16 +347,17 @@ void card_send_command(struct ft1000_usb *ft1000dev, void *ptempbuffer, size += 4 - (size % 4); ft1000_write_dpram32(ft1000dev, 0, commandbuf, size); - msleep(1); + usleep_range(900, 1100); ft1000_write_register(ft1000dev, FT1000_DB_DPRAM_TX, FT1000_REG_DOORBELL); - msleep(1); + usleep_range(900, 1100); ft1000_read_register(ft1000dev, &temp, FT1000_REG_DOORBELL); - if ((temp & 0x0100) == 0) { - //DEBUG("card_send_command: Message sent\n"); - } +#if 0 + if ((temp & 0x0100) == 0) + DEBUG("card_send_command: Message sent\n"); +#endif } @@ -498,7 +502,7 @@ static void ft1000_usb_transmit_complete(struct urb *urb) /* take an ethernet packet and convert it to a Flarion * packet prior to sending it to the ASIC Downlink FIFO. */ -static int ft1000_copy_down_pkt(struct net_device *netdev, u8 * packet, u16 len) +static int ft1000_copy_down_pkt(struct net_device *netdev, u8 *packet, u16 len) { struct ft1000_info *pInfo = netdev_priv(netdev); struct ft1000_usb *pFt1000Dev = pInfo->priv; @@ -641,8 +645,7 @@ static struct net_device_stats *ft1000_netdev_stats(struct net_device *dev) return &(info->stats); } -static const struct net_device_ops ftnet_ops = -{ +static const struct net_device_ops ftnet_ops = { .ndo_open = &ft1000_open, .ndo_stop = &ft1000_close, .ndo_start_xmit = &ft1000_start_xmit, @@ -687,14 +690,14 @@ int init_ft1000_netdev(struct ft1000_usb *ft1000dev) card_nr[1] = '\0'; ret_val = kstrtou8(card_nr, 10, &gCardIndex); if (ret_val) { - printk(KERN_ERR "Can't parse netdev\n"); + netdev_err(ft1000dev->net, "Can't parse netdev\n"); goto err_net; } ft1000dev->CardNumber = gCardIndex; DEBUG("card number = %d\n", ft1000dev->CardNumber); } else { - printk(KERN_ERR "ft1000: Invalid device name\n"); + netdev_err(ft1000dev->net, "ft1000: Invalid device name\n"); ret_val = -ENXIO; goto err_net; } @@ -825,7 +828,7 @@ static int ft1000_copy_up_pkt(struct urb *urb) DEBUG("network driver is closed, return\n"); return 0; } - // Read length + /* Read length */ len = urb->transfer_buffer_length; lena = urb->actual_length; @@ -942,8 +945,7 @@ static int ft1000_chkcard(struct ft1000_usb *dev) int status; if (dev->fCondResetPend) { - DEBUG - ("ft1000_hw:ft1000_chkcard:Card is being reset, return FALSE\n"); + DEBUG("ft1000_hw:ft1000_chkcard:Card is being reset, return FALSE\n"); return TRUE; } /* Mask register is used to check for device presence since it is never @@ -951,8 +953,7 @@ static int ft1000_chkcard(struct ft1000_usb *dev) */ status = ft1000_read_register(dev, &tempword, FT1000_REG_SUP_IMASK); if (tempword == 0) { - DEBUG - ("ft1000_hw:ft1000_chkcard: IMASK = 0 Card not detected\n"); + DEBUG("ft1000_hw:ft1000_chkcard: IMASK = 0 Card not detected\n"); return FALSE; } /* The system will return the value of 0xffff for the version register @@ -961,8 +962,7 @@ static int ft1000_chkcard(struct ft1000_usb *dev) status = ft1000_read_register(dev, &tempword, FT1000_REG_ASIC_ID); if (tempword != 0x1b01) { dev->status |= FT1000_STATUS_CLOSING; - DEBUG - ("ft1000_hw:ft1000_chkcard: Version = 0xffff Card not detected\n"); + DEBUG("ft1000_hw:ft1000_chkcard: Version = 0xffff Card not detected\n"); return FALSE; } return TRUE; @@ -1095,9 +1095,8 @@ static int ft1000_dsp_prov(void *arg) ppseudo_hdr->portsrc = 0; /* Calculate new checksum */ ppseudo_hdr->checksum = *pmsg++; - for (i = 1; i < 7; i++) { + for (i = 1; i < 7; i++) ppseudo_hdr->checksum ^= *pmsg++; - } TempShortBuf[0] = 0; TempShortBuf[1] = htons(len); @@ -1115,7 +1114,7 @@ static int ft1000_dsp_prov(void *arg) kfree(ptr->pprov_data); kfree(ptr); } - msleep(10); + usleep_range(9000, 11000); } DEBUG("DSP Provisioning List Entry finished\n"); @@ -1171,154 +1170,179 @@ static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size) DEBUG("ft1000_proc_drvmsg:Command message type = 0x%x\n", msgtype); switch (msgtype) { case MEDIA_STATE:{ - DEBUG - ("ft1000_proc_drvmsg:Command message type = MEDIA_STATE"); - - pmediamsg = (struct media_msg *)&cmdbuffer[0]; - if (info->ProgConStat != 0xFF) { - if (pmediamsg->state) { - DEBUG("Media is up\n"); - if (info->mediastate == 0) { - if (dev->NetDevRegDone) { - netif_wake_queue(dev-> - net); - } - info->mediastate = 1; - } - } else { - DEBUG("Media is down\n"); - if (info->mediastate == 1) { - info->mediastate = 0; - if (dev->NetDevRegDone) { - } - info->ConTm = 0; - } + DEBUG("ft1000_proc_drvmsg:Command message type = MEDIA_STATE"); + pmediamsg = (struct media_msg *)&cmdbuffer[0]; + if (info->ProgConStat != 0xFF) { + if (pmediamsg->state) { + DEBUG("Media is up\n"); + if (info->mediastate == 0) { + if (dev->NetDevRegDone) + netif_wake_queue(dev->net); + info->mediastate = 1; } } else { DEBUG("Media is down\n"); if (info->mediastate == 1) { info->mediastate = 0; - info->ConTm = 0; + if (dev->NetDevRegDone) + info->ConTm = 0; } } - break; + } else { + DEBUG("Media is down\n"); + if (info->mediastate == 1) { + info->mediastate = 0; + info->ConTm = 0; + } } + break; + } case DSP_INIT_MSG:{ - DEBUG - ("ft1000_proc_drvmsg:Command message type = DSP_INIT_MSG"); + DEBUG("ft1000_proc_drvmsg:Command message type = DSP_INIT_MSG"); + pdspinitmsg = (struct dsp_init_msg *)&cmdbuffer[2]; + memcpy(info->DspVer, pdspinitmsg->DspVer, DSPVERSZ); + DEBUG("DSPVER = 0x%2x 0x%2x 0x%2x 0x%2x\n", + info->DspVer[0], info->DspVer[1], info->DspVer[2], + info->DspVer[3]); + memcpy(info->HwSerNum, pdspinitmsg->HwSerNum, + HWSERNUMSZ); + memcpy(info->Sku, pdspinitmsg->Sku, SKUSZ); + memcpy(info->eui64, pdspinitmsg->eui64, EUISZ); + DEBUG("EUI64=%2x.%2x.%2x.%2x.%2x.%2x.%2x.%2x\n", + info->eui64[0], info->eui64[1], info->eui64[2], + info->eui64[3], info->eui64[4], info->eui64[5], + info->eui64[6], info->eui64[7]); + dev->net->dev_addr[0] = info->eui64[0]; + dev->net->dev_addr[1] = info->eui64[1]; + dev->net->dev_addr[2] = info->eui64[2]; + dev->net->dev_addr[3] = info->eui64[5]; + dev->net->dev_addr[4] = info->eui64[6]; + dev->net->dev_addr[5] = info->eui64[7]; - pdspinitmsg = (struct dsp_init_msg *)&cmdbuffer[2]; - memcpy(info->DspVer, pdspinitmsg->DspVer, DSPVERSZ); - DEBUG("DSPVER = 0x%2x 0x%2x 0x%2x 0x%2x\n", - info->DspVer[0], info->DspVer[1], info->DspVer[2], - info->DspVer[3]); - memcpy(info->HwSerNum, pdspinitmsg->HwSerNum, - HWSERNUMSZ); - memcpy(info->Sku, pdspinitmsg->Sku, SKUSZ); - memcpy(info->eui64, pdspinitmsg->eui64, EUISZ); - DEBUG("EUI64=%2x.%2x.%2x.%2x.%2x.%2x.%2x.%2x\n", - info->eui64[0], info->eui64[1], info->eui64[2], - info->eui64[3], info->eui64[4], info->eui64[5], - info->eui64[6], info->eui64[7]); - dev->net->dev_addr[0] = info->eui64[0]; - dev->net->dev_addr[1] = info->eui64[1]; - dev->net->dev_addr[2] = info->eui64[2]; - dev->net->dev_addr[3] = info->eui64[5]; - dev->net->dev_addr[4] = info->eui64[6]; - dev->net->dev_addr[5] = info->eui64[7]; - - if (ntohs(pdspinitmsg->length) == - (sizeof(struct dsp_init_msg) - 20)) { - memcpy(info->ProductMode, - pdspinitmsg->ProductMode, MODESZ); - memcpy(info->RfCalVer, pdspinitmsg->RfCalVer, - CALVERSZ); - memcpy(info->RfCalDate, pdspinitmsg->RfCalDate, - CALDATESZ); - DEBUG("RFCalVer = 0x%2x 0x%2x\n", - info->RfCalVer[0], info->RfCalVer[1]); - } - break; + if (ntohs(pdspinitmsg->length) == + (sizeof(struct dsp_init_msg) - 20)) { + memcpy(info->ProductMode, pdspinitmsg->ProductMode, + MODESZ); + memcpy(info->RfCalVer, pdspinitmsg->RfCalVer, CALVERSZ); + memcpy(info->RfCalDate, pdspinitmsg->RfCalDate, + CALDATESZ); + DEBUG("RFCalVer = 0x%2x 0x%2x\n", info->RfCalVer[0], + info->RfCalVer[1]); } + break; + } case DSP_PROVISION:{ - DEBUG - ("ft1000_proc_drvmsg:Command message type = DSP_PROVISION\n"); + DEBUG("ft1000_proc_drvmsg:Command message type = DSP_PROVISION\n"); - /* kick off dspprov routine to start provisioning - * Send provisioning data to DSP - */ - if (list_empty(&info->prov_list) == 0) { - dev->fProvComplete = false; - status = ft1000_dsp_prov(dev); - if (status != 0) - goto out; - } else { - dev->fProvComplete = true; - status = - ft1000_write_register(dev, FT1000_DB_HB, - FT1000_REG_DOORBELL); - DEBUG - ("FT1000:drivermsg:No more DSP provisioning data in dsp image\n"); - } - DEBUG("ft1000_proc_drvmsg:DSP PROVISION is done\n"); - break; + /* kick off dspprov routine to start provisioning + * Send provisioning data to DSP + */ + if (list_empty(&info->prov_list) == 0) { + dev->fProvComplete = false; + status = ft1000_dsp_prov(dev); + if (status != 0) + goto out; + } else { + dev->fProvComplete = true; + status = ft1000_write_register(dev, FT1000_DB_HB, + FT1000_REG_DOORBELL); + DEBUG("FT1000:drivermsg:No more DSP provisioning data in dsp image\n"); } + DEBUG("ft1000_proc_drvmsg:DSP PROVISION is done\n"); + break; + } case DSP_STORE_INFO:{ - DEBUG - ("ft1000_proc_drvmsg:Command message type = DSP_STORE_INFO"); - - DEBUG("FT1000:drivermsg:Got DSP_STORE_INFO\n"); - tempword = ntohs(pdrvmsg->length); - info->DSPInfoBlklen = tempword; - if (tempword < (MAX_DSP_SESS_REC - 4)) { - pmsg = (u16 *) &pdrvmsg->data[0]; - for (i = 0; i < ((tempword + 1) / 2); i++) { - DEBUG - ("FT1000:drivermsg:dsp info data = 0x%x\n", - *pmsg); - info->DSPInfoBlk[i + 10] = *pmsg++; - } - } else { - info->DSPInfoBlklen = 0; + DEBUG("ft1000_proc_drvmsg:Command message type = DSP_STORE_INFO"); + DEBUG("FT1000:drivermsg:Got DSP_STORE_INFO\n"); + tempword = ntohs(pdrvmsg->length); + info->DSPInfoBlklen = tempword; + if (tempword < (MAX_DSP_SESS_REC - 4)) { + pmsg = (u16 *) &pdrvmsg->data[0]; + for (i = 0; i < ((tempword + 1) / 2); i++) { + DEBUG("FT1000:drivermsg:dsp info data = 0x%x\n", *pmsg); + info->DSPInfoBlk[i + 10] = *pmsg++; } - break; + } else { + info->DSPInfoBlklen = 0; } + break; + } case DSP_GET_INFO:{ - DEBUG("FT1000:drivermsg:Got DSP_GET_INFO\n"); - /* copy dsp info block to dsp */ - dev->DrvMsgPend = 1; - /* allow any outstanding ioctl to finish */ + DEBUG("FT1000:drivermsg:Got DSP_GET_INFO\n"); + /* copy dsp info block to dsp */ + dev->DrvMsgPend = 1; + /* allow any outstanding ioctl to finish */ + mdelay(10); + status = ft1000_read_register(dev, &tempword, + FT1000_REG_DOORBELL); + if (tempword & FT1000_DB_DPRAM_TX) { mdelay(10); - status = - ft1000_read_register(dev, &tempword, - FT1000_REG_DOORBELL); + status = ft1000_read_register(dev, &tempword, + FT1000_REG_DOORBELL); if (tempword & FT1000_DB_DPRAM_TX) { mdelay(10); - status = - ft1000_read_register(dev, &tempword, - FT1000_REG_DOORBELL); - if (tempword & FT1000_DB_DPRAM_TX) { - mdelay(10); - status = - ft1000_read_register(dev, &tempword, - FT1000_REG_DOORBELL); - if (tempword & FT1000_DB_DPRAM_TX) - break; - } + status = ft1000_read_register(dev, &tempword, + FT1000_REG_DOORBELL); + if (tempword & FT1000_DB_DPRAM_TX) + break; } - /* Put message into Slow Queue - * Form Pseudo header - */ - pmsg = (u16 *) info->DSPInfoBlk; - *pmsg++ = 0; - *pmsg++ = - htons(info->DSPInfoBlklen + 20 + - info->DSPInfoBlklen); - ppseudo_hdr = - (struct pseudo_hdr *)(u16 *) &info->DSPInfoBlk[2]; - ppseudo_hdr->length = - htons(info->DSPInfoBlklen + 4 + - info->DSPInfoBlklen); + } + /* Put message into Slow Queue Form Pseudo header */ + pmsg = (u16 *) info->DSPInfoBlk; + *pmsg++ = 0; + *pmsg++ = htons(info->DSPInfoBlklen + 20 + info->DSPInfoBlklen); + ppseudo_hdr = + (struct pseudo_hdr *)(u16 *) &info->DSPInfoBlk[2]; + ppseudo_hdr->length = htons(info->DSPInfoBlklen + 4 + + info->DSPInfoBlklen); + ppseudo_hdr->source = 0x10; + ppseudo_hdr->destination = 0x20; + ppseudo_hdr->portdest = 0; + ppseudo_hdr->portsrc = 0; + ppseudo_hdr->sh_str_id = 0; + ppseudo_hdr->control = 0; + ppseudo_hdr->rsvd1 = 0; + ppseudo_hdr->rsvd2 = 0; + ppseudo_hdr->qos_class = 0; + /* Insert slow queue sequence number */ + ppseudo_hdr->seq_num = info->squeseqnum++; + /* Insert application id */ + ppseudo_hdr->portsrc = 0; + /* Calculate new checksum */ + ppseudo_hdr->checksum = *pmsg++; + for (i = 1; i < 7; i++) + ppseudo_hdr->checksum ^= *pmsg++; + + info->DSPInfoBlk[10] = 0x7200; + info->DSPInfoBlk[11] = htons(info->DSPInfoBlklen); + status = ft1000_write_dpram32(dev, 0, + (u8 *)&info->DSPInfoBlk[0], + (unsigned short)(info->DSPInfoBlklen + 22)); + status = ft1000_write_register(dev, FT1000_DB_DPRAM_TX, + FT1000_REG_DOORBELL); + dev->DrvMsgPend = 0; + break; + } + case GET_DRV_ERR_RPT_MSG:{ + DEBUG("FT1000:drivermsg:Got GET_DRV_ERR_RPT_MSG\n"); + /* copy driver error message to dsp */ + dev->DrvMsgPend = 1; + /* allow any outstanding ioctl to finish */ + mdelay(10); + status = ft1000_read_register(dev, &tempword, + FT1000_REG_DOORBELL); + if (tempword & FT1000_DB_DPRAM_TX) { + mdelay(10); + status = ft1000_read_register(dev, &tempword, + FT1000_REG_DOORBELL); + if (tempword & FT1000_DB_DPRAM_TX) + mdelay(10); + } + if ((tempword & FT1000_DB_DPRAM_TX) == 0) { + /* Put message into Slow Queue Form Pseudo header */ + pmsg = (u16 *) &tempbuffer[0]; + ppseudo_hdr = (struct pseudo_hdr *)pmsg; + ppseudo_hdr->length = htons(0x0012); ppseudo_hdr->source = 0x10; ppseudo_hdr->destination = 0x20; ppseudo_hdr->portdest = 0; @@ -1337,90 +1361,28 @@ static int ft1000_proc_drvmsg(struct ft1000_usb *dev, u16 size) for (i = 1; i < 7; i++) ppseudo_hdr->checksum ^= *pmsg++; - info->DSPInfoBlk[10] = 0x7200; - info->DSPInfoBlk[11] = htons(info->DSPInfoBlklen); - status = - ft1000_write_dpram32(dev, 0, - (u8 *) &info->DSPInfoBlk[0], - (unsigned short)(info-> - DSPInfoBlklen - + 22)); - status = - ft1000_write_register(dev, FT1000_DB_DPRAM_TX, - FT1000_REG_DOORBELL); - dev->DrvMsgPend = 0; + pmsg = (u16 *) &tempbuffer[16]; + *pmsg++ = htons(RSP_DRV_ERR_RPT_MSG); + *pmsg++ = htons(0x000e); + *pmsg++ = htons(info->DSP_TIME[0]); + *pmsg++ = htons(info->DSP_TIME[1]); + *pmsg++ = htons(info->DSP_TIME[2]); + *pmsg++ = htons(info->DSP_TIME[3]); + convert.byte[0] = info->DspVer[0]; + convert.byte[1] = info->DspVer[1]; + *pmsg++ = convert.wrd; + convert.byte[0] = info->DspVer[2]; + convert.byte[1] = info->DspVer[3]; + *pmsg++ = convert.wrd; + *pmsg++ = htons(info->DrvErrNum); - break; + card_send_command(dev, (unsigned char *)&tempbuffer[0], + (u16)(0x0012 + PSEUDOSZ)); + info->DrvErrNum = 0; } - - case GET_DRV_ERR_RPT_MSG:{ - DEBUG("FT1000:drivermsg:Got GET_DRV_ERR_RPT_MSG\n"); - /* copy driver error message to dsp */ - dev->DrvMsgPend = 1; - /* allow any outstanding ioctl to finish */ - mdelay(10); - status = - ft1000_read_register(dev, &tempword, - FT1000_REG_DOORBELL); - if (tempword & FT1000_DB_DPRAM_TX) { - mdelay(10); - status = - ft1000_read_register(dev, &tempword, - FT1000_REG_DOORBELL); - if (tempword & FT1000_DB_DPRAM_TX) - mdelay(10); - } - - if ((tempword & FT1000_DB_DPRAM_TX) == 0) { - /* Put message into Slow Queue - * Form Pseudo header - */ - pmsg = (u16 *) &tempbuffer[0]; - ppseudo_hdr = (struct pseudo_hdr *)pmsg; - ppseudo_hdr->length = htons(0x0012); - ppseudo_hdr->source = 0x10; - ppseudo_hdr->destination = 0x20; - ppseudo_hdr->portdest = 0; - ppseudo_hdr->portsrc = 0; - ppseudo_hdr->sh_str_id = 0; - ppseudo_hdr->control = 0; - ppseudo_hdr->rsvd1 = 0; - ppseudo_hdr->rsvd2 = 0; - ppseudo_hdr->qos_class = 0; - /* Insert slow queue sequence number */ - ppseudo_hdr->seq_num = info->squeseqnum++; - /* Insert application id */ - ppseudo_hdr->portsrc = 0; - /* Calculate new checksum */ - ppseudo_hdr->checksum = *pmsg++; - for (i = 1; i < 7; i++) - ppseudo_hdr->checksum ^= *pmsg++; - - pmsg = (u16 *) &tempbuffer[16]; - *pmsg++ = htons(RSP_DRV_ERR_RPT_MSG); - *pmsg++ = htons(0x000e); - *pmsg++ = htons(info->DSP_TIME[0]); - *pmsg++ = htons(info->DSP_TIME[1]); - *pmsg++ = htons(info->DSP_TIME[2]); - *pmsg++ = htons(info->DSP_TIME[3]); - convert.byte[0] = info->DspVer[0]; - convert.byte[1] = info->DspVer[1]; - *pmsg++ = convert.wrd; - convert.byte[0] = info->DspVer[2]; - convert.byte[1] = info->DspVer[3]; - *pmsg++ = convert.wrd; - *pmsg++ = htons(info->DrvErrNum); - - card_send_command(dev, - (unsigned char *)&tempbuffer[0], - (u16) (0x0012 + PSEUDOSZ)); - info->DrvErrNum = 0; - } - dev->DrvMsgPend = 0; - - break; - } - + dev->DrvMsgPend = 0; + break; + } default: break; } From ae6a214b3bbc8978e366b9e0eb4bdc45abdc1559 Mon Sep 17 00:00:00 2001 From: Dulshani Gunawardhana Date: Thu, 31 Oct 2013 00:19:54 +0530 Subject: [PATCH 011/238] staging/cxt1e1:Fixes incorrect brace placement This patch fixes the error "This open brace { should be on the above line" detected via checkpatch.pl. Signed-off-by: Dulshani Gunawardhana Reviewed-by: Zach Brown Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/cxt1e1/comet.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/staging/cxt1e1/comet.c b/drivers/staging/cxt1e1/comet.c index 46a0d92173e0..6b3182aa6dc1 100644 --- a/drivers/staging/cxt1e1/comet.c +++ b/drivers/staging/cxt1e1/comet.c @@ -159,8 +159,7 @@ void init_comet(void *ci, comet_t *comet, u_int32_t port_mode, int clockmaster, /* 60: t1 ALMI cfg */ /* Configure Line Coding */ - switch (port_mode) - { + switch (port_mode) { /* 1 - T1 B8ZS */ case CFG_FRAME_SF: pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0); @@ -286,8 +285,7 @@ void init_comet(void *ci, comet_t *comet, u_int32_t port_mode, int clockmaster, /* 0x30: "BRIF cfg"; 0x20 is 'CMODE', 0x03 is (bit) rate */ /* note "rate bits can only be set once after reset" */ - if (clockmaster) - { + if (clockmaster) { /* CMODE == clockMode, 0=clock master (so all 3 others should be slave) */ /* rate = 1.544 Mb/s */ if (isT1mode) @@ -302,8 +300,7 @@ void init_comet(void *ci, comet_t *comet, u_int32_t port_mode, int clockmaster, /* Master Mode i.e.FPMODE=0 (@0x20) */ pci_write_32((u_int32_t *) &comet->brif_fpcfg, 0x00); - if ((moreParams & CFG_CLK_PORT_MASK) == CFG_CLK_PORT_INTERNAL) - { + if ((moreParams & CFG_CLK_PORT_MASK) == CFG_CLK_PORT_INTERNAL) { if (cxt1e1_log_level >= LOG_SBEBUG12) pr_info(">> %s: clockmaster internal clock\n", __func__); /* internal oscillator */ @@ -422,8 +419,7 @@ WrtXmtWaveformTbl(ci_t *ci, comet_t *comet, { u_int32_t sample, unit; - for (sample = 0; sample < COMET_NUM_SAMPLES; sample++) - { + for (sample = 0; sample < COMET_NUM_SAMPLES; sample++) { for (unit = 0; unit < COMET_NUM_UNITS; unit++) WrtXmtWaveform(ci, comet, sample, unit, table[sample][unit]); } @@ -554,8 +550,7 @@ SetCometOps(comet_t *comet) { volatile u_int8_t rd_value; - if (comet == mConfig.C4Func1Base + (COMET0_OFFSET >> 2)) - { + if (comet == mConfig.C4Func1Base + (COMET0_OFFSET >> 2)) { /* read the BRIF Configuration */ rd_value = (u_int8_t) pci_read_32((u_int32_t *) &comet->brif_cfg); rd_value &= ~0x20; From 89c05d27814c77bd7b6dc86e78d2b0cfbb3e1dea Mon Sep 17 00:00:00 2001 From: Sima Baymani Date: Tue, 5 Nov 2013 21:21:38 +0100 Subject: [PATCH 012/238] staging: cxt1e1: comet.h - fix wrong indentation Reindent needed parts of comet.h per checkpatch warnings - whitespace changes only. This patch introduces long line warnings because of the reindentation. Those warnings are fixed by the next patch in series. Signed-off-by: Sima Baymani Reviewed-by: Lisa Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/cxt1e1/comet.h | 528 ++++++++++++++++----------------- 1 file changed, 264 insertions(+), 264 deletions(-) diff --git a/drivers/staging/cxt1e1/comet.h b/drivers/staging/cxt1e1/comet.h index 03b9bb77a809..9b2166345f55 100644 --- a/drivers/staging/cxt1e1/comet.h +++ b/drivers/staging/cxt1e1/comet.h @@ -27,298 +27,298 @@ struct s_comet_reg { - VINT32 gbl_cfg; /* 00 Global Cfg */ - VINT32 clkmon; /* 01 Clk Monitor */ - VINT32 rx_opt; /* 02 RX Options */ - VINT32 rx_line_cfg; /* 03 RX Line Interface Cfg */ - VINT32 tx_line_cfg; /* 04 TX Line Interface Cfg */ - VINT32 tx_frpass; /* 05 TX Framing & Bypass Options */ - VINT32 tx_time; /* 06 TX Timing Options */ - VINT32 intr_1; /* 07 Intr Source #1 */ - VINT32 intr_2; /* 08 Intr Source #2 */ - VINT32 intr_3; /* 09 Intr Source #3 */ - VINT32 mdiag; /* 0A Master Diagnostics */ - VINT32 mtest; /* 0B Master Test */ - VINT32 adiag; /* 0C Analog Diagnostics */ - VINT32 rev_id; /* 0D Rev/Chip Id/Global PMON Update */ + VINT32 gbl_cfg; /* 00 Global Cfg */ + VINT32 clkmon; /* 01 Clk Monitor */ + VINT32 rx_opt; /* 02 RX Options */ + VINT32 rx_line_cfg; /* 03 RX Line Interface Cfg */ + VINT32 tx_line_cfg; /* 04 TX Line Interface Cfg */ + VINT32 tx_frpass; /* 05 TX Framing & Bypass Options */ + VINT32 tx_time; /* 06 TX Timing Options */ + VINT32 intr_1; /* 07 Intr Source #1 */ + VINT32 intr_2; /* 08 Intr Source #2 */ + VINT32 intr_3; /* 09 Intr Source #3 */ + VINT32 mdiag; /* 0A Master Diagnostics */ + VINT32 mtest; /* 0B Master Test */ + VINT32 adiag; /* 0C Analog Diagnostics */ + VINT32 rev_id; /* 0D Rev/Chip Id/Global PMON Update */ #define pmon rev_id - VINT32 reset; /* 0E Reset */ - VINT32 prgd_phctl; /* 0F PRGD Positioning/Ctl & HDLC Ctl */ - VINT32 cdrc_cfg; /* 10 CDRC Cfg */ - VINT32 cdrc_ien; /* 11 CDRC Intr Enable */ - VINT32 cdrc_ists; /* 12 CDRC Intr Sts */ - VINT32 cdrc_alos; /* 13 CDRC Alternate Loss of Signal */ + VINT32 reset; /* 0E Reset */ + VINT32 prgd_phctl; /* 0F PRGD Positioning/Ctl & HDLC Ctl */ + VINT32 cdrc_cfg; /* 10 CDRC Cfg */ + VINT32 cdrc_ien; /* 11 CDRC Intr Enable */ + VINT32 cdrc_ists; /* 12 CDRC Intr Sts */ + VINT32 cdrc_alos; /* 13 CDRC Alternate Loss of Signal */ - VINT32 rjat_ists; /* 14 RJAT Intr Sts */ - VINT32 rjat_n1clk; /* 15 RJAT Reference Clk Divisor (N1) Ctl */ - VINT32 rjat_n2clk; /* 16 RJAT Output Clk Divisor (N2) Ctl */ - VINT32 rjat_cfg; /* 17 RJAT Cfg */ + VINT32 rjat_ists; /* 14 RJAT Intr Sts */ + VINT32 rjat_n1clk; /* 15 RJAT Reference Clk Divisor (N1) Ctl */ + VINT32 rjat_n2clk; /* 16 RJAT Output Clk Divisor (N2) Ctl */ + VINT32 rjat_cfg; /* 17 RJAT Cfg */ - VINT32 tjat_ists; /* 18 TJAT Intr Sts */ - VINT32 tjat_n1clk; /* 19 TJAT Reference Clk Divisor (N1) Ctl */ - VINT32 tjat_n2clk; /* 1A TJAT Output Clk Divisor (N2) Ctl */ - VINT32 tjat_cfg; /* 1B TJAT Cfg */ + VINT32 tjat_ists; /* 18 TJAT Intr Sts */ + VINT32 tjat_n1clk; /* 19 TJAT Reference Clk Divisor (N1) Ctl */ + VINT32 tjat_n2clk; /* 1A TJAT Output Clk Divisor (N2) Ctl */ + VINT32 tjat_cfg; /* 1B TJAT Cfg */ - VINT32 rx_elst_cfg; /* 1C RX-ELST Cfg */ - VINT32 rx_elst_ists; /* 1D RX-ELST Intr Sts */ - VINT32 rx_elst_idle; /* 1E RX-ELST Idle Code */ - VINT32 _rx_elst_res1f; /* 1F RX-ELST Reserved */ + VINT32 rx_elst_cfg; /* 1C RX-ELST Cfg */ + VINT32 rx_elst_ists; /* 1D RX-ELST Intr Sts */ + VINT32 rx_elst_idle; /* 1E RX-ELST Idle Code */ + VINT32 _rx_elst_res1f; /* 1F RX-ELST Reserved */ - VINT32 tx_elst_cfg; /* 20 TX-ELST Cfg */ - VINT32 tx_elst_ists; /* 21 TX-ELST Intr Sts */ - VINT32 _tx_elst_res22; /* 22 TX-ELST Reserved */ - VINT32 _tx_elst_res23; /* 23 TX-ELST Reserved */ - VINT32 __res24; /* 24 Reserved */ - VINT32 __res25; /* 25 Reserved */ - VINT32 __res26; /* 26 Reserved */ - VINT32 __res27; /* 27 Reserved */ + VINT32 tx_elst_cfg; /* 20 TX-ELST Cfg */ + VINT32 tx_elst_ists; /* 21 TX-ELST Intr Sts */ + VINT32 _tx_elst_res22; /* 22 TX-ELST Reserved */ + VINT32 _tx_elst_res23; /* 23 TX-ELST Reserved */ + VINT32 __res24; /* 24 Reserved */ + VINT32 __res25; /* 25 Reserved */ + VINT32 __res26; /* 26 Reserved */ + VINT32 __res27; /* 27 Reserved */ - VINT32 rxce1_ctl; /* 28 RXCE RX Data Link 1 Ctl */ - VINT32 rxce1_bits; /* 29 RXCE RX Data Link 1 Bit Select */ - VINT32 rxce2_ctl; /* 2A RXCE RX Data Link 2 Ctl */ - VINT32 rxce2_bits; /* 2B RXCE RX Data Link 2 Bit Select */ - VINT32 rxce3_ctl; /* 2C RXCE RX Data Link 3 Ctl */ - VINT32 rxce3_bits; /* 2D RXCE RX Data Link 3 Bit Select */ - VINT32 _rxce_res2E; /* 2E RXCE Reserved */ - VINT32 _rxce_res2F; /* 2F RXCE Reserved */ + VINT32 rxce1_ctl; /* 28 RXCE RX Data Link 1 Ctl */ + VINT32 rxce1_bits; /* 29 RXCE RX Data Link 1 Bit Select */ + VINT32 rxce2_ctl; /* 2A RXCE RX Data Link 2 Ctl */ + VINT32 rxce2_bits; /* 2B RXCE RX Data Link 2 Bit Select */ + VINT32 rxce3_ctl; /* 2C RXCE RX Data Link 3 Ctl */ + VINT32 rxce3_bits; /* 2D RXCE RX Data Link 3 Bit Select */ + VINT32 _rxce_res2E; /* 2E RXCE Reserved */ + VINT32 _rxce_res2F; /* 2F RXCE Reserved */ - VINT32 brif_cfg; /* 30 BRIF RX Backplane Cfg */ - VINT32 brif_fpcfg; /* 31 BRIF RX Backplane Frame Pulse Cfg */ - VINT32 brif_pfcfg; /* 32 BRIF RX Backplane Parity/F-Bit Cfg */ - VINT32 brif_tsoff; /* 33 BRIF RX Backplane Time Slot Offset */ - VINT32 brif_boff; /* 34 BRIF RX Backplane Bit Offset */ - VINT32 _brif_res35; /* 35 BRIF RX Backplane Reserved */ - VINT32 _brif_res36; /* 36 BRIF RX Backplane Reserved */ - VINT32 _brif_res37; /* 37 BRIF RX Backplane Reserved */ + VINT32 brif_cfg; /* 30 BRIF RX Backplane Cfg */ + VINT32 brif_fpcfg; /* 31 BRIF RX Backplane Frame Pulse Cfg */ + VINT32 brif_pfcfg; /* 32 BRIF RX Backplane Parity/F-Bit Cfg */ + VINT32 brif_tsoff; /* 33 BRIF RX Backplane Time Slot Offset */ + VINT32 brif_boff; /* 34 BRIF RX Backplane Bit Offset */ + VINT32 _brif_res35; /* 35 BRIF RX Backplane Reserved */ + VINT32 _brif_res36; /* 36 BRIF RX Backplane Reserved */ + VINT32 _brif_res37; /* 37 BRIF RX Backplane Reserved */ - VINT32 txci1_ctl; /* 38 TXCI TX Data Link 1 Ctl */ - VINT32 txci1_bits; /* 39 TXCI TX Data Link 2 Bit Select */ - VINT32 txci2_ctl; /* 3A TXCI TX Data Link 1 Ctl */ - VINT32 txci2_bits; /* 3B TXCI TX Data Link 2 Bit Select */ - VINT32 txci3_ctl; /* 3C TXCI TX Data Link 1 Ctl */ - VINT32 txci3_bits; /* 3D TXCI TX Data Link 2 Bit Select */ - VINT32 _txci_res3E; /* 3E TXCI Reserved */ - VINT32 _txci_res3F; /* 3F TXCI Reserved */ + VINT32 txci1_ctl; /* 38 TXCI TX Data Link 1 Ctl */ + VINT32 txci1_bits; /* 39 TXCI TX Data Link 2 Bit Select */ + VINT32 txci2_ctl; /* 3A TXCI TX Data Link 1 Ctl */ + VINT32 txci2_bits; /* 3B TXCI TX Data Link 2 Bit Select */ + VINT32 txci3_ctl; /* 3C TXCI TX Data Link 1 Ctl */ + VINT32 txci3_bits; /* 3D TXCI TX Data Link 2 Bit Select */ + VINT32 _txci_res3E; /* 3E TXCI Reserved */ + VINT32 _txci_res3F; /* 3F TXCI Reserved */ - VINT32 btif_cfg; /* 40 BTIF TX Backplane Cfg */ - VINT32 btif_fpcfg; /* 41 BTIF TX Backplane Frame Pulse Cfg */ - VINT32 btif_pcfgsts; /* 42 BTIF TX Backplane Parity Cfg & Sts */ - VINT32 btif_tsoff; /* 43 BTIF TX Backplane Time Slot Offset */ - VINT32 btif_boff; /* 44 BTIF TX Backplane Bit Offset */ - VINT32 _btif_res45; /* 45 BTIF TX Backplane Reserved */ - VINT32 _btif_res46; /* 46 BTIF TX Backplane Reserved */ - VINT32 _btif_res47; /* 47 BTIF TX Backplane Reserved */ - VINT32 t1_frmr_cfg; /* 48 T1 FRMR Cfg */ - VINT32 t1_frmr_ien; /* 49 T1 FRMR Intr Enable */ - VINT32 t1_frmr_ists; /* 4A T1 FRMR Intr Sts */ - VINT32 __res_4B; /* 4B Reserved */ - VINT32 ibcd_cfg; /* 4C IBCD Cfg */ - VINT32 ibcd_ies; /* 4D IBCD Intr Enable/Sts */ - VINT32 ibcd_act; /* 4E IBCD Activate Code */ - VINT32 ibcd_deact; /* 4F IBCD Deactivate Code */ + VINT32 btif_cfg; /* 40 BTIF TX Backplane Cfg */ + VINT32 btif_fpcfg; /* 41 BTIF TX Backplane Frame Pulse Cfg */ + VINT32 btif_pcfgsts; /* 42 BTIF TX Backplane Parity Cfg & Sts */ + VINT32 btif_tsoff; /* 43 BTIF TX Backplane Time Slot Offset */ + VINT32 btif_boff; /* 44 BTIF TX Backplane Bit Offset */ + VINT32 _btif_res45; /* 45 BTIF TX Backplane Reserved */ + VINT32 _btif_res46; /* 46 BTIF TX Backplane Reserved */ + VINT32 _btif_res47; /* 47 BTIF TX Backplane Reserved */ + VINT32 t1_frmr_cfg; /* 48 T1 FRMR Cfg */ + VINT32 t1_frmr_ien; /* 49 T1 FRMR Intr Enable */ + VINT32 t1_frmr_ists; /* 4A T1 FRMR Intr Sts */ + VINT32 __res_4B; /* 4B Reserved */ + VINT32 ibcd_cfg; /* 4C IBCD Cfg */ + VINT32 ibcd_ies; /* 4D IBCD Intr Enable/Sts */ + VINT32 ibcd_act; /* 4E IBCD Activate Code */ + VINT32 ibcd_deact; /* 4F IBCD Deactivate Code */ - VINT32 sigx_cfg; /* 50 SIGX Cfg/Change of Signaling State */ - VINT32 sigx_acc_cos; /* 51 SIGX uP Access Sts/Change of Signaling State */ - VINT32 sigx_iac_cos; /* 52 SIGX Channel Indirect - * Addr/Ctl/Change of Signaling State */ - VINT32 sigx_idb_cos; /* 53 SIGX Channel Indirect Data - * Buffer/Change of Signaling State */ + VINT32 sigx_cfg; /* 50 SIGX Cfg/Change of Signaling State */ + VINT32 sigx_acc_cos; /* 51 SIGX uP Access Sts/Change of Signaling State */ + VINT32 sigx_iac_cos; /* 52 SIGX Channel Indirect + * Addr/Ctl/Change of Signaling State */ + VINT32 sigx_idb_cos; /* 53 SIGX Channel Indirect Data + * Buffer/Change of Signaling State */ - VINT32 t1_xbas_cfg; /* 54 T1 XBAS Cfg */ - VINT32 t1_xbas_altx; /* 55 T1 XBAS Alarm TX */ - VINT32 t1_xibc_ctl; /* 56 T1 XIBC Ctl */ - VINT32 t1_xibc_lbcode; /* 57 T1 XIBC Loopback Code */ + VINT32 t1_xbas_cfg; /* 54 T1 XBAS Cfg */ + VINT32 t1_xbas_altx; /* 55 T1 XBAS Alarm TX */ + VINT32 t1_xibc_ctl; /* 56 T1 XIBC Ctl */ + VINT32 t1_xibc_lbcode; /* 57 T1 XIBC Loopback Code */ - VINT32 pmon_ies; /* 58 PMON Intr Enable/Sts */ - VINT32 pmon_fberr; /* 59 PMON Framing Bit Err Cnt */ - VINT32 pmon_feb_lsb; /* 5A PMON OFF/COFA/Far End Block Err Cnt (LSB) */ - VINT32 pmon_feb_msb; /* 5B PMON OFF/COFA/Far End Block Err Cnt (MSB) */ - VINT32 pmon_bed_lsb; /* 5C PMON Bit/Err/CRCE Cnt (LSB) */ - VINT32 pmon_bed_msb; /* 5D PMON Bit/Err/CRCE Cnt (MSB) */ - VINT32 pmon_lvc_lsb; /* 5E PMON LVC Cnt (LSB) */ - VINT32 pmon_lvc_msb; /* 5F PMON LVC Cnt (MSB) */ + VINT32 pmon_ies; /* 58 PMON Intr Enable/Sts */ + VINT32 pmon_fberr; /* 59 PMON Framing Bit Err Cnt */ + VINT32 pmon_feb_lsb; /* 5A PMON OFF/COFA/Far End Block Err Cnt (LSB) */ + VINT32 pmon_feb_msb; /* 5B PMON OFF/COFA/Far End Block Err Cnt (MSB) */ + VINT32 pmon_bed_lsb; /* 5C PMON Bit/Err/CRCE Cnt (LSB) */ + VINT32 pmon_bed_msb; /* 5D PMON Bit/Err/CRCE Cnt (MSB) */ + VINT32 pmon_lvc_lsb; /* 5E PMON LVC Cnt (LSB) */ + VINT32 pmon_lvc_msb; /* 5F PMON LVC Cnt (MSB) */ - VINT32 t1_almi_cfg; /* 60 T1 ALMI Cfg */ - VINT32 t1_almi_ien; /* 61 T1 ALMI Intr Enable */ - VINT32 t1_almi_ists; /* 62 T1 ALMI Intr Sts */ - VINT32 t1_almi_detsts; /* 63 T1 ALMI Alarm Detection Sts */ + VINT32 t1_almi_cfg; /* 60 T1 ALMI Cfg */ + VINT32 t1_almi_ien; /* 61 T1 ALMI Intr Enable */ + VINT32 t1_almi_ists; /* 62 T1 ALMI Intr Sts */ + VINT32 t1_almi_detsts; /* 63 T1 ALMI Alarm Detection Sts */ - VINT32 _t1_pdvd_res64; /* 64 T1 PDVD Reserved */ - VINT32 t1_pdvd_ies; /* 65 T1 PDVD Intr Enable/Sts */ - VINT32 _t1_xboc_res66; /* 66 T1 XBOC Reserved */ - VINT32 t1_xboc_code; /* 67 T1 XBOC Code */ - VINT32 _t1_xpde_res68; /* 68 T1 XPDE Reserved */ - VINT32 t1_xpde_ies; /* 69 T1 XPDE Intr Enable/Sts */ + VINT32 _t1_pdvd_res64; /* 64 T1 PDVD Reserved */ + VINT32 t1_pdvd_ies; /* 65 T1 PDVD Intr Enable/Sts */ + VINT32 _t1_xboc_res66; /* 66 T1 XBOC Reserved */ + VINT32 t1_xboc_code; /* 67 T1 XBOC Code */ + VINT32 _t1_xpde_res68; /* 68 T1 XPDE Reserved */ + VINT32 t1_xpde_ies; /* 69 T1 XPDE Intr Enable/Sts */ - VINT32 t1_rboc_ena; /* 6A T1 RBOC Enable */ - VINT32 t1_rboc_sts; /* 6B T1 RBOC Code Sts */ + VINT32 t1_rboc_ena; /* 6A T1 RBOC Enable */ + VINT32 t1_rboc_sts; /* 6B T1 RBOC Code Sts */ - VINT32 t1_tpsc_cfg; /* 6C TPSC Cfg */ - VINT32 t1_tpsc_sts; /* 6D TPSC uP Access Sts */ - VINT32 t1_tpsc_ciaddr; /* 6E TPSC Channel Indirect - * Addr/Ctl */ - VINT32 t1_tpsc_cidata; /* 6F TPSC Channel Indirect Data - * Buffer */ - VINT32 t1_rpsc_cfg; /* 70 RPSC Cfg */ - VINT32 t1_rpsc_sts; /* 71 RPSC uP Access Sts */ - VINT32 t1_rpsc_ciaddr; /* 72 RPSC Channel Indirect - * Addr/Ctl */ - VINT32 t1_rpsc_cidata; /* 73 RPSC Channel Indirect Data - * Buffer */ - VINT32 __res74; /* 74 Reserved */ - VINT32 __res75; /* 75 Reserved */ - VINT32 __res76; /* 76 Reserved */ - VINT32 __res77; /* 77 Reserved */ + VINT32 t1_tpsc_cfg; /* 6C TPSC Cfg */ + VINT32 t1_tpsc_sts; /* 6D TPSC uP Access Sts */ + VINT32 t1_tpsc_ciaddr; /* 6E TPSC Channel Indirect + * Addr/Ctl */ + VINT32 t1_tpsc_cidata; /* 6F TPSC Channel Indirect Data + * Buffer */ + VINT32 t1_rpsc_cfg; /* 70 RPSC Cfg */ + VINT32 t1_rpsc_sts; /* 71 RPSC uP Access Sts */ + VINT32 t1_rpsc_ciaddr; /* 72 RPSC Channel Indirect + * Addr/Ctl */ + VINT32 t1_rpsc_cidata; /* 73 RPSC Channel Indirect Data + * Buffer */ + VINT32 __res74; /* 74 Reserved */ + VINT32 __res75; /* 75 Reserved */ + VINT32 __res76; /* 76 Reserved */ + VINT32 __res77; /* 77 Reserved */ - VINT32 t1_aprm_cfg; /* 78 T1 APRM Cfg/Ctl */ - VINT32 t1_aprm_load; /* 79 T1 APRM Manual Load */ - VINT32 t1_aprm_ists; /* 7A T1 APRM Intr Sts */ - VINT32 t1_aprm_1sec_2; /* 7B T1 APRM One Second Content Octet 2 */ - VINT32 t1_aprm_1sec_3; /* 7C T1 APRM One Second Content Octet 3 */ - VINT32 t1_aprm_1sec_4; /* 7D T1 APRM One Second Content Octet 4 */ - VINT32 t1_aprm_1sec_5; /* 7E T1 APRM One Second Content MSB (Octect 5) */ - VINT32 t1_aprm_1sec_6; /* 7F T1 APRM One Second Content MSB (Octect 6) */ + VINT32 t1_aprm_cfg; /* 78 T1 APRM Cfg/Ctl */ + VINT32 t1_aprm_load; /* 79 T1 APRM Manual Load */ + VINT32 t1_aprm_ists; /* 7A T1 APRM Intr Sts */ + VINT32 t1_aprm_1sec_2; /* 7B T1 APRM One Second Content Octet 2 */ + VINT32 t1_aprm_1sec_3; /* 7C T1 APRM One Second Content Octet 3 */ + VINT32 t1_aprm_1sec_4; /* 7D T1 APRM One Second Content Octet 4 */ + VINT32 t1_aprm_1sec_5; /* 7E T1 APRM One Second Content MSB (Octect 5) */ + VINT32 t1_aprm_1sec_6; /* 7F T1 APRM One Second Content MSB (Octect 6) */ - VINT32 e1_tran_cfg; /* 80 E1 TRAN Cfg */ - VINT32 e1_tran_txalarm; /* 81 E1 TRAN TX Alarm/Diagnostic Ctl */ - VINT32 e1_tran_intctl; /* 82 E1 TRAN International Ctl */ - VINT32 e1_tran_extrab; /* 83 E1 TRAN Extra Bits Ctl */ - VINT32 e1_tran_ien; /* 84 E1 TRAN Intr Enable */ - VINT32 e1_tran_ists; /* 85 E1 TRAN Intr Sts */ - VINT32 e1_tran_nats; /* 86 E1 TRAN National Bit Codeword - * Select */ - VINT32 e1_tran_nat; /* 87 E1 TRAN National Bit Codeword */ - VINT32 __res88; /* 88 Reserved */ - VINT32 __res89; /* 89 Reserved */ - VINT32 __res8A; /* 8A Reserved */ - VINT32 __res8B; /* 8B Reserved */ + VINT32 e1_tran_cfg; /* 80 E1 TRAN Cfg */ + VINT32 e1_tran_txalarm; /* 81 E1 TRAN TX Alarm/Diagnostic Ctl */ + VINT32 e1_tran_intctl; /* 82 E1 TRAN International Ctl */ + VINT32 e1_tran_extrab; /* 83 E1 TRAN Extra Bits Ctl */ + VINT32 e1_tran_ien; /* 84 E1 TRAN Intr Enable */ + VINT32 e1_tran_ists; /* 85 E1 TRAN Intr Sts */ + VINT32 e1_tran_nats; /* 86 E1 TRAN National Bit Codeword + * Select */ + VINT32 e1_tran_nat; /* 87 E1 TRAN National Bit Codeword */ + VINT32 __res88; /* 88 Reserved */ + VINT32 __res89; /* 89 Reserved */ + VINT32 __res8A; /* 8A Reserved */ + VINT32 __res8B; /* 8B Reserved */ - VINT32 _t1_frmr_res8C; /* 8C T1 FRMR Reserved */ - VINT32 _t1_frmr_res8D; /* 8D T1 FRMR Reserved */ - VINT32 __res8E; /* 8E Reserved */ - VINT32 __res8F; /* 8F Reserved */ + VINT32 _t1_frmr_res8C; /* 8C T1 FRMR Reserved */ + VINT32 _t1_frmr_res8D; /* 8D T1 FRMR Reserved */ + VINT32 __res8E; /* 8E Reserved */ + VINT32 __res8F; /* 8F Reserved */ - VINT32 e1_frmr_aopts; /* 90 E1 FRMR Frame Alignment Options */ - VINT32 e1_frmr_mopts; /* 91 E1 FRMR Maintenance Mode Options */ - VINT32 e1_frmr_ien; /* 92 E1 FRMR Framing Sts Intr Enable */ - VINT32 e1_frmr_mien; /* 93 E1 FRMR Maintenance/Alarm Sts Intr Enable */ - VINT32 e1_frmr_ists; /* 94 E1 FRMR Framing Sts Intr Indication */ - VINT32 e1_frmr_mists; /* 95 E1 FRMR Maintenance/Alarm Sts Indication Enable */ - VINT32 e1_frmr_sts; /* 96 E1 FRMR Framing Sts */ - VINT32 e1_frmr_masts; /* 97 E1 FRMR Maintenance/Alarm Sts */ - VINT32 e1_frmr_nat_bits; /* 98 E1 FRMR International/National Bits */ - VINT32 e1_frmr_crc_lsb; /* 99 E1 FRMR CRC Err Cnt - LSB */ - VINT32 e1_frmr_crc_msb; /* 9A E1 FRMR CRC Err Cnt - MSB */ - VINT32 e1_frmr_nat_ien; /* 9B E1 FRMR National Bit Codeword Intr Enables */ - VINT32 e1_frmr_nat_ists; /* 9C E1 FRMR National Bit Codeword Intr/Sts */ - VINT32 e1_frmr_nat; /* 9D E1 FRMR National Bit Codewords */ - VINT32 e1_frmr_fp_ien; /* 9E E1 FRMR Frame Pulse/Alarm Intr Enables */ - VINT32 e1_frmr_fp_ists; /* 9F E1 FRMR Frame Pulse/Alarm Intr/Sts */ + VINT32 e1_frmr_aopts; /* 90 E1 FRMR Frame Alignment Options */ + VINT32 e1_frmr_mopts; /* 91 E1 FRMR Maintenance Mode Options */ + VINT32 e1_frmr_ien; /* 92 E1 FRMR Framing Sts Intr Enable */ + VINT32 e1_frmr_mien; /* 93 E1 FRMR Maintenance/Alarm Sts Intr Enable */ + VINT32 e1_frmr_ists; /* 94 E1 FRMR Framing Sts Intr Indication */ + VINT32 e1_frmr_mists; /* 95 E1 FRMR Maintenance/Alarm Sts Indication Enable */ + VINT32 e1_frmr_sts; /* 96 E1 FRMR Framing Sts */ + VINT32 e1_frmr_masts; /* 97 E1 FRMR Maintenance/Alarm Sts */ + VINT32 e1_frmr_nat_bits; /* 98 E1 FRMR International/National Bits */ + VINT32 e1_frmr_crc_lsb; /* 99 E1 FRMR CRC Err Cnt - LSB */ + VINT32 e1_frmr_crc_msb; /* 9A E1 FRMR CRC Err Cnt - MSB */ + VINT32 e1_frmr_nat_ien; /* 9B E1 FRMR National Bit Codeword Intr Enables */ + VINT32 e1_frmr_nat_ists; /* 9C E1 FRMR National Bit Codeword Intr/Sts */ + VINT32 e1_frmr_nat; /* 9D E1 FRMR National Bit Codewords */ + VINT32 e1_frmr_fp_ien; /* 9E E1 FRMR Frame Pulse/Alarm Intr Enables */ + VINT32 e1_frmr_fp_ists; /* 9F E1 FRMR Frame Pulse/Alarm Intr/Sts */ - VINT32 __resA0; /* A0 Reserved */ - VINT32 __resA1; /* A1 Reserved */ - VINT32 __resA2; /* A2 Reserved */ - VINT32 __resA3; /* A3 Reserved */ - VINT32 __resA4; /* A4 Reserved */ - VINT32 __resA5; /* A5 Reserved */ - VINT32 __resA6; /* A6 Reserved */ - VINT32 __resA7; /* A7 Reserved */ + VINT32 __resA0; /* A0 Reserved */ + VINT32 __resA1; /* A1 Reserved */ + VINT32 __resA2; /* A2 Reserved */ + VINT32 __resA3; /* A3 Reserved */ + VINT32 __resA4; /* A4 Reserved */ + VINT32 __resA5; /* A5 Reserved */ + VINT32 __resA6; /* A6 Reserved */ + VINT32 __resA7; /* A7 Reserved */ - VINT32 tdpr1_cfg; /* A8 TDPR #1 Cfg */ - VINT32 tdpr1_utl; /* A9 TDPR #1 Upper TX Threshold */ - VINT32 tdpr1_ltl; /* AA TDPR #1 Lower TX Threshold */ - VINT32 tdpr1_ien; /* AB TDPR #1 Intr Enable */ - VINT32 tdpr1_ists; /* AC TDPR #1 Intr Sts/UDR Clear */ - VINT32 tdpr1_data; /* AD TDPR #1 TX Data */ - VINT32 __resAE; /* AE Reserved */ - VINT32 __resAF; /* AF Reserved */ - VINT32 tdpr2_cfg; /* B0 TDPR #2 Cfg */ - VINT32 tdpr2_utl; /* B1 TDPR #2 Upper TX Threshold */ - VINT32 tdpr2_ltl; /* B2 TDPR #2 Lower TX Threshold */ - VINT32 tdpr2_ien; /* B3 TDPR #2 Intr Enable */ - VINT32 tdpr2_ists; /* B4 TDPR #2 Intr Sts/UDR Clear */ - VINT32 tdpr2_data; /* B5 TDPR #2 TX Data */ - VINT32 __resB6; /* B6 Reserved */ - VINT32 __resB7; /* B7 Reserved1 */ - VINT32 tdpr3_cfg; /* B8 TDPR #3 Cfg */ - VINT32 tdpr3_utl; /* B9 TDPR #3 Upper TX Threshold */ - VINT32 tdpr3_ltl; /* BA TDPR #3 Lower TX Threshold */ - VINT32 tdpr3_ien; /* BB TDPR #3 Intr Enable */ - VINT32 tdpr3_ists; /* BC TDPR #3 Intr Sts/UDR Clear */ - VINT32 tdpr3_data; /* BD TDPR #3 TX Data */ - VINT32 __resBE; /* BE Reserved */ - VINT32 __resBF; /* BF Reserved */ + VINT32 tdpr1_cfg; /* A8 TDPR #1 Cfg */ + VINT32 tdpr1_utl; /* A9 TDPR #1 Upper TX Threshold */ + VINT32 tdpr1_ltl; /* AA TDPR #1 Lower TX Threshold */ + VINT32 tdpr1_ien; /* AB TDPR #1 Intr Enable */ + VINT32 tdpr1_ists; /* AC TDPR #1 Intr Sts/UDR Clear */ + VINT32 tdpr1_data; /* AD TDPR #1 TX Data */ + VINT32 __resAE; /* AE Reserved */ + VINT32 __resAF; /* AF Reserved */ + VINT32 tdpr2_cfg; /* B0 TDPR #2 Cfg */ + VINT32 tdpr2_utl; /* B1 TDPR #2 Upper TX Threshold */ + VINT32 tdpr2_ltl; /* B2 TDPR #2 Lower TX Threshold */ + VINT32 tdpr2_ien; /* B3 TDPR #2 Intr Enable */ + VINT32 tdpr2_ists; /* B4 TDPR #2 Intr Sts/UDR Clear */ + VINT32 tdpr2_data; /* B5 TDPR #2 TX Data */ + VINT32 __resB6; /* B6 Reserved */ + VINT32 __resB7; /* B7 Reserved1 */ + VINT32 tdpr3_cfg; /* B8 TDPR #3 Cfg */ + VINT32 tdpr3_utl; /* B9 TDPR #3 Upper TX Threshold */ + VINT32 tdpr3_ltl; /* BA TDPR #3 Lower TX Threshold */ + VINT32 tdpr3_ien; /* BB TDPR #3 Intr Enable */ + VINT32 tdpr3_ists; /* BC TDPR #3 Intr Sts/UDR Clear */ + VINT32 tdpr3_data; /* BD TDPR #3 TX Data */ + VINT32 __resBE; /* BE Reserved */ + VINT32 __resBF; /* BF Reserved */ - VINT32 rdlc1_cfg; /* C0 RDLC #1 Cfg */ - VINT32 rdlc1_intctl; /* C1 RDLC #1 Intr Ctl */ - VINT32 rdlc1_sts; /* C2 RDLC #1 Sts */ - VINT32 rdlc1_data; /* C3 RDLC #1 Data */ - VINT32 rdlc1_paddr; /* C4 RDLC #1 Primary Addr Match */ - VINT32 rdlc1_saddr; /* C5 RDLC #1 Secondary Addr Match */ - VINT32 __resC6; /* C6 Reserved */ - VINT32 __resC7; /* C7 Reserved */ - VINT32 rdlc2_cfg; /* C8 RDLC #2 Cfg */ - VINT32 rdlc2_intctl; /* C9 RDLC #2 Intr Ctl */ - VINT32 rdlc2_sts; /* CA RDLC #2 Sts */ - VINT32 rdlc2_data; /* CB RDLC #2 Data */ - VINT32 rdlc2_paddr; /* CC RDLC #2 Primary Addr Match */ - VINT32 rdlc2_saddr; /* CD RDLC #2 Secondary Addr Match */ - VINT32 __resCE; /* CE Reserved */ - VINT32 __resCF; /* CF Reserved */ - VINT32 rdlc3_cfg; /* D0 RDLC #3 Cfg */ - VINT32 rdlc3_intctl; /* D1 RDLC #3 Intr Ctl */ - VINT32 rdlc3_sts; /* D2 RDLC #3 Sts */ - VINT32 rdlc3_data; /* D3 RDLC #3 Data */ - VINT32 rdlc3_paddr; /* D4 RDLC #3 Primary Addr Match */ - VINT32 rdlc3_saddr; /* D5 RDLC #3 Secondary Addr Match */ + VINT32 rdlc1_cfg; /* C0 RDLC #1 Cfg */ + VINT32 rdlc1_intctl; /* C1 RDLC #1 Intr Ctl */ + VINT32 rdlc1_sts; /* C2 RDLC #1 Sts */ + VINT32 rdlc1_data; /* C3 RDLC #1 Data */ + VINT32 rdlc1_paddr; /* C4 RDLC #1 Primary Addr Match */ + VINT32 rdlc1_saddr; /* C5 RDLC #1 Secondary Addr Match */ + VINT32 __resC6; /* C6 Reserved */ + VINT32 __resC7; /* C7 Reserved */ + VINT32 rdlc2_cfg; /* C8 RDLC #2 Cfg */ + VINT32 rdlc2_intctl; /* C9 RDLC #2 Intr Ctl */ + VINT32 rdlc2_sts; /* CA RDLC #2 Sts */ + VINT32 rdlc2_data; /* CB RDLC #2 Data */ + VINT32 rdlc2_paddr; /* CC RDLC #2 Primary Addr Match */ + VINT32 rdlc2_saddr; /* CD RDLC #2 Secondary Addr Match */ + VINT32 __resCE; /* CE Reserved */ + VINT32 __resCF; /* CF Reserved */ + VINT32 rdlc3_cfg; /* D0 RDLC #3 Cfg */ + VINT32 rdlc3_intctl; /* D1 RDLC #3 Intr Ctl */ + VINT32 rdlc3_sts; /* D2 RDLC #3 Sts */ + VINT32 rdlc3_data; /* D3 RDLC #3 Data */ + VINT32 rdlc3_paddr; /* D4 RDLC #3 Primary Addr Match */ + VINT32 rdlc3_saddr; /* D5 RDLC #3 Secondary Addr Match */ - VINT32 csu_cfg; /* D6 CSU Cfg */ - VINT32 _csu_resD7; /* D7 CSU Reserved */ + VINT32 csu_cfg; /* D6 CSU Cfg */ + VINT32 _csu_resD7; /* D7 CSU Reserved */ - VINT32 rlps_idata3; /* D8 RLPS Indirect Data, 24-31 */ - VINT32 rlps_idata2; /* D9 RLPS Indirect Data, 16-23 */ - VINT32 rlps_idata1; /* DA RLPS Indirect Data, 8-15 */ - VINT32 rlps_idata0; /* DB RLPS Indirect Data, 0-7 */ - VINT32 rlps_eqvr; /* DC RLPS Equalizer Voltage Reference - * (E1 missing) */ - VINT32 _rlps_resDD; /* DD RLPS Reserved */ - VINT32 _rlps_resDE; /* DE RLPS Reserved */ - VINT32 _rlps_resDF; /* DF RLPS Reserved */ + VINT32 rlps_idata3; /* D8 RLPS Indirect Data, 24-31 */ + VINT32 rlps_idata2; /* D9 RLPS Indirect Data, 16-23 */ + VINT32 rlps_idata1; /* DA RLPS Indirect Data, 8-15 */ + VINT32 rlps_idata0; /* DB RLPS Indirect Data, 0-7 */ + VINT32 rlps_eqvr; /* DC RLPS Equalizer Voltage Reference + * (E1 missing) */ + VINT32 _rlps_resDD; /* DD RLPS Reserved */ + VINT32 _rlps_resDE; /* DE RLPS Reserved */ + VINT32 _rlps_resDF; /* DF RLPS Reserved */ - VINT32 prgd_ctl; /* E0 PRGD Ctl */ - VINT32 prgd_ies; /* E1 PRGD Intr Enable/Sts */ - VINT32 prgd_shift_len; /* E2 PRGD Shift Length */ - VINT32 prgd_tap; /* E3 PRGD Tap */ - VINT32 prgd_errin; /* E4 PRGD Err Insertion */ - VINT32 _prgd_resE5; /* E5 PRGD Reserved */ - VINT32 _prgd_resE6; /* E6 PRGD Reserved */ - VINT32 _prgd_resE7; /* E7 PRGD Reserved */ - VINT32 prgd_patin1; /* E8 PRGD Pattern Insertion #1 */ - VINT32 prgd_patin2; /* E9 PRGD Pattern Insertion #2 */ - VINT32 prgd_patin3; /* EA PRGD Pattern Insertion #3 */ - VINT32 prgd_patin4; /* EB PRGD Pattern Insertion #4 */ - VINT32 prgd_patdet1; /* EC PRGD Pattern Detector #1 */ - VINT32 prgd_patdet2; /* ED PRGD Pattern Detector #2 */ - VINT32 prgd_patdet3; /* EE PRGD Pattern Detector #3 */ - VINT32 prgd_patdet4; /* EF PRGD Pattern Detector #4 */ + VINT32 prgd_ctl; /* E0 PRGD Ctl */ + VINT32 prgd_ies; /* E1 PRGD Intr Enable/Sts */ + VINT32 prgd_shift_len; /* E2 PRGD Shift Length */ + VINT32 prgd_tap; /* E3 PRGD Tap */ + VINT32 prgd_errin; /* E4 PRGD Err Insertion */ + VINT32 _prgd_resE5; /* E5 PRGD Reserved */ + VINT32 _prgd_resE6; /* E6 PRGD Reserved */ + VINT32 _prgd_resE7; /* E7 PRGD Reserved */ + VINT32 prgd_patin1; /* E8 PRGD Pattern Insertion #1 */ + VINT32 prgd_patin2; /* E9 PRGD Pattern Insertion #2 */ + VINT32 prgd_patin3; /* EA PRGD Pattern Insertion #3 */ + VINT32 prgd_patin4; /* EB PRGD Pattern Insertion #4 */ + VINT32 prgd_patdet1; /* EC PRGD Pattern Detector #1 */ + VINT32 prgd_patdet2; /* ED PRGD Pattern Detector #2 */ + VINT32 prgd_patdet3; /* EE PRGD Pattern Detector #3 */ + VINT32 prgd_patdet4; /* EF PRGD Pattern Detector #4 */ - VINT32 xlpg_cfg; /* F0 XLPG Line Driver Cfg */ - VINT32 xlpg_ctlsts; /* F1 XLPG Ctl/Sts */ - VINT32 xlpg_pwave_addr; /* F2 XLPG Pulse Waveform Storage Write Addr */ - VINT32 xlpg_pwave_data; /* F3 XLPG Pulse Waveform Storage Data */ - VINT32 xlpg_atest_pctl; /* F4 XLPG Analog Test Positive Ctl */ - VINT32 xlpg_atest_nctl; /* F5 XLPG Analog Test Negative Ctl */ - VINT32 xlpg_fdata_sel; /* F6 XLPG Fuse Data Select */ - VINT32 _xlpg_resF7; /* F7 XLPG Reserved */ + VINT32 xlpg_cfg; /* F0 XLPG Line Driver Cfg */ + VINT32 xlpg_ctlsts; /* F1 XLPG Ctl/Sts */ + VINT32 xlpg_pwave_addr; /* F2 XLPG Pulse Waveform Storage Write Addr */ + VINT32 xlpg_pwave_data; /* F3 XLPG Pulse Waveform Storage Data */ + VINT32 xlpg_atest_pctl; /* F4 XLPG Analog Test Positive Ctl */ + VINT32 xlpg_atest_nctl; /* F5 XLPG Analog Test Negative Ctl */ + VINT32 xlpg_fdata_sel; /* F6 XLPG Fuse Data Select */ + VINT32 _xlpg_resF7; /* F7 XLPG Reserved */ - VINT32 rlps_cfgsts; /* F8 RLPS Cfg & Sts */ - VINT32 rlps_alos_thresh; /* F9 RLPS ALOS Detection/Clearance Threshold */ - VINT32 rlps_alos_dper; /* FA RLPS ALOS Detection Period */ - VINT32 rlps_alos_cper; /* FB RLPS ALOS Clearance Period */ - VINT32 rlps_eq_iaddr; /* FC RLPS Equalization Indirect Addr */ - VINT32 rlps_eq_rwsel; /* FD RLPS Equalization Read/WriteB Select */ - VINT32 rlps_eq_ctlsts; /* FE RLPS Equalizer Loop Sts & Ctl */ - VINT32 rlps_eq_cfg; /* FF RLPS Equalizer Cfg */ + VINT32 rlps_cfgsts; /* F8 RLPS Cfg & Sts */ + VINT32 rlps_alos_thresh; /* F9 RLPS ALOS Detection/Clearance Threshold */ + VINT32 rlps_alos_dper; /* FA RLPS ALOS Detection Period */ + VINT32 rlps_alos_cper; /* FB RLPS ALOS Clearance Period */ + VINT32 rlps_eq_iaddr; /* FC RLPS Equalization Indirect Addr */ + VINT32 rlps_eq_rwsel; /* FD RLPS Equalization Read/WriteB Select */ + VINT32 rlps_eq_ctlsts; /* FE RLPS Equalizer Loop Sts & Ctl */ + VINT32 rlps_eq_cfg; /* FF RLPS Equalizer Cfg */ }; typedef struct s_comet_reg comet_t; From 353808bf5367c046b7ea7d8189cad2531adedbb9 Mon Sep 17 00:00:00 2001 From: Sima Baymani Date: Tue, 5 Nov 2013 21:22:12 +0100 Subject: [PATCH 013/238] staging: cxt1e1: comet.h - fix long lines warning Fix long lines warnings from checkpatch which were introduced in previous patch in series due to reindentation. Signed-off-by: Sima Baymani Reviewed-by: Lisa Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/cxt1e1/comet.h | 36 ++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/drivers/staging/cxt1e1/comet.h b/drivers/staging/cxt1e1/comet.h index 9b2166345f55..70829078e91e 100644 --- a/drivers/staging/cxt1e1/comet.h +++ b/drivers/staging/cxt1e1/comet.h @@ -118,7 +118,8 @@ struct s_comet_reg VINT32 ibcd_deact; /* 4F IBCD Deactivate Code */ VINT32 sigx_cfg; /* 50 SIGX Cfg/Change of Signaling State */ - VINT32 sigx_acc_cos; /* 51 SIGX uP Access Sts/Change of Signaling State */ + VINT32 sigx_acc_cos; /* 51 SIGX + * uP Access Sts/Change of Signaling State */ VINT32 sigx_iac_cos; /* 52 SIGX Channel Indirect * Addr/Ctl/Change of Signaling State */ VINT32 sigx_idb_cos; /* 53 SIGX Channel Indirect Data @@ -131,8 +132,10 @@ struct s_comet_reg VINT32 pmon_ies; /* 58 PMON Intr Enable/Sts */ VINT32 pmon_fberr; /* 59 PMON Framing Bit Err Cnt */ - VINT32 pmon_feb_lsb; /* 5A PMON OFF/COFA/Far End Block Err Cnt (LSB) */ - VINT32 pmon_feb_msb; /* 5B PMON OFF/COFA/Far End Block Err Cnt (MSB) */ + VINT32 pmon_feb_lsb; /* 5A PMON + * OFF/COFA/Far End Block Err Cnt (LSB) */ + VINT32 pmon_feb_msb; /* 5B PMON + * OFF/COFA/Far End Block Err Cnt (MSB) */ VINT32 pmon_bed_lsb; /* 5C PMON Bit/Err/CRCE Cnt (LSB) */ VINT32 pmon_bed_msb; /* 5D PMON Bit/Err/CRCE Cnt (MSB) */ VINT32 pmon_lvc_lsb; /* 5E PMON LVC Cnt (LSB) */ @@ -176,8 +179,10 @@ struct s_comet_reg VINT32 t1_aprm_1sec_2; /* 7B T1 APRM One Second Content Octet 2 */ VINT32 t1_aprm_1sec_3; /* 7C T1 APRM One Second Content Octet 3 */ VINT32 t1_aprm_1sec_4; /* 7D T1 APRM One Second Content Octet 4 */ - VINT32 t1_aprm_1sec_5; /* 7E T1 APRM One Second Content MSB (Octect 5) */ - VINT32 t1_aprm_1sec_6; /* 7F T1 APRM One Second Content MSB (Octect 6) */ + VINT32 t1_aprm_1sec_5; /* 7E T1 APRM + * One Second Content MSB (Octect 5) */ + VINT32 t1_aprm_1sec_6; /* 7F T1 APRM + * One Second Content MSB (Octect 6) */ VINT32 e1_tran_cfg; /* 80 E1 TRAN Cfg */ VINT32 e1_tran_txalarm; /* 81 E1 TRAN TX Alarm/Diagnostic Ctl */ @@ -201,18 +206,23 @@ struct s_comet_reg VINT32 e1_frmr_aopts; /* 90 E1 FRMR Frame Alignment Options */ VINT32 e1_frmr_mopts; /* 91 E1 FRMR Maintenance Mode Options */ VINT32 e1_frmr_ien; /* 92 E1 FRMR Framing Sts Intr Enable */ - VINT32 e1_frmr_mien; /* 93 E1 FRMR Maintenance/Alarm Sts Intr Enable */ + VINT32 e1_frmr_mien; /* 93 E1 FRMR + * Maintenance/Alarm Sts Intr Enable */ VINT32 e1_frmr_ists; /* 94 E1 FRMR Framing Sts Intr Indication */ - VINT32 e1_frmr_mists; /* 95 E1 FRMR Maintenance/Alarm Sts Indication Enable */ + VINT32 e1_frmr_mists; /* 95 E1 FRMR + * Maintenance/Alarm Sts Indication Enable */ VINT32 e1_frmr_sts; /* 96 E1 FRMR Framing Sts */ VINT32 e1_frmr_masts; /* 97 E1 FRMR Maintenance/Alarm Sts */ VINT32 e1_frmr_nat_bits; /* 98 E1 FRMR International/National Bits */ VINT32 e1_frmr_crc_lsb; /* 99 E1 FRMR CRC Err Cnt - LSB */ VINT32 e1_frmr_crc_msb; /* 9A E1 FRMR CRC Err Cnt - MSB */ - VINT32 e1_frmr_nat_ien; /* 9B E1 FRMR National Bit Codeword Intr Enables */ - VINT32 e1_frmr_nat_ists; /* 9C E1 FRMR National Bit Codeword Intr/Sts */ + VINT32 e1_frmr_nat_ien; /* 9B E1 FRMR + * National Bit Codeword Intr Enables */ + VINT32 e1_frmr_nat_ists; /* 9C E1 FRMR + * National Bit Codeword Intr/Sts */ VINT32 e1_frmr_nat; /* 9D E1 FRMR National Bit Codewords */ - VINT32 e1_frmr_fp_ien; /* 9E E1 FRMR Frame Pulse/Alarm Intr Enables */ + VINT32 e1_frmr_fp_ien; /* 9E E1 FRMR + * Frame Pulse/Alarm Intr Enables */ VINT32 e1_frmr_fp_ists; /* 9F E1 FRMR Frame Pulse/Alarm Intr/Sts */ VINT32 __resA0; /* A0 Reserved */ @@ -304,7 +314,8 @@ struct s_comet_reg VINT32 xlpg_cfg; /* F0 XLPG Line Driver Cfg */ VINT32 xlpg_ctlsts; /* F1 XLPG Ctl/Sts */ - VINT32 xlpg_pwave_addr; /* F2 XLPG Pulse Waveform Storage Write Addr */ + VINT32 xlpg_pwave_addr; /* F2 XLPG + * Pulse Waveform Storage Write Addr */ VINT32 xlpg_pwave_data; /* F3 XLPG Pulse Waveform Storage Data */ VINT32 xlpg_atest_pctl; /* F4 XLPG Analog Test Positive Ctl */ VINT32 xlpg_atest_nctl; /* F5 XLPG Analog Test Negative Ctl */ @@ -312,7 +323,8 @@ struct s_comet_reg VINT32 _xlpg_resF7; /* F7 XLPG Reserved */ VINT32 rlps_cfgsts; /* F8 RLPS Cfg & Sts */ - VINT32 rlps_alos_thresh; /* F9 RLPS ALOS Detection/Clearance Threshold */ + VINT32 rlps_alos_thresh; /* F9 RLPS + * ALOS Detection/Clearance Threshold */ VINT32 rlps_alos_dper; /* FA RLPS ALOS Detection Period */ VINT32 rlps_alos_cper; /* FB RLPS ALOS Clearance Period */ VINT32 rlps_eq_iaddr; /* FC RLPS Equalization Indirect Addr */ From af2594402d61d28bae5e784c3eb9dc80d92038eb Mon Sep 17 00:00:00 2001 From: Sima Baymani Date: Tue, 5 Nov 2013 21:22:56 +0100 Subject: [PATCH 014/238] staging: cxt1e1: comet,h - fix placement of braces Fix bad placement of braces per checkpatch warning. Signed-off-by: Sima Baymani Reviewed-by: Lisa Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/cxt1e1/comet.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/cxt1e1/comet.h b/drivers/staging/cxt1e1/comet.h index 70829078e91e..4ed78297053b 100644 --- a/drivers/staging/cxt1e1/comet.h +++ b/drivers/staging/cxt1e1/comet.h @@ -25,8 +25,7 @@ #define VINT32 volatile u_int32_t -struct s_comet_reg -{ +struct s_comet_reg { VINT32 gbl_cfg; /* 00 Global Cfg */ VINT32 clkmon; /* 01 Clk Monitor */ VINT32 rx_opt; /* 02 RX Options */ From 987e8bef1ce93299408b75ff1b08592aba7e3c5a Mon Sep 17 00:00:00 2001 From: Sima Baymani Date: Tue, 5 Nov 2013 21:49:16 +0100 Subject: [PATCH 015/238] staging: cxt1e1: remove typedef comet_t Remove typedef declaration per checkpatch warning. Built and loaded. Signed-off-by: Sima Baymani Reviewed-by: Lisa Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/cxt1e1/comet.c | 18 +++++++++--------- drivers/staging/cxt1e1/comet.h | 4 +--- drivers/staging/cxt1e1/functions.c | 2 +- drivers/staging/cxt1e1/pmcc4_drv.c | 10 +++++----- drivers/staging/cxt1e1/pmcc4_private.h | 2 +- 5 files changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/staging/cxt1e1/comet.c b/drivers/staging/cxt1e1/comet.c index 6b3182aa6dc1..229435ce8583 100644 --- a/drivers/staging/cxt1e1/comet.c +++ b/drivers/staging/cxt1e1/comet.c @@ -28,9 +28,9 @@ extern int cxt1e1_log_level; #define COMET_NUM_UNITS 5 /* Number of points per entry in table */ /* forward references */ -static void SetPwrLevel(comet_t *comet); -static void WrtRcvEqualizerTbl(ci_t *ci, comet_t *comet, u_int32_t *table); -static void WrtXmtWaveformTbl(ci_t *ci, comet_t *comet, u_int8_t table[COMET_NUM_SAMPLES][COMET_NUM_UNITS]); +static void SetPwrLevel(struct s_comet_reg *comet); +static void WrtRcvEqualizerTbl(ci_t *ci, struct s_comet_reg *comet, u_int32_t *table); +static void WrtXmtWaveformTbl(ci_t *ci, struct s_comet_reg *comet, u_int8_t table[COMET_NUM_SAMPLES][COMET_NUM_UNITS]); void *TWV_table[12] = { @@ -58,7 +58,7 @@ lbo_tbl_lkup(int t1, int lbo) { return lbo - 1; } -void init_comet(void *ci, comet_t *comet, u_int32_t port_mode, int clockmaster, +void init_comet(void *ci, struct s_comet_reg *comet, u_int32_t port_mode, int clockmaster, u_int8_t moreParams) { u_int8_t isT1mode; @@ -396,7 +396,7 @@ void init_comet(void *ci, comet_t *comet, u_int32_t port_mode, int clockmaster, ** Returns: Nothing */ static void -WrtXmtWaveform(ci_t *ci, comet_t *comet, u_int32_t sample, u_int32_t unit, u_int8_t data) +WrtXmtWaveform(ci_t *ci, struct s_comet_reg *comet, u_int32_t sample, u_int32_t unit, u_int8_t data) { u_int8_t WaveformAddr; @@ -414,7 +414,7 @@ WrtXmtWaveform(ci_t *ci, comet_t *comet, u_int32_t sample, u_int32_t unit, u_int ** Returns: Nothing */ static void -WrtXmtWaveformTbl(ci_t *ci, comet_t *comet, +WrtXmtWaveformTbl(ci_t *ci, struct s_comet_reg *comet, u_int8_t table[COMET_NUM_SAMPLES][COMET_NUM_UNITS]) { u_int32_t sample, unit; @@ -440,7 +440,7 @@ WrtXmtWaveformTbl(ci_t *ci, comet_t *comet, */ static void -WrtRcvEqualizerTbl(ci_t *ci, comet_t *comet, u_int32_t *table) +WrtRcvEqualizerTbl(ci_t *ci, struct s_comet_reg *comet, u_int32_t *table) { u_int32_t ramaddr; volatile u_int32_t value; @@ -504,7 +504,7 @@ WrtRcvEqualizerTbl(ci_t *ci, comet_t *comet, u_int32_t *table) */ static void -SetPwrLevel(comet_t *comet) +SetPwrLevel(struct s_comet_reg *comet) { volatile u_int32_t temp; @@ -546,7 +546,7 @@ SetPwrLevel(comet_t *comet) */ #if 0 static void -SetCometOps(comet_t *comet) +SetCometOps(struct s_comet_reg *comet) { volatile u_int8_t rd_value; diff --git a/drivers/staging/cxt1e1/comet.h b/drivers/staging/cxt1e1/comet.h index 4ed78297053b..d5d286e47a4b 100644 --- a/drivers/staging/cxt1e1/comet.h +++ b/drivers/staging/cxt1e1/comet.h @@ -332,8 +332,6 @@ struct s_comet_reg { VINT32 rlps_eq_cfg; /* FF RLPS Equalizer Cfg */ }; -typedef struct s_comet_reg comet_t; - /* 00AH: MDIAG Register bit definitions */ #define COMET_MDIAG_ID5 0x40 #define COMET_MDIAG_LBMASK 0x3F @@ -349,7 +347,7 @@ typedef struct s_comet_reg comet_t; #ifdef __KERNEL__ extern void -init_comet(void *, comet_t *, u_int32_t, int, u_int8_t); +init_comet(void *, struct s_comet_reg *, u_int32_t, int, u_int8_t); #endif #endif /* _INC_COMET_H_ */ diff --git a/drivers/staging/cxt1e1/functions.c b/drivers/staging/cxt1e1/functions.c index d021b312ffa2..95218e283966 100644 --- a/drivers/staging/cxt1e1/functions.c +++ b/drivers/staging/cxt1e1/functions.c @@ -274,7 +274,7 @@ VMETRO_TRACE (void *x) void VMETRO_TRIGGER (ci_t *ci, int x) { - comet_t *comet; + struct s_comet_reg *comet; volatile u_int32_t data; comet = ci->port[0].cometbase; /* default to COMET # 0 */ diff --git a/drivers/staging/cxt1e1/pmcc4_drv.c b/drivers/staging/cxt1e1/pmcc4_drv.c index 4028ea11c442..a9d95753be20 100644 --- a/drivers/staging/cxt1e1/pmcc4_drv.c +++ b/drivers/staging/cxt1e1/pmcc4_drv.c @@ -194,7 +194,7 @@ checkPorts (ci_t *ci) * alarms conflicts with NCOMM's interrupt servicing implementation. */ - comet_t *comet; + struct s_comet_reg *comet; volatile u_int32_t value; u_int32_t copyVal, LEDval; @@ -507,7 +507,7 @@ c4_cleanup (void) int c4_get_portcfg (ci_t *ci) { - comet_t *comet; + struct s_comet_reg *comet; int portnum, mask; u_int32_t wdata, rdata; @@ -561,7 +561,7 @@ c4_init (ci_t *ci, u_char *func0, u_char *func1) for (portnum = 0; portnum < MUSYCC_NPORTS; portnum++) { pi = &ci->port[portnum]; - pi->cometbase = (comet_t *) ((u_int32_t *) (func1 + COMET_OFFSET (portnum))); + pi->cometbase = (struct s_comet_reg *) ((u_int32_t *) (func1 + COMET_OFFSET (portnum))); pi->reg = (struct musycc_globalr *) ((u_char *) ci->reg + (portnum * 0x800)); pi->portnum = portnum; pi->p.portnum = portnum; @@ -693,7 +693,7 @@ c4_init2 (ci_t *ci) int c4_loop_port (ci_t *ci, int portnum, u_int8_t cmd) { - comet_t *comet; + struct s_comet_reg *comet; volatile u_int32_t loopValue; comet = ci->port[portnum].cometbase; @@ -752,7 +752,7 @@ c4_loop_port (ci_t *ci, int portnum, u_int8_t cmd) status_t c4_frame_rw (ci_t *ci, struct sbecom_port_param *pp) { - comet_t *comet; + struct s_comet_reg *comet; volatile u_int32_t data; if (pp->portnum >= ci->max_port)/* sanity check */ diff --git a/drivers/staging/cxt1e1/pmcc4_private.h b/drivers/staging/cxt1e1/pmcc4_private.h index b2b6e3702630..7edbd4e492e3 100644 --- a/drivers/staging/cxt1e1/pmcc4_private.h +++ b/drivers/staging/cxt1e1/pmcc4_private.h @@ -133,7 +133,7 @@ struct c4_port_info void *regram_saved; /* Original malloc value may have non-2KB * boundary. Need to save for use when * freeing. */ - comet_t *cometbase; + struct s_comet_reg *cometbase; struct sbe_card_info *up; /* From 9b38da66d0011cd7c8ba04aa92bd0d362bd6be17 Mon Sep 17 00:00:00 2001 From: Sima Baymani Date: Tue, 5 Nov 2013 21:28:56 +0100 Subject: [PATCH 016/238] staging: cxt1e1: fix long lines warning Break up long lines per checkpatch warnings. Signed-off-by: Sima Baymani Reviewed-by: Lisa Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/cxt1e1/comet.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/staging/cxt1e1/comet.c b/drivers/staging/cxt1e1/comet.c index 229435ce8583..c4c8c0f9c959 100644 --- a/drivers/staging/cxt1e1/comet.c +++ b/drivers/staging/cxt1e1/comet.c @@ -302,13 +302,15 @@ void init_comet(void *ci, struct s_comet_reg *comet, u_int32_t port_mode, int cl pci_write_32((u_int32_t *) &comet->brif_fpcfg, 0x00); if ((moreParams & CFG_CLK_PORT_MASK) == CFG_CLK_PORT_INTERNAL) { if (cxt1e1_log_level >= LOG_SBEBUG12) - pr_info(">> %s: clockmaster internal clock\n", __func__); + pr_info(">> %s: clockmaster internal clock\n", + __func__); /* internal oscillator */ pci_write_32((u_int32_t *) &comet->tx_time, 0x0d); } else { /* external clock source */ if (cxt1e1_log_level >= LOG_SBEBUG12) - pr_info(">> %s: clockmaster external clock\n", __func__); + pr_info(">> %s: clockmaster external clock\n", + __func__); /* loop timing(external) */ pci_write_32((u_int32_t *) &comet->tx_time, 0x09); } @@ -421,11 +423,13 @@ WrtXmtWaveformTbl(ci_t *ci, struct s_comet_reg *comet, for (sample = 0; sample < COMET_NUM_SAMPLES; sample++) { for (unit = 0; unit < COMET_NUM_UNITS; unit++) - WrtXmtWaveform(ci, comet, sample, unit, table[sample][unit]); + WrtXmtWaveform(ci, comet, sample, unit, + table[sample][unit]); } /* Enable transmitter and set output amplitude */ - pci_write_32((u_int32_t *) &comet->xlpg_cfg, table[COMET_NUM_SAMPLES][0]); + pci_write_32((u_int32_t *) &comet->xlpg_cfg, + table[COMET_NUM_SAMPLES][0]); } @@ -453,7 +457,8 @@ WrtRcvEqualizerTbl(ci_t *ci, struct s_comet_reg *comet, u_int32_t *table) /* for write order preservation when Optimizing driver */ pci_flush_write(ci); /* write the addr, initiate a read */ - pci_write_32((u_int32_t *) &comet->rlps_eq_iaddr, (u_int8_t) ramaddr); + pci_write_32((u_int32_t *) &comet->rlps_eq_iaddr, + (u_int8_t) ramaddr); /* for write order preservation when Optimizing driver */ pci_flush_write(ci); /* @@ -466,9 +471,12 @@ WrtRcvEqualizerTbl(ci_t *ci, struct s_comet_reg *comet, u_int32_t *table) } value = *table++; - pci_write_32((u_int32_t *) &comet->rlps_idata3, (u_int8_t) (value >> 24)); - pci_write_32((u_int32_t *) &comet->rlps_idata2, (u_int8_t) (value >> 16)); - pci_write_32((u_int32_t *) &comet->rlps_idata1, (u_int8_t) (value >> 8)); + pci_write_32((u_int32_t *) &comet->rlps_idata3, + (u_int8_t) (value >> 24)); + pci_write_32((u_int32_t *) &comet->rlps_idata2, + (u_int8_t) (value >> 16)); + pci_write_32((u_int32_t *) &comet->rlps_idata1, + (u_int8_t) (value >> 8)); pci_write_32((u_int32_t *) &comet->rlps_idata0, (u_int8_t) value); /* for write order preservation when Optimizing driver */ pci_flush_write(ci); @@ -480,7 +488,8 @@ WrtRcvEqualizerTbl(ci_t *ci, struct s_comet_reg *comet, u_int32_t *table) /* for write order preservation when optimizing driver */ pci_flush_write(ci); /* write the addr, initiate a read */ - pci_write_32((u_int32_t *) &comet->rlps_eq_iaddr, (u_int8_t) ramaddr); + pci_write_32((u_int32_t *) &comet->rlps_eq_iaddr, + (u_int8_t) ramaddr); /* for write order preservation when optimizing driver */ pci_flush_write(ci); From 5354cb6423fbe590be8e332858a5795577919f84 Mon Sep 17 00:00:00 2001 From: Archana kumari Date: Thu, 31 Oct 2013 00:34:08 +0530 Subject: [PATCH 017/238] staging: imx-drm: Fix warning for static const char * array in imx-ldb.c This patch fixes the warning "static const char * array should probably be static const char * const" in imx-ldb.c. Signed-off-by: Archana kumari Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/imx-drm/imx-ldb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/imx-drm/imx-ldb.c b/drivers/staging/imx-drm/imx-ldb.c index 654bf03e05ff..655d0c0f4ace 100644 --- a/drivers/staging/imx-drm/imx-ldb.c +++ b/drivers/staging/imx-drm/imx-ldb.c @@ -414,7 +414,7 @@ enum { LVDS_BIT_MAP_JEIDA }; -static const char *imx_ldb_bit_mappings[] = { +static const char * const imx_ldb_bit_mappings[] = { [LVDS_BIT_MAP_SPWG] = "spwg", [LVDS_BIT_MAP_JEIDA] = "jeida", }; From 49f4a9c81c1a83854ddf9510b92199368262abb2 Mon Sep 17 00:00:00 2001 From: Sima Baymani Date: Sun, 3 Nov 2013 11:18:57 +0100 Subject: [PATCH 018/238] staging: imx-drm: remove unnecessary braces Fix checkpatch warning by removing unnecessary braces. Compile-tested the single file. Signed-off-by: Sima Baymani Reviewed-by: Josh Triplett Reviewed-by: Archana Kumari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/imx-drm/imx-ldb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/imx-drm/imx-ldb.c b/drivers/staging/imx-drm/imx-ldb.c index 655d0c0f4ace..7e593296ac47 100644 --- a/drivers/staging/imx-drm/imx-ldb.c +++ b/drivers/staging/imx-drm/imx-ldb.c @@ -167,9 +167,8 @@ static void imx_ldb_set_clock(struct imx_ldb *ldb, int mux, int chno, /* set display clock mux to LDB input clock */ ret = clk_set_parent(ldb->clk_sel[mux], ldb->clk[chno]); - if (ret) { + if (ret) dev_err(ldb->dev, "unable to set di%d parent clock to ldb_di%d\n", mux, chno); - } } static void imx_ldb_encoder_prepare(struct drm_encoder *encoder) From 0c4c9350c1080bf9a10fcfb73d4cd963bdce9c35 Mon Sep 17 00:00:00 2001 From: Himangi Saraogi Date: Thu, 31 Oct 2013 09:01:41 +0530 Subject: [PATCH 019/238] drivers : staging :rtl8187se : r8180_core.c : remove space before semicolon This patch removes the checkpatch.pl warning space prohibited before semicolon. Signed-off-by: Himangi Saraogi Reviewed-by: Josh Triplett Reviewed-by: Lisa Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/r8180_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c index 76a67386b927..2462ced68215 100644 --- a/drivers/staging/rtl8187se/r8180_core.c +++ b/drivers/staging/rtl8187se/r8180_core.c @@ -1855,7 +1855,7 @@ short rtl8180_tx(struct net_device *dev, u8 *txbuf, int len, int priority, if (remain == len && !descfrag) { ownbit_flag = false; - *tail = *tail | (1<<29) ; /* fist segment of the packet */ + *tail = *tail | (1<<29); /* fist segment of the packet */ *tail = *tail | (len); } else { ownbit_flag = true; From 8e0e3aeede138c5ccc45fc1394c53c848a9f4608 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sat, 2 Nov 2013 22:44:38 +0530 Subject: [PATCH 020/238] Staging: rtl8187se: Fix C99 style commenting in dot11d.c This patch fixes the following checkpatch.pl issues in ieee80211/dot11d.c- ERROR: do not use C99 // comments Signed-off-by: Rashika Kheria Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/ieee80211/dot11d.c | 68 ++++++++++---------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/drivers/staging/rtl8187se/ieee80211/dot11d.c b/drivers/staging/rtl8187se/ieee80211/dot11d.c index 9d2d5c58add2..b623080247f5 100644 --- a/drivers/staging/rtl8187se/ieee80211/dot11d.c +++ b/drivers/staging/rtl8187se/ieee80211/dot11d.c @@ -1,11 +1,10 @@ -//----------------------------------------------------------------------------- -// File: -// Dot11d.c -// -// Description: -// Implement 802.11d. -// -//----------------------------------------------------------------------------- +/* + * File: + * Dot11d.c + * + * Description: + * Implement 802.11d + */ #include "dot11d.h" @@ -25,20 +24,20 @@ Dot11d_Init(struct ieee80211_device *ieee) printk("Dot11d_Init()\n"); } -// -// Description: -// Reset to the state as we are just entering a regulatory domain. -// +/* + * Description: + * Reset to the state as we are just entering a regulatory domain. + */ void Dot11d_Reset(struct ieee80211_device *ieee) { u32 i; PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(ieee); - // Clear old channel map + /* Clear old channel map */ memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1); - // Set new channel map + /* Set new channel map */ for (i = 1; i <= 11; i++) (pDot11dInfo->channel_map)[i] = 1; @@ -48,22 +47,20 @@ Dot11d_Reset(struct ieee80211_device *ieee) pDot11dInfo->State = DOT11D_STATE_NONE; pDot11dInfo->CountryIeLen = 0; RESET_CIE_WATCHDOG(ieee); - - //printk("Dot11d_Reset()\n"); } -// -// Description: -// Update country IE from Beacon or Probe Response -// and configure PHY for operation in the regulatory domain. -// -// TODO: -// Configure Tx power. -// -// Assumption: -// 1. IS_DOT11D_ENABLE() is TRUE. -// 2. Input IE is an valid one. -// +/* + * Description: + * Update country IE from Beacon or Probe Response and configure PHY for + * operation in the regulatory domain. + * + * TODO: + * Configure Tx power. + * + * Assumption: + * 1. IS_DOT11D_ENABLE() is TRUE. + * 2. Input IE is an valid one. + */ void Dot11d_UpdateCountryIe( struct ieee80211_device *dev, @@ -85,17 +82,23 @@ Dot11d_UpdateCountryIe( memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1); MaxChnlNum = 0; - NumTriples = (CoutryIeLen - 3) / 3; // skip 3-byte country string. + NumTriples = (CoutryIeLen - 3) / 3; /* skip 3-byte country string. */ pTriple = (PCHNL_TXPOWER_TRIPLE)(pCoutryIe + 3); for (i = 0; i < NumTriples; i++) { if (MaxChnlNum >= pTriple->FirstChnl) { - // It is not in a monotonically increasing order, so stop processing. + /* + * It is not in a monotonically increasing order, + * so stop processing. + */ printk("Dot11d_UpdateCountryIe(): Invalid country IE, skip it........1\n"); Dot11d_Reset(dev); return; } if (MAX_CHANNEL_NUMBER < (pTriple->FirstChnl + pTriple->NumChnls)) { - // It is not a valid set of channel id, so stop processing. + /* + * It is not a valid set of channel id, + * so stop processing + */ printk("Dot11d_UpdateCountryIe(): Invalid country IE, skip it........2\n"); Dot11d_Reset(dev); return; @@ -110,7 +113,6 @@ Dot11d_UpdateCountryIe( pTriple = (PCHNL_TXPOWER_TRIPLE)((u8 *)pTriple + 3); } #if 1 - //printk("Dot11d_UpdateCountryIe(): Channel List:\n"); printk("Channel List:"); for (i = 1; i <= MAX_CHANNEL_NUMBER; i++) if (pDot11dInfo->channel_map[i] > 0) @@ -160,7 +162,7 @@ DOT11D_ScanComplete( case DOT11D_STATE_DONE: if (GET_CIE_WATCHDOG(dev) == 0) { - // Reset country IE if previous one is gone. + /* Reset country IE if previous one is gone. */ Dot11d_Reset(dev); } break; From d58df7513d461bbec33c4d1d2410f6a441dc3b90 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sat, 2 Nov 2013 22:46:00 +0530 Subject: [PATCH 021/238] Staging: rtl8187se: Fix printk() should include KERN_ facility level This patch fixes the following checkpatch.pl issues in ieee80211/dot11d.c- WARNING: printk() should include KERN_ facility level Signed-off-by: Rashika Kheria Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/ieee80211/dot11d.c | 22 +++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8187se/ieee80211/dot11d.c b/drivers/staging/rtl8187se/ieee80211/dot11d.c index b623080247f5..c8874b80486a 100644 --- a/drivers/staging/rtl8187se/ieee80211/dot11d.c +++ b/drivers/staging/rtl8187se/ieee80211/dot11d.c @@ -21,7 +21,7 @@ Dot11d_Init(struct ieee80211_device *ieee) memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1); RESET_CIE_WATCHDOG(ieee); - printk("Dot11d_Init()\n"); + netdev_info(ieee->dev, "Dot11d_Init()\n"); } /* @@ -74,7 +74,7 @@ Dot11d_UpdateCountryIe( PCHNL_TXPOWER_TRIPLE pTriple; if ((CoutryIeLen - 3)%3 != 0) { - printk("Dot11d_UpdateCountryIe(): Invalid country IE, skip it........1\n"); + netdev_info(dev->dev, "Dot11d_UpdateCountryIe(): Invalid country IE, skip it........1\n"); Dot11d_Reset(dev); return; } @@ -90,7 +90,8 @@ Dot11d_UpdateCountryIe( * It is not in a monotonically increasing order, * so stop processing. */ - printk("Dot11d_UpdateCountryIe(): Invalid country IE, skip it........1\n"); + netdev_info(dev->dev, + "Dot11d_UpdateCountryIe(): Invalid country IE, skip it........1\n"); Dot11d_Reset(dev); return; } @@ -99,7 +100,8 @@ Dot11d_UpdateCountryIe( * It is not a valid set of channel id, * so stop processing */ - printk("Dot11d_UpdateCountryIe(): Invalid country IE, skip it........2\n"); + netdev_info(dev->dev, + "Dot11d_UpdateCountryIe(): Invalid country IE, skip it........2\n"); Dot11d_Reset(dev); return; } @@ -113,11 +115,11 @@ Dot11d_UpdateCountryIe( pTriple = (PCHNL_TXPOWER_TRIPLE)((u8 *)pTriple + 3); } #if 1 - printk("Channel List:"); + netdev_info(dev->dev, "Channel List:"); for (i = 1; i <= MAX_CHANNEL_NUMBER; i++) if (pDot11dInfo->channel_map[i] > 0) - printk(" %d", i); - printk("\n"); + netdev_info(dev->dev, " %d", i); + netdev_info(dev->dev, "\n"); #endif UPDATE_CIE_SRC(dev, pTaddr); @@ -137,7 +139,7 @@ DOT11D_GetMaxTxPwrInDbm( u8 MaxTxPwrInDbm = 255; if (MAX_CHANNEL_NUMBER < Channel) { - printk("DOT11D_GetMaxTxPwrInDbm(): Invalid Channel\n"); + netdev_info(dev->dev, "DOT11D_GetMaxTxPwrInDbm(): Invalid Channel\n"); return MaxTxPwrInDbm; } if (pDot11dInfo->channel_map[Channel]) { @@ -179,7 +181,7 @@ int IsLegalChannel( PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); if (MAX_CHANNEL_NUMBER < channel) { - printk("IsLegalChannel(): Invalid Channel\n"); + netdev_info(dev->dev, "IsLegalChannel(): Invalid Channel\n"); return 0; } if (pDot11dInfo->channel_map[channel] > 0) @@ -204,7 +206,7 @@ int ToLegalChannel( } if (MAX_CHANNEL_NUMBER < channel) { - printk("IsLegalChannel(): Invalid Channel\n"); + netdev_info(dev->dev, "IsLegalChannel(): Invalid Channel\n"); return default_chn; } From 3e3f837c659efc8fbb88e60cfda79b6ccfd2ac13 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sat, 2 Nov 2013 22:47:45 +0530 Subject: [PATCH 022/238] Staging: rtl8187se: Fix space prohibited before semicolon in dot11d.c This patch fixes the following checkpatch.pl issues in ieee80211/dot11d.c- WARNING: space prohibited before semicolon Signed-off-by: Rashika Kheria Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/ieee80211/dot11d.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8187se/ieee80211/dot11d.c b/drivers/staging/rtl8187se/ieee80211/dot11d.c index c8874b80486a..2f5d367cd1c4 100644 --- a/drivers/staging/rtl8187se/ieee80211/dot11d.c +++ b/drivers/staging/rtl8187se/ieee80211/dot11d.c @@ -106,7 +106,7 @@ Dot11d_UpdateCountryIe( return; } - for (j = 0 ; j < pTriple->NumChnls; j++) { + for (j = 0; j < pTriple->NumChnls; j++) { pDot11dInfo->channel_map[pTriple->FirstChnl + j] = 1; pDot11dInfo->MaxTxPwrDbmList[pTriple->FirstChnl + j] = pTriple->MaxTxPowerInDbm; MaxChnlNum = pTriple->FirstChnl + j; From 96983a0c65775095be881ab811b3f86154bfdf6a Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sat, 2 Nov 2013 22:49:59 +0530 Subject: [PATCH 023/238] Staging: rtl8187se: Remove unnecessary braces around single statement in dot11d.c This patch fixes the following checkpatch.pl issues in ieee80211/dot11d.c- WARNING: braces {} are not necessary for single statement blocks Signed-off-by: Rashika Kheria Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/ieee80211/dot11d.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/rtl8187se/ieee80211/dot11d.c b/drivers/staging/rtl8187se/ieee80211/dot11d.c index 2f5d367cd1c4..eb161f28a186 100644 --- a/drivers/staging/rtl8187se/ieee80211/dot11d.c +++ b/drivers/staging/rtl8187se/ieee80211/dot11d.c @@ -142,9 +142,8 @@ DOT11D_GetMaxTxPwrInDbm( netdev_info(dev->dev, "DOT11D_GetMaxTxPwrInDbm(): Invalid Channel\n"); return MaxTxPwrInDbm; } - if (pDot11dInfo->channel_map[Channel]) { + if (pDot11dInfo->channel_map[Channel]) MaxTxPwrInDbm = pDot11dInfo->MaxTxPwrDbmList[Channel]; - } return MaxTxPwrInDbm; } From 10aff642fd49228bc111bce29e1b201f7dcdeca1 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sat, 2 Nov 2013 22:51:26 +0530 Subject: [PATCH 024/238] Staging: rtl8187se: Fix line over 80 characters in dot11d.c This patch fixes the following checkpatch.pl issues in ieee80211/dot11d.c- WARNING: line over 80 characters Signed-off-by: Rashika Kheria Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/ieee80211/dot11d.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8187se/ieee80211/dot11d.c b/drivers/staging/rtl8187se/ieee80211/dot11d.c index eb161f28a186..0d914f25894f 100644 --- a/drivers/staging/rtl8187se/ieee80211/dot11d.c +++ b/drivers/staging/rtl8187se/ieee80211/dot11d.c @@ -71,6 +71,7 @@ Dot11d_UpdateCountryIe( { PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); u8 i, j, NumTriples, MaxChnlNum; + u8 index, MaxTxPowerInDbm; PCHNL_TXPOWER_TRIPLE pTriple; if ((CoutryIeLen - 3)%3 != 0) { @@ -95,7 +96,8 @@ Dot11d_UpdateCountryIe( Dot11d_Reset(dev); return; } - if (MAX_CHANNEL_NUMBER < (pTriple->FirstChnl + pTriple->NumChnls)) { + if (MAX_CHANNEL_NUMBER < + (pTriple->FirstChnl + pTriple->NumChnls)) { /* * It is not a valid set of channel id, * so stop processing @@ -107,8 +109,10 @@ Dot11d_UpdateCountryIe( } for (j = 0; j < pTriple->NumChnls; j++) { - pDot11dInfo->channel_map[pTriple->FirstChnl + j] = 1; - pDot11dInfo->MaxTxPwrDbmList[pTriple->FirstChnl + j] = pTriple->MaxTxPowerInDbm; + index = pTriple->FirstChnl + j; + pDot11dInfo->channel_map[index] = 1; + MaxTxPowerInDbm = pTriple->MaxTxPowerInDbm; + pDot11dInfo->MaxTxPwrDbmList[index] = MaxTxPowerInDbm; MaxChnlNum = pTriple->FirstChnl + j; } From 734412501b623643165424d7a839efa21471bbf7 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sat, 2 Nov 2013 22:53:07 +0530 Subject: [PATCH 025/238] Staging: rtl8187se: Remove unnecessary comments in ieee80211_crypt_ccmp.c This patch removes unnecessary comments written in ieee80211/ieee80211_crypt_ccmp.c. And hence also, removes the following checkpatch.pl issue- ERROR: do not use C99 // comments Signed-off-by: Rashika Kheria Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c index f5949e89e5c2..c74c0ccb3c6a 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c @@ -11,7 +11,6 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -//#include #include #include #include @@ -130,7 +129,6 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && (WLAN_FC_GET_STYPE(fc) & 0x08)); */ - // fixed by David :2006.9.6 qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && (WLAN_FC_GET_STYPE(fc) & 0x80)); aad_len = 22; @@ -212,7 +210,6 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) pos = skb_push(skb, CCMP_HDR_LEN); memmove(pos, pos + CCMP_HDR_LEN, hdr_len); pos += hdr_len; -// mic = skb_put(skb, CCMP_MIC_LEN); i = CCMP_PN_LEN - 1; while (i >= 0) { @@ -232,7 +229,6 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) *pos++ = key->tx_pn[0]; hdr = (struct ieee80211_hdr_4addr *)skb->data; - //mic is moved to here by john mic = skb_put(skb, CCMP_MIC_LEN); ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0); @@ -430,7 +426,6 @@ static char *ieee80211_ccmp_print_stats(char *p, void *priv) void ieee80211_ccmp_null(void) { -// printk("============>%s()\n", __func__); return; } static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = { From c6a2c52f45f19998637ceab4aeee6f1cd7e1fdaf Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sat, 2 Nov 2013 22:54:39 +0530 Subject: [PATCH 026/238] Staging: rtl8187se: Fix quoted strings split across lines in ieee80211_crypt_ccmp.c This patch fixes the following checkpatch.pl issues in ieee80211/ieee80211_crypt_ccmp.c- WARNING: quoted string split across lines Signed-off-by: Rashika Kheria Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c index c74c0ccb3c6a..05d34e5453c9 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c @@ -412,9 +412,8 @@ static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv) static char *ieee80211_ccmp_print_stats(char *p, void *priv) { struct ieee80211_ccmp_data *ccmp = priv; - p += sprintf(p, "key[%d] alg=CCMP key_set=%d " - "tx_pn=%pm rx_pn=%pm " - "format_errors=%d replays=%d decrypt_errors=%d\n", + p += sprintf(p, + "key[%d] alg=CCMP key_set=%d tx_pn=%pm rx_pn=%pm format_errors=%d replays=%d decrypt_errors=%d\n", ccmp->key_idx, ccmp->key_set, ccmp->tx_pn, ccmp->rx_pn, ccmp->dot11RSNAStatsCCMPFormatErrors, From 1cf5ef1c46b4ab1c6a99a646648ad7ae54d23dfd Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sat, 2 Nov 2013 22:55:52 +0530 Subject: [PATCH 027/238] Staging: rtl8187se: Remove useless comments in ieee80211_crypt_tkip.c This patch removes useless comments in ieee80211/ieee80211_crypt_tkip.c. And, hence also removes the following checkpatch.pl issue- ERROR: do not use C99 // comments Signed-off-by: Rashika Kheria Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c index da24e430ca13..e5254ee0ea30 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c @@ -9,7 +9,6 @@ * more details. */ -//#include #include #include #include @@ -538,12 +537,9 @@ static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *pri michael_mic_hdr(skb, tkey->tx_hdr); - // { david, 2006.9.1 - // fix the wpa process with wmm enabled. if(IEEE80211_QOS_HAS_SEQ(le16_to_cpu(hdr->frame_ctl))) { tkey->tx_hdr[12] = *(skb->data + hdr_len - 2) & 0x07; } - // } pos = skb_put(skb, 8); if (michael_mic(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr, @@ -587,12 +583,9 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, return -1; michael_mic_hdr(skb, tkey->rx_hdr); - // { david, 2006.9.1 - // fix the wpa process with wmm enabled. if(IEEE80211_QOS_HAS_SEQ(le16_to_cpu(hdr->frame_ctl))) { tkey->rx_hdr[12] = *(skb->data + hdr_len - 2) & 0x07; } - // } if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr, skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) @@ -746,6 +739,5 @@ void ieee80211_crypto_tkip_exit(void) void ieee80211_tkip_null(void) { -// printk("============>%s()\n", __func__); return; } From 080b94a71350ba78973ce1e0b164bc158c787f65 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sat, 2 Nov 2013 22:57:07 +0530 Subject: [PATCH 028/238] Staging: rtl8187se: Replace "foo * bar" with "foo *bar" in ieee80211_crypt_tkip.c This patch fixes the following checkpatch.pl issues in ieee80211/ieee80211_crypt_tkip.c- ERROR: "foo * bar" should be "foo *bar" Signed-off-by: Rashika Kheria Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c index e5254ee0ea30..8630504fcaac 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c @@ -64,7 +64,7 @@ struct ieee80211_tkip_data { u8 rx_hdr[16], tx_hdr[16]; }; -static void * ieee80211_tkip_init(int key_idx) +static void *ieee80211_tkip_init(int key_idx) { struct ieee80211_tkip_data *priv; @@ -466,8 +466,8 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) return keyidx; } -static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr, - u8 * data, size_t data_len, u8 * mic) +static int michael_mic(struct crypto_hash *tfm_michael, u8 *key, u8 *hdr, + u8 *data, size_t data_len, u8 *mic) { struct hash_desc desc; struct scatterlist sg[2]; @@ -681,7 +681,7 @@ static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv) } -static char * ieee80211_tkip_print_stats(char *p, void *priv) +static char *ieee80211_tkip_print_stats(char *p, void *priv) { struct ieee80211_tkip_data *tkip = priv; p += sprintf(p, "key[%d] alg=TKIP key_set=%d " From 5befdae5b58c956bb38ae9599ef0394ef7ee0792 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sat, 2 Nov 2013 22:58:20 +0530 Subject: [PATCH 029/238] Staging: rtl8187se: Fix code indent should use tabs in ieee80211_crypt_tkip.c This patch fixes the following checkpatch.pl issues in ieee80211/ieee80211_crypt_tkip.c- ERROR: code indent should use tabs where possible Signed-off-by: Rashika Kheria Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- .../ieee80211/ieee80211_crypt_tkip.c | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c index 8630504fcaac..fbda853d693a 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c @@ -303,8 +303,8 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) { - struct ieee80211_tkip_data *tkey = priv; - struct blkcipher_desc desc = {.tfm = tkey->tx_tfm_arc4}; + struct ieee80211_tkip_data *tkey = priv; + struct blkcipher_desc desc = {.tfm = tkey->tx_tfm_arc4}; int len; u8 *pos; struct ieee80211_hdr_4addr *hdr; @@ -467,26 +467,26 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) } static int michael_mic(struct crypto_hash *tfm_michael, u8 *key, u8 *hdr, - u8 *data, size_t data_len, u8 *mic) + u8 *data, size_t data_len, u8 *mic) { - struct hash_desc desc; - struct scatterlist sg[2]; + struct hash_desc desc; + struct scatterlist sg[2]; - if (tfm_michael == NULL) { - printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); - return -1; - } + if (tfm_michael == NULL) { + printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); + return -1; + } sg_init_table(sg, 2); sg_set_buf(&sg[0], hdr, 16); sg_set_buf(&sg[1], data, data_len); - if (crypto_hash_setkey(tfm_michael, key, 8)) - return -1; + if (crypto_hash_setkey(tfm_michael, key, 8)) + return -1; - desc.tfm = tfm_michael; - desc.flags = 0; - return crypto_hash_digest(&desc, sg, data_len + 16, mic); + desc.tfm = tfm_michael; + desc.flags = 0; + return crypto_hash_digest(&desc, sg, data_len + 16, mic); } static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr) @@ -739,5 +739,5 @@ void ieee80211_crypto_tkip_exit(void) void ieee80211_tkip_null(void) { - return; + return; } From 4a0b1c4181a3af2c1c55ecf69c79fc5da635341e Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sat, 2 Nov 2013 23:03:43 +0530 Subject: [PATCH 030/238] Staging: rtl8187se: Remove unnecessary return statement in ieee80211_crypt_tkip.c This patch removes an unnecessary return statement in the function ieee80211_tkip_null() in ieee80211/ieee80211_crypt_tkip.c. Signed-off-by: Rashika Kheria Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c index fbda853d693a..9c25ffb1697c 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c @@ -739,5 +739,4 @@ void ieee80211_crypto_tkip_exit(void) void ieee80211_tkip_null(void) { - return; } From caace4b5315c3f43f19d8b16b41d5d64d00d628f Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sat, 2 Nov 2013 23:05:19 +0530 Subject: [PATCH 031/238] Staging: rtl8187se: Remove useless comments in dot11d.c This patch removes unnecessary comments in ieee80211/dot11d.c. Signed-off-by: Rashika Kheria Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/ieee80211/dot11d.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/staging/rtl8187se/ieee80211/dot11d.c b/drivers/staging/rtl8187se/ieee80211/dot11d.c index 0d914f25894f..d1395a683d5b 100644 --- a/drivers/staging/rtl8187se/ieee80211/dot11d.c +++ b/drivers/staging/rtl8187se/ieee80211/dot11d.c @@ -1,11 +1,3 @@ -/* - * File: - * Dot11d.c - * - * Description: - * Implement 802.11d - */ - #include "dot11d.h" void @@ -24,10 +16,7 @@ Dot11d_Init(struct ieee80211_device *ieee) netdev_info(ieee->dev, "Dot11d_Init()\n"); } -/* - * Description: - * Reset to the state as we are just entering a regulatory domain. - */ +/* Reset to the state as we are just entering a regulatory domain. */ void Dot11d_Reset(struct ieee80211_device *ieee) { From 52c5c2e0bcc4ca09f49b627a209716bc81b28145 Mon Sep 17 00:00:00 2001 From: Himangi Saraogi Date: Sun, 3 Nov 2013 16:16:14 +0530 Subject: [PATCH 032/238] Staging: rtl8187se: Fix C99 style commenting in dot11d.h This patch fixes the checkpatch.pl error "do not use C99 // comments" in ieee80211/dot11d.n. Signed-off-by: Himangi Saraogi Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/ieee80211/dot11d.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8187se/ieee80211/dot11d.h b/drivers/staging/rtl8187se/ieee80211/dot11d.h index 029c2cab1e00..9c016fee0107 100644 --- a/drivers/staging/rtl8187se/ieee80211/dot11d.h +++ b/drivers/staging/rtl8187se/ieee80211/dot11d.h @@ -3,9 +3,9 @@ #include "ieee80211.h" -//#define ENABLE_DOT11D +/* #define ENABLE_DOT11D */ -//#define DOT11D_MAX_CHNL_NUM 83 +/* #define DOT11D_MAX_CHNL_NUM 83 */ typedef struct _CHNL_TXPOWER_TRIPLE { u8 FirstChnl; @@ -20,18 +20,18 @@ typedef enum _DOT11D_STATE { }DOT11D_STATE; typedef struct _RT_DOT11D_INFO { - //DECLARE_RT_OBJECT(RT_DOT11D_INFO); + /* DECLARE_RT_OBJECT(RT_DOT12D_INFO); */ - bool bEnabled; // dot11MultiDomainCapabilityEnabled + bool bEnabled; /* dot11MultiDomainCapabilityEnabled */ - u16 CountryIeLen; // > 0 if CountryIeBuf[] contains valid country information element. + u16 CountryIeLen; /* > 0 if CountryIeBuf[] contains valid country information element. */ u8 CountryIeBuf[MAX_IE_LEN]; - u8 CountryIeSrcAddr[6]; // Source AP of the country IE. + u8 CountryIeSrcAddr[6]; /* Source AP of the country IE. */ u8 CountryIeWatchdog; - u8 channel_map[MAX_CHANNEL_NUMBER+1]; //!!!Value 0: Invalid, 1: Valid (active scan), 2: Valid (passive scan) - //u8 ChnlListLen; // #Bytes valid in ChnlList[]. - //u8 ChnlList[DOT11D_MAX_CHNL_NUM]; + u8 channel_map[MAX_CHANNEL_NUMBER+1]; /* !!!Value 0: Invalid, 1: Valid (active scan), 2: Valid (passive scan) */ + /* u8 ChnlListLen; // #Bytes valid in ChnlList[]. */ + /* u8 ChnlList[DOT11D_MAX_CHNL_NUM]; */ u8 MaxTxPwrDbmList[MAX_CHANNEL_NUMBER+1]; DOT11D_STATE State; @@ -97,4 +97,4 @@ int ToLegalChannel( struct ieee80211_device * dev, u8 channel ); -#endif // #ifndef __INC_DOT11D_H +#endif /* #ifndef __INC_DOT11D_H */ From 17295913d897dc4762cae2e304032ff64a697cf6 Mon Sep 17 00:00:00 2001 From: Himangi Saraogi Date: Wed, 6 Nov 2013 03:36:11 +0530 Subject: [PATCH 033/238] staging:rtl8187se: Shift open brace of function declarations to next line This patch fixes the checkpatch.pl error "open brace '{' following function declarations go on the next line" in ieee80211_softmac.c. Signed-off-by: Himangi Saraogi Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c index 029070603f66..1885fa47e2a6 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c @@ -106,7 +106,8 @@ void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p) } -void ieee80211_WMM_Info(struct ieee80211_device *ieee, u8 **tag_p) { +void ieee80211_WMM_Info(struct ieee80211_device *ieee, u8 **tag_p) +{ u8 *tag = *tag_p; *tag++ = MFIE_TYPE_GENERIC; //0 @@ -129,7 +130,8 @@ void ieee80211_WMM_Info(struct ieee80211_device *ieee, u8 **tag_p) { *tag_p = tag; } -void ieee80211_TURBO_Info(struct ieee80211_device *ieee, u8 **tag_p) { +void ieee80211_TURBO_Info(struct ieee80211_device *ieee, u8 **tag_p) +{ u8 *tag = *tag_p; *tag++ = MFIE_TYPE_GENERIC; //0 From 5b74ff92d35e0b634d9e3ca0e698cbb568e68901 Mon Sep 17 00:00:00 2001 From: Himangi Saraogi Date: Wed, 6 Nov 2013 11:10:24 +0530 Subject: [PATCH 034/238] staging:rtl8187se: Use preferred library linux/uaccess.h over asm/uaccess.h This patch fixes the checkpatch.pl warning "Use #include instead of " in ieee80211/ieee80211_softmac.c . Signed-off-by: Himangi Saraogi Reviewed-by: Lisa Nguyen Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c index 1885fa47e2a6..30d973bf997e 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include "dot11d.h" From 1fcd80670345c4a16c46b1e4c6c8df86727aff17 Mon Sep 17 00:00:00 2001 From: Himangi Saraogi Date: Wed, 6 Nov 2013 16:56:33 +0530 Subject: [PATCH 035/238] Staging:rtl8187se: Insert spaces after commas This patch fixes the checkpatch.pl warnings space required after that ',' in ieee80211/ieee80211_softmac.c Signed-off-by: Himangi Saraogi Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8187se/ieee80211/ieee80211_softmac.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c index 30d973bf997e..d769f168f795 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c @@ -25,12 +25,12 @@ #include "dot11d.h" u8 rsn_authen_cipher_suite[16][4] = { - {0x00,0x0F,0xAC,0x00}, //Use group key, //Reserved - {0x00,0x0F,0xAC,0x01}, //WEP-40 //RSNA default - {0x00,0x0F,0xAC,0x02}, //TKIP //NONE //{used just as default} - {0x00,0x0F,0xAC,0x03}, //WRAP-historical - {0x00,0x0F,0xAC,0x04}, //CCMP - {0x00,0x0F,0xAC,0x05}, //WEP-104 + {0x00, 0x0F, 0xAC, 0x00}, //Use group key, //Reserved + {0x00, 0x0F, 0xAC, 0x01}, //WEP-40 //RSNA default + {0x00, 0x0F, 0xAC, 0x02}, //TKIP //NONE //{used just as default} + {0x00, 0x0F, 0xAC, 0x03}, //WRAP-historical + {0x00, 0x0F, 0xAC, 0x04}, //CCMP + {0x00, 0x0F, 0xAC, 0x05}, //WEP-104 }; short ieee80211_is_54g(const struct ieee80211_network *net) From 2063cd41565b22e415777799660b2063ed1626ac Mon Sep 17 00:00:00 2001 From: Ana Rey Botello Date: Thu, 7 Nov 2013 09:31:21 +0100 Subject: [PATCH 036/238] Staging: rtl8187se: use macro IW_HANDLER to initialize r8180_wx_handlers Use IW_HANDLER to initialize iw_handler structure like in others wireless driver. Acked-by: Pablo Neira Ayuso Signed-off-by: Ana Rey Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/r8180_wx.c | 100 +++++++++++---------------- 1 file changed, 42 insertions(+), 58 deletions(-) diff --git a/drivers/staging/rtl8187se/r8180_wx.c b/drivers/staging/rtl8187se/r8180_wx.c index 4e01653e098a..92b76f4cca47 100644 --- a/drivers/staging/rtl8187se/r8180_wx.c +++ b/drivers/staging/rtl8187se/r8180_wx.c @@ -21,6 +21,7 @@ #include "r8180.h" #include "r8180_hw.h" +#include #include "ieee80211/dot11d.h" u32 rtl8180_rates[] = {1000000, 2000000, 5500000, 11000000, @@ -1156,65 +1157,48 @@ static int r8180_wx_set_gen_ie(struct net_device *dev, } -static iw_handler r8180_wx_handlers[] = { - NULL, /* SIOCSIWCOMMIT */ - r8180_wx_get_name, /* SIOCGIWNAME */ - dummy, /* SIOCSIWNWID */ - dummy, /* SIOCGIWNWID */ - r8180_wx_set_freq, /* SIOCSIWFREQ */ - r8180_wx_get_freq, /* SIOCGIWFREQ */ - r8180_wx_set_mode, /* SIOCSIWMODE */ - r8180_wx_get_mode, /* SIOCGIWMODE */ - r8180_wx_set_sens, /* SIOCSIWSENS */ - r8180_wx_get_sens, /* SIOCGIWSENS */ - NULL, /* SIOCSIWRANGE */ - rtl8180_wx_get_range, /* SIOCGIWRANGE */ - NULL, /* SIOCSIWPRIV */ - NULL, /* SIOCGIWPRIV */ - NULL, /* SIOCSIWSTATS */ - NULL, /* SIOCGIWSTATS */ - dummy, /* SIOCSIWSPY */ - dummy, /* SIOCGIWSPY */ - NULL, /* SIOCGIWTHRSPY */ - NULL, /* SIOCWIWTHRSPY */ - r8180_wx_set_wap, /* SIOCSIWAP */ - r8180_wx_get_wap, /* SIOCGIWAP */ - r8180_wx_set_mlme, /* SIOCSIWMLME*/ - dummy, /* SIOCGIWAPLIST -- deprecated */ - r8180_wx_set_scan, /* SIOCSIWSCAN */ - r8180_wx_get_scan, /* SIOCGIWSCAN */ - r8180_wx_set_essid, /* SIOCSIWESSID */ - r8180_wx_get_essid, /* SIOCGIWESSID */ - dummy, /* SIOCSIWNICKN */ - dummy, /* SIOCGIWNICKN */ - NULL, /* -- hole -- */ - NULL, /* -- hole -- */ - r8180_wx_set_rate, /* SIOCSIWRATE */ - r8180_wx_get_rate, /* SIOCGIWRATE */ - r8180_wx_set_rts, /* SIOCSIWRTS */ - r8180_wx_get_rts, /* SIOCGIWRTS */ - r8180_wx_set_frag, /* SIOCSIWFRAG */ - r8180_wx_get_frag, /* SIOCGIWFRAG */ - dummy, /* SIOCSIWTXPOW */ - dummy, /* SIOCGIWTXPOW */ - r8180_wx_set_retry, /* SIOCSIWRETRY */ - r8180_wx_get_retry, /* SIOCGIWRETRY */ - r8180_wx_set_enc, /* SIOCSIWENCODE */ - r8180_wx_get_enc, /* SIOCGIWENCODE */ - r8180_wx_set_power, /* SIOCSIWPOWER */ - r8180_wx_get_power, /* SIOCGIWPOWER */ - NULL, /*---hole---*/ - NULL, /*---hole---*/ - r8180_wx_set_gen_ie, /* SIOCSIWGENIE */ - NULL, /* SIOCSIWGENIE */ - r8180_wx_set_auth, /* SIOCSIWAUTH */ - NULL, /* SIOCSIWAUTH */ - r8180_wx_set_enc_ext, /* SIOCSIWENCODEEXT */ - NULL, /* SIOCSIWENCODEEXT */ - NULL, /* SIOCSIWPMKSA */ - NULL, /*---hole---*/ -}; +static const iw_handler r8180_wx_handlers[] = { + IW_HANDLER(SIOCGIWNAME, r8180_wx_get_name), + IW_HANDLER(SIOCSIWNWID, dummy), + IW_HANDLER(SIOCGIWNWID, dummy), + IW_HANDLER(SIOCSIWFREQ, r8180_wx_set_freq), + IW_HANDLER(SIOCGIWFREQ, r8180_wx_get_freq), + IW_HANDLER(SIOCSIWMODE, r8180_wx_set_mode), + IW_HANDLER(SIOCGIWMODE, r8180_wx_get_mode), + IW_HANDLER(SIOCSIWSENS, r8180_wx_set_sens), + IW_HANDLER(SIOCGIWSENS, r8180_wx_get_sens), + IW_HANDLER(SIOCGIWRANGE, rtl8180_wx_get_range), + IW_HANDLER(SIOCSIWSPY, dummy), + IW_HANDLER(SIOCGIWSPY, dummy), + IW_HANDLER(SIOCSIWAP, r8180_wx_set_wap), + IW_HANDLER(SIOCGIWAP, r8180_wx_get_wap), + IW_HANDLER(SIOCSIWMLME, r8180_wx_set_mlme), + IW_HANDLER(SIOCGIWAPLIST, dummy), /* deprecated */ + IW_HANDLER(SIOCSIWSCAN, r8180_wx_set_scan), + IW_HANDLER(SIOCGIWSCAN, r8180_wx_get_scan), + IW_HANDLER(SIOCSIWESSID, r8180_wx_set_essid), + IW_HANDLER(SIOCGIWESSID, r8180_wx_get_essid), + IW_HANDLER(SIOCSIWNICKN, dummy), + IW_HANDLER(SIOCGIWNICKN, dummy), + IW_HANDLER(SIOCSIWRATE, r8180_wx_set_rate), + IW_HANDLER(SIOCGIWRATE, r8180_wx_get_rate), + IW_HANDLER(SIOCSIWRTS, r8180_wx_set_rts), + IW_HANDLER(SIOCGIWRTS, r8180_wx_get_rts), + IW_HANDLER(SIOCSIWFRAG, r8180_wx_set_frag), + IW_HANDLER(SIOCGIWFRAG, r8180_wx_get_frag), + IW_HANDLER(SIOCSIWTXPOW, dummy), + IW_HANDLER(SIOCGIWTXPOW, dummy), + IW_HANDLER(SIOCSIWRETRY, r8180_wx_set_retry), + IW_HANDLER(SIOCGIWRETRY, r8180_wx_get_retry), + IW_HANDLER(SIOCSIWENCODE, r8180_wx_set_enc), + IW_HANDLER(SIOCGIWENCODE, r8180_wx_get_enc), + IW_HANDLER(SIOCSIWPOWER, r8180_wx_set_power), + IW_HANDLER(SIOCGIWPOWER, r8180_wx_get_power), + IW_HANDLER(SIOCSIWGENIE, r8180_wx_set_gen_ie), + IW_HANDLER(SIOCSIWAUTH, r8180_wx_set_auth), + IW_HANDLER(SIOCSIWENCODEEXT, r8180_wx_set_enc_ext), +}; static const struct iw_priv_args r8180_private_args[] = { { From 4270826c6912ff354b2ba0cb3892a6f3640a375d Mon Sep 17 00:00:00 2001 From: Himangi Saraogi Date: Fri, 8 Nov 2013 03:06:39 +0530 Subject: [PATCH 037/238] Staging:rtl8187se: Add space before open parenthesis of if condition This patch fixes the checkpatch.pl warning : space required before the open parenthesis '(' in ieee80211/ieee80211_softmac.c. Signed-off-by: Himangi Saraogi Reviewed-by: Lisa Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c index d769f168f795..7864267f7980 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c @@ -119,7 +119,7 @@ void ieee80211_WMM_Info(struct ieee80211_device *ieee, u8 **tag_p) *tag++ = 0x00; *tag++ = 0x01; #ifdef SUPPORT_USPD - if(ieee->current_network.wmm_info & 0x80) { + if (ieee->current_network.wmm_info & 0x80) { *tag++ = 0x0f|MAX_SP_Len; } else { *tag++ = MAX_SP_Len; From 821aa20462f655f052215df8afd61c4a012056f7 Mon Sep 17 00:00:00 2001 From: Himangi Saraogi Date: Fri, 8 Nov 2013 03:07:03 +0530 Subject: [PATCH 038/238] Staging:rtl8187se: Remove unnecessary braces from if-else statement This patch fixes the checkpatch.pl warning braces {} are not necessary for any arm of this statement in ieee80211/ieee80211_softmac.c. Signed-off-by: Himangi Saraogi Reviewed-by: Lisa Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c index 7864267f7980..a5d0e54100ca 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c @@ -119,11 +119,10 @@ void ieee80211_WMM_Info(struct ieee80211_device *ieee, u8 **tag_p) *tag++ = 0x00; *tag++ = 0x01; #ifdef SUPPORT_USPD - if (ieee->current_network.wmm_info & 0x80) { + if (ieee->current_network.wmm_info & 0x80) *tag++ = 0x0f|MAX_SP_Len; - } else { + else *tag++ = MAX_SP_Len; - } #else *tag++ = MAX_SP_Len; #endif From 62953c869f147f241118e3f36e58e778d86ffe25 Mon Sep 17 00:00:00 2001 From: Himangi Saraogi Date: Sun, 10 Nov 2013 14:24:44 +0530 Subject: [PATCH 039/238] Staging: rtl8187se: Fix indentation errors This patch fixes the checkpatch.pl warnings "code indent should use tabs where possible" in ieee80211/ieee80211_softmac.c. Also unnecessary blanks lines are removed. Signed-off-by: Himangi Saraogi Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- .../rtl8187se/ieee80211/ieee80211_softmac.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c index a5d0e54100ca..c281c6728e63 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c @@ -132,17 +132,15 @@ void ieee80211_WMM_Info(struct ieee80211_device *ieee, u8 **tag_p) void ieee80211_TURBO_Info(struct ieee80211_device *ieee, u8 **tag_p) { u8 *tag = *tag_p; - - *tag++ = MFIE_TYPE_GENERIC; //0 - *tag++ = 7; - *tag++ = 0x00; - *tag++ = 0xe0; - *tag++ = 0x4c; - *tag++ = 0x01;//5 - *tag++ = 0x02; - *tag++ = 0x11; + *tag++ = MFIE_TYPE_GENERIC; //0 + *tag++ = 7; + *tag++ = 0x00; + *tag++ = 0xe0; + *tag++ = 0x4c; + *tag++ = 0x01;//5 + *tag++ = 0x02; + *tag++ = 0x11; *tag++ = 0x00; - *tag_p = tag; printk(KERN_ALERT "This is enable turbo mode IE process\n"); } From fb3e170cfa4495eeef8092055dd7e84c8cf10961 Mon Sep 17 00:00:00 2001 From: Himangi Saraogi Date: Sun, 10 Nov 2013 14:26:17 +0530 Subject: [PATCH 040/238] Staging: rtl8187se: Remove C99 style commenting This patch fixes the checkpatch.pl warning "do not use C99 // comments" in ieee80211/ieee80211_softmac.c. Signed-off-by: Himangi Saraogi Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c index c281c6728e63..7e16ccb7a645 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c @@ -132,12 +132,12 @@ void ieee80211_WMM_Info(struct ieee80211_device *ieee, u8 **tag_p) void ieee80211_TURBO_Info(struct ieee80211_device *ieee, u8 **tag_p) { u8 *tag = *tag_p; - *tag++ = MFIE_TYPE_GENERIC; //0 + *tag++ = MFIE_TYPE_GENERIC; /* 0 */ *tag++ = 7; *tag++ = 0x00; *tag++ = 0xe0; *tag++ = 0x4c; - *tag++ = 0x01;//5 + *tag++ = 0x01; /* 5 */ *tag++ = 0x02; *tag++ = 0x11; *tag++ = 0x00; From 33700ac776ce60352c98c4d5fe149b48cfe790e1 Mon Sep 17 00:00:00 2001 From: Dulshani Gunawardhana Date: Thu, 31 Oct 2013 21:51:32 +0530 Subject: [PATCH 041/238] staging:lustre: Fix plain integer as NULL pointer warning Fix the sparse warning of 'Using plain integer as NULL pointer' in lproc_lov.c. Signed-off-by: Dulshani Gunawardhana Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lov/lproc_lov.c | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lproc_lov.c b/drivers/staging/lustre/lustre/lov/lproc_lov.c index 15744e13a3f2..e6f22e3a3a38 100644 --- a/drivers/staging/lustre/lustre/lov/lproc_lov.c +++ b/drivers/staging/lustre/lustre/lov/lproc_lov.c @@ -260,29 +260,29 @@ LPROC_SEQ_FOPS_RO_TYPE(lov, kbytesfree); LPROC_SEQ_FOPS_RO_TYPE(lov, kbytesavail); struct lprocfs_vars lprocfs_lov_obd_vars[] = { - { "uuid", &lov_uuid_fops, 0, 0 }, - { "stripesize", &lov_stripesize_fops, 0 }, - { "stripeoffset", &lov_stripeoffset_fops, 0 }, - { "stripecount", &lov_stripecount_fops, 0 }, - { "stripetype", &lov_stripetype_fops, 0 }, - { "numobd", &lov_numobd_fops, 0, 0 }, - { "activeobd", &lov_activeobd_fops, 0, 0 }, - { "filestotal", &lov_filestotal_fops, 0, 0 }, - { "filesfree", &lov_filesfree_fops, 0, 0 }, - /*{ "filegroups", lprocfs_rd_filegroups, 0, 0 },*/ - { "blocksize", &lov_blksize_fops, 0, 0 }, - { "kbytestotal", &lov_kbytestotal_fops, 0, 0 }, - { "kbytesfree", &lov_kbytesfree_fops, 0, 0 }, - { "kbytesavail", &lov_kbytesavail_fops, 0, 0 }, - { "desc_uuid", &lov_desc_uuid_fops, 0, 0 }, - { 0 } + { "uuid", &lov_uuid_fops, NULL, 0 }, + { "stripesize", &lov_stripesize_fops, NULL }, + { "stripeoffset", &lov_stripeoffset_fops, NULL }, + { "stripecount", &lov_stripecount_fops, NULL }, + { "stripetype", &lov_stripetype_fops, NULL }, + { "numobd", &lov_numobd_fops, NULL, 0 }, + { "activeobd", &lov_activeobd_fops, NULL, 0 }, + { "filestotal", &lov_filestotal_fops, NULL, 0 }, + { "filesfree", &lov_filesfree_fops, NULL, 0 }, + /*{ "filegroups", lprocfs_rd_filegroups, NULL, 0 },*/ + { "blocksize", &lov_blksize_fops, NULL, 0 }, + { "kbytestotal", &lov_kbytestotal_fops, NULL, 0 }, + { "kbytesfree", &lov_kbytesfree_fops, NULL, 0 }, + { "kbytesavail", &lov_kbytesavail_fops, NULL, 0 }, + { "desc_uuid", &lov_desc_uuid_fops, NULL, 0 }, + { NULL } }; LPROC_SEQ_FOPS_RO_TYPE(lov, numrefs); static struct lprocfs_vars lprocfs_lov_module_vars[] = { - { "num_refs", &lov_numrefs_fops, 0, 0 }, - { 0 } + { "num_refs", &lov_numrefs_fops, NULL, 0 }, + { NULL } }; void lprocfs_lov_init_vars(struct lprocfs_static_vars *lvars) From b008e65cc236ce693017589c09ee3ac838630c35 Mon Sep 17 00:00:00 2001 From: Teodora Baluta Date: Tue, 5 Nov 2013 18:36:45 +0200 Subject: [PATCH 042/238] staging: lustre: remove space between function name and open parenthesis This fixes the following checkpatch.pl warnings: WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Teodora Baluta Reviewed-by: Lisa Nguyen Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/nidstrings.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/nidstrings.c b/drivers/staging/lustre/lustre/libcfs/nidstrings.c index 99c9e9d2493f..347579d7f560 100644 --- a/drivers/staging/lustre/lustre/libcfs/nidstrings.c +++ b/drivers/staging/lustre/lustre/libcfs/nidstrings.c @@ -60,7 +60,7 @@ static int libcfs_nidstring_idx = 0; static spinlock_t libcfs_nidstring_lock; -void libcfs_init_nidstrings (void) +void libcfs_init_nidstrings(void) { spin_lock_init(&libcfs_nidstring_lock); } @@ -69,7 +69,7 @@ void libcfs_init_nidstrings (void) # define NIDSTR_UNLOCK(f) spin_unlock_irqrestore(&libcfs_nidstring_lock, f) static char * -libcfs_next_nidstring (void) +libcfs_next_nidstring(void) { char *str; unsigned long flags; @@ -475,7 +475,7 @@ libcfs_str2nid(const char *str) sep = str + strlen(str); net = LNET_MKNET(SOCKLND, 0); nf = libcfs_lnd2netstrfns(SOCKLND); - LASSERT (nf != NULL); + LASSERT(nf != NULL); } if (!nf->nf_str2addr(str, (int)(sep - str), &addr)) From 0b2b3070f1f920ff9dae1ea26809944b6b1d46f2 Mon Sep 17 00:00:00 2001 From: Teodora Baluta Date: Tue, 5 Nov 2013 18:36:46 +0200 Subject: [PATCH 043/238] staging: lustre: place EXPORT_SYMBOL after its function This patch fixes the following type of warnings detected by checkpatch.pl: WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable Signed-off-by: Teodora Baluta Reviewed-by: Lisa Nguyen Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/libcfs/nidstrings.c | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/nidstrings.c b/drivers/staging/lustre/lustre/libcfs/nidstrings.c index 347579d7f560..790c5130b74c 100644 --- a/drivers/staging/lustre/lustre/libcfs/nidstrings.c +++ b/drivers/staging/lustre/lustre/libcfs/nidstrings.c @@ -326,6 +326,7 @@ libcfs_isknown_lnd(int type) { return libcfs_lnd2netstrfns(type) != NULL; } +EXPORT_SYMBOL(libcfs_isknown_lnd); char * libcfs_lnd2modname(int lnd) @@ -334,6 +335,7 @@ libcfs_lnd2modname(int lnd) return (nf == NULL) ? NULL : nf->nf_modname; } +EXPORT_SYMBOL(libcfs_lnd2modname); char * libcfs_lnd2str(int lnd) @@ -348,6 +350,7 @@ libcfs_lnd2str(int lnd) snprintf(str, LNET_NIDSTR_SIZE, "?%u?", lnd); return str; } +EXPORT_SYMBOL(libcfs_lnd2str); int libcfs_str2lnd(const char *str) @@ -359,6 +362,7 @@ libcfs_str2lnd(const char *str) return -1; } +EXPORT_SYMBOL(libcfs_str2lnd); char * libcfs_net2str(__u32 net) @@ -377,6 +381,7 @@ libcfs_net2str(__u32 net) return str; } +EXPORT_SYMBOL(libcfs_net2str); char * libcfs_nid2str(lnet_nid_t nid) @@ -410,6 +415,7 @@ libcfs_nid2str(lnet_nid_t nid) return str; } +EXPORT_SYMBOL(libcfs_nid2str); static struct netstrfns * libcfs_str2net_internal(const char *str, __u32 *net) @@ -458,6 +464,7 @@ libcfs_str2net(const char *str) return LNET_NIDNET(LNET_NID_ANY); } +EXPORT_SYMBOL(libcfs_str2net); lnet_nid_t libcfs_str2nid(const char *str) @@ -483,6 +490,7 @@ libcfs_str2nid(const char *str) return LNET_MKNID(net, addr); } +EXPORT_SYMBOL(libcfs_str2nid); char * libcfs_id2str(lnet_process_id_t id) @@ -500,6 +508,7 @@ libcfs_id2str(lnet_process_id_t id) (id.pid & ~LNET_PID_USERFLAG), libcfs_nid2str(id.nid)); return str; } +EXPORT_SYMBOL(libcfs_id2str); int libcfs_str2anynid(lnet_nid_t *nidp, const char *str) @@ -512,6 +521,7 @@ libcfs_str2anynid(lnet_nid_t *nidp, const char *str) *nidp = libcfs_str2nid(str); return *nidp != LNET_NID_ANY; } +EXPORT_SYMBOL(libcfs_str2anynid); /** * Nid range list syntax. @@ -765,6 +775,7 @@ cfs_free_nidlist(struct list_head *list) LIBCFS_FREE(nr, sizeof(struct nidrange)); } } +EXPORT_SYMBOL(cfs_free_nidlist); /** * Parses nid range list. @@ -803,6 +814,7 @@ cfs_parse_nidlist(char *str, int len, struct list_head *nidlist) } return 1; } +EXPORT_SYMBOL(cfs_parse_nidlist); /* * Nf_match_addr method for networks using numeric addresses @@ -848,18 +860,4 @@ int cfs_match_nid(lnet_nid_t nid, struct list_head *nidlist) } return 0; } - - -EXPORT_SYMBOL(libcfs_isknown_lnd); -EXPORT_SYMBOL(libcfs_lnd2modname); -EXPORT_SYMBOL(libcfs_lnd2str); -EXPORT_SYMBOL(libcfs_str2lnd); -EXPORT_SYMBOL(libcfs_net2str); -EXPORT_SYMBOL(libcfs_nid2str); -EXPORT_SYMBOL(libcfs_str2net); -EXPORT_SYMBOL(libcfs_str2nid); -EXPORT_SYMBOL(libcfs_id2str); -EXPORT_SYMBOL(libcfs_str2anynid); -EXPORT_SYMBOL(cfs_free_nidlist); -EXPORT_SYMBOL(cfs_parse_nidlist); EXPORT_SYMBOL(cfs_match_nid); From 06fcedc8ea5df80c7a6d7940d6ec97056aff2de2 Mon Sep 17 00:00:00 2001 From: Teodora Baluta Date: Tue, 5 Nov 2013 18:36:47 +0200 Subject: [PATCH 044/238] staging: lustre: remove initialisation of static variable Fix the following checkpatch.pl error: ERROR: do not initialise statics to 0 or NULL +static int libcfs_nidstring_idx = 0; Signed-off-by: Teodora Baluta Reviewed-by: Lisa Nguyen Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/nidstrings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/libcfs/nidstrings.c b/drivers/staging/lustre/lustre/libcfs/nidstrings.c index 790c5130b74c..732ae5540bf4 100644 --- a/drivers/staging/lustre/lustre/libcfs/nidstrings.c +++ b/drivers/staging/lustre/lustre/libcfs/nidstrings.c @@ -56,7 +56,7 @@ */ static char libcfs_nidstrings[LNET_NIDSTR_COUNT][LNET_NIDSTR_SIZE]; -static int libcfs_nidstring_idx = 0; +static int libcfs_nidstring_idx; static spinlock_t libcfs_nidstring_lock; From 51d6774a91fbf1b311aa8f412d761048af7d8d53 Mon Sep 17 00:00:00 2001 From: Ebru Akagunduz Date: Sun, 10 Nov 2013 19:10:31 +0200 Subject: [PATCH 045/238] Staging: rtl8187se: fix printk() should include kern_ facility level Fix checkpatch.pl issues with printk() should include kern_ facility level in r8185b_init.c Signed-off-by: Ebru Akagunduz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/r8185b_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8187se/r8185b_init.c b/drivers/staging/rtl8187se/r8185b_init.c index dc52a3e584d8..f2f0dc7d4e9a 100644 --- a/drivers/staging/rtl8187se/r8185b_init.c +++ b/drivers/staging/rtl8187se/r8185b_init.c @@ -497,7 +497,7 @@ static void ZEBRA_Config_85BASIC_HardCode(struct net_device *dev) */ RF_WriteReg(dev, 0x0f, (priv->XtalCal_Xin<<5) | (priv->XtalCal_Xout<<1) | BIT11 | BIT9); mdelay(1); - printk("ZEBRA_Config_85BASIC_HardCode(): (%02x)\n", + netdev_info(dev, "ZEBRA_Config_85BASIC_HardCode(): (%02x)\n", (priv->XtalCal_Xin<<5) | (priv->XtalCal_Xout<<1) | BIT11 | BIT9); } else { @@ -1125,7 +1125,7 @@ bool MgntActSet_RF_State(struct net_device *dev, * to be stuck here. */ if (RFWaitCounter > 1000) { /* 1sec */ - printk("MgntActSet_RF_State(): Wait too long to set RF\n"); + netdev_info(dev, "MgntActSet_RF_State(): Wait too long to set RF\n"); /* TODO: Reset RF state? */ return false; } From 1e01f94317cf85bd4b0bbeaf4e00cf948d660ee0 Mon Sep 17 00:00:00 2001 From: Archana kumari Date: Fri, 1 Nov 2013 12:19:21 +0530 Subject: [PATCH 046/238] staging: vt6655: fixed sparse warning for static declaration in wpa2.c This patch fixes sparse warning for static declaration in wpa2.c Signed-off-by: Archana kumari Reviewed-by: Josh Triplett Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/wpa2.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/vt6655/wpa2.c b/drivers/staging/vt6655/wpa2.c index 089788dfba63..a7e33c0ceb74 100644 --- a/drivers/staging/vt6655/wpa2.c +++ b/drivers/staging/vt6655/wpa2.c @@ -42,14 +42,14 @@ static int msglevel = MSG_LEVEL_INFO; /*--------------------- Static Variables --------------------------*/ -const unsigned char abyOUIGK[4] = { 0x00, 0x0F, 0xAC, 0x00 }; -const unsigned char abyOUIWEP40[4] = { 0x00, 0x0F, 0xAC, 0x01 }; -const unsigned char abyOUIWEP104[4] = { 0x00, 0x0F, 0xAC, 0x05 }; -const unsigned char abyOUITKIP[4] = { 0x00, 0x0F, 0xAC, 0x02 }; -const unsigned char abyOUICCMP[4] = { 0x00, 0x0F, 0xAC, 0x04 }; +static const unsigned char abyOUIGK[4] = { 0x00, 0x0F, 0xAC, 0x00 }; +static const unsigned char abyOUIWEP40[4] = { 0x00, 0x0F, 0xAC, 0x01 }; +static const unsigned char abyOUIWEP104[4] = { 0x00, 0x0F, 0xAC, 0x05 }; +static const unsigned char abyOUITKIP[4] = { 0x00, 0x0F, 0xAC, 0x02 }; +static const unsigned char abyOUICCMP[4] = { 0x00, 0x0F, 0xAC, 0x04 }; -const unsigned char abyOUI8021X[4] = { 0x00, 0x0F, 0xAC, 0x01 }; -const unsigned char abyOUIPSK[4] = { 0x00, 0x0F, 0xAC, 0x02 }; +static const unsigned char abyOUI8021X[4] = { 0x00, 0x0F, 0xAC, 0x01 }; +static const unsigned char abyOUIPSK[4] = { 0x00, 0x0F, 0xAC, 0x02 }; /*--------------------- Static Functions --------------------------*/ From 3b1388518a316f1eefe0b781e0583937d5407160 Mon Sep 17 00:00:00 2001 From: Valentina Manea Date: Mon, 4 Nov 2013 10:44:02 +0200 Subject: [PATCH 047/238] staging: vt6656: Fix (most) sparse warnings regarding static functions/variables This fixes sparse warnings for functions and variables, e.g.: * drivers/staging/vt6656/card.c:69:11: warning: symbol 'cwRXBCNTSFOff' was not declared. Should it be static? Some warnings were false positives, such as: * drivers/staging/vt6656/dpc.c:249:5: warning: symbol 'RXbBulkInProcessData' was not declared. Should it be static? Signed-off-by: Valentina Manea Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/aes_ccmp.c | 16 ++++++++-------- drivers/staging/vt6656/baseband.c | 8 ++++---- drivers/staging/vt6656/bssdb.c | 4 ++-- drivers/staging/vt6656/card.c | 4 ++-- drivers/staging/vt6656/datarate.c | 2 +- drivers/staging/vt6656/dpc.c | 2 +- drivers/staging/vt6656/rf.c | 4 ++-- drivers/staging/vt6656/rxtx.c | 6 +++--- drivers/staging/vt6656/tkip.c | 4 ++-- drivers/staging/vt6656/wcmd.c | 5 +++-- drivers/staging/vt6656/wmgr.c | 10 +++++----- drivers/staging/vt6656/wpa.c | 12 ++++++------ drivers/staging/vt6656/wpa2.c | 14 +++++++------- 13 files changed, 46 insertions(+), 45 deletions(-) diff --git a/drivers/staging/vt6656/aes_ccmp.c b/drivers/staging/vt6656/aes_ccmp.c index 6c7693911cd6..61b9f7bdb858 100644 --- a/drivers/staging/vt6656/aes_ccmp.c +++ b/drivers/staging/vt6656/aes_ccmp.c @@ -37,7 +37,7 @@ * SBOX Table */ -u8 sbox_table[256] = { +static u8 sbox_table[256] = { 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, @@ -56,7 +56,7 @@ u8 sbox_table[256] = { 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 }; -u8 dot2_table[256] = { +static u8 dot2_table[256] = { 0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e, 0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e, 0x40, 0x42, 0x44, 0x46, 0x48, 0x4a, 0x4c, 0x4e, 0x50, 0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e, @@ -75,7 +75,7 @@ u8 dot2_table[256] = { 0xfb, 0xf9, 0xff, 0xfd, 0xf3, 0xf1, 0xf7, 0xf5, 0xeb, 0xe9, 0xef, 0xed, 0xe3, 0xe1, 0xe7, 0xe5 }; -u8 dot3_table[256] = { +static u8 dot3_table[256] = { 0x00, 0x03, 0x06, 0x05, 0x0c, 0x0f, 0x0a, 0x09, 0x18, 0x1b, 0x1e, 0x1d, 0x14, 0x17, 0x12, 0x11, 0x30, 0x33, 0x36, 0x35, 0x3c, 0x3f, 0x3a, 0x39, 0x28, 0x2b, 0x2e, 0x2d, 0x24, 0x27, 0x22, 0x21, 0x60, 0x63, 0x66, 0x65, 0x6c, 0x6f, 0x6a, 0x69, 0x78, 0x7b, 0x7e, 0x7d, 0x74, 0x77, 0x72, 0x71, @@ -115,7 +115,7 @@ static void xor_32(u8 *a, u8 *b, u8 *out) (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++); } -void AddRoundKey(u8 *key, int round) +static void AddRoundKey(u8 *key, int round) { u8 sbox_key[4]; u8 rcon_table[10] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36}; @@ -133,7 +133,7 @@ void AddRoundKey(u8 *key, int round) xor_32(&key[12], &key[8], &key[12]); } -void SubBytes(u8 *in, u8 *out) +static void SubBytes(u8 *in, u8 *out) { int i; @@ -141,7 +141,7 @@ void SubBytes(u8 *in, u8 *out) out[i] = sbox_table[in[i]]; } -void ShiftRows(u8 *in, u8 *out) +static void ShiftRows(u8 *in, u8 *out) { out[0] = in[0]; out[1] = in[5]; @@ -161,7 +161,7 @@ void ShiftRows(u8 *in, u8 *out) out[15] = in[11]; } -void MixColumns(u8 *in, u8 *out) +static void MixColumns(u8 *in, u8 *out) { out[0] = dot2_table[in[0]] ^ dot3_table[in[1]] ^ in[2] ^ in[3]; @@ -170,7 +170,7 @@ void MixColumns(u8 *in, u8 *out) out[3] = dot3_table[in[0]] ^ in[1] ^ in[2] ^ dot2_table[in[3]]; } -void AESv128(u8 *key, u8 *data, u8 *ciphertext) +static void AESv128(u8 *key, u8 *data, u8 *ciphertext) { int i; int round; diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index 1e8b8412e67e..5f6480e7353d 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -48,7 +48,7 @@ static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; -u8 abyVT3184_AGC[] = { +static u8 abyVT3184_AGC[] = { 0x00, //0 0x00, //1 0x02, //2 @@ -115,7 +115,7 @@ u8 abyVT3184_AGC[] = { 0x3E //3F }; -u8 abyVT3184_AL2230[] = { +static u8 abyVT3184_AL2230[] = { 0x31,//00 0x00, 0x00, @@ -375,7 +375,7 @@ u8 abyVT3184_AL2230[] = { }; //{{RobertYu:20060515, new BB setting for VT3226D0 -u8 abyVT3184_VT3226D0[] = { +static u8 abyVT3184_VT3226D0[] = { 0x31,//00 0x00, 0x00, @@ -634,7 +634,7 @@ u8 abyVT3184_VT3226D0[] = { 0x00, }; -const u16 awcFrameTime[MAX_RATE] = +static const u16 awcFrameTime[MAX_RATE] = {10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216}; /* diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c index dad3f8c78e21..1c3cbc54ce18 100644 --- a/drivers/staging/vt6656/bssdb.c +++ b/drivers/staging/vt6656/bssdb.c @@ -62,14 +62,14 @@ static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; -const u16 awHWRetry0[5][5] = { +static const u16 awHWRetry0[5][5] = { {RATE_18M, RATE_18M, RATE_12M, RATE_12M, RATE_12M}, {RATE_24M, RATE_24M, RATE_18M, RATE_12M, RATE_12M}, {RATE_36M, RATE_36M, RATE_24M, RATE_18M, RATE_18M}, {RATE_48M, RATE_48M, RATE_36M, RATE_24M, RATE_24M}, {RATE_54M, RATE_54M, RATE_48M, RATE_36M, RATE_36M} }; -const u16 awHWRetry1[5][5] = { +static const u16 awHWRetry1[5][5] = { {RATE_18M, RATE_18M, RATE_12M, RATE_6M, RATE_6M}, {RATE_24M, RATE_24M, RATE_18M, RATE_6M, RATE_6M}, {RATE_36M, RATE_36M, RATE_24M, RATE_12M, RATE_12M}, diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index 19d3cf451b88..662cfea7527e 100644 --- a/drivers/staging/vt6656/card.c +++ b/drivers/staging/vt6656/card.c @@ -66,7 +66,7 @@ static int msglevel =MSG_LEVEL_INFO; //const u16 cwRXBCNTSFOff[MAX_RATE] = //{17, 34, 96, 192, 34, 23, 17, 11, 8, 5, 4, 3}; -const u16 cwRXBCNTSFOff[MAX_RATE] = +static const u16 cwRXBCNTSFOff[MAX_RATE] = {192, 96, 34, 17, 34, 23, 17, 11, 8, 5, 4, 3}; /* @@ -205,7 +205,7 @@ static u16 swGetOFDMControlRate(struct vnt_private *pDevice, u16 wRateIdx) * Return Value: none * */ -void +static void CARDvCalculateOFDMRParameter ( u16 wRate, u8 byBBType, diff --git a/drivers/staging/vt6656/datarate.c b/drivers/staging/vt6656/datarate.c index af9eab0c00a3..547db6f0c53f 100644 --- a/drivers/staging/vt6656/datarate.c +++ b/drivers/staging/vt6656/datarate.c @@ -45,7 +45,7 @@ /* static int msglevel = MSG_LEVEL_DEBUG; */ static int msglevel = MSG_LEVEL_INFO; -const u8 acbyIERate[MAX_RATE] = {0x02, 0x04, 0x0B, 0x16, 0x0C, 0x12, 0x18, +static const u8 acbyIERate[MAX_RATE] = {0x02, 0x04, 0x0B, 0x16, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; #define AUTORATE_TXOK_CNT 0x0400 diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c index 75dc92d64056..2bed31b741c0 100644 --- a/drivers/staging/vt6656/dpc.c +++ b/drivers/staging/vt6656/dpc.c @@ -59,7 +59,7 @@ //static int msglevel =MSG_LEVEL_DEBUG; static int msglevel =MSG_LEVEL_INFO; -const u8 acbyRxRate[MAX_RATE] = +static const u8 acbyRxRate[MAX_RATE] = {2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108}; static u8 s_byGetRateIdx(u8 byRate); diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c index d27fa434550d..e545232f670b 100644 --- a/drivers/staging/vt6656/rf.c +++ b/drivers/staging/vt6656/rf.c @@ -419,7 +419,7 @@ static u8 vt3226_channel_table1[CB_MAX_CHANNEL_24G][3] = { ///}}RobertYu //{{RobertYu:20060502, TWIF 1.14, LO Current for 11b mode -const u32 vt3226d0_lo_current_table[CB_MAX_CHANNEL_24G] = { +static const u32 vt3226d0_lo_current_table[CB_MAX_CHANNEL_24G] = { 0x0135C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz 0x0135C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz 0x0235C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 3, Tf = 2422MHz @@ -597,7 +597,7 @@ static u8 vt3342_channel_table1[CB_MAX_CHANNEL][3] = { * -*/ -const u32 al2230_power_table[AL2230_PWR_IDX_LEN] = { +static const u32 al2230_power_table[AL2230_PWR_IDX_LEN] = { 0x04040900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, 0x04041900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, 0x04042900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index 35a3ddb41a6a..5601331708f3 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -64,16 +64,16 @@ static int msglevel = MSG_LEVEL_INFO; -const u16 wTimeStampOff[2][MAX_RATE] = { +static const u16 wTimeStampOff[2][MAX_RATE] = { {384, 288, 226, 209, 54, 43, 37, 31, 28, 25, 24, 23}, // Long Preamble {384, 192, 130, 113, 54, 43, 37, 31, 28, 25, 24, 23}, // Short Preamble }; -const u16 wFB_Opt0[2][5] = { +static const u16 wFB_Opt0[2][5] = { {RATE_12M, RATE_18M, RATE_24M, RATE_36M, RATE_48M}, // fallback_rate0 {RATE_12M, RATE_12M, RATE_18M, RATE_24M, RATE_36M}, // fallback_rate1 }; -const u16 wFB_Opt1[2][5] = { +static const u16 wFB_Opt1[2][5] = { {RATE_12M, RATE_18M, RATE_24M, RATE_24M, RATE_36M}, // fallback_rate0 {RATE_6M , RATE_6M, RATE_12M, RATE_12M, RATE_18M}, // fallback_rate1 }; diff --git a/drivers/staging/vt6656/tkip.c b/drivers/staging/vt6656/tkip.c index 9d643e449ac3..28282f345901 100644 --- a/drivers/staging/vt6656/tkip.c +++ b/drivers/staging/vt6656/tkip.c @@ -39,7 +39,7 @@ /* The 2nd table is the same as the 1st but with the upper and lower */ /* bytes swapped. To allow an endian tolerant implementation, the byte */ /* halves have been expressed independently here. */ -const u8 TKIP_Sbox_Lower[256] = { +static const u8 TKIP_Sbox_Lower[256] = { 0xA5,0x84,0x99,0x8D,0x0D,0xBD,0xB1,0x54, 0x50,0x03,0xA9,0x7D,0x19,0x62,0xE6,0x9A, 0x45,0x9D,0x40,0x87,0x15,0xEB,0xC9,0x0B, @@ -74,7 +74,7 @@ const u8 TKIP_Sbox_Lower[256] = { 0xC3,0xB0,0x77,0x11,0xCB,0xFC,0xD6,0x3A }; -const u8 TKIP_Sbox_Upper[256] = { +static const u8 TKIP_Sbox_Upper[256] = { 0xC6,0xF8,0xEE,0xF6,0xFF,0xD6,0xDE,0x91, 0x60,0x02,0xCE,0x56,0xE7,0xB5,0x4D,0xEC, 0x8F,0x1F,0x89,0xFA,0xEF,0xB2,0x8E,0xFB, diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index 2f8e2a875331..1031e54284f7 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -224,7 +224,7 @@ static void s_vProbeChannel(struct vnt_private *pDevice) * -*/ -struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *pDevice, +static struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *pDevice, struct vnt_manager *pMgmt, u8 *pScanBSSID, PWLAN_IE_SSID pSSID, PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates) { @@ -266,7 +266,8 @@ struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *pDevice, return pTxPacket; } -void vCommandTimerWait(struct vnt_private *pDevice, unsigned long MSecond) +static void +vCommandTimerWait(struct vnt_private *pDevice, unsigned long MSecond) { schedule_delayed_work(&pDevice->run_command_work, msecs_to_jiffies(MSecond)); diff --git a/drivers/staging/vt6656/wmgr.c b/drivers/staging/vt6656/wmgr.c index e26c41519b15..d74b0e7cb171 100644 --- a/drivers/staging/vt6656/wmgr.c +++ b/drivers/staging/vt6656/wmgr.c @@ -2961,7 +2961,7 @@ static struct vnt_tx_mgmt *s_MgrMakeBeacon(struct vnt_private *pDevice, * -*/ -struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *pDevice, +static struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *pDevice, struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wCurrBeaconPeriod, u32 uCurrChannel, u16 wCurrATIMWinodw, u8 *pDstAddr, PWLAN_IE_SSID pCurrSSID, u8 *pCurrBSSID, @@ -3081,7 +3081,7 @@ struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *pDevice, * -*/ -struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *pDevice, +static struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *pDevice, struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo, u16 wListenInterval, PWLAN_IE_SSID pCurrSSID, @@ -3329,7 +3329,7 @@ struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *pDevice, * -*/ -struct vnt_tx_mgmt *s_MgrMakeReAssocRequest(struct vnt_private *pDevice, +static struct vnt_tx_mgmt *s_MgrMakeReAssocRequest(struct vnt_private *pDevice, struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo, u16 wListenInterval, PWLAN_IE_SSID pCurrSSID, PWLAN_IE_SUPP_RATES pCurrRates, @@ -3576,7 +3576,7 @@ struct vnt_tx_mgmt *s_MgrMakeReAssocRequest(struct vnt_private *pDevice, * -*/ -struct vnt_tx_mgmt *s_MgrMakeAssocResponse(struct vnt_private *pDevice, +static struct vnt_tx_mgmt *s_MgrMakeAssocResponse(struct vnt_private *pDevice, struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus, u16 wAssocAID, u8 *pDstAddr, PWLAN_IE_SUPP_RATES pCurrSuppRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates) @@ -3642,7 +3642,7 @@ struct vnt_tx_mgmt *s_MgrMakeAssocResponse(struct vnt_private *pDevice, * -*/ -struct vnt_tx_mgmt *s_MgrMakeReAssocResponse(struct vnt_private *pDevice, +static struct vnt_tx_mgmt *s_MgrMakeReAssocResponse(struct vnt_private *pDevice, struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus, u16 wAssocAID, u8 *pDstAddr, PWLAN_IE_SUPP_RATES pCurrSuppRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates) diff --git a/drivers/staging/vt6656/wpa.c b/drivers/staging/vt6656/wpa.c index 01db4e7154da..403c295cc02c 100644 --- a/drivers/staging/vt6656/wpa.c +++ b/drivers/staging/vt6656/wpa.c @@ -43,12 +43,12 @@ static int msglevel =MSG_LEVEL_INFO; -const u8 abyOUI00[4] = { 0x00, 0x50, 0xf2, 0x00 }; -const u8 abyOUI01[4] = { 0x00, 0x50, 0xf2, 0x01 }; -const u8 abyOUI02[4] = { 0x00, 0x50, 0xf2, 0x02 }; -const u8 abyOUI03[4] = { 0x00, 0x50, 0xf2, 0x03 }; -const u8 abyOUI04[4] = { 0x00, 0x50, 0xf2, 0x04 }; -const u8 abyOUI05[4] = { 0x00, 0x50, 0xf2, 0x05 }; +static const u8 abyOUI00[4] = { 0x00, 0x50, 0xf2, 0x00 }; +static const u8 abyOUI01[4] = { 0x00, 0x50, 0xf2, 0x01 }; +static const u8 abyOUI02[4] = { 0x00, 0x50, 0xf2, 0x02 }; +static const u8 abyOUI03[4] = { 0x00, 0x50, 0xf2, 0x03 }; +static const u8 abyOUI04[4] = { 0x00, 0x50, 0xf2, 0x04 }; +static const u8 abyOUI05[4] = { 0x00, 0x50, 0xf2, 0x05 }; /*+ * diff --git a/drivers/staging/vt6656/wpa2.c b/drivers/staging/vt6656/wpa2.c index aa2216184345..df5541794e0f 100644 --- a/drivers/staging/vt6656/wpa2.c +++ b/drivers/staging/vt6656/wpa2.c @@ -37,14 +37,14 @@ static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; -const u8 abyOUIGK[4] = { 0x00, 0x0F, 0xAC, 0x00 }; -const u8 abyOUIWEP40[4] = { 0x00, 0x0F, 0xAC, 0x01 }; -const u8 abyOUIWEP104[4] = { 0x00, 0x0F, 0xAC, 0x05 }; -const u8 abyOUITKIP[4] = { 0x00, 0x0F, 0xAC, 0x02 }; -const u8 abyOUICCMP[4] = { 0x00, 0x0F, 0xAC, 0x04 }; +static const u8 abyOUIGK[4] = { 0x00, 0x0F, 0xAC, 0x00 }; +static const u8 abyOUIWEP40[4] = { 0x00, 0x0F, 0xAC, 0x01 }; +static const u8 abyOUIWEP104[4] = { 0x00, 0x0F, 0xAC, 0x05 }; +static const u8 abyOUITKIP[4] = { 0x00, 0x0F, 0xAC, 0x02 }; +static const u8 abyOUICCMP[4] = { 0x00, 0x0F, 0xAC, 0x04 }; -const u8 abyOUI8021X[4] = { 0x00, 0x0F, 0xAC, 0x01 }; -const u8 abyOUIPSK[4] = { 0x00, 0x0F, 0xAC, 0x02 }; +static const u8 abyOUI8021X[4] = { 0x00, 0x0F, 0xAC, 0x01 }; +static const u8 abyOUIPSK[4] = { 0x00, 0x0F, 0xAC, 0x02 }; /*+ * From ebd381d9851bba4b9565ec3b414055c726391907 Mon Sep 17 00:00:00 2001 From: Nandini Hanumanthagowda Date: Sun, 3 Nov 2013 18:30:52 +0530 Subject: [PATCH 048/238] staging: vt6656: fixed whitespace related errors around operators removed prohibited spaces around operators and added required spaces around operators wherever necessary to fix checkpatch errors Signed-off-by: Nandini Hanumanthagowda Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/wcmd.c | 112 +++++++++++++++++----------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index 1031e54284f7..ca57fc37d609 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -55,8 +55,8 @@ #include "channel.h" #include "iowpa.h" -static int msglevel =MSG_LEVEL_INFO; -//static int msglevel =MSG_LEVEL_DEBUG; +static int msglevel = MSG_LEVEL_INFO; +//static int msglevel = MSG_LEVEL_DEBUG; static void s_vProbeChannel(struct vnt_private *); @@ -200,8 +200,8 @@ static void s_vProbeChannel(struct vnt_private *pDevice) (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRatesG ); - if (pTxPacket != NULL ){ - for (ii = 0; ii < 1 ; ii++) { + if (pTxPacket != NULL) { + for (ii = 0; ii < 1; ii++) { if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request sending fail.. \n"); } @@ -244,9 +244,9 @@ static struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *pDevice, WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_PROBEREQ) )); - memcpy( sFrame.pHdr->sA3.abyAddr1, pScanBSSID, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); - memcpy( sFrame.pHdr->sA3.abyAddr3, pScanBSSID, WLAN_BSSID_LEN); + memcpy(sFrame.pHdr->sA3.abyAddr1, pScanBSSID, WLAN_ADDR_LEN); + memcpy(sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); + memcpy(sFrame.pHdr->sA3.abyAddr3, pScanBSSID, WLAN_BSSID_LEN); // Copy the SSID, pSSID->len=0 indicate broadcast SSID sFrame.pSSID = (PWLAN_IE_SSID)(sFrame.pBuf + sFrame.len); sFrame.len += pSSID->len + WLAN_IEHDR_LEN; @@ -297,7 +297,7 @@ void vRunCommand(struct work_struct *work) spin_lock_irq(&pDevice->lock); - switch ( pDevice->eCommandState ) { + switch (pDevice->eCommandState) { case WLAN_CMD_SCAN_START: @@ -316,7 +316,7 @@ void vRunCommand(struct work_struct *work) pItemSSID = (PWLAN_IE_SSID)pMgmt->abyScanSSID; - if (pMgmt->uScanChannel == 0 ) { + if (pMgmt->uScanChannel == 0) { pMgmt->uScanChannel = pDevice->byMinChannel; } if (pMgmt->uScanChannel > pDevice->byMaxChannel) { @@ -327,7 +327,7 @@ void vRunCommand(struct work_struct *work) } else { if (!ChannelValid(pDevice->byZoneType, pMgmt->uScanChannel)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Invalid channel pMgmt->uScanChannel = %d \n",pMgmt->uScanChannel); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Invalid channel pMgmt->uScanChannel = %d \n", pMgmt->uScanChannel); pMgmt->uScanChannel++; s_bCommandComplete(pDevice); spin_unlock_irq(&pDevice->lock); @@ -376,7 +376,7 @@ void vRunCommand(struct work_struct *work) pMgmt->uScanChannel++; while (!ChannelValid(pDevice->byZoneType, pMgmt->uScanChannel) && - pMgmt->uScanChannel <= pDevice->byMaxChannel ){ + pMgmt->uScanChannel <= pDevice->byMaxChannel){ pMgmt->uScanChannel++; } @@ -437,7 +437,7 @@ void vRunCommand(struct work_struct *work) s_bCommandComplete(pDevice); break; - case WLAN_CMD_DISASSOCIATE_START : + case WLAN_CMD_DISASSOCIATE_START: pDevice->byReAssocCount = 0; if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState != WMAC_STATE_ASSOC)) { @@ -461,7 +461,7 @@ void vRunCommand(struct work_struct *work) (8), &Status); pDevice->bLinkPass = false; - ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); + ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW); // unlock command busy pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; pItemSSID->len = 0; @@ -485,7 +485,7 @@ void vRunCommand(struct work_struct *work) return; } - memcpy(pMgmt->abyAdHocSSID,pMgmt->abyDesireSSID, + memcpy(pMgmt->abyAdHocSSID, pMgmt->abyDesireSSID, ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len + WLAN_IEHDR_LEN); pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; @@ -495,14 +495,14 @@ void vRunCommand(struct work_struct *work) if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Cmd pMgmt->eCurrState == WMAC_STATE_ASSOC\n"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pItemSSID->len =%d\n",pItemSSID->len); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pItemSSIDCurr->len = %d\n",pItemSSIDCurr->len); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pItemSSID->len =%d\n", pItemSSID->len); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pItemSSIDCurr->len = %d\n", pItemSSIDCurr->len); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" desire ssid = %s\n", pItemSSID->abySSID); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" curr ssid = %s\n", pItemSSIDCurr->abySSID); } if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) || - ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)&& (pMgmt->eCurrState == WMAC_STATE_JOINTED))) { + ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) { if (pItemSSID->len == pItemSSIDCurr->len) { if (memcmp(pItemSSID->abySSID, pItemSSIDCurr->abySSID, pItemSSID->len) == 0) { @@ -513,7 +513,7 @@ void vRunCommand(struct work_struct *work) } netif_stop_queue(pDevice->dev); pDevice->bLinkPass = false; - ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); + ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW); } // set initial state pMgmt->eCurrState = WMAC_STATE_IDLE; @@ -546,11 +546,11 @@ void vRunCommand(struct work_struct *work) // if Adhoc mode else if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { if (pMgmt->eCurrState == WMAC_STATE_JOINTED) { - if (netif_queue_stopped(pDevice->dev)){ + if (netif_queue_stopped(pDevice->dev)) { netif_wake_queue(pDevice->dev); } pDevice->bLinkPass = true; - ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); + ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_INTER); pMgmt->sNodeDBTable[0].bActive = true; pMgmt->sNodeDBTable[0].uInActiveCount = 0; } @@ -559,7 +559,7 @@ void vRunCommand(struct work_struct *work) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CreateOwn IBSS by CurrMode = IBSS_STA\n"); vMgrCreateOwnIBSS((void *) pDevice, &Status); - if (Status != CMD_STATUS_SUCCESS){ + if (Status != CMD_STATUS_SUCCESS) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_IBSS_CREATE fail!\n"); } @@ -575,7 +575,7 @@ void vRunCommand(struct work_struct *work) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CreateOwn IBSS by CurrMode = STANDBY\n"); vMgrCreateOwnIBSS((void *) pDevice, &Status); - if (Status != CMD_STATUS_SUCCESS){ + if (Status != CMD_STATUS_SUCCESS) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_IBSS_CREATE fail!\n"); } @@ -595,7 +595,7 @@ void vRunCommand(struct work_struct *work) // if(pDevice->bWPASuppWextEnabled == true) { union iwreq_data wrqu; - memset(&wrqu, 0, sizeof (wrqu)); + memset(&wrqu, 0, sizeof(wrqu)); wrqu.ap_addr.sa_family = ARPHRD_ETHER; PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated:vMgrJoinBSSBegin Fail !!)\n"); wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); @@ -605,7 +605,7 @@ void vRunCommand(struct work_struct *work) s_bCommandComplete(pDevice); break; - case WLAN_AUTHENTICATE_WAIT : + case WLAN_AUTHENTICATE_WAIT: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_AUTHENTICATE_WAIT\n"); if (pMgmt->eCurrState == WMAC_STATE_AUTH) { pDevice->byLinkWaitCount = 0; @@ -621,12 +621,12 @@ void vRunCommand(struct work_struct *work) return; } } - else if(pMgmt->eCurrState < WMAC_STATE_AUTHPENDING) { + else if (pMgmt->eCurrState < WMAC_STATE_AUTHPENDING) { printk("WLAN_AUTHENTICATE_WAIT:Authen Fail???\n"); } - else if(pDevice->byLinkWaitCount <= 4){ //mike add:wait another 2 sec if authenticated_frame delay! - pDevice->byLinkWaitCount ++; - printk("WLAN_AUTHENTICATE_WAIT:wait %d times!!\n",pDevice->byLinkWaitCount); + else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if authenticated_frame delay! + pDevice->byLinkWaitCount++; + printk("WLAN_AUTHENTICATE_WAIT:wait %d times!!\n", pDevice->byLinkWaitCount); spin_unlock_irq(&pDevice->lock); vCommandTimerWait((void *) pDevice, AUTHENTICATE_TIMEOUT/2); return; @@ -636,7 +636,7 @@ void vRunCommand(struct work_struct *work) s_bCommandComplete(pDevice); break; - case WLAN_ASSOCIATE_WAIT : + case WLAN_ASSOCIATE_WAIT: if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCurrState == WMAC_STATE_ASSOC\n"); if (pDevice->ePSMode != WMAC_POWER_CAM) { @@ -651,20 +651,20 @@ void vRunCommand(struct work_struct *work) pDevice->byLinkWaitCount = 0; pDevice->byReAssocCount = 0; pDevice->bLinkPass = true; - ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); + ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_INTER); s_bClearBSSID_SCAN(pDevice); - if (netif_queue_stopped(pDevice->dev)){ + if (netif_queue_stopped(pDevice->dev)) { netif_wake_queue(pDevice->dev); } } - else if(pMgmt->eCurrState < WMAC_STATE_ASSOCPENDING) { + else if (pMgmt->eCurrState < WMAC_STATE_ASSOCPENDING) { printk("WLAN_ASSOCIATE_WAIT:Association Fail???\n"); } - else if(pDevice->byLinkWaitCount <= 4){ //mike add:wait another 2 sec if associated_frame delay! - pDevice->byLinkWaitCount ++; - printk("WLAN_ASSOCIATE_WAIT:wait %d times!!\n",pDevice->byLinkWaitCount); + else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if associated_frame delay! + pDevice->byLinkWaitCount++; + printk("WLAN_ASSOCIATE_WAIT:wait %d times!!\n", pDevice->byLinkWaitCount); spin_unlock_irq(&pDevice->lock); vCommandTimerWait((void *) pDevice, ASSOCIATE_TIMEOUT/2); return; @@ -673,7 +673,7 @@ void vRunCommand(struct work_struct *work) s_bCommandComplete(pDevice); break; - case WLAN_CMD_AP_MODE_START : + case WLAN_CMD_AP_MODE_START: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_AP_MODE_START\n"); if (pMgmt->eConfigMode == WMAC_CONFIG_AP) { @@ -681,7 +681,7 @@ void vRunCommand(struct work_struct *work) pMgmt->eCurrState = WMAC_STATE_IDLE; pMgmt->eCurrMode = WMAC_MODE_STANDBY; pDevice->bLinkPass = false; - ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); + ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW); if (pDevice->bEnableHostWEP == true) BSSvClearNodeDBTable(pDevice, 1); else @@ -698,19 +698,19 @@ void vRunCommand(struct work_struct *work) // always turn off unicast bit MACvRegBitsOff(pDevice, MAC_REG_RCR, RCR_UNICAST); pDevice->byRxMode &= ~RCR_UNICAST; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wcmd: rx_mode = %x\n", pDevice->byRxMode ); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wcmd: rx_mode = %x\n", pDevice->byRxMode); BSSvAddMulticastNode(pDevice); - if (netif_queue_stopped(pDevice->dev)){ + if (netif_queue_stopped(pDevice->dev)) { netif_wake_queue(pDevice->dev); } pDevice->bLinkPass = true; - ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); + ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_INTER); schedule_delayed_work(&pDevice->second_callback_work, HZ); } s_bCommandComplete(pDevice); break; - case WLAN_CMD_TX_PSPACKET_START : + case WLAN_CMD_TX_PSPACKET_START: // DTIM Multicast tx if (pMgmt->sNodeDBTable[0].bRxPSPoll) { while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[0].sTxPSQueue)) != NULL) { @@ -789,12 +789,12 @@ void vRunCommand(struct work_struct *work) 1, &byTmp); - if ( ntStatus != STATUS_SUCCESS ) { + if (ntStatus != STATUS_SUCCESS) { s_bCommandComplete(pDevice); spin_unlock_irq(&pDevice->lock); return; } - if ( (byTmp & GPIO3_DATA) == 0 ) { + if ((byTmp & GPIO3_DATA) == 0) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" WLAN_CMD_RADIO_START_OFF........................\n"); // Old commands are useless. // empty command Q @@ -809,7 +809,7 @@ void vRunCommand(struct work_struct *work) pDevice->byKeyIndex = 0; pDevice->bTransmitKey = false; spin_unlock_irq(&pDevice->lock); - KeyvInitTable(pDevice,&pDevice->sKey); + KeyvInitTable(pDevice, &pDevice->sKey); spin_lock_irq(&pDevice->lock); pMgmt->byCSSPK = KEY_CTL_NONE; pMgmt->byCSSGK = KEY_CTL_NONE; @@ -828,7 +828,7 @@ void vRunCommand(struct work_struct *work) // if(pDevice->bWPASuppWextEnabled == true) { union iwreq_data wrqu; - memset(&wrqu, 0, sizeof (wrqu)); + memset(&wrqu, 0, sizeof(wrqu)); wrqu.ap_addr.sa_family = ARPHRD_ETHER; PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n"); wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); @@ -850,15 +850,15 @@ void vRunCommand(struct work_struct *work) netif_stop_queue(pDevice->dev); CARDbRadioPowerOff(pDevice); - MACvRegBitsOn(pDevice,MAC_REG_GPIOCTL1,GPIO3_INTMD); - ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_OFF); + MACvRegBitsOn(pDevice, MAC_REG_GPIOCTL1, GPIO3_INTMD); + ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_OFF); pDevice->bHWRadioOff = true; } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" WLAN_CMD_RADIO_START_ON........................\n"); pDevice->bHWRadioOff = false; CARDbRadioPowerOn(pDevice); - MACvRegBitsOff(pDevice,MAC_REG_GPIOCTL1,GPIO3_INTMD); - ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_ON); + MACvRegBitsOff(pDevice, MAC_REG_GPIOCTL1, GPIO3_INTMD); + ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_ON); } } @@ -894,14 +894,14 @@ void vRunCommand(struct work_struct *work) case WLAN_CMD_CHANGE_ANTENNA_START: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Change from Antenna%d to", (int)pDevice->dwRxAntennaSel); - if ( pDevice->dwRxAntennaSel == 0) { - pDevice->dwRxAntennaSel=1; + if (pDevice->dwRxAntennaSel == 0) { + pDevice->dwRxAntennaSel = 1; if (pDevice->bTxRxAntInv == true) BBvSetAntennaMode(pDevice, ANT_RXA); else BBvSetAntennaMode(pDevice, ANT_RXB); } else { - pDevice->dwRxAntennaSel=0; + pDevice->dwRxAntennaSel = 0; if (pDevice->bTxRxAntInv == true) BBvSetAntennaMode(pDevice, ANT_RXB); else @@ -916,8 +916,8 @@ void vRunCommand(struct work_struct *work) break; case WLAN_CMD_MAC_DISPOWERSAVING_START: - ControlvReadByte (pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PSCTL, &byData); - if ( (byData & PSCTL_PS) != 0 ) { + ControlvReadByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PSCTL, &byData); + if ((byData & PSCTL_PS) != 0) { // disable power saving hw function CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_DISABLE_PS, @@ -968,7 +968,7 @@ static int s_bCommandComplete(struct vnt_private *pDevice) ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdDequeueIdx, CMD_Q_SIZE); pDevice->cbFreeCmdQueue++; pDevice->bCmdRunning = true; - switch ( pDevice->eCommand ) { + switch (pDevice->eCommand) { case WLAN_CMD_BSSID_SCAN: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_BSSID_SCAN\n"); pDevice->eCommandState = WLAN_CMD_SCAN_START; @@ -1123,7 +1123,7 @@ static int s_bClearBSSID_SCAN(struct vnt_private *pDevice) unsigned int ii; if ((pDevice->cbFreeCmdQueue < CMD_Q_SIZE) && (uCmdDequeueIdx != pDevice->uCmdEnqueueIdx)) { - for (ii = 0; ii < (CMD_Q_SIZE - pDevice->cbFreeCmdQueue); ii ++) { + for (ii = 0; ii < (CMD_Q_SIZE - pDevice->cbFreeCmdQueue); ii++) { if (pDevice->eCmdQueue[uCmdDequeueIdx].eCmd == WLAN_CMD_BSSID_SCAN) pDevice->eCmdQueue[uCmdDequeueIdx].eCmd = WLAN_CMD_IDLE; ADD_ONE_WITH_WRAP_AROUND(uCmdDequeueIdx, CMD_Q_SIZE); From 383956442d7ab639777f84c3709390bc1b4daa78 Mon Sep 17 00:00:00 2001 From: Teodora Baluta Date: Sat, 9 Nov 2013 01:00:00 +0200 Subject: [PATCH 049/238] staging: vt6655: replace C99 comments wtih C89 comments This patch replaces C99 comments with /* .. */ comments. Any commented code is deleted. Signed-off-by: Teodora Baluta Reviewed-by: Lisa Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/bssdb.c | 182 ++++++++++++--------------------- 1 file changed, 68 insertions(+), 114 deletions(-) diff --git a/drivers/staging/vt6655/bssdb.c b/drivers/staging/vt6655/bssdb.c index a23b591eeac3..9fd8baac64b9 100644 --- a/drivers/staging/vt6655/bssdb.c +++ b/drivers/staging/vt6655/bssdb.c @@ -64,7 +64,6 @@ /*--------------------- Static Variables --------------------------*/ static int msglevel = MSG_LEVEL_INFO; -//static int msglevel =MSG_LEVEL_DEBUG; const unsigned short awHWRetry0[5][5] = { {RATE_18M, RATE_18M, RATE_12M, RATE_12M, RATE_12M}, @@ -142,7 +141,7 @@ BSSpSearchBSSList( } if (pbyBSSID != NULL) { - // match BSSID first + /* match BSSID first */ for (ii = 0; ii < MAX_BSS_NUM; ii++) { pCurrBSS = &(pMgmt->sBSSList[ii]); if (pDevice->bLinkPass == false) pCurrBSS->bSelected = false; @@ -151,7 +150,7 @@ BSSpSearchBSSList( if (ether_addr_equal(pCurrBSS->abyBSSID, pbyBSSID)) { if (pSSID != NULL) { - // compare ssid + /* compare ssid */ if (!memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pCurrBSS->abySSID)->abySSID, pSSID->len)) { @@ -176,26 +175,26 @@ BSSpSearchBSSList( } } } else { - // ignore BSSID + /* ignore BSSID */ for (ii = 0; ii < MAX_BSS_NUM; ii++) { pCurrBSS = &(pMgmt->sBSSList[ii]); - //2007-0721-01by MikeLiu + /* 2007-0721-01by MikeLiu */ pCurrBSS->bSelected = false; if (pCurrBSS->bActive) { if (pSSID != NULL) { - // matched SSID + /* matched SSID */ if (!!memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pCurrBSS->abySSID)->abySSID, pSSID->len) || (pSSID->len != ((PWLAN_IE_SSID)pCurrBSS->abySSID)->len)) { - // SSID not match skip this BSS + /* SSID not match skip this BSS */ continue; } } if (((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)) || ((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ) { - // Type not match skip this BSS + /* Type not match skip this BSS */ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BSS type mismatch.... Config[%d] BSS[0x%04x]\n", pMgmt->eConfigMode, pCurrBSS->wCapInfo); continue; } @@ -203,35 +202,16 @@ BSSpSearchBSSList( if (ePhyType != PHY_TYPE_AUTO) { if (((ePhyType == PHY_TYPE_11A) && (PHY_TYPE_11A != pCurrBSS->eNetworkTypeInUse)) || ((ePhyType != PHY_TYPE_11A) && (PHY_TYPE_11A == pCurrBSS->eNetworkTypeInUse))) { - // PhyType not match skip this BSS + /* PhyType not match skip this BSS */ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Physical type mismatch.... ePhyType[%d] BSS[%d]\n", ePhyType, pCurrBSS->eNetworkTypeInUse); continue; } } -/* - if (pMgmt->eAuthenMode < WMAC_AUTH_WPA) { - if (pCurrBSS->bWPAValid == true) { - // WPA AP will reject connection of station without WPA enable. - continue; - } - } else if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA) || - (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK)) { - if (pCurrBSS->bWPAValid == false) { - // station with WPA enable can't join NonWPA AP. - continue; - } - } else if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || - (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) { - if (pCurrBSS->bWPA2Valid == false) { - // station with WPA2 enable can't join NonWPA2 AP. - continue; - } - } -*/ + if (pSelect == NULL) { pSelect = pCurrBSS; } else { - // compare RSSI, select signal strong one + /* compare RSSI, select signal strong one */ if (pCurrBSS->uRSSI < pSelect->uRSSI) { pSelect = pCurrBSS; } @@ -240,13 +220,6 @@ BSSpSearchBSSList( } if (pSelect != NULL) { pSelect->bSelected = true; -/* - if (pDevice->bRoaming == false) { - // Einsn Add @20070907 - memset(pbyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - memcpy(pbyDesireSSID,pCurrBSS->abySSID,WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - }*/ - return pSelect; } } @@ -278,7 +251,6 @@ BSSvClearBSSList( if (pMgmt->sBSSList[ii].bActive && ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID, pMgmt->abyCurrBSSID)) { - // bKeepCurrBSSID = false; continue; } } @@ -385,7 +357,7 @@ BSSbInsertToBSSList( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Get free KnowBSS node failed.\n"); return false; } - // save the BSS info + /* save the BSS info */ pBSSList->bActive = true; memcpy(pBSSList->abyBSSID, abyBSSIDAddr, WLAN_BSSID_LEN); HIDWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(HIDWORD(qwTimestamp)); @@ -416,7 +388,7 @@ BSSbInsertToBSSList( pBSSList->sERP.byERP = psERP->byERP; pBSSList->sERP.bERPExist = psERP->bERPExist; - // Check if BSS is 802.11a/b/g + /* check if BSS is 802.11a/b/g */ if (pBSSList->uChannel > CB_MAX_CHANNEL_24G) { pBSSList->eNetworkTypeInUse = PHY_TYPE_11A; } else { @@ -434,7 +406,7 @@ BSSbInsertToBSSList( if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { - // assoc with BSS + /* assoc with BSS */ if (pBSSList == pMgmt->pCurrBSS) { bParsingQuiet = true; } @@ -490,7 +462,7 @@ BSSbInsertToBSSList( } if (pDevice->bUpdateBBVGA) { - // Moniter if RSSI is too strong. + /* monitor if RSSI is too strong */ pBSSList->byRSSIStatCnt = 0; RFvRSSITodBm(pDevice, (unsigned char)(pRxPacket->uRSSI), &pBSSList->ldBmMAX); pBSSList->ldBmAverage[0] = pBSSList->ldBmMAX; @@ -507,7 +479,7 @@ BSSbInsertToBSSList( if ((bParsingQuiet == true) && (pIE_Quiet != NULL)) { if ((((PWLAN_IE_QUIET)pIE_Quiet)->len == 8) && (((PWLAN_IE_QUIET)pIE_Quiet)->byQuietCount != 0)) { - // valid EID + /* valid EID */ if (pQuiet == NULL) { pQuiet = (PWLAN_IE_QUIET)pIE_Quiet; CARDbSetQuiet(pMgmt->pAdapter, @@ -552,7 +524,7 @@ BSSbInsertToBSSList( * true if success. * -*/ -// TODO: input structure modify +/* TODO: input structure modify */ bool BSSbUpdateToBSSList( @@ -593,7 +565,6 @@ BSSbUpdateToBSSList( pBSSList->wCapInfo = cpu_to_le16(wCapInfo); pBSSList->uClearCount = 0; pBSSList->uChannel = byCurrChannel; -// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BSSbUpdateToBSSList: pBSSList->uChannel: %d\n", pBSSList->uChannel); if (pSSID->len > WLAN_SSID_MAXLEN) pSSID->len = WLAN_SSID_MAXLEN; @@ -610,7 +581,7 @@ BSSbUpdateToBSSList( pBSSList->sERP.byERP = psERP->byERP; pBSSList->sERP.bERPExist = psERP->bERPExist; - // Check if BSS is 802.11a/b/g + /* check if BSS is 802.11a/b/g */ if (pBSSList->uChannel > CB_MAX_CHANNEL_24G) { pBSSList->eNetworkTypeInUse = PHY_TYPE_11A; } else { @@ -629,13 +600,13 @@ BSSbUpdateToBSSList( if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { - // assoc with BSS + /* assoc with BSS */ if (pBSSList == pMgmt->pCurrBSS) { bParsingQuiet = true; } } - WPA_ClearRSN(pBSSList); //mike update + WPA_ClearRSN(pBSSList); /* mike update */ if (pRSNWPA != NULL) { unsigned int uLen = pRSNWPA->len + 2; @@ -646,7 +617,7 @@ BSSbUpdateToBSSList( } } - WPA2_ClearRSN(pBSSList); //mike update + WPA2_ClearRSN(pBSSList); /* mike update */ if (pRSN != NULL) { unsigned int uLen = pRSN->len + 2; @@ -659,7 +630,7 @@ BSSbUpdateToBSSList( if (pRxPacket->uRSSI != 0) { RFvRSSITodBm(pDevice, (unsigned char)(pRxPacket->uRSSI), &ldBm); - // Moniter if RSSI is too strong. + /* monitor if RSSI is too strong */ pBSSList->byRSSIStatCnt++; pBSSList->byRSSIStatCnt %= RSSI_STAT_COUNT; pBSSList->ldBmAverage[pBSSList->byRSSIStatCnt] = ldBm; @@ -679,7 +650,7 @@ BSSbUpdateToBSSList( if ((bParsingQuiet == true) && (pIE_Quiet != NULL)) { if ((((PWLAN_IE_QUIET)pIE_Quiet)->len == 8) && (((PWLAN_IE_QUIET)pIE_Quiet)->byQuietCount != 0)) { - // valid EID + /* valid EID */ if (pQuiet == NULL) { pQuiet = (PWLAN_IE_QUIET)pIE_Quiet; CARDbSetQuiet(pMgmt->pAdapter, @@ -732,7 +703,7 @@ BSSDBbIsSTAInNodeDB(void *pMgmtObject, unsigned char *abyDstAddr, PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject; unsigned int ii; - // Index = 0 reserved for AP Node + /* Index = 0 reserved for AP Node */ for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) { if (pMgmt->sNodeDBTable[ii].bActive) { if (ether_addr_equal(abyDstAddr, @@ -765,8 +736,10 @@ BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex) unsigned int BigestCount = 0; unsigned int SelectIndex; struct sk_buff *skb; - // Index = 0 reserved for AP Node (In STA mode) - // Index = 0 reserved for Broadcast/MultiCast (In AP mode) + /* + * Index = 0 reserved for AP Node (In STA mode) + * Index = 0 reserved for Broadcast/MultiCast (In AP mode) + */ SelectIndex = 1; for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) { if (pMgmt->sNodeDBTable[ii].bActive) { @@ -779,11 +752,11 @@ BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex) } } - // if not found replace uInActiveCount is largest one. + /* if not found replace uInActiveCount is largest one */ if (ii == (MAX_NODE_NUM + 1)) { *puNodeIndex = SelectIndex; DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Replace inactive node = %d\n", SelectIndex); - // clear ps buffer + /* clear ps buffer */ if (pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue.next != NULL) { while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue)) != NULL) dev_kfree_skb(skb); @@ -795,7 +768,7 @@ BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex) memset(&pMgmt->sNodeDBTable[*puNodeIndex], 0, sizeof(KnownNodeDB)); pMgmt->sNodeDBTable[*puNodeIndex].bActive = true; pMgmt->sNodeDBTable[*puNodeIndex].uRatePollTimeout = FALLBACK_POLL_SECOND; - // for AP mode PS queue + /* for AP mode PS queue */ skb_queue_head_init(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue); pMgmt->sNodeDBTable[*puNodeIndex].byAuthSequence = 0; pMgmt->sNodeDBTable[*puNodeIndex].wEnQueueCnt = 0; @@ -826,9 +799,9 @@ BSSvRemoveOneNode( while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue)) != NULL) dev_kfree_skb(skb); - // clear context + /* clear context */ memset(&pMgmt->sNodeDBTable[uNodeIndex], 0, sizeof(KnownNodeDB)); - // clear tx bit map + /* clear tx bit map */ pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[uNodeIndex].wAID >> 3] &= ~byMask[pMgmt->sNodeDBTable[uNodeIndex].wAID & 7]; return; @@ -885,8 +858,7 @@ BSSvUpdateAPNode( #ifdef PLICE_DEBUG printk("BSSvUpdateAPNode:MaxSuppRate is %d\n", pMgmt->sNodeDBTable[0].wMaxSuppRate); #endif - // Auto rate fallback function initiation. - // RATEbInit(pDevice); + /* auto rate fallback function initiation */ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->sNodeDBTable[0].wTxDataRate = %d \n", pMgmt->sNodeDBTable[0].wTxDataRate); }; @@ -944,7 +916,7 @@ BSSvAddMulticastNode( * none. * -*/ -//2008-4-14 by chester for led issue +/* 2008-4-14 by chester for led issue */ #ifdef FOR_LED_ON_NOTEBOOK bool cc = false; unsigned int status; @@ -961,7 +933,7 @@ BSSvSecondCallBack( unsigned int uSleepySTACnt = 0; unsigned int uNonShortSlotSTACnt = 0; unsigned int uLongPreambleSTACnt = 0; - viawget_wpa_header *wpahdr; //DavidWang + viawget_wpa_header *wpahdr; /* DavidWang */ spin_lock_irq(&pDevice->lock); @@ -969,7 +941,7 @@ BSSvSecondCallBack( pDevice->byERPFlag &= ~(WLAN_SET_ERP_BARKER_MODE(1) | WLAN_SET_ERP_NONERP_PRESENT(1)); - //2008-4-14 by chester for led issue + /* 2008-4-14 by chester for led issue */ #ifdef FOR_LED_ON_NOTEBOOK MACvGPIOIn(pDevice->PortOffset, &pDevice->byGPIO); if (((!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->bHWRadioOff == false)) || ((pDevice->byGPIO & GPIO0_DATA) && (pDevice->bHWRadioOff == true))) && (cc == false)) { @@ -977,7 +949,6 @@ BSSvSecondCallBack( } else if (cc == true) { if (pDevice->bHWRadioOff == true) { if (!(pDevice->byGPIO & GPIO0_DATA)) -//||(!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV))) { if (status == 1) goto start; status = 1; @@ -985,12 +956,10 @@ BSSvSecondCallBack( pMgmt->sNodeDBTable[0].bActive = false; pMgmt->eCurrMode = WMAC_MODE_STANDBY; pMgmt->eCurrState = WMAC_STATE_IDLE; - //netif_stop_queue(pDevice->dev); pDevice->bLinkPass = false; } if (pDevice->byGPIO & GPIO0_DATA) -//||(!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV))) { if (status == 2) goto start; status = 2; @@ -998,7 +967,6 @@ BSSvSecondCallBack( } } else { if (pDevice->byGPIO & GPIO0_DATA) -//||(!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV))) { if (status == 3) goto start; status = 3; @@ -1006,12 +974,10 @@ BSSvSecondCallBack( pMgmt->sNodeDBTable[0].bActive = false; pMgmt->eCurrMode = WMAC_MODE_STANDBY; pMgmt->eCurrState = WMAC_STATE_IDLE; - //netif_stop_queue(pDevice->dev); pDevice->bLinkPass = false; } if (!(pDevice->byGPIO & GPIO0_DATA)) -//||(!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV))) { if (status == 4) goto start; status = 4; @@ -1025,13 +991,14 @@ start: if (pDevice->wUseProtectCntDown > 0) { pDevice->wUseProtectCntDown--; } else { - // disable protect mode + /* disable protect mode */ pDevice->byERPFlag &= ~(WLAN_SET_ERP_USE_PROTECTION(1)); } { pDevice->byReAssocCount++; - if ((pDevice->byReAssocCount > 10) && (pDevice->bLinkPass != true)) { //10 sec timeout + /* 10 sec timeout */ + if ((pDevice->byReAssocCount > 10) && (pDevice->bLinkPass != true)) { printk("Re-association timeout!!!\n"); pDevice->byReAssocCount = 0; #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT @@ -1053,7 +1020,7 @@ start: for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) { if (pMgmt->sNodeDBTable[ii].bActive) { - // Increase in-activity counter + /* increase in-activity counter */ pMgmt->sNodeDBTable[ii].uInActiveCount++; if (ii > 0) { @@ -1067,7 +1034,7 @@ start: if (pMgmt->sNodeDBTable[ii].eNodeState >= NODE_ASSOC) { pDevice->uAssocCount++; - // check if Non ERP exist + /* check if Non ERP exist */ if (pMgmt->sNodeDBTable[ii].uInActiveCount < ERP_RECOVER_COUNT) { if (!pMgmt->sNodeDBTable[ii].bShortPreamble) { pDevice->byERPFlag |= WLAN_SET_ERP_BARKER_MODE(1); @@ -1082,23 +1049,19 @@ start: } } - // check if any STA in PS mode + /* check if any STA in PS mode */ if (pMgmt->sNodeDBTable[ii].bPSEnable) uSleepySTACnt++; } - // Rate fallback check + /* rate fallback check */ if (!pDevice->bFixRate) { -/* - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (ii == 0)) - RATEvTxRateFallBack(pDevice, &(pMgmt->sNodeDBTable[ii])); -*/ if (ii > 0) { - // ii = 0 for multicast node (AP & Adhoc) + /* ii = 0 for multicast node (AP & Adhoc) */ RATEvTxRateFallBack((void *)pDevice, &(pMgmt->sNodeDBTable[ii])); } else { - // ii = 0 reserved for unicast AP node (Infra STA) + /* ii = 0 reserved for unicast AP node (Infra STA) */ if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) #ifdef PLICE_DEBUG printk("SecondCallback:Before:TxDataRate is %d\n", pMgmt->sNodeDBTable[0].wTxDataRate); @@ -1112,7 +1075,7 @@ start: } - // check if pending PS queue + /* check if pending PS queue */ if (pMgmt->sNodeDBTable[ii].wEnQueueCnt != 0) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index= %d, Queue = %d pending \n", ii, pMgmt->sNodeDBTable[ii].wEnQueueCnt); @@ -1127,7 +1090,7 @@ start: } if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->eCurrentPHYType == PHY_TYPE_11G)) { - // on/off protect mode + /* on/off protect mode */ if (WLAN_GET_ERP_USE_PROTECTION(pDevice->byERPFlag)) { if (!pDevice->bProtectMode) { MACvEnableProtectMD(pDevice->PortOffset); @@ -1139,7 +1102,7 @@ start: pDevice->bProtectMode = false; } } - // on/off short slot time + /* on/off short slot time */ if (uNonShortSlotSTACnt > 0) { if (pDevice->bShortSlotTime) { @@ -1155,7 +1118,7 @@ start: } } - // on/off barker long preamble mode + /* on/off barker long preamble mode */ if (uLongPreambleSTACnt > 0) { if (!pDevice->bBarkerPreambleMd) { @@ -1171,7 +1134,7 @@ start: } - // Check if any STA in PS mode, enable DTIM multicast deliver + /* check if any STA in PS mode, enable DTIM multicast deliver */ if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { if (uSleepySTACnt > 0) pMgmt->sNodeDBTable[0].bPSEnable = true; @@ -1184,9 +1147,9 @@ start: if ((pMgmt->eCurrMode == WMAC_MODE_STANDBY) || (pMgmt->eCurrMode == WMAC_MODE_ESS_STA)) { - if (pMgmt->sNodeDBTable[0].bActive) { // Assoc with BSS + /* assoc with BSS */ + if (pMgmt->sNodeDBTable[0].bActive) { if (pDevice->bUpdateBBVGA) { - // s_vCheckSensitivity((void *) pDevice); s_vCheckPreEDThreshold((void *)pDevice); } @@ -1232,12 +1195,18 @@ start: if (pDevice->uAutoReConnectTime < 10) { pDevice->uAutoReConnectTime++; #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT - //network manager support need not do Roaming scan??? + /* + * network manager support need not do + * Roaming scan??? + */ if (pDevice->bWPASuppWextEnabled == true) pDevice->uAutoReConnectTime = 0; #endif } else { - //mike use old encryption status for wpa reauthen + /* + * mike use old encryption status + * for wpa reauthentication + */ if (pDevice->bWPADEVUp) pDevice->eEncryptionStatus = pDevice->eOldEncryptionStatus; @@ -1252,7 +1221,7 @@ start: } if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { - // if adhoc started which essid is NULL string, rescanning. + /* if adhoc started which essid is NULL string, rescanning */ if ((pMgmt->eCurrState == WMAC_STATE_STARTED) && (pCurrSSID->len == 0)) { if (pDevice->uAutoReConnectTime < 10) { pDevice->uAutoReConnectTime++; @@ -1266,7 +1235,6 @@ start: } if (pMgmt->eCurrState == WMAC_STATE_JOINTED) { if (pDevice->bUpdateBBVGA) { - //s_vCheckSensitivity((void *) pDevice); s_vCheckPreEDThreshold((void *)pDevice); } if (pMgmt->sNodeDBTable[0].uInActiveCount >= ADHOC_LOST_BEACON_COUNT) { @@ -1318,10 +1286,6 @@ BSSvUpdateNodeTxCounter( unsigned short wFallBackRate = RATE_1M; unsigned char byFallBack; unsigned int ii; -// unsigned int txRetryTemp; -//PLICE_DEBUG-> - //txRetryTemp = byTxRetry; -//PLICE_DEBUG <- pTxBufHead = (PSTxBufHead) pbyBuffer; if (pTxBufHead->wFIFOCtl & FIFOCTL_AUTO_FB_0) { byFallBack = AUTO_FB_0; @@ -1330,28 +1294,24 @@ BSSvUpdateNodeTxCounter( } else { byFallBack = AUTO_FB_NONE; } - wRate = pTxBufHead->wReserved; //?wRate + wRate = pTxBufHead->wReserved; - // Only Unicast using support rates + /* Only Unicast using support rates */ if (pTxBufHead->wFIFOCtl & FIFOCTL_NEEDACK) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wRate %04X, byTsr0 %02X, byTsr1 %02X\n", wRate, byTsr0, byTsr1); if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) { pMgmt->sNodeDBTable[0].uTxAttempts += 1; if ((byTsr1 & TSR1_TERR) == 0) { - // transmit success, TxAttempts at least plus one + /* transmit success, TxAttempts at least plus one */ pMgmt->sNodeDBTable[0].uTxOk[MAX_RATE]++; if ((byFallBack == AUTO_FB_NONE) || (wRate < RATE_18M)) { wFallBackRate = wRate; } else if (byFallBack == AUTO_FB_0) { -//PLICE_DEBUG if (byTxRetry < 5) wFallBackRate = awHWRetry0[wRate-RATE_18M][byTxRetry]; - //wFallBackRate = awHWRetry0[wRate-RATE_12M][byTxRetry]; - //wFallBackRate = awHWRetry0[wRate-RATE_18M][txRetryTemp] +1; else wFallBackRate = awHWRetry0[wRate-RATE_18M][4]; - //wFallBackRate = awHWRetry0[wRate-RATE_12M][4]; } else if (byFallBack == AUTO_FB_1) { if (byTxRetry < 5) wFallBackRate = awHWRetry1[wRate-RATE_18M][byTxRetry]; @@ -1369,17 +1329,12 @@ BSSvUpdateNodeTxCounter( (wRate < RATE_18M)) { pMgmt->sNodeDBTable[0].uTxFail[wRate] += byTxRetry; } else if (byFallBack == AUTO_FB_0) { -//PLICE_DEBUG for (ii = 0; ii < byTxRetry; ii++) - //for (ii=0;iisNodeDBTable[0].uTxFail[wFallBackRate]++; } @@ -1402,7 +1357,7 @@ BSSvUpdateNodeTxCounter( if (BSSDBbIsSTAInNodeDB((void *)pMgmt, &(pMACHeader->abyAddr1[0]), &uNodeIndex)) { pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts += 1; if ((byTsr1 & TSR1_TERR) == 0) { - // transmit success, TxAttempts at least plus one + /* transmit success, TxAttempts at least plus one */ pMgmt->sNodeDBTable[uNodeIndex].uTxOk[MAX_RATE]++; if ((byFallBack == AUTO_FB_NONE) || (wRate < RATE_18M)) { @@ -1485,7 +1440,7 @@ BSSvClearNodeDBTable( for (ii = uStartIndex; ii < (MAX_NODE_NUM + 1); ii++) { if (pMgmt->sNodeDBTable[ii].bActive) { - // check if sTxPSQueue has been initial + /* check if sTxPSQueue has been initial */ if (pMgmt->sNodeDBTable[ii].sTxPSQueue.next != NULL) { while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) != NULL) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS skb != NULL %d\n", ii); @@ -1517,7 +1472,7 @@ void s_vCheckSensitivity( ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) { pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID)pMgmt->abyCurrSSID); if (pBSSList != NULL) { - // Updata BB Reg if RSSI is too strong. + /* Update BB Reg if RSSI is too strong */ long LocalldBmAverage = 0; long uNumofdBm = 0; for (ii = 0; ii < RSSI_STAT_COUNT; ii++) { @@ -1580,7 +1535,7 @@ void s_uCalculateLinkQual( pDevice->scStatistic.RxOkCnt; TxOkRatio = (TxCnt < 6) ? 4000 : ((pDevice->scStatistic.TxNoRetryOkCount * 4000) / TxCnt); RxOkRatio = (RxCnt < 6) ? 2000 : ((pDevice->scStatistic.RxOkCnt * 2000) / RxCnt); -//decide link quality + /* decide link quality */ if (pDevice->bLinkPass != true) { pDevice->scStatistic.LinkQuality = 0; pDevice->scStatistic.SignalStren = 0; @@ -1618,7 +1573,6 @@ void s_vCheckPreEDThreshold( pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID)pMgmt->abyCurrSSID); if (pBSSList != NULL) { pDevice->byBBPreEDRSSI = (unsigned char) (~(pBSSList->ldBmAverRange) + 1); - //BBvUpdatePreEDThreshold(pDevice, false); } } return; From 347a0475a627d77684b16b718230d5e5395f1cad Mon Sep 17 00:00:00 2001 From: Teodora Baluta Date: Sat, 9 Nov 2013 01:00:01 +0200 Subject: [PATCH 050/238] staging: vt6655: remove braces for single statement blocks This patch removes braces for single statement blocks, clearing these types of checkpatch.pl warnings: WARNING: braces {} are not necessary for single statement blocks WARNING: braces {} are not necessary for any arm of this statement Signed-off-by: Teodora Baluta Reviewed-by: Lisa Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/bssdb.c | 67 +++++++++++++--------------------- 1 file changed, 25 insertions(+), 42 deletions(-) diff --git a/drivers/staging/vt6655/bssdb.c b/drivers/staging/vt6655/bssdb.c index 9fd8baac64b9..6c27be4ae9fa 100644 --- a/drivers/staging/vt6655/bssdb.c +++ b/drivers/staging/vt6655/bssdb.c @@ -130,14 +130,12 @@ BSSpSearchBSSList( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BSSpSearchBSSList BSSID[%pM]\n", pbyDesireBSSID); if ((!is_broadcast_ether_addr(pbyDesireBSSID)) && - (memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0)) { + (memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0)) pbyBSSID = pbyDesireBSSID; - } } if (pbyDesireSSID != NULL) { - if (((PWLAN_IE_SSID)pbyDesireSSID)->len != 0) { + if (((PWLAN_IE_SSID)pbyDesireSSID)->len != 0) pSSID = (PWLAN_IE_SSID) pbyDesireSSID; - } } if (pbyBSSID != NULL) { @@ -212,9 +210,8 @@ BSSpSearchBSSList( pSelect = pCurrBSS; } else { /* compare RSSI, select signal strong one */ - if (pCurrBSS->uRSSI < pSelect->uRSSI) { + if (pCurrBSS->uRSSI < pSelect->uRSSI) pSelect = pCurrBSS; - } } } } @@ -392,11 +389,10 @@ BSSbInsertToBSSList( if (pBSSList->uChannel > CB_MAX_CHANNEL_24G) { pBSSList->eNetworkTypeInUse = PHY_TYPE_11A; } else { - if (pBSSList->sERP.bERPExist == true) { + if (pBSSList->sERP.bERPExist == true) pBSSList->eNetworkTypeInUse = PHY_TYPE_11G; - } else { + else pBSSList->eNetworkTypeInUse = PHY_TYPE_11B; - } } pBSSList->byRxRate = pRxPacket->byRxRate; @@ -407,9 +403,8 @@ BSSbInsertToBSSList( if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { /* assoc with BSS */ - if (pBSSList == pMgmt->pCurrBSS) { + if (pBSSList == pMgmt->pCurrBSS) bParsingQuiet = true; - } } WPA_ClearRSN(pBSSList); @@ -573,11 +568,10 @@ BSSbUpdateToBSSList( memcpy(pBSSList->abySSID, pSSID, pSSID->len + WLAN_IEHDR_LEN); memcpy(pBSSList->abySuppRates, pSuppRates, pSuppRates->len + WLAN_IEHDR_LEN); - if (pExtSuppRates != NULL) { + if (pExtSuppRates != NULL) memcpy(pBSSList->abyExtSuppRates, pExtSuppRates, pExtSuppRates->len + WLAN_IEHDR_LEN); - } else { + else memset(pBSSList->abyExtSuppRates, 0, WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1); - } pBSSList->sERP.byERP = psERP->byERP; pBSSList->sERP.bERPExist = psERP->bERPExist; @@ -585,11 +579,10 @@ BSSbUpdateToBSSList( if (pBSSList->uChannel > CB_MAX_CHANNEL_24G) { pBSSList->eNetworkTypeInUse = PHY_TYPE_11A; } else { - if (pBSSList->sERP.bERPExist == true) { + if (pBSSList->sERP.bERPExist == true) pBSSList->eNetworkTypeInUse = PHY_TYPE_11G; - } else { + else pBSSList->eNetworkTypeInUse = PHY_TYPE_11B; - } } pBSSList->byRxRate = pRxPacket->byRxRate; @@ -601,9 +594,8 @@ BSSbUpdateToBSSList( if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { /* assoc with BSS */ - if (pBSSList == pMgmt->pCurrBSS) { + if (pBSSList == pMgmt->pCurrBSS) bParsingQuiet = true; - } } WPA_ClearRSN(pBSSList); /* mike update */ @@ -635,9 +627,8 @@ BSSbUpdateToBSSList( pBSSList->byRSSIStatCnt %= RSSI_STAT_COUNT; pBSSList->ldBmAverage[pBSSList->byRSSIStatCnt] = ldBm; for (ii = 0; ii < RSSI_STAT_COUNT; ii++) { - if (pBSSList->ldBmAverage[ii] != 0) { + if (pBSSList->ldBmAverage[ii] != 0) pBSSList->ldBmMAX = max(pBSSList->ldBmAverage[ii], ldBm); - } } } @@ -832,9 +823,8 @@ BSSvUpdateAPNode( memset(&pMgmt->sNodeDBTable[0], 0, sizeof(KnownNodeDB)); pMgmt->sNodeDBTable[0].bActive = true; - if (pDevice->eCurrentPHYType == PHY_TYPE_11B) { + if (pDevice->eCurrentPHYType == PHY_TYPE_11B) uRateLen = WLAN_RATES_MAXLEN_11B; - } pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)pSuppRates, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, uRateLen); @@ -1149,9 +1139,8 @@ start: (pMgmt->eCurrMode == WMAC_MODE_ESS_STA)) { /* assoc with BSS */ if (pMgmt->sNodeDBTable[0].bActive) { - if (pDevice->bUpdateBBVGA) { + if (pDevice->bUpdateBBVGA) s_vCheckPreEDThreshold((void *)pDevice); - } if ((pMgmt->sNodeDBTable[0].uInActiveCount >= (LOST_BEACON_COUNT/2)) && (pDevice->byBBVGACurrent != pDevice->abyBBVGA[0])) { @@ -1234,9 +1223,8 @@ start: }; } if (pMgmt->eCurrState == WMAC_STATE_JOINTED) { - if (pDevice->bUpdateBBVGA) { + if (pDevice->bUpdateBBVGA) s_vCheckPreEDThreshold((void *)pDevice); - } if (pMgmt->sNodeDBTable[0].uInActiveCount >= ADHOC_LOST_BEACON_COUNT) { DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost other STA beacon [%d] sec, started !\n", pMgmt->sNodeDBTable[0].uInActiveCount); pMgmt->sNodeDBTable[0].uInActiveCount = 0; @@ -1287,13 +1275,12 @@ BSSvUpdateNodeTxCounter( unsigned char byFallBack; unsigned int ii; pTxBufHead = (PSTxBufHead) pbyBuffer; - if (pTxBufHead->wFIFOCtl & FIFOCTL_AUTO_FB_0) { + if (pTxBufHead->wFIFOCtl & FIFOCTL_AUTO_FB_0) byFallBack = AUTO_FB_0; - } else if (pTxBufHead->wFIFOCtl & FIFOCTL_AUTO_FB_1) { + else if (pTxBufHead->wFIFOCtl & FIFOCTL_AUTO_FB_1) byFallBack = AUTO_FB_1; - } else { + else byFallBack = AUTO_FB_NONE; - } wRate = pTxBufHead->wReserved; /* Only Unicast using support rates */ @@ -1331,11 +1318,10 @@ BSSvUpdateNodeTxCounter( } else if (byFallBack == AUTO_FB_0) { for (ii = 0; ii < byTxRetry; ii++) { - if (ii < 5) { + if (ii < 5) wFallBackRate = awHWRetry0[wRate-RATE_18M][ii]; - } else { + else wFallBackRate = awHWRetry0[wRate-RATE_18M][4]; - } pMgmt->sNodeDBTable[0].uTxFail[wFallBackRate]++; } } else if (byFallBack == AUTO_FB_1) { @@ -1511,9 +1497,8 @@ BSSvClearAnyBSSJoinRecord( PSMgmtObject pMgmt = pDevice->pMgmt; unsigned int ii; - for (ii = 0; ii < MAX_BSS_NUM; ii++) { + for (ii = 0; ii < MAX_BSS_NUM; ii++) pMgmt->sBSSList[ii].bSelected = false; - } return; } @@ -1541,13 +1526,12 @@ void s_uCalculateLinkQual( pDevice->scStatistic.SignalStren = 0; } else { RFvRSSITodBm(pDevice, (unsigned char)(pDevice->uCurrRSSI), &ldBm); - if (-ldBm < 50) { + if (-ldBm < 50) RssiRatio = 4000; - } else if (-ldBm > 90) { + else if (-ldBm > 90) RssiRatio = 0; - } else { + else RssiRatio = (40-(-ldBm-50))*4000/40; - } pDevice->scStatistic.SignalStren = RssiRatio/40; pDevice->scStatistic.LinkQuality = (RssiRatio+TxOkRatio+RxOkRatio)/100; } @@ -1571,9 +1555,8 @@ void s_vCheckPreEDThreshold( if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) || ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) { pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID)pMgmt->abyCurrSSID); - if (pBSSList != NULL) { + if (pBSSList != NULL) pDevice->byBBPreEDRSSI = (unsigned char) (~(pBSSList->ldBmAverRange) + 1); - } } return; } From b4f66ad83bcfa45247f5d587168b884435a566c4 Mon Sep 17 00:00:00 2001 From: Teodora Baluta Date: Sat, 9 Nov 2013 01:00:02 +0200 Subject: [PATCH 051/238] staging: vt6655: put trailing statements on next line This patch fixes the following type of checkpatch.pl errors in drivers/staging/vt6655/bssdb.c file: ERROR: trailing statements should be on next line Signed-off-by: Teodora Baluta Reviewed-by: Lisa Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/bssdb.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/staging/vt6655/bssdb.c b/drivers/staging/vt6655/bssdb.c index 6c27be4ae9fa..ef660cd88d45 100644 --- a/drivers/staging/vt6655/bssdb.c +++ b/drivers/staging/vt6655/bssdb.c @@ -142,7 +142,8 @@ BSSpSearchBSSList( /* match BSSID first */ for (ii = 0; ii < MAX_BSS_NUM; ii++) { pCurrBSS = &(pMgmt->sBSSList[ii]); - if (pDevice->bLinkPass == false) pCurrBSS->bSelected = false; + if (pDevice->bLinkPass == false) + pCurrBSS->bSelected = false; if ((pCurrBSS->bActive) && (pCurrBSS->bSelected == false)) { if (ether_addr_equal(pCurrBSS->abyBSSID, @@ -940,7 +941,8 @@ BSSvSecondCallBack( if (pDevice->bHWRadioOff == true) { if (!(pDevice->byGPIO & GPIO0_DATA)) { - if (status == 1) goto start; + if (status == 1) + goto start; status = 1; CARDbRadioPowerOff(pDevice); pMgmt->sNodeDBTable[0].bActive = false; @@ -951,14 +953,16 @@ BSSvSecondCallBack( } if (pDevice->byGPIO & GPIO0_DATA) { - if (status == 2) goto start; + if (status == 2) + goto start; status = 2; CARDbRadioPowerOn(pDevice); } } else { if (pDevice->byGPIO & GPIO0_DATA) { - if (status == 3) goto start; + if (status == 3) + goto start; status = 3; CARDbRadioPowerOff(pDevice); pMgmt->sNodeDBTable[0].bActive = false; @@ -969,7 +973,8 @@ BSSvSecondCallBack( } if (!(pDevice->byGPIO & GPIO0_DATA)) { - if (status == 4) goto start; + if (status == 4) + goto start; status = 4; CARDbRadioPowerOn(pDevice); } From 938db28b337b40faa4a5563f2f7e07ebda66ae7b Mon Sep 17 00:00:00 2001 From: Teodora Baluta Date: Sat, 9 Nov 2013 01:00:03 +0200 Subject: [PATCH 052/238] staging: vt6655: put brace on previous line Place braces on same line for code statements. Fix the following checkpatch.pl type of error for drivers/staging/vt6655/bssdb.c file: ERROR: that open brace { should be on the previous line Signed-off-by: Teodora Baluta Reviewed-by: Lisa Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/bssdb.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/staging/vt6655/bssdb.c b/drivers/staging/vt6655/bssdb.c index ef660cd88d45..3b39cb214418 100644 --- a/drivers/staging/vt6655/bssdb.c +++ b/drivers/staging/vt6655/bssdb.c @@ -939,8 +939,7 @@ BSSvSecondCallBack( cc = true; } else if (cc == true) { if (pDevice->bHWRadioOff == true) { - if (!(pDevice->byGPIO & GPIO0_DATA)) - { + if (!(pDevice->byGPIO & GPIO0_DATA)) { if (status == 1) goto start; status = 1; @@ -951,16 +950,14 @@ BSSvSecondCallBack( pDevice->bLinkPass = false; } - if (pDevice->byGPIO & GPIO0_DATA) - { + if (pDevice->byGPIO & GPIO0_DATA) { if (status == 2) goto start; status = 2; CARDbRadioPowerOn(pDevice); } } else { - if (pDevice->byGPIO & GPIO0_DATA) - { + if (pDevice->byGPIO & GPIO0_DATA) { if (status == 3) goto start; status = 3; @@ -971,8 +968,7 @@ BSSvSecondCallBack( pDevice->bLinkPass = false; } - if (!(pDevice->byGPIO & GPIO0_DATA)) - { + if (!(pDevice->byGPIO & GPIO0_DATA)) { if (status == 4) goto start; status = 4; @@ -1321,8 +1317,7 @@ BSSvUpdateNodeTxCounter( (wRate < RATE_18M)) { pMgmt->sNodeDBTable[0].uTxFail[wRate] += byTxRetry; } else if (byFallBack == AUTO_FB_0) { - for (ii = 0; ii < byTxRetry; ii++) - { + for (ii = 0; ii < byTxRetry; ii++) { if (ii < 5) wFallBackRate = awHWRetry0[wRate-RATE_18M][ii]; else From 1208f14a37fde2669b86bf1b1cd1122ad2ba3579 Mon Sep 17 00:00:00 2001 From: Teodora Baluta Date: Sun, 10 Nov 2013 17:12:42 +0200 Subject: [PATCH 053/238] staging: vt6655: delete explicit comparison to bool This patch fixes the following type of coccinelle detected warnings for driver vt6655: WARNING: Comparison to bool Signed-off-by: Teodora Baluta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/baseband.c | 4 +- drivers/staging/vt6655/card.c | 8 +- drivers/staging/vt6655/channel.c | 16 ++-- drivers/staging/vt6655/datarate.c | 8 +- drivers/staging/vt6655/device_main.c | 60 +++++++-------- drivers/staging/vt6655/dpc.c | 34 ++++----- drivers/staging/vt6655/hostap.c | 12 +-- drivers/staging/vt6655/key.c | 44 ++++++----- drivers/staging/vt6655/mac.c | 4 +- drivers/staging/vt6655/power.c | 7 +- drivers/staging/vt6655/rf.c | 2 +- drivers/staging/vt6655/vntwifi.c | 6 +- drivers/staging/vt6655/wcmd.c | 22 +++--- drivers/staging/vt6655/wctl.c | 6 +- drivers/staging/vt6655/wmgr.c | 109 +++++++++++++-------------- drivers/staging/vt6655/wpa.c | 2 +- drivers/staging/vt6655/wpa2.c | 4 +- drivers/staging/vt6655/wpactl.c | 12 +-- 18 files changed, 176 insertions(+), 184 deletions(-) diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c index 959568a1eb6a..fa14659ba43c 100644 --- a/drivers/staging/vt6655/baseband.c +++ b/drivers/staging/vt6655/baseband.c @@ -1865,7 +1865,7 @@ BBvCalculateParameter( break; case RATE_5M: - if (bCCK == false) + if (!bCCK) cbBitCount++; cbUsCount = (cbBitCount * 10) / 55; cbTmp = (cbUsCount * 55) / 10; @@ -1879,7 +1879,7 @@ BBvCalculateParameter( case RATE_11M: - if (bCCK == false) + if (!bCCK) cbBitCount++; cbUsCount = cbBitCount / 11; cbTmp = cbUsCount * 11; diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c index fbf18e23e78e..e95ecca549f7 100644 --- a/drivers/staging/vt6655/card.c +++ b/drivers/staging/vt6655/card.c @@ -1053,7 +1053,7 @@ CARDbAdd_PMKID_Candidate( for (ii = 0; ii < pDevice->gsPMKIDCandidate.NumCandidates; ii++) { pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[ii]; if (!memcmp(pCandidateList->BSSID, pbyBSSID, ETH_ALEN)) { - if ((bRSNCapExist == true) && (wRSNCap & BIT0)) { + if (bRSNCapExist && (wRSNCap & BIT0)) { pCandidateList->Flags |= NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED; } else { pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED); @@ -1064,7 +1064,7 @@ CARDbAdd_PMKID_Candidate( // New Candidate pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[pDevice->gsPMKIDCandidate.NumCandidates]; - if ((bRSNCapExist == true) && (wRSNCap & BIT0)) { + if (bRSNCapExist && (wRSNCap & BIT0)) { pCandidateList->Flags |= NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED; } else { pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED); @@ -1190,7 +1190,7 @@ CARDbStartMeasure( } } while (pDevice->uNumOfMeasureEIDs != 0); - if (bExpired == false) { + if (!bExpired) { MACvSelectPage1(pDevice->PortOffset); VNSvOutPortD(pDevice->PortOffset + MAC_REG_MSRSTART, LODWORD(qwStartTSF)); VNSvOutPortD(pDevice->PortOffset + MAC_REG_MSRSTART + 4, HIDWORD(qwStartTSF)); @@ -1280,7 +1280,7 @@ CARDbSetQuiet( PSDevice pDevice = (PSDevice) pDeviceHandler; unsigned int ii = 0; - if (bResetQuiet == true) { + if (bResetQuiet) { MACvRegBitsOff(pDevice->PortOffset, MAC_REG_MSRCTL, (MSRCTL_QUIETTXCHK | MSRCTL_QUIETEN)); for (ii = 0; ii < MAX_QUIET_COUNT; ii++) { pDevice->sQuiet[ii].bEnable = false; diff --git a/drivers/staging/vt6655/channel.c b/drivers/staging/vt6655/channel.c index ba9481fa654f..3198a31e2ed7 100644 --- a/drivers/staging/vt6655/channel.c +++ b/drivers/staging/vt6655/channel.c @@ -441,8 +441,8 @@ void init_channel_table(void *pDeviceHandler) break; } - if ((pDevice->dwDiagRefCount != 0) || (pDevice->b11hEnable == true)) { - if (bMultiBand == true) { + if ((pDevice->dwDiagRefCount != 0) || pDevice->b11hEnable) { + if (bMultiBand) { for (ii = 0; ii < CARD_MAX_CHANNEL_TBL; ii++) { sChannelTbl[ii + 1].bValid = true; pDevice->abyRegPwr[ii + 1] = pDevice->abyOFDMDefaultPwr[ii + 1]; @@ -463,7 +463,7 @@ void init_channel_table(void *pDeviceHandler) } } } else if (pDevice->byZoneType <= CCODE_MAX) { - if (bMultiBand == true) { + if (bMultiBand) { for (ii = 0; ii < CARD_MAX_CHANNEL_TBL; ii++) { if (ChannelRuleTab[pDevice->byZoneType].bChannelIdxList[ii] != 0) { sChannelTbl[ii + 1].bValid = true; @@ -531,7 +531,7 @@ bool set_channel(void *pDeviceHandler, unsigned int uConnectionChannel) return bResult; } - if (sChannelTbl[uConnectionChannel].bValid == false) { + if (!sChannelTbl[uConnectionChannel].bValid) { return false; } @@ -557,7 +557,7 @@ bool set_channel(void *pDeviceHandler, unsigned int uConnectionChannel) bResult &= RFbSelectChannel(pDevice->PortOffset, pDevice->byRFType, (unsigned char)uConnectionChannel); // Init Synthesizer Table - if (pDevice->bEnablePSMode == true) + if (pDevice->bEnablePSMode) RFvWriteWakeProgSyn(pDevice->PortOffset, pDevice->byRFType, uConnectionChannel); //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CARDbSetMediaChannel: %d\n", (unsigned char)uConnectionChannel); @@ -766,7 +766,7 @@ unsigned char auto_channel_select(void *pDeviceHandler, CARD_PHY_TYPE ePHYType) if (ePHYType == PHY_TYPE_11A) { for (ii = CB_MAX_CHANNEL_24G + 1; ii <= CB_MAX_CHANNEL; ii++) { - if (sChannelTbl[ii].bValid == true) { + if (sChannelTbl[ii].bValid) { if (byOptionChannel == 0) { byOptionChannel = (unsigned char) ii; } @@ -780,7 +780,7 @@ unsigned char auto_channel_select(void *pDeviceHandler, CARD_PHY_TYPE ePHYType) } else { byOptionChannel = 0; for (ii = 1; ii <= CB_MAX_CHANNEL_24G; ii++) { - if (sChannelTbl[ii].bValid == true) { + if (sChannelTbl[ii].bValid) { if (sChannelTbl[ii].byMAP == 0) { aiWeight[ii] += 100; } else if (sChannelTbl[ii].byMAP & 0x01) { @@ -807,7 +807,7 @@ unsigned char auto_channel_select(void *pDeviceHandler, CARD_PHY_TYPE ePHYType) } } for (ii = 1; ii <= CB_MAX_CHANNEL_24G; ii++) { - if ((sChannelTbl[ii].bValid == true) && + if (sChannelTbl[ii].bValid && (aiWeight[ii] > aiWeight[byOptionChannel])) { byOptionChannel = (unsigned char) ii; } diff --git a/drivers/staging/vt6655/datarate.c b/drivers/staging/vt6655/datarate.c index e7b6bc7de4ac..c9a89cd7633c 100644 --- a/drivers/staging/vt6655/datarate.c +++ b/drivers/staging/vt6655/datarate.c @@ -218,8 +218,7 @@ RATEvParseMaxRate( for (ii = 0; ii < uRateLen; ii++) { byRate = (unsigned char)(pItemRates->abyRates[ii]); - if (WLAN_MGMT_IS_BASICRATE(byRate) && - (bUpdateBasicRate == true)) { + if (WLAN_MGMT_IS_BASICRATE(byRate) && bUpdateBasicRate) { // Add to basic rate set, update pDevice->byTopCCKBasicRate and pDevice->byTopOFDMBasicRate CARDbAddBasicRate((void *)pDevice, wGetRateIdx(byRate)); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ParseMaxRate AddBasicRate: %d\n", wGetRateIdx(byRate)); @@ -329,7 +328,7 @@ RATEvTxRateFallBack( for (ii = 0; ii < MAX_RATE; ii++) { if (psNodeDBTable->wSuppRate & (0x0001<wTxDataRate; for (ii = psNodeDBTable->wTxDataRate; ii > 0;) { ii--; - if ((dwThroughputTbl[ii] > dwThroughput) && - (bAutoRate[ii] == true)) { + if ((dwThroughputTbl[ii] > dwThroughput) && bAutoRate[ii]) { dwThroughput = dwThroughputTbl[ii]; wIdxDownRate = (unsigned short) ii; } diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index e93fdc88d844..68cbaee29775 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -561,7 +561,7 @@ static void device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) pDevice->byTxAntennaMode = ANT_B; pDevice->dwTxAntennaSel = 1; pDevice->dwRxAntennaSel = 1; - if (pDevice->bTxRxAntInv == true) + if (pDevice->bTxRxAntInv) pDevice->byRxAntennaMode = ANT_A; else pDevice->byRxAntennaMode = ANT_B; @@ -578,13 +578,13 @@ static void device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) pDevice->dwRxAntennaSel = 0; if (byValue & EEP_ANTENNA_AUX) { pDevice->byTxAntennaMode = ANT_A; - if (pDevice->bTxRxAntInv == true) + if (pDevice->bTxRxAntInv) pDevice->byRxAntennaMode = ANT_B; else pDevice->byRxAntennaMode = ANT_A; } else { pDevice->byTxAntennaMode = ANT_B; - if (pDevice->bTxRxAntInv == true) + if (pDevice->bTxRxAntInv) pDevice->byRxAntennaMode = ANT_A; else pDevice->byRxAntennaMode = ANT_B; @@ -635,7 +635,7 @@ static void device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) pDevice->byRFType &= RF_MASK; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byRFType = %x\n", pDevice->byRFType); - if (pDevice->bZoneRegExist == false) { + if (!pDevice->bZoneRegExist) { pDevice->byZoneType = pDevice->abyEEPROM[EEP_OFS_ZONETYPE]; } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byZoneType = %x\n", pDevice->byZoneType); @@ -742,7 +742,7 @@ static void device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) if (!(pDevice->byGPIO & GPIO0_DATA)) { pDevice->bHWRadioOff = false; } } - if ((pDevice->bRadioControlOff == true)) { + if (pDevice->bRadioControlOff) { CARDbRadioPowerOff(pDevice); } else CARDbRadioPowerOn(pDevice); #else @@ -751,7 +751,7 @@ static void device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) pDevice->bHWRadioOff = true; } } - if ((pDevice->bHWRadioOff == true) || (pDevice->bRadioControlOff == true)) { + if (pDevice->bHWRadioOff || pDevice->bRadioControlOff) { CARDbRadioPowerOff(pDevice); } @@ -809,7 +809,7 @@ static bool device_release_WPADEV(PSDevice pDevice) int ii = 0; // wait_queue_head_t Set_wait; //send device close to wpa_supplicnat layer - if (pDevice->bWPADEVUp == true) { + if (pDevice->bWPADEVUp) { wpahdr = (viawget_wpa_header *)pDevice->skb->data; wpahdr->type = VIAWGET_DEVICECLOSE_MSG; wpahdr->resp_ie_len = 0; @@ -826,7 +826,7 @@ static bool device_release_WPADEV(PSDevice pDevice) //wait release WPADEV // init_waitqueue_head(&Set_wait); // wait_event_timeout(Set_wait, ((pDevice->wpadev==NULL)&&(pDevice->skb == NULL)),5*HZ); //1s wait - while ((pDevice->bWPADEVUp == true)) { + while (pDevice->bWPADEVUp) { set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(HZ / 20); //wait 50ms ii++; @@ -892,7 +892,7 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) #ifdef DEBUG printk("Before get pci_info memaddr is %x\n", pDevice->memaddr); #endif - if (device_get_pci_info(pDevice, pcid) == false) { + if (!device_get_pci_info(pDevice, pcid)) { printk(KERN_ERR DEVICE_NAME ": Failed to find PCI device.\n"); device_free_info(pDevice); return -ENODEV; @@ -1633,7 +1633,7 @@ static int device_tx_srv(PSDevice pDevice, unsigned int uIdx) { bFull = true; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " AC0DMA is Full = %d\n", pDevice->iTDUsed[uIdx]); } - if (netif_queue_stopped(pDevice->dev) && (bFull == false)) { + if (netif_queue_stopped(pDevice->dev) && !bFull) { netif_wake_queue(pDevice->dev); } } @@ -1798,7 +1798,7 @@ static int device_open(struct net_device *dev) { pDevice->byReAssocCount = 0; pDevice->bWPADEVUp = false; // Patch: if WEP key already set by iwconfig but device not yet open - if ((pDevice->bEncryptionEnable == true) && (pDevice->bTransmitKey == true)) { + if (pDevice->bEncryptionEnable && pDevice->bTransmitKey) { KeybSetDefaultKey(&(pDevice->sKey), (unsigned long)(pDevice->byKeyIndex | (1 << 31)), pDevice->uKeyLength, @@ -1895,7 +1895,7 @@ static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) { return 0; } - if (pDevice->bStopTx0Pkt == true) { + if (pDevice->bStopTx0Pkt) { dev_kfree_skb_irq(skb); spin_unlock_irq(&pDevice->lock); return 0; @@ -1924,7 +1924,7 @@ bool device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, unsigned int uNodeI SKeyItem STempKey; // unsigned char byKeyIndex = 0; - if (pDevice->bStopTx0Pkt == true) { + if (pDevice->bStopTx0Pkt) { dev_kfree_skb_irq(skb); return false; } @@ -1993,14 +1993,14 @@ bool device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, unsigned int uNodeI } else if (pDevice->eCurrentPHYType == PHY_TYPE_11A) { byPktType = PK_TYPE_11A; } else { - if (pDevice->bProtectMode == true) { + if (pDevice->bProtectMode) { byPktType = PK_TYPE_11GB; } else { byPktType = PK_TYPE_11GA; } } - if (pDevice->bEncryptionEnable == true) + if (pDevice->bEncryptionEnable) bNeedEncryption = true; if (pDevice->bEnableHostWEP) { @@ -2076,7 +2076,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { bool bNodeExist = false; spin_lock_irq(&pDevice->lock); - if (pDevice->bLinkPass == false) { + if (!pDevice->bLinkPass) { dev_kfree_skb_irq(skb); spin_unlock_irq(&pDevice->lock); return 0; @@ -2130,7 +2130,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { } } - if (bNodeExist == false) { + if (!bNodeExist) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "Unknown STA not found in node DB \n"); dev_kfree_skb_irq(skb); spin_unlock_irq(&pDevice->lock); @@ -2149,7 +2149,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { cbFrameBodySize += 8; } - if (pDevice->bEncryptionEnable == true) { + if (pDevice->bEncryptionEnable) { bNeedEncryption = true; // get Transmit key do { @@ -2196,7 +2196,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { if (pDevice->bEnableHostWEP) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "acdma0: STA index %d\n", uNodeIndex); - if (pDevice->bEncryptionEnable == true) { + if (pDevice->bEncryptionEnable) { pTransmitKey = &STempKey; pTransmitKey->byCipherSuite = pMgmt->sNodeDBTable[uNodeIndex].byCipherSuite; pTransmitKey->dwKeyIndex = pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex; @@ -2286,7 +2286,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { } else if (pDevice->eCurrentPHYType == PHY_TYPE_11A) { byPktType = PK_TYPE_11A; } else { - if (pDevice->bProtectMode == true) { + if (pDevice->bProtectMode) { byPktType = PK_TYPE_11GB; } else { byPktType = PK_TYPE_11GA; @@ -2297,7 +2297,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { // printk("FIX RATE:CurrentRate is %d"); //#endif - if (bNeedEncryption == true) { + if (bNeedEncryption) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ntohs Pkt Type=%04x\n", ntohs(pDevice->sTxEthHeader.wType)); if ((pDevice->sTxEthHeader.wType) == TYPE_PKT_802_1x) { bNeedEncryption = false; @@ -2306,7 +2306,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { if (pTransmitKey == NULL) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Don't Find TX KEY\n"); } else { - if (bTKIP_UseGTK == true) { + if (bTKIP_UseGTK) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "error: KEY is GTK!!~~\n"); } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Find PTK [%lX]\n", pTransmitKey->dwKeyIndex); @@ -2493,7 +2493,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { MACvSelectPage0(pDevice->PortOffset); //xxxx // WCMDbFlushCommandQueue(pDevice->pMgmt, true); - if (set_channel(pDevice, pDevice->pCurrMeasureEID->sReq.byChannel) == true) { + if (set_channel(pDevice, pDevice->pCurrMeasureEID->sReq.byChannel)) { pDevice->bMeasureInProgress = true; MACvSelectPage1(pDevice->PortOffset); MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL, MSRCTL_READY); @@ -2544,12 +2544,12 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { if (pDevice->dwIsr & ISR_QUIETSTART) { do { ; - } while (CARDbStartQuiet(pDevice) == false); + } while (!CARDbStartQuiet(pDevice)); } } if (pDevice->dwIsr & ISR_TBTT) { - if (pDevice->bEnableFirstQuiet == true) { + if (pDevice->bEnableFirstQuiet) { pDevice->byQuietStartCount--; if (pDevice->byQuietStartCount == 0) { pDevice->bEnableFirstQuiet = false; @@ -2558,7 +2558,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { MACvSelectPage0(pDevice->PortOffset); } } - if ((pDevice->bChannelSwitch == true) && + if (pDevice->bChannelSwitch && (pDevice->eOPMode == OP_MODE_INFRASTRUCTURE)) { pDevice->byChannelSwitchCount--; if (pDevice->byChannelSwitchCount == 0) { @@ -2575,7 +2575,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { if (pDevice->eOPMode == OP_MODE_ADHOC) { //pDevice->bBeaconSent = false; } else { - if ((pDevice->bUpdateBBVGA) && (pDevice->bLinkPass == true) && (pDevice->uCurrRSSI != 0)) { + if ((pDevice->bUpdateBBVGA) && pDevice->bLinkPass && (pDevice->uCurrRSSI != 0)) { long ldBm; RFvRSSITodBm(pDevice, (unsigned char) pDevice->uCurrRSSI, &ldBm); @@ -2642,7 +2642,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { } pDevice->bBeaconSent = true; - if (pDevice->bChannelSwitch == true) { + if (pDevice->bChannelSwitch) { pDevice->byChannelSwitchCount--; if (pDevice->byChannelSwitchCount == 0) { pDevice->bChannelSwitch = false; @@ -3237,7 +3237,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { netif_stop_queue(pDevice->dev); #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT pMgmt->eScanType = WMAC_SCAN_ACTIVE; - if (pDevice->bWPASuppWextEnabled != true) + if (!pDevice->bWPASuppWextEnabled) #endif bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, NULL); @@ -3373,7 +3373,7 @@ viawget_resume(struct pci_dev *pcid) spin_lock_irq(&pDevice->lock); MACvRestoreContext(pDevice->PortOffset, pDevice->abyMacContext); device_init_registers(pDevice, DEVICE_INIT_DXPL); - if (pMgmt->sNodeDBTable[0].bActive == true) { // Assoc with BSS + if (pMgmt->sNodeDBTable[0].bActive) { // Assoc with BSS pMgmt->sNodeDBTable[0].bActive = false; pDevice->bLinkPass = false; if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { diff --git a/drivers/staging/vt6655/dpc.c b/drivers/staging/vt6655/dpc.c index 0ff51cb4a207..c60f3e6dc6f8 100644 --- a/drivers/staging/vt6655/dpc.c +++ b/drivers/staging/vt6655/dpc.c @@ -379,7 +379,7 @@ device_receive_frame( pMACHeader = (PS802_11Header)((unsigned char *)(skb->data) + 8); //PLICE_DEBUG<- - if (pDevice->bMeasureInProgress == true) { + if (pDevice->bMeasureInProgress) { if ((*pbyRsr & RSR_CRCOK) != 0) { pDevice->byBasicMap |= 0x01; } @@ -436,7 +436,7 @@ device_receive_frame( } if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { - if (s_bAPModeRxCtl(pDevice, pbyFrame, iSANodeIndex) == true) { + if (s_bAPModeRxCtl(pDevice, pbyFrame, iSANodeIndex)) { return false; } } @@ -608,8 +608,7 @@ device_receive_frame( } } else { // discard DATA packet while not associate || BSSID error - if ((pDevice->bLinkPass == false) || - !(*pbyRsr & RSR_BSSIDOK)) { + if (!pDevice->bLinkPass || !(*pbyRsr & RSR_BSSIDOK)) { if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc more frag bufs\n", @@ -658,7 +657,7 @@ device_receive_frame( // Now it only supports 802.11g Infrastructure Mode, and support rate must up to 54 Mbps if (pDevice->bDiversityEnable && (FrameSize > 50) && (pDevice->eOPMode == OP_MODE_INFRASTRUCTURE) && - (pDevice->bLinkPass == true)) { + pDevice->bLinkPass) { BBvAntennaDiversity(pDevice, s_byGetRateIdx(*pbyRxRate), 0); } @@ -683,7 +682,7 @@ device_receive_frame( // ----------------------------------------------- - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnable8021x == true)) { + if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && pDevice->bEnable8021x) { unsigned char abyMacHdr[24]; // Only 802.1x packet incoming allowed @@ -698,7 +697,7 @@ device_receive_frame( if (wEtherType == ETH_P_PAE) { skb->dev = pDevice->apdev; - if (bIsWEP == true) { + if (bIsWEP) { // strip IV header(8) memcpy(&abyMacHdr[0], (skb->data + 4), 24); memcpy((skb->data + 4 + cbIVOffset), &abyMacHdr[0], 24); @@ -770,8 +769,9 @@ device_receive_frame( //DBG_PRN_GRP12(("LocalL: %lx, LocalR: %lx\n", dwLocalMIC_L, dwLocalMIC_R)); //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dwMICKey0= %lx,dwMICKey1= %lx \n", dwMICKey0, dwMICKey1); - if ((cpu_to_le32(*pdwMIC_L) != dwLocalMIC_L) || (cpu_to_le32(*pdwMIC_R) != dwLocalMIC_R) || - (pDevice->bRxMICFail == true)) { + if ((cpu_to_le32(*pdwMIC_L) != dwLocalMIC_L) || + (cpu_to_le32(*pdwMIC_R) != dwLocalMIC_R) || + pDevice->bRxMICFail) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MIC comparison is fail!\n"); pDevice->bRxMICFail = false; //pDevice->s802_11Counter.TKIPLocalMICFailures.QuadPart++; @@ -894,13 +894,13 @@ device_receive_frame( return false; if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { - if (s_bAPModeRxData(pDevice, + if (!s_bAPModeRxData(pDevice, skb, FrameSize, cbHeaderOffset, iSANodeIndex, iDANodeIndex -) == false) { +)) { if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc more frag bufs\n", @@ -1123,7 +1123,7 @@ static bool s_bHandleRxEncryption( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey == NULL\n"); if (byDecMode == KEY_CTL_WEP) { // pDevice->s802_11Counter.WEPUndecryptableCount.QuadPart++; - } else if (pDevice->bLinkPass == true) { + } else if (pDevice->bLinkPass) { // pDevice->s802_11Counter.DecryptFailureCount.QuadPart++; } return false; @@ -1131,7 +1131,7 @@ static bool s_bHandleRxEncryption( if (byDecMode != pKey->byCipherSuite) { if (byDecMode == KEY_CTL_WEP) { // pDevice->s802_11Counter.WEPUndecryptableCount.QuadPart++; - } else if (pDevice->bLinkPass == true) { + } else if (pDevice->bLinkPass) { // pDevice->s802_11Counter.DecryptFailureCount.QuadPart++; } *pKeyOut = NULL; @@ -1234,7 +1234,7 @@ static bool s_bHostWepRxEncryption( if (byDecMode != pKey->byCipherSuite) { if (byDecMode == KEY_CTL_WEP) { // pDevice->s802_11Counter.WEPUndecryptableCount.QuadPart++; - } else if (pDevice->bLinkPass == true) { + } else if (pDevice->bLinkPass) { // pDevice->s802_11Counter.DecryptFailureCount.QuadPart++; } return false; @@ -1245,7 +1245,7 @@ static bool s_bHostWepRxEncryption( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "byDecMode == KEY_CTL_WEP \n"); if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || (((PSKeyTable)(pKey->pvKeyTable))->bSoftWEP == true) || - (bOnFly == false)) { + !bOnFly) { // Software WEP // 1. 3253A // 2. WEP 256 @@ -1277,7 +1277,7 @@ static bool s_bHostWepRxEncryption( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "TSC0_15: %x\n", *pwRxTSC15_0); if (byDecMode == KEY_CTL_TKIP) { - if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || (bOnFly == false)) { + if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || !bOnFly) { // Software TKIP // 1. 3253 A // 2. NotOnFly @@ -1297,7 +1297,7 @@ static bool s_bHostWepRxEncryption( } if (byDecMode == KEY_CTL_CCMP) { - if (bOnFly == false) { + if (!bOnFly) { // Software CCMP // NotOnFly DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "soft KEY_CTL_CCMP\n"); diff --git a/drivers/staging/vt6655/hostap.c b/drivers/staging/vt6655/hostap.c index aab0012bba92..3d30a435cabd 100644 --- a/drivers/staging/vt6655/hostap.c +++ b/drivers/staging/vt6655/hostap.c @@ -494,11 +494,11 @@ static int hostap_set_encryption(PSDevice pDevice, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " hostap_set_encryption: alg %d \n", param->u.crypt.alg); if (param->u.crypt.alg == WPA_ALG_NONE) { - if (pMgmt->sNodeDBTable[iNodeIndex].bOnFly == true) { - if (KeybRemoveKey(&(pDevice->sKey), + if (pMgmt->sNodeDBTable[iNodeIndex].bOnFly) { + if (!KeybRemoveKey(&(pDevice->sKey), param->sta_addr, pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex, - pDevice->PortOffset) == false) { + pDevice->PortOffset)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybRemoveKey fail \n"); } pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false; @@ -556,7 +556,7 @@ static int hostap_set_encryption(PSDevice pDevice, (unsigned char *)abyKey, KEY_CTL_WEP, pDevice->PortOffset, - pDevice->byLocalID) == true) { + pDevice->byLocalID)) { pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; } else { @@ -623,7 +623,7 @@ static int hostap_set_encryption(PSDevice pDevice, (unsigned char *)abyKey, byKeyDecMode, pDevice->PortOffset, - pDevice->byLocalID) == true) { + pDevice->byLocalID)) { pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; } else { @@ -635,7 +635,7 @@ static int hostap_set_encryption(PSDevice pDevice, } - if (bKeyTableFull == true) { + if (bKeyTableFull) { wKeyCtl &= 0x7F00; // clear all key control filed wKeyCtl |= (byKeyDecMode << 4); wKeyCtl |= (byKeyDecMode); diff --git a/drivers/staging/vt6655/key.c b/drivers/staging/vt6655/key.c index 04c1304d16e5..eab3b41f9e3c 100644 --- a/drivers/staging/vt6655/key.c +++ b/drivers/staging/vt6655/key.c @@ -64,13 +64,12 @@ s_vCheckKeyTableValid(PSKeyManagement pTable, unsigned long dwIoBase) int i; for (i = 0; i < MAX_KEY_TABLE; i++) { - if ((pTable->KeyTable[i].bInUse == true) && - (pTable->KeyTable[i].PairwiseKey.bKeyValid == false) && - (pTable->KeyTable[i].GroupKey[0].bKeyValid == false) && - (pTable->KeyTable[i].GroupKey[1].bKeyValid == false) && - (pTable->KeyTable[i].GroupKey[2].bKeyValid == false) && - (pTable->KeyTable[i].GroupKey[3].bKeyValid == false) -) { + if (pTable->KeyTable[i].bInUse && + !pTable->KeyTable[i].PairwiseKey.bKeyValid && + !pTable->KeyTable[i].GroupKey[0].bKeyValid && + !pTable->KeyTable[i].GroupKey[1].bKeyValid && + !pTable->KeyTable[i].GroupKey[2].bKeyValid && + !pTable->KeyTable[i].GroupKey[3].bKeyValid) { pTable->KeyTable[i].bInUse = false; pTable->KeyTable[i].wKeyCtl = 0; pTable->KeyTable[i].bSoftWEP = false; @@ -140,17 +139,17 @@ bool KeybGetKey( *pKey = NULL; for (i = 0; i < MAX_KEY_TABLE; i++) { - if ((pTable->KeyTable[i].bInUse == true) && + if (pTable->KeyTable[i].bInUse && ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { if (dwKeyIndex == 0xFFFFFFFF) { - if (pTable->KeyTable[i].PairwiseKey.bKeyValid == true) { + if (pTable->KeyTable[i].PairwiseKey.bKeyValid) { *pKey = &(pTable->KeyTable[i].PairwiseKey); return true; } else { return false; } } else if (dwKeyIndex < MAX_GROUP_KEY) { - if (pTable->KeyTable[i].GroupKey[dwKeyIndex].bKeyValid == true) { + if (pTable->KeyTable[i].GroupKey[dwKeyIndex].bKeyValid) { *pKey = &(pTable->KeyTable[i].GroupKey[dwKeyIndex]); return true; } else { @@ -202,12 +201,11 @@ bool KeybSetKey( j = (MAX_KEY_TABLE-1); for (i = 0; i < (MAX_KEY_TABLE - 1); i++) { - if ((pTable->KeyTable[i].bInUse == false) && - (j == (MAX_KEY_TABLE-1))) { + if (!pTable->KeyTable[i].bInUse && (j == (MAX_KEY_TABLE-1))) { // found empty table j = i; } - if ((pTable->KeyTable[i].bInUse == true) && + if (pTable->KeyTable[i].bInUse && ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { // found table already exist if ((dwKeyIndex & PAIRWISE_KEY) != 0) { @@ -384,7 +382,7 @@ bool KeybRemoveKey( } for (i = 0; i < MAX_KEY_TABLE; i++) { - if ((pTable->KeyTable[i].bInUse == true) && + if (pTable->KeyTable[i].bInUse && ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { if ((dwKeyIndex & PAIRWISE_KEY) != 0) { pTable->KeyTable[i].PairwiseKey.bKeyValid = false; @@ -428,7 +426,7 @@ bool KeybRemoveAllKey( int i, u; for (i = 0; i < MAX_KEY_TABLE; i++) { - if ((pTable->KeyTable[i].bInUse == true) && + if (pTable->KeyTable[i].bInUse && ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { pTable->KeyTable[i].PairwiseKey.bKeyValid = false; for (u = 0; u < MAX_GROUP_KEY; u++) { @@ -461,7 +459,7 @@ void KeyvRemoveWEPKey( ) { if ((dwKeyIndex & 0x000000FF) < MAX_GROUP_KEY) { - if (pTable->KeyTable[MAX_KEY_TABLE-1].bInUse == true) { + if (pTable->KeyTable[MAX_KEY_TABLE-1].bInUse) { if (pTable->KeyTable[MAX_KEY_TABLE-1].GroupKey[dwKeyIndex & 0x000000FF].byCipherSuite == KEY_CTL_WEP) { pTable->KeyTable[MAX_KEY_TABLE-1].GroupKey[dwKeyIndex & 0x000000FF].bKeyValid = false; if ((dwKeyIndex & 0x7FFFFFFF) == (pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex & 0x7FFFFFFF)) { @@ -511,10 +509,10 @@ bool KeybGetTransmitKey( *pKey = NULL; for (i = 0; i < MAX_KEY_TABLE; i++) { - if ((pTable->KeyTable[i].bInUse == true) && + if (pTable->KeyTable[i].bInUse && ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { if (dwKeyType == PAIRWISE_KEY) { - if (pTable->KeyTable[i].PairwiseKey.bKeyValid == true) { + if (pTable->KeyTable[i].PairwiseKey.bKeyValid) { *pKey = &(pTable->KeyTable[i].PairwiseKey); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybGetTransmitKey:"); @@ -535,7 +533,7 @@ bool KeybGetTransmitKey( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ERROR: dwGTKeyIndex == 0 !!!\n"); return false; } - if (pTable->KeyTable[i].GroupKey[(pTable->KeyTable[i].dwGTKeyIndex&0x000000FF)].bKeyValid == true) { + if (pTable->KeyTable[i].GroupKey[(pTable->KeyTable[i].dwGTKeyIndex&0x000000FF)].bKeyValid) { *pKey = &(pTable->KeyTable[i].GroupKey[(pTable->KeyTable[i].dwGTKeyIndex&0x000000FF)]); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybGetTransmitKey:"); @@ -583,8 +581,8 @@ bool KeybCheckPairewiseKey( *pKey = NULL; for (i = 0; i < MAX_KEY_TABLE; i++) { - if ((pTable->KeyTable[i].bInUse == true) && - (pTable->KeyTable[i].PairwiseKey.bKeyValid == true)) { + if (pTable->KeyTable[i].bInUse && + pTable->KeyTable[i].PairwiseKey.bKeyValid) { *pKey = &(pTable->KeyTable[i].PairwiseKey); return true; } @@ -657,7 +655,7 @@ bool KeybSetDefaultKey( pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl |= 0x4000; // disable on-fly disable address match pTable->KeyTable[MAX_KEY_TABLE-1].bSoftWEP = true; } else { - if (pTable->KeyTable[MAX_KEY_TABLE-1].bSoftWEP == false) + if (!pTable->KeyTable[MAX_KEY_TABLE-1].bSoftWEP) pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl |= 0xC000; // enable on-fly disable address match } @@ -740,7 +738,7 @@ bool KeybSetAllGroupKey( } for (i = 0; i < MAX_KEY_TABLE - 1; i++) { - if (pTable->KeyTable[i].bInUse == true) { + if (pTable->KeyTable[i].bInUse) { // found table already exist // Group key pKey = &(pTable->KeyTable[i].GroupKey[dwKeyIndex & 0x000000FF]); diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c index 001d15c0fa40..21bd8a1126d7 100644 --- a/drivers/staging/vt6655/mac.c +++ b/drivers/staging/vt6655/mac.c @@ -957,13 +957,13 @@ bool MACbSafeStop(unsigned long dwIoBase) { MACvRegBitsOff(dwIoBase, MAC_REG_TCR, TCR_AUTOBCNTX); - if (MACbSafeRxOff(dwIoBase) == false) { + if (!MACbSafeRxOff(dwIoBase)) { DBG_PORT80(0xA1); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " MACbSafeRxOff == false)\n"); MACbSafeSoftwareReset(dwIoBase); return false; } - if (MACbSafeTxOff(dwIoBase) == false) { + if (!MACbSafeTxOff(dwIoBase)) { DBG_PORT80(0xA2); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " MACbSafeTxOff == false)\n"); MACbSafeSoftwareReset(dwIoBase); diff --git a/drivers/staging/vt6655/power.c b/drivers/staging/vt6655/power.c index 2340d2f0399b..3da2838006e3 100644 --- a/drivers/staging/vt6655/power.c +++ b/drivers/staging/vt6655/power.c @@ -284,16 +284,15 @@ PSbSendNullPacket( PSMgmtObject pMgmt = pDevice->pMgmt; unsigned int uIdx; - if (pDevice->bLinkPass == false) { + if (!pDevice->bLinkPass) { return false; } #ifdef TxInSleep - if ((pDevice->bEnablePSMode == false) && - (pDevice->fTxDataInSleep == false)) { + if (!pDevice->bEnablePSMode && !pDevice->fTxDataInSleep) { return false; } #else - if (pDevice->bEnablePSMode == false) { + if (!pDevice->bEnablePSMode) { return false; } #endif diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c index ce173cc16c19..edb1b2768b17 100644 --- a/drivers/staging/vt6655/rf.c +++ b/drivers/staging/vt6655/rf.c @@ -976,7 +976,7 @@ bool RFbSetPower( } bResult = RFbRawSetPower(pDevice, byPwr, uRATE); - if (bResult == true) { + if (bResult) { pDevice->byCurPwr = byPwr; } return bResult; diff --git a/drivers/staging/vt6655/vntwifi.c b/drivers/staging/vt6655/vntwifi.c index d2bdb71fe62d..e78aedf99077 100644 --- a/drivers/staging/vt6655/vntwifi.c +++ b/drivers/staging/vt6655/vntwifi.c @@ -494,7 +494,7 @@ VNTWIFIvUpdateNodeTxCounter( } } pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts++; - if (bTxOk == true) { + if (bTxOk) { // transmit success, TxAttempts at least plus one pMgmt->sNodeDBTable[uNodeIndex].uTxOk[MAX_RATE]++; pMgmt->sNodeDBTable[uNodeIndex].uTxOk[wRate]++; @@ -584,7 +584,7 @@ VNTWIFIbyGetKeyCypher( { PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; - if (bGroupKey == true) { + if (bGroupKey) { return pMgmt->byCSSGK; } else { return pMgmt->byCSSPK; @@ -731,7 +731,7 @@ VNTWIFIbMeasureReport( pMgmt->uLengthOfRepEIDs += (2 + pMgmt->pCurrMeasureEIDRep->len); pMgmt->pCurrMeasureEIDRep = (PWLAN_IE_MEASURE_REP) pbyCurrentEID; } - if (bEndOfReport == true) { + if (bEndOfReport) { IEEE11hbMSRRepTx(pMgmt); } //spin_unlock_irq(&pDevice->lock); diff --git a/drivers/staging/vt6655/wcmd.c b/drivers/staging/vt6655/wcmd.c index 9c57eefe78fb..72caaa203ddc 100644 --- a/drivers/staging/vt6655/wcmd.c +++ b/drivers/staging/vt6655/wcmd.c @@ -317,7 +317,7 @@ vCommandTimer( if (pDevice->dwDiagRefCount != 0) return; - if (pDevice->bCmdRunning != true) + if (!pDevice->bCmdRunning) return; spin_lock_irq(&pDevice->lock); @@ -326,7 +326,7 @@ vCommandTimer( case WLAN_CMD_SCAN_START: pDevice->byReAssocCount = 0; - if (pDevice->bRadioOff == true) { + if (pDevice->bRadioOff) { s_bCommandComplete(pDevice); spin_unlock_irq(&pDevice->lock); return; @@ -393,7 +393,7 @@ vCommandTimer( vAdHocBeaconStop(pDevice); - if (set_channel(pMgmt->pAdapter, pMgmt->uScanChannel) == true) { + if (set_channel(pMgmt->pAdapter, pMgmt->uScanChannel)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SCAN Channel: %d\n", pMgmt->uScanChannel); } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SET SCAN Channel Fail: %d\n", pMgmt->uScanChannel); @@ -408,7 +408,7 @@ vCommandTimer( } - if ((pMgmt->b11hEnable == false) || + if (!pMgmt->b11hEnable || (pMgmt->uScanChannel < CB_MAX_CHANNEL_24G)) { s_vProbeChannel(pDevice); spin_unlock_irq(&pDevice->lock); @@ -498,7 +498,7 @@ vCommandTimer( case WLAN_CMD_SSID_START: pDevice->byReAssocCount = 0; - if (pDevice->bRadioOff == true) { + if (pDevice->bRadioOff) { s_bCommandComplete(pDevice); spin_unlock_irq(&pDevice->lock); return; @@ -659,7 +659,7 @@ vCommandTimer( netif_wake_queue(pDevice->dev); } #ifdef TxInSleep - if (pDevice->IsTxDataTrigger != false) { //TxDataTimer is not triggered at the first time + if (pDevice->IsTxDataTrigger) { //TxDataTimer is not triggered at the first time del_timer(&pDevice->sTimerTxData); init_timer(&pDevice->sTimerTxData); pDevice->sTimerTxData.data = (unsigned long) pDevice; @@ -694,7 +694,7 @@ vCommandTimer( pMgmt->eCurrState = WMAC_STATE_IDLE; pMgmt->eCurrMode = WMAC_MODE_STANDBY; pDevice->bLinkPass = false; - if (pDevice->bEnableHostWEP == true) + if (pDevice->bEnableHostWEP) BSSvClearNodeDBTable(pDevice, 1); else BSSvClearNodeDBTable(pDevice, 0); @@ -776,7 +776,7 @@ vCommandTimer( case WLAN_CMD_RADIO_START: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState == WLAN_CMD_RADIO_START\n"); - if (pDevice->bRadioCmd == true) + if (pDevice->bRadioCmd) CARDbRadioPowerOn(pDevice); else CARDbRadioPowerOff(pDevice); @@ -948,7 +948,7 @@ bool bScheduleCommand( ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdEnqueueIdx, CMD_Q_SIZE); pDevice->cbFreeCmdQueue--; - if (pDevice->bCmdRunning == false) { + if (!pDevice->bCmdRunning) { s_bCommandComplete(pDevice); } else { } @@ -1031,8 +1031,8 @@ BSSvSecondTxData( spin_lock_irq(&pDevice->lock); #if 1 - if (((pDevice->bLinkPass == true) && (pMgmt->eAuthenMode < WMAC_AUTH_WPA)) || //open && sharekey linking - (pDevice->fWPA_Authened == true)) { //wpa linking + if ((pDevice->bLinkPass && (pMgmt->eAuthenMode < WMAC_AUTH_WPA)) || //open && sharekey linking + pDevice->fWPA_Authened) { //wpa linking #else if (pDevice->bLinkPass == true) { #endif diff --git a/drivers/staging/vt6655/wctl.c b/drivers/staging/vt6655/wctl.c index f05f9f55398b..950039f6d128 100644 --- a/drivers/staging/vt6655/wctl.c +++ b/drivers/staging/vt6655/wctl.c @@ -110,7 +110,7 @@ unsigned int WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader) unsigned int ii; for (ii = 0; ii < pDevice->cbDFCB; ii++) { - if ((pDevice->sRxDFCB[ii].bInUse == true) && + if (pDevice->sRxDFCB[ii].bInUse && ether_addr_equal(pDevice->sRxDFCB[ii].abyAddr2, pMACHeader->abyAddr2)) { // @@ -141,7 +141,7 @@ unsigned int WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader) if (pDevice->cbFreeDFCB == 0) return pDevice->cbDFCB; for (ii = 0; ii < pDevice->cbDFCB; ii++) { - if (pDevice->sRxDFCB[ii].bInUse == false) { + if (!pDevice->sRxDFCB[ii].bInUse) { pDevice->cbFreeDFCB--; pDevice->sRxDFCB[ii].uLifetime = pDevice->dwMaxReceiveLifetime; pDevice->sRxDFCB[ii].bInUse = true; @@ -174,7 +174,7 @@ bool WCTLbHandleFragment(PSDevice pDevice, PS802_11Header pMACHeader, unsigned i { unsigned int uHeaderSize; - if (bWEP == true) { + if (bWEP) { uHeaderSize = 28; if (bExtIV) // ExtIV diff --git a/drivers/staging/vt6655/wmgr.c b/drivers/staging/vt6655/wmgr.c index ed4b32b6d9ce..40bb9004a921 100644 --- a/drivers/staging/vt6655/wmgr.c +++ b/drivers/staging/vt6655/wmgr.c @@ -468,15 +468,15 @@ vMgrAssocBeginSta( // ERP Phy (802.11g) should support short preamble. if (pMgmt->eCurrentPHYMode == PHY_TYPE_11G) { pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); - if (CARDbIsShorSlotTime(pMgmt->pAdapter) == true) { + if (CARDbIsShorSlotTime(pMgmt->pAdapter)) { pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTSLOTTIME(1); } } else if (pMgmt->eCurrentPHYMode == PHY_TYPE_11B) { - if (CARDbIsShortPreamble(pMgmt->pAdapter) == true) { + if (CARDbIsShortPreamble(pMgmt->pAdapter)) { pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); } } - if (pMgmt->b11hEnable == true) + if (pMgmt->b11hEnable) pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SPECTRUMMNG(1); /* build an assocreq frame and send it */ @@ -539,15 +539,15 @@ vMgrReAssocBeginSta( // ERP Phy (802.11g) should support short preamble. if (pMgmt->eCurrentPHYMode == PHY_TYPE_11G) { pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); - if (CARDbIsShorSlotTime(pMgmt->pAdapter) == true) { + if (CARDbIsShorSlotTime(pMgmt->pAdapter)) { pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTSLOTTIME(1); } } else if (pMgmt->eCurrentPHYMode == PHY_TYPE_11B) { - if (CARDbIsShortPreamble(pMgmt->pAdapter) == true) { + if (CARDbIsShortPreamble(pMgmt->pAdapter)) { pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); } } - if (pMgmt->b11hEnable == true) + if (pMgmt->b11hEnable) pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SPECTRUMMNG(1); pTxPacket = s_MgrMakeReAssocRequest @@ -736,7 +736,7 @@ s_vMgrRxAssocRequest( pDevice->bProtectMode = true; pDevice->bNonERPPresent = true; } - if (pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble == false) { + if (!pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble) { pDevice->bBarkerPreambleMd = true; } @@ -891,7 +891,7 @@ s_vMgrRxReAssocRequest( pDevice->bProtectMode = true; pDevice->bNonERPPresent = true; } - if (pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble == false) { + if (!pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble) { pDevice->bBarkerPreambleMd = true; } @@ -1837,7 +1837,7 @@ s_vMgrRxBeacon( bChannelHit = true; } //2008-0730-01by MikeLiu - if (ChannelExceedZoneType(pDevice, byCurrChannel) == true) + if (ChannelExceedZoneType(pDevice, byCurrChannel)) return; if (sFrame.pERP != NULL) { @@ -1957,9 +1957,9 @@ s_vMgrRxBeacon( } } - if ((WLAN_GET_CAP_INFO_ESS(*sFrame.pwCapInfo) == true) && - (bIsBSSIDEqual == true) && - (bIsSSIDEqual == true) && + if (WLAN_GET_CAP_INFO_ESS(*sFrame.pwCapInfo) && + bIsBSSIDEqual && + bIsSSIDEqual && (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { // add state check to prevent reconnect fail since we'll receive Beacon @@ -2001,7 +2001,7 @@ s_vMgrRxBeacon( &(pMgmt->sNodeDBTable[0].byTopCCKBasicRate), &(pMgmt->sNodeDBTable[0].byTopOFDMBasicRate) ); - if (bUpdatePhyParameter == true) { + if (bUpdatePhyParameter) { CARDbSetPhyParameter(pMgmt->pAdapter, pMgmt->eCurrentPHYMode, pMgmt->wCurrCapInfo, @@ -2023,7 +2023,7 @@ s_vMgrRxBeacon( sFrame.pIE_CHSW->byCount ); - } else if (bIsChannelEqual == false) { + } else if (!bIsChannelEqual) { set_channel(pMgmt->pAdapter, pBSSList->uChannel); } } @@ -2067,12 +2067,12 @@ s_vMgrRxBeacon( } // if infra mode - if (bIsAPBeacon == true) { + if (bIsAPBeacon) { // Infra mode: Local TSF always follow AP's TSF if Difference huge. if (bTSFLargeDiff) bUpdateTSF = true; - if ((pDevice->bEnablePSMode == true) && (sFrame.pTIM != 0)) { + if (pDevice->bEnablePSMode && (sFrame.pTIM != 0)) { // deal with DTIM, analysis TIM pMgmt->bMulticastTIM = WLAN_MGMT_IS_MULTICAST_TIM(sFrame.pTIM->byBitMapCtl) ? true : false; pMgmt->byDTIMCount = sFrame.pTIM->byDTIMCount; @@ -2110,7 +2110,7 @@ s_vMgrRxBeacon( } else { pMgmt->bInTIMWake = false; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Not In TIM..\n"); - if (pDevice->bPWBitOn == false) { + if (!pDevice->bPWBitOn) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Send Null Packet\n"); if (PSbSendNullPacket(pDevice)) pDevice->bPWBitOn = true; @@ -2480,7 +2480,7 @@ vMgrCreateOwnIBSS( pMgmt->wCurrCapInfo &= (~WLAN_SET_CAP_INFO_SHORTPREAMBLE(1)); } - if ((pMgmt->b11hEnable == true) && + if (pMgmt->b11hEnable && (pMgmt->eCurrentPHYMode == PHY_TYPE_11A)) { pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SPECTRUMMNG(1); } else { @@ -2530,7 +2530,7 @@ vMgrJoinBSSBegin( unsigned char byTopOFDMBasicRate = RATE_1M; for (ii = 0; ii < MAX_BSS_NUM; ii++) { - if (pMgmt->sBSSList[ii].bActive == true) + if (pMgmt->sBSSList[ii].bActive) break; } @@ -2656,7 +2656,7 @@ vMgrJoinBSSBegin( if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) { bool bResult = bAdd_PMKID_Candidate((void *)pDevice, pMgmt->abyCurrBSSID, &pCurr->sRSNCapObj); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bAdd_PMKID_Candidate: 1(%d)\n", bResult); - if (bResult == false) { + if (!bResult) { vFlush_PMKID_Candidate((void *)pDevice); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vFlush_PMKID_Candidate: 4\n"); bAdd_PMKID_Candidate((void *)pDevice, pMgmt->abyCurrBSSID, &pCurr->sRSNCapObj); @@ -2677,13 +2677,13 @@ vMgrJoinBSSBegin( // ad-hoc mode BSS if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) { if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) { - if (WPA_SearchRSN(0, WPA_TKIP, pCurr) == false) { + if (!WPA_SearchRSN(0, WPA_TKIP, pCurr)) { // encryption mode error pMgmt->eCurrState = WMAC_STATE_IDLE; return; } } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) { - if (WPA_SearchRSN(0, WPA_AESCCMP, pCurr) == false) { + if (!WPA_SearchRSN(0, WPA_AESCCMP, pCurr)) { // encryption mode error pMgmt->eCurrState = WMAC_STATE_IDLE; return; @@ -2776,10 +2776,10 @@ s_vMgrSynchBSS( *pStatus = CMD_STATUS_FAILURE; - if (s_bCipherMatch(pCurr, + if (!s_bCipherMatch(pCurr, pDevice->eEncryptionStatus, &(pMgmt->byCSSPK), - &(pMgmt->byCSSGK)) == false) { + &(pMgmt->byCSSGK))) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "s_bCipherMatch Fail .......\n"); return; } @@ -2869,18 +2869,17 @@ s_vMgrSynchBSS( CARDbSetBSSID(pMgmt->pAdapter, pCurr->abyBSSID, OP_MODE_ADHOC); } - if (CARDbSetPhyParameter(pMgmt->pAdapter, + if (!CARDbSetPhyParameter(pMgmt->pAdapter, ePhyType, pCurr->wCapInfo, pCurr->sERP.byERP, pMgmt->abyCurrSuppRates, - pMgmt->abyCurrExtSuppRates - ) != true) { + pMgmt->abyCurrExtSuppRates)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "<----s_bSynchBSS Set Phy Mode Fail [%d]\n", ePhyType); return; } // set channel and clear NAV - if (set_channel(pMgmt->pAdapter, pCurr->uChannel) == false) { + if (!set_channel(pMgmt->pAdapter, pCurr->uChannel)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "<----s_bSynchBSS Set Channel [%d]\n", pCurr->uChannel); return; } @@ -2924,7 +2923,7 @@ static void Encyption_Rebuild( if ((pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || //networkmanager 0.7.0 does not give the pairwise-key selection, (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) { // so we need re-select it according to real pairwise-key info. - if (pCurr->bWPAValid == true) { //WPA-PSK + if (pCurr->bWPAValid) { //WPA-PSK pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK; if (pCurr->abyPKType[0] == WPA_TKIP) { pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; //TKIP @@ -2933,7 +2932,7 @@ static void Encyption_Rebuild( pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; //AES PRINT_K("Encyption_Rebuild--->ssid reset config to [WPAPSK-AES]\n"); } - } else if (pCurr->bWPA2Valid == true) { //WPA2-PSK + } else if (pCurr->bWPA2Valid) { //WPA2-PSK pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK; if (pCurr->abyCSSPK[0] == WLAN_11i_CSS_TKIP) { pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; //TKIP @@ -3150,8 +3149,7 @@ s_MgrMakeBeacon( } } - if ((pMgmt->b11hEnable == true) && - (pMgmt->eCurrentPHYMode == PHY_TYPE_11A)) { + if (pMgmt->b11hEnable && (pMgmt->eCurrentPHYMode == PHY_TYPE_11A)) { // Country IE pbyBuffer = (unsigned char *)(sFrame.pBuf + sFrame.len); set_country_IE(pMgmt->pAdapter, pbyBuffer); @@ -3164,7 +3162,7 @@ s_MgrMakeBeacon( ((PWLAN_IE_PW_CONST) pbyBuffer)->byPower = 0; pbyBuffer += (1) + WLAN_IEHDR_LEN; uLength += (1) + WLAN_IEHDR_LEN; - if (pMgmt->bSwitchChannel == true) { + if (pMgmt->bSwitchChannel) { // Channel Switch IE ((PWLAN_IE_CH_SW) pbyBuffer)->byElementID = WLAN_EID_CH_SWITCH; ((PWLAN_IE_CH_SW) pbyBuffer)->len = 3; @@ -3193,7 +3191,7 @@ s_MgrMakeBeacon( pbyBuffer += (7) + WLAN_IEHDR_LEN; uLength += (7) + WLAN_IEHDR_LEN; for (ii = CB_MAX_CHANNEL_24G+1; ii <= CB_MAX_CHANNEL; ii++) { - if (get_channel_map_info(pMgmt->pAdapter, ii, pbyBuffer, pbyBuffer+1) == true) { + if (get_channel_map_info(pMgmt->pAdapter, ii, pbyBuffer, pbyBuffer+1)) { pbyBuffer += 2; uLength += 2; pIBSSDFS->len += 2; @@ -3209,11 +3207,11 @@ s_MgrMakeBeacon( sFrame.pERP->byElementID = WLAN_EID_ERP; sFrame.pERP->len = 1; sFrame.pERP->byContext = 0; - if (pDevice->bProtectMode == true) + if (pDevice->bProtectMode) sFrame.pERP->byContext |= WLAN_EID_ERP_USE_PROTECTION; - if (pDevice->bNonERPPresent == true) + if (pDevice->bNonERPPresent) sFrame.pERP->byContext |= WLAN_EID_ERP_NONERP_PRESENT; - if (pDevice->bBarkerPreambleMd == true) + if (pDevice->bBarkerPreambleMd) sFrame.pERP->byContext |= WLAN_EID_ERP_BARKER_MODE; } if (((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len != 0) { @@ -3225,7 +3223,7 @@ s_MgrMakeBeacon( ); } // hostapd wpa/wpa2 IE - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnableHostapd == true)) { + if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && pDevice->bEnableHostapd) { if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) { if (pMgmt->wWPAIELen != 0) { sFrame.pRSN = (PWLAN_IE_RSN)(sFrame.pBuf + sFrame.len); @@ -3338,16 +3336,15 @@ s_MgrMakeProbeResponse( sFrame.pERP->byElementID = WLAN_EID_ERP; sFrame.pERP->len = 1; sFrame.pERP->byContext = 0; - if (pDevice->bProtectMode == true) + if (pDevice->bProtectMode) sFrame.pERP->byContext |= WLAN_EID_ERP_USE_PROTECTION; - if (pDevice->bNonERPPresent == true) + if (pDevice->bNonERPPresent) sFrame.pERP->byContext |= WLAN_EID_ERP_NONERP_PRESENT; - if (pDevice->bBarkerPreambleMd == true) + if (pDevice->bBarkerPreambleMd) sFrame.pERP->byContext |= WLAN_EID_ERP_BARKER_MODE; } - if ((pMgmt->b11hEnable == true) && - (pMgmt->eCurrentPHYMode == PHY_TYPE_11A)) { + if (pMgmt->b11hEnable && (pMgmt->eCurrentPHYMode == PHY_TYPE_11A)) { // Country IE pbyBuffer = (unsigned char *)(sFrame.pBuf + sFrame.len); set_country_IE(pMgmt->pAdapter, pbyBuffer); @@ -3360,7 +3357,7 @@ s_MgrMakeProbeResponse( ((PWLAN_IE_PW_CONST) pbyBuffer)->byPower = 0; pbyBuffer += (1) + WLAN_IEHDR_LEN; uLength += (1) + WLAN_IEHDR_LEN; - if (pMgmt->bSwitchChannel == true) { + if (pMgmt->bSwitchChannel) { // Channel Switch IE ((PWLAN_IE_CH_SW) pbyBuffer)->byElementID = WLAN_EID_CH_SWITCH; ((PWLAN_IE_CH_SW) pbyBuffer)->len = 3; @@ -3389,7 +3386,7 @@ s_MgrMakeProbeResponse( pbyBuffer += (7) + WLAN_IEHDR_LEN; uLength += (7) + WLAN_IEHDR_LEN; for (ii = CB_MAX_CHANNEL_24G + 1; ii <= CB_MAX_CHANNEL; ii++) { - if (get_channel_map_info(pMgmt->pAdapter, ii, pbyBuffer, pbyBuffer+1) == true) { + if (get_channel_map_info(pMgmt->pAdapter, ii, pbyBuffer, pbyBuffer+1)) { pbyBuffer += 2; uLength += 2; pIBSSDFS->len += 2; @@ -3409,7 +3406,7 @@ s_MgrMakeProbeResponse( } // hostapd wpa/wpa2 IE - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnableHostapd == true)) { + if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && pDevice->bEnableHostapd) { if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) { if (pMgmt->wWPAIELen != 0) { sFrame.pRSN = (PWLAN_IE_RSN)(sFrame.pBuf + sFrame.len); @@ -3507,7 +3504,7 @@ s_MgrMakeAssocRequest( pbyIEs += pCurrRates->len + WLAN_IEHDR_LEN; // for 802.11h - if (pMgmt->b11hEnable == true) { + if (pMgmt->b11hEnable) { if (sFrame.pCurrPowerCap == NULL) { sFrame.pCurrPowerCap = (PWLAN_IE_PW_CAP)(sFrame.pBuf + sFrame.len); sFrame.len += (2 + WLAN_IEHDR_LEN); @@ -3650,7 +3647,7 @@ s_MgrMakeAssocRequest( sFrame.pRSN->len += 6; // RSN Capabilities - if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == true) { + if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist) { memcpy(&sFrame.pRSN->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2); } else { sFrame.pRSN->abyRSN[16] = 0; @@ -3658,7 +3655,7 @@ s_MgrMakeAssocRequest( } sFrame.pRSN->len += 2; - if ((pDevice->gsPMKID.BSSIDInfoCount > 0) && (pDevice->bRoaming == true) && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { + if ((pDevice->gsPMKID.BSSIDInfoCount > 0) && pDevice->bRoaming && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { // RSN PMKID pbyRSN = &sFrame.pRSN->abyRSN[18]; pwPMKID = (unsigned short *)pbyRSN; // Point to PMKID count @@ -3896,7 +3893,7 @@ s_MgrMakeReAssocRequest( sFrame.pRSN->len += 6; // RSN Capabilities - if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == true) { + if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist) { memcpy(&sFrame.pRSN->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2); } else { sFrame.pRSN->abyRSN[16] = 0; @@ -3904,7 +3901,7 @@ s_MgrMakeReAssocRequest( } sFrame.pRSN->len += 2; - if ((pDevice->gsPMKID.BSSIDInfoCount > 0) && (pDevice->bRoaming == true) && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { + if ((pDevice->gsPMKID.BSSIDInfoCount > 0) && pDevice->bRoaming && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { // RSN PMKID pbyRSN = &sFrame.pRSN->abyRSN[18]; pwPMKID = (unsigned short *)pbyRSN; // Point to PMKID count @@ -4141,7 +4138,7 @@ s_vMgrRxProbeResponse( } //2008-0730-01by MikeLiu - if (ChannelExceedZoneType(pDevice, byCurrChannel) == true) + if (ChannelExceedZoneType(pDevice, byCurrChannel)) return; if (sFrame.pERP != NULL) { @@ -4578,7 +4575,7 @@ bAdd_PMKID_Candidate( for (ii = 0; ii < pDevice->gsPMKIDCandidate.NumCandidates; ii++) { pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[ii]; if (!memcmp(pCandidateList->BSSID, pbyBSSID, ETH_ALEN)) { - if ((psRSNCapObj->bRSNCapExist == true) && (psRSNCapObj->wRSNCap & BIT0)) { + if (psRSNCapObj->bRSNCapExist && (psRSNCapObj->wRSNCap & BIT0)) { pCandidateList->Flags |= NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED; } else { pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED); @@ -4589,7 +4586,7 @@ bAdd_PMKID_Candidate( // New Candidate pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[pDevice->gsPMKIDCandidate.NumCandidates]; - if ((psRSNCapObj->bRSNCapExist == true) && (psRSNCapObj->wRSNCap & BIT0)) { + if (psRSNCapObj->bRSNCapExist && (psRSNCapObj->wRSNCap & BIT0)) { pCandidateList->Flags |= NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED; } else { pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED); @@ -4650,7 +4647,7 @@ s_bCipherMatch( } if ((WLAN_GET_CAP_INFO_PRIVACY(pBSSNode->wCapInfo) != 0) && - (pBSSNode->bWPA2Valid == true) && + pBSSNode->bWPA2Valid && //20080123-01, by Einsn Liu ((EncStatus == Ndis802_11Encryption3Enabled) || (EncStatus == Ndis802_11Encryption2Enabled))) { //WPA2 @@ -4684,7 +4681,7 @@ s_bCipherMatch( } } else if ((WLAN_GET_CAP_INFO_PRIVACY(pBSSNode->wCapInfo) != 0) && - (pBSSNode->bWPAValid == true) && + pBSSNode->bWPAValid && ((EncStatus == Ndis802_11Encryption3Enabled) || (EncStatus == Ndis802_11Encryption2Enabled))) { //WPA // check Group Key Cipher diff --git a/drivers/staging/vt6655/wpa.c b/drivers/staging/vt6655/wpa.c index b697fa6c3b16..990ea0f9e9fb 100644 --- a/drivers/staging/vt6655/wpa.c +++ b/drivers/staging/vt6655/wpa.c @@ -241,7 +241,7 @@ WPA_SearchRSN( int ii; unsigned char byPKType = WPA_NONE; - if (pBSSList->bWPAValid == false) + if (!pBSSList->bWPAValid) return false; switch (byCmd) { diff --git a/drivers/staging/vt6655/wpa2.c b/drivers/staging/vt6655/wpa2.c index a7e33c0ceb74..2013122e92b2 100644 --- a/drivers/staging/vt6655/wpa2.c +++ b/drivers/staging/vt6655/wpa2.c @@ -192,7 +192,7 @@ WPA2vParseRSN( break; } //for - if (bUseGK == true) { + if (bUseGK) { if (j != 1) { // invalid CSS, This should be only PK CSS. return; @@ -335,7 +335,7 @@ WPA2uSetIEs( pRSNIEs->len += 2; if ((pMgmt->gsPMKIDCache.BSSIDInfoCount > 0) && - (pMgmt->bRoaming == true) && + pMgmt->bRoaming && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { // RSN PMKID pwPMKID = (unsigned short *)(&pRSNIEs->abyRSN[18]); // Point to PMKID count diff --git a/drivers/staging/vt6655/wpactl.c b/drivers/staging/vt6655/wpactl.c index 044368a46c53..ee83704e4401 100644 --- a/drivers/staging/vt6655/wpactl.c +++ b/drivers/staging/vt6655/wpactl.c @@ -341,22 +341,22 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, bool fcpfkernel) // If is_broadcast_ether_addr, set the key as every key entry's group key. DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Groupe Key Assign.\n"); - if ((KeybSetAllGroupKey(&(pDevice->sKey), + if (KeybSetAllGroupKey(&(pDevice->sKey), dwKeyIndex, param->u.wpa_key.key_len, (PQWORD) &(KeyRSC), (unsigned char *)abyKey, byKeyDecMode, pDevice->PortOffset, - pDevice->byLocalID) == true) && - (KeybSetDefaultKey(&(pDevice->sKey), + pDevice->byLocalID) && + KeybSetDefaultKey(&(pDevice->sKey), dwKeyIndex, param->u.wpa_key.key_len, (PQWORD) &(KeyRSC), (unsigned char *)abyKey, byKeyDecMode, pDevice->PortOffset, - pDevice->byLocalID) == true)) { + pDevice->byLocalID)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "GROUP Key Assign.\n"); } else { @@ -389,7 +389,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, bool fcpfkernel) (unsigned char *)abyKey, byKeyDecMode, pDevice->PortOffset, - pDevice->byLocalID) == true) { + pDevice->byLocalID)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key Set\n"); } else { @@ -804,7 +804,7 @@ static int wpa_set_associate(PSDevice pDevice, else pDevice->bEncryptionEnable = false; if (!((pMgmt->eAuthenMode == WMAC_AUTH_SHAREKEY) || - ((pMgmt->eAuthenMode == WMAC_AUTH_OPEN) && (bWepEnabled == true)))) //DavidWang //20080717-06, by chester//Not to initial WEP + ((pMgmt->eAuthenMode == WMAC_AUTH_OPEN) && bWepEnabled))) //DavidWang //20080717-06, by chester//Not to initial WEP KeyvInitTable(&pDevice->sKey, pDevice->PortOffset); spin_lock_irq(&pDevice->lock); pDevice->bLinkPass = false; From 0fd682f644d5773c0107838f5316db3361332a19 Mon Sep 17 00:00:00 2001 From: Teodora Baluta Date: Sun, 10 Nov 2013 17:12:43 +0200 Subject: [PATCH 054/238] staging: vt6655: fix assignment of bool to 0 This patch fixes the following warnings detected using coccinelle for drivers/staging/wmgr.c file: drivers/staging/vt6655/wmgr.c:2335:1-22: WARNING: Assignment of bool to 0/1 drivers/staging/vt6655/wmgr.c:2338:1-27: WARNING: Assignment of bool to 0/1 Signed-off-by: Teodora Baluta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/wmgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/vt6655/wmgr.c b/drivers/staging/vt6655/wmgr.c index 40bb9004a921..a1eff7e514a9 100644 --- a/drivers/staging/vt6655/wmgr.c +++ b/drivers/staging/vt6655/wmgr.c @@ -2332,10 +2332,10 @@ vMgrCreateOwnIBSS( } // Disable Protect Mode - pDevice->bProtectMode = 0; + pDevice->bProtectMode = false; MACvDisableProtectMD(pDevice->PortOffset); - pDevice->bBarkerPreambleMd = 0; + pDevice->bBarkerPreambleMd = false; MACvDisableBarkerPreambleMd(pDevice->PortOffset); // Kyle Test 2003.11.04 From 649520bbc51a06955b8563906b17e957e972926d Mon Sep 17 00:00:00 2001 From: Teodora Baluta Date: Sun, 10 Nov 2013 17:12:44 +0200 Subject: [PATCH 055/238] staging: vt6655: fix comparison of bool to 0/1 This patch corrects comparison of bool to 0/1 for file drivers/staging/vt6655/rxtx.c. The following type of coccinelle detected warnings are silenced: WARNING: Comparison of bool to 0/1 Signed-off-by: Teodora Baluta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/rxtx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index 3a2661e2b27c..182c53ee66da 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -435,7 +435,7 @@ s_uGetDataDuration( switch (byDurType) { case DATADUR_B: //DATADUR_B - if (((uMACfragNum == 1)) || (bLastFrag == 1)) {//Non Frag or Last Frag + if (((uMACfragNum == 1)) || bLastFrag) {//Non Frag or Last Frag if (bNeedAck) { uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate); return pDevice->uSIFS + uAckTime; @@ -458,7 +458,7 @@ s_uGetDataDuration( break; case DATADUR_A: //DATADUR_A - if (((uMACfragNum == 1)) || (bLastFrag == 1)) {//Non Frag or Last Frag + if (((uMACfragNum == 1)) || bLastFrag) {//Non Frag or Last Frag if (bNeedAck) { uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); return pDevice->uSIFS + uAckTime; @@ -481,7 +481,7 @@ s_uGetDataDuration( break; case DATADUR_A_F0: //DATADUR_A_F0 - if (((uMACfragNum == 1)) || (bLastFrag == 1)) {//Non Frag or Last Frag + if (((uMACfragNum == 1)) || bLastFrag) {//Non Frag or Last Frag if (bNeedAck) { uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); return pDevice->uSIFS + uAckTime; @@ -523,7 +523,7 @@ s_uGetDataDuration( break; case DATADUR_A_F1: //DATADUR_A_F1 - if (((uMACfragNum == 1)) || (bLastFrag == 1)) {//Non Frag or Last Frag + if (((uMACfragNum == 1)) || bLastFrag) {//Non Frag or Last Frag if (bNeedAck) { uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); return pDevice->uSIFS + uAckTime; From 88cc85075d1e53731e90fec8670cd9ccafcbe9aa Mon Sep 17 00:00:00 2001 From: Teodora Baluta Date: Sun, 10 Nov 2013 17:12:45 +0200 Subject: [PATCH 056/238] staging: vt6655: remove unneeded semicolon This patch deletes any unneeded semicolons in driver vt6655 as detected by coccinelle. Signed-off-by: Teodora Baluta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/bssdb.c | 2 +- drivers/staging/vt6655/card.c | 2 +- drivers/staging/vt6655/dpc.c | 6 +++--- drivers/staging/vt6655/iwctl.c | 2 +- drivers/staging/vt6655/power.c | 2 +- drivers/staging/vt6655/rxtx.c | 4 ++-- drivers/staging/vt6655/wmgr.c | 12 ++++++------ 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/vt6655/bssdb.c b/drivers/staging/vt6655/bssdb.c index 3b39cb214418..5995dc203c79 100644 --- a/drivers/staging/vt6655/bssdb.c +++ b/drivers/staging/vt6655/bssdb.c @@ -1221,7 +1221,7 @@ start: bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, NULL); bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, NULL); pDevice->uAutoReConnectTime = 0; - }; + } } if (pMgmt->eCurrState == WMAC_STATE_JOINTED) { if (pDevice->bUpdateBBVGA) diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c index e95ecca549f7..db38ca051130 100644 --- a/drivers/staging/vt6655/card.c +++ b/drivers/staging/vt6655/card.c @@ -2013,7 +2013,7 @@ QWORD CARDqGetTSFOffset(unsigned char byRxRate, QWORD qwTSF1, QWORD qwTSF2) HIDWORD(qwTSFOffset) = HIDWORD(qwTSF1) - HIDWORD(qwTSF2) - 1; } else { HIDWORD(qwTSFOffset) = HIDWORD(qwTSF1) - HIDWORD(qwTSF2); - }; + } return qwTSFOffset; } diff --git a/drivers/staging/vt6655/dpc.c b/drivers/staging/vt6655/dpc.c index c60f3e6dc6f8..0a29c9015419 100644 --- a/drivers/staging/vt6655/dpc.c +++ b/drivers/staging/vt6655/dpc.c @@ -169,7 +169,7 @@ s_vProcessRxMACHeader(PSDevice pDevice, unsigned char *pbyRxBufferAddr, } } else { cbHeaderSize += WLAN_HDR_ADDR3_LEN; - }; + } pbyRxBuffer = (unsigned char *)(pbyRxBufferAddr + cbHeaderSize); if (ether_addr_equal(pbyRxBuffer, pDevice->abySNAP_Bridgetunnel)) { @@ -263,7 +263,7 @@ s_vGetDASA(unsigned char *pbyRxBufferAddr, unsigned int *pcbHeaderSize, psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr2[ii]; } } - }; + } *pcbHeaderSize = cbHeaderSize; } @@ -592,7 +592,7 @@ device_receive_frame( } } else { // Control Frame - }; + } return false; } else { if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c index 4bff8aa96be7..2db4bc88e45e 100644 --- a/drivers/staging/vt6655/iwctl.c +++ b/drivers/staging/vt6655/iwctl.c @@ -1632,7 +1632,7 @@ int iwctl_giwsens(struct net_device *dev, wrq->value = ldBm; } else { wrq->value = 0; - }; + } wrq->disabled = (wrq->value == 0); wrq->fixed = 1; diff --git a/drivers/staging/vt6655/power.c b/drivers/staging/vt6655/power.c index 3da2838006e3..4bd1ccb79515 100644 --- a/drivers/staging/vt6655/power.c +++ b/drivers/staging/vt6655/power.c @@ -260,7 +260,7 @@ PSvSendPSPOLL( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send PS-Poll packet failed..\n"); } else { // DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send PS-Poll packet success..\n"); - }; + } return; } diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index 182c53ee66da..6affd6edac0d 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -2212,7 +2212,7 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) { else { bNeedACK = true; pTxBufHead->wFIFOCtl |= FIFOCTL_NEEDACK; - }; + } if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) || (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)) { @@ -2686,7 +2686,7 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, un } bNeedACK = true; pTxBufHead->wFIFOCtl |= FIFOCTL_NEEDACK; - }; + } if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) || (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)) { diff --git a/drivers/staging/vt6655/wmgr.c b/drivers/staging/vt6655/wmgr.c index a1eff7e514a9..5200a2a0ecca 100644 --- a/drivers/staging/vt6655/wmgr.c +++ b/drivers/staging/vt6655/wmgr.c @@ -1719,7 +1719,7 @@ s_vMgrRxDeauthentication( } /* else, ignore it. TODO: IBSS authentication service would be implemented here */ - }; + } return; } @@ -2092,10 +2092,10 @@ s_vMgrRxBeacon( pMgmt->bInTIM = sFrame.pTIM->byVirtBitMap[uLocateByteIndex] & byTIMBitOn ? true : false; } else { pMgmt->bInTIM = false; - }; + } } else { pMgmt->bInTIM = false; - }; + } if (pMgmt->bInTIM || (pMgmt->bMulticastTIM && (pMgmt->byDTIMCount == 0))) { @@ -2671,7 +2671,7 @@ vMgrJoinBSSBegin( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "End of Join AP -- A/B/G Action\n"); } else { pMgmt->eCurrState = WMAC_STATE_IDLE; - }; + } } else { // ad-hoc mode BSS @@ -2740,8 +2740,8 @@ vMgrJoinBSSBegin( bMgrPrepareBeaconToSend((void *)pDevice, pMgmt); } else { pMgmt->eCurrState = WMAC_STATE_IDLE; - }; - }; + } + } return; } From 05323e78161b4396c31e7ed8d84670461805fb97 Mon Sep 17 00:00:00 2001 From: Archana kumari Date: Fri, 1 Nov 2013 14:05:44 +0530 Subject: [PATCH 057/238] staging: media: lirc: fixed sparse warnings by adding __user annotations in lirc_serial.c This patch fixes sparse warning by adding __user annotations in lirc_serial.c Signed-off-by: Archana kumari Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/lirc/lirc_serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/lirc/lirc_serial.c b/drivers/staging/media/lirc/lirc_serial.c index af08e677b60f..23043bd70e7e 100644 --- a/drivers/staging/media/lirc/lirc_serial.c +++ b/drivers/staging/media/lirc/lirc_serial.c @@ -961,7 +961,7 @@ static void set_use_dec(void *data) spin_unlock_irqrestore(&hardware[type].lock, flags); } -static ssize_t lirc_write(struct file *file, const char *buf, +static ssize_t lirc_write(struct file *file, const char __user *buf, size_t n, loff_t *ppos) { int i, count; From 278660a44648e02c3a75b6161acd31fa120067fc Mon Sep 17 00:00:00 2001 From: Valentina Manea Date: Fri, 1 Nov 2013 15:03:08 +0200 Subject: [PATCH 058/238] staging: crystalhd: return true and false instead of 1 and 0 This fixes coccinelle error regarding functions that return bool and return 1 and 0 instead of true and false. Signed-off-by: Valentina Manea Reviewed-by: Lisa Nguyen Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/crystalhd/crystalhd_cmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/crystalhd/crystalhd_cmds.c b/drivers/staging/crystalhd/crystalhd_cmds.c index 07a2f24d0d47..3972b52e1416 100644 --- a/drivers/staging/crystalhd/crystalhd_cmds.c +++ b/drivers/staging/crystalhd/crystalhd_cmds.c @@ -1059,7 +1059,7 @@ bool crystalhd_cmd_interrupt(struct crystalhd_cmd *ctx) { if (!ctx) { BCMLOG_ERR("Invalid arg..\n"); - return 0; + return false; } return crystalhd_hw_interrupt(ctx->adp, &ctx->hw_ctx); From 585dc70d0e7b311bca74050dfca64715b1d26e4c Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Fri, 1 Nov 2013 19:19:57 +0530 Subject: [PATCH 059/238] Staging: keucr: Fix externs are avoided in smilmain.c This patch fixes the following checkpatch.pl warning in smilmain.c- WARNING: externs should be avoided in .c files Signed-off-by: Rashika Kheria Signed-off-by: Greg Kroah-Hartman --- drivers/staging/keucr/smilmain.c | 80 ++++++++++++-------------------- 1 file changed, 30 insertions(+), 50 deletions(-) diff --git a/drivers/staging/keucr/smilmain.c b/drivers/staging/keucr/smilmain.c index 2786808fde9f..ed15c3531eb9 100644 --- a/drivers/staging/keucr/smilmain.c +++ b/drivers/staging/keucr/smilmain.c @@ -4,46 +4,26 @@ #include "smcommon.h" #include "smil.h" -int Check_D_LogCHS(WORD *, BYTE *, BYTE *); -void Initialize_D_Media(void); -void PowerOff_D_Media(void); -int Check_D_MediaPower(void); -int Check_D_MediaExist(void); -int Check_D_MediaWP(void); -int Check_D_MediaFmt(struct us_data *); -int Check_D_MediaFmtForEraseAll(struct us_data *); -int Conv_D_MediaAddr(struct us_data *, DWORD); -int Inc_D_MediaAddr(struct us_data *); -int Check_D_FirstSect(void); -int Check_D_LastSect(void); -int Media_D_ReadOneSect(struct us_data *, WORD, BYTE *); -int Media_D_WriteOneSect(struct us_data *, WORD, BYTE *); -int Media_D_CopyBlockHead(struct us_data *); -int Media_D_CopyBlockTail(struct us_data *); -int Media_D_EraseOneBlock(void); -int Media_D_EraseAllBlock(void); +static int Conv_D_MediaAddr(struct us_data *, DWORD); +static int Inc_D_MediaAddr(struct us_data *); +static int Media_D_ReadOneSect(struct us_data *, WORD, BYTE *); -int Copy_D_BlockAll(struct us_data *, DWORD); -int Copy_D_BlockHead(struct us_data *); -int Copy_D_BlockTail(struct us_data *); -int Reassign_D_BlockHead(struct us_data *); +static int Copy_D_BlockAll(struct us_data *, DWORD); -int Assign_D_WriteBlock(void); -int Release_D_ReadBlock(struct us_data *); -int Release_D_WriteBlock(struct us_data *); -int Release_D_CopySector(struct us_data *); +static int Assign_D_WriteBlock(void); +static int Release_D_ReadBlock(struct us_data *); +static int Release_D_WriteBlock(struct us_data *); +static int Release_D_CopySector(struct us_data *); -int Copy_D_PhyOneSect(struct us_data *); -int Read_D_PhyOneSect(struct us_data *, WORD, BYTE *); -int Write_D_PhyOneSect(struct us_data *, WORD, BYTE *); -int Erase_D_PhyOneBlock(struct us_data *); +static int Copy_D_PhyOneSect(struct us_data *); +static int Read_D_PhyOneSect(struct us_data *, WORD, BYTE *); +static int Erase_D_PhyOneBlock(struct us_data *); -int Set_D_PhyFmtValue(struct us_data *); -int Search_D_CIS(struct us_data *); -int Make_D_LogTable(struct us_data *); -void Check_D_BlockIsFull(void); +static int Set_D_PhyFmtValue(struct us_data *); +static int Search_D_CIS(struct us_data *); +static int Make_D_LogTable(struct us_data *); -int MarkFail_D_PhyOneBlock(struct us_data *); +static int MarkFail_D_PhyOneBlock(struct us_data *); DWORD ErrXDCode; DWORD ErrCode; @@ -167,7 +147,7 @@ int Media_D_CopySector(struct us_data *us, DWORD start, WORD count, BYTE *buf) } /* ----- Release_D_CopySector() ------------------------------------------ */ -int Release_D_CopySector(struct us_data *us) +static int Release_D_CopySector(struct us_data *us) { Log2Phy[Media.Zone][Media.LogBlock] = WriteBlock; Media.PhyBlock = ReadBlock; @@ -211,7 +191,7 @@ int Check_D_MediaFmt(struct us_data *us) /* SmartMedia Physical Address Control Subroutine */ /* ----- Conv_D_MediaAddr() --------------------------------------------- */ -int Conv_D_MediaAddr(struct us_data *us, DWORD addr) +static int Conv_D_MediaAddr(struct us_data *us, DWORD addr) { DWORD temp; @@ -240,7 +220,7 @@ int Conv_D_MediaAddr(struct us_data *us, DWORD addr) } /* ----- Inc_D_MediaAddr() ---------------------------------------------- */ -int Inc_D_MediaAddr(struct us_data *us) +static int Inc_D_MediaAddr(struct us_data *us) { WORD LogBlock = Media.LogBlock; @@ -290,7 +270,7 @@ int Inc_D_MediaAddr(struct us_data *us) /* SmartMedia Read/Write Subroutine with Retry */ /* ----- Media_D_ReadOneSect() ------------------------------------------ */ -int Media_D_ReadOneSect(struct us_data *us, WORD count, BYTE *buf) +static int Media_D_ReadOneSect(struct us_data *us, WORD count, BYTE *buf) { DWORD err, retry; @@ -334,7 +314,7 @@ int Media_D_ReadOneSect(struct us_data *us, WORD count, BYTE *buf) /* SmartMedia Physical Sector Data Copy Subroutine */ /* ----- Copy_D_BlockAll() ---------------------------------------------- */ -int Copy_D_BlockAll(struct us_data *us, DWORD mode) +static int Copy_D_BlockAll(struct us_data *us, DWORD mode) { BYTE sect; @@ -371,7 +351,7 @@ int Copy_D_BlockAll(struct us_data *us, DWORD mode) /* SmartMedia Physical Block Assign/Release Subroutine */ /* ----- Assign_D_WriteBlock() ------------------------------------------ */ -int Assign_D_WriteBlock(void) +static int Assign_D_WriteBlock(void) { ReadBlock = Media.PhyBlock; @@ -404,7 +384,7 @@ int Assign_D_WriteBlock(void) } /* ----- Release_D_ReadBlock() ------------------------------------------ */ -int Release_D_ReadBlock(struct us_data *us) +static int Release_D_ReadBlock(struct us_data *us) { DWORD mode; @@ -438,7 +418,7 @@ int Release_D_ReadBlock(struct us_data *us) } /* ----- Release_D_WriteBlock() ----------------------------------------- */ -int Release_D_WriteBlock(struct us_data *us) +static int Release_D_WriteBlock(struct us_data *us) { SectCopyMode = COMPLETED; Media.PhyBlock = WriteBlock; @@ -452,7 +432,7 @@ int Release_D_WriteBlock(struct us_data *us) /* SmartMedia Physical Sector Data Copy Subroutine */ /* ----- Copy_D_PhyOneSect() -------------------------------------------- */ -int Copy_D_PhyOneSect(struct us_data *us) +static int Copy_D_PhyOneSect(struct us_data *us) { int i; DWORD err, retry; @@ -529,7 +509,7 @@ int Copy_D_PhyOneSect(struct us_data *us) /* SmartMedia Physical Sector Read/Write/Erase Subroutine */ /* ----- Read_D_PhyOneSect() -------------------------------------------- */ -int Read_D_PhyOneSect(struct us_data *us, WORD count, BYTE *buf) +static int Read_D_PhyOneSect(struct us_data *us, WORD count, BYTE *buf) { int i; DWORD retry; @@ -580,7 +560,7 @@ int Read_D_PhyOneSect(struct us_data *us, WORD count, BYTE *buf) } /* ----- Erase_D_PhyOneBlock() ------------------------------------------ */ -int Erase_D_PhyOneBlock(struct us_data *us) +static int Erase_D_PhyOneBlock(struct us_data *us) { if (Ssfdc_D_EraseBlock(us)) { ErrCode = ERR_HwError; @@ -597,7 +577,7 @@ int Erase_D_PhyOneBlock(struct us_data *us) /* SmartMedia Physical Format Check Local Subroutine */ /* ----- Set_D_PhyFmtValue() -------------------------------------------- */ -int Set_D_PhyFmtValue(struct us_data *us) +static int Set_D_PhyFmtValue(struct us_data *us) { if (Set_D_SsfdcModel(us->SM_DeviceID)) return ERROR; @@ -606,7 +586,7 @@ int Set_D_PhyFmtValue(struct us_data *us) } /* ----- Search_D_CIS() ------------------------------------------------- */ -int Search_D_CIS(struct us_data *us) +static int Search_D_CIS(struct us_data *us) { Media.Zone = 0; Media.Sector = 0; @@ -660,7 +640,7 @@ int Search_D_CIS(struct us_data *us) } /* ----- Make_D_LogTable() ---------------------------------------------- */ -int Make_D_LogTable(struct us_data *us) +static int Make_D_LogTable(struct us_data *us) { WORD phyblock, logblock; @@ -761,7 +741,7 @@ int Make_D_LogTable(struct us_data *us) } /* ----- MarkFail_D_PhyOneBlock() --------------------------------------- */ -int MarkFail_D_PhyOneBlock(struct us_data *us) +static int MarkFail_D_PhyOneBlock(struct us_data *us) { BYTE sect; From 23657199840c18d605490d2d63aec2fdcf51eddc Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Fri, 1 Nov 2013 19:21:27 +0530 Subject: [PATCH 060/238] Staging: keucr: Fix externs are avoided in smilsub.c This patch fixes the following checkpatch.pl warning in smilsub.c- WARNING: externs should be avoided in .c files Signed-off-by: Rashika Kheria Signed-off-by: Greg Kroah-Hartman --- drivers/staging/keucr/smilsub.c | 34 +-------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/drivers/staging/keucr/smilsub.c b/drivers/staging/keucr/smilsub.c index 346c5702f411..ea3c747b3a28 100644 --- a/drivers/staging/keucr/smilsub.c +++ b/drivers/staging/keucr/smilsub.c @@ -6,45 +6,13 @@ #include "smcommon.h" #include "smil.h" -void _Set_D_SsfdcRdCmd(BYTE); -void _Set_D_SsfdcRdAddr(BYTE); -void _Set_D_SsfdcRdChip(void); -void _Set_D_SsfdcRdStandby(void); -void _Start_D_SsfdcRdHwECC(void); -void _Stop_D_SsfdcRdHwECC(void); -void _Load_D_SsfdcRdHwECC(BYTE); -void _Set_D_SsfdcWrCmd(BYTE); -void _Set_D_SsfdcWrAddr(BYTE); -void _Set_D_SsfdcWrBlock(void); -void _Set_D_SsfdcWrStandby(void); -void _Start_D_SsfdcWrHwECC(void); -void _Load_D_SsfdcWrHwECC(BYTE); -int _Check_D_SsfdcBusy(WORD); -int _Check_D_SsfdcStatus(void); -void _Reset_D_SsfdcErr(void); -void _Read_D_SsfdcBuf(BYTE *); -void _Write_D_SsfdcBuf(BYTE *); -void _Read_D_SsfdcByte(BYTE *); -void _ReadRedt_D_SsfdcBuf(BYTE *); -void _WriteRedt_D_SsfdcBuf(BYTE *); -BYTE _Check_D_DevCode(BYTE); - -void _Set_D_ECCdata(BYTE, BYTE *); -void _Calc_D_ECCdata(BYTE *); - +static BYTE _Check_D_DevCode(BYTE); struct keucr_media_info Ssfdc; struct keucr_media_address Media; struct keucr_media_area CisArea; static BYTE EccBuf[6]; -extern PBYTE SMHostAddr; -extern DWORD ErrXDCode; - -extern WORD ReadBlock; -extern WORD WriteBlock; - - #define EVEN 0 /* Even Page for 256byte/page */ #define ODD 1 /* Odd Page for 256byte/page */ From afbab210f6474139f48445a9d9c7082f54da837b Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Fri, 1 Nov 2013 19:24:17 +0530 Subject: [PATCH 061/238] Staging: keucr: Fix externs are avoided in smscsi.c This patch fixes the following checkpatch.pl warning in smscsi.c- WARNING: externs should be avoided in .c files Signed-off-by: Rashika Kheria Signed-off-by: Greg Kroah-Hartman --- drivers/staging/keucr/smscsi.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/drivers/staging/keucr/smscsi.c b/drivers/staging/keucr/smscsi.c index 572d6489b66b..5c03eca4dba8 100644 --- a/drivers/staging/keucr/smscsi.c +++ b/drivers/staging/keucr/smscsi.c @@ -11,16 +11,12 @@ #include "transport.h" #include "smil.h" -int SM_SCSI_Test_Unit_Ready(struct us_data *us, struct scsi_cmnd *srb); -int SM_SCSI_Inquiry(struct us_data *us, struct scsi_cmnd *srb); -int SM_SCSI_Mode_Sense(struct us_data *us, struct scsi_cmnd *srb); -int SM_SCSI_Start_Stop(struct us_data *us, struct scsi_cmnd *srb); -int SM_SCSI_Read_Capacity(struct us_data *us, struct scsi_cmnd *srb); -int SM_SCSI_Read(struct us_data *us, struct scsi_cmnd *srb); -int SM_SCSI_Write(struct us_data *us, struct scsi_cmnd *srb); - -extern PBYTE SMHostAddr; -extern DWORD ErrXDCode; +static int SM_SCSI_Test_Unit_Ready(struct us_data *us, struct scsi_cmnd *srb); +static int SM_SCSI_Inquiry(struct us_data *us, struct scsi_cmnd *srb); +static int SM_SCSI_Mode_Sense(struct us_data *us, struct scsi_cmnd *srb); +static int SM_SCSI_Read_Capacity(struct us_data *us, struct scsi_cmnd *srb); +static int SM_SCSI_Read(struct us_data *us, struct scsi_cmnd *srb); +static int SM_SCSI_Write(struct us_data *us, struct scsi_cmnd *srb); /* ----- SM_SCSIIrp() -------------------------------------------------- */ int SM_SCSIIrp(struct us_data *us, struct scsi_cmnd *srb) @@ -57,7 +53,7 @@ int SM_SCSIIrp(struct us_data *us, struct scsi_cmnd *srb) } /* ----- SM_SCSI_Test_Unit_Ready() ------------------------------------- */ -int SM_SCSI_Test_Unit_Ready(struct us_data *us, struct scsi_cmnd *srb) +static int SM_SCSI_Test_Unit_Ready(struct us_data *us, struct scsi_cmnd *srb) { if (us->SM_Status.Insert && us->SM_Status.Ready) return USB_STOR_TRANSPORT_GOOD; @@ -70,7 +66,7 @@ int SM_SCSI_Test_Unit_Ready(struct us_data *us, struct scsi_cmnd *srb) } /* ----- SM_SCSI_Inquiry() --------------------------------------------- */ -int SM_SCSI_Inquiry(struct us_data *us, struct scsi_cmnd *srb) +static int SM_SCSI_Inquiry(struct us_data *us, struct scsi_cmnd *srb) { BYTE data_ptr[36] = {0x00, 0x80, 0x02, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x55, 0x53, 0x42, 0x32, 0x2E, 0x30, 0x20, @@ -84,7 +80,7 @@ int SM_SCSI_Inquiry(struct us_data *us, struct scsi_cmnd *srb) /* ----- SM_SCSI_Mode_Sense() ------------------------------------------ */ -int SM_SCSI_Mode_Sense(struct us_data *us, struct scsi_cmnd *srb) +static int SM_SCSI_Mode_Sense(struct us_data *us, struct scsi_cmnd *srb) { BYTE mediaNoWP[12] = {0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x71, 0xc0, 0x00, 0x00, 0x02, 0x00}; @@ -101,7 +97,7 @@ int SM_SCSI_Mode_Sense(struct us_data *us, struct scsi_cmnd *srb) } /* ----- SM_SCSI_Read_Capacity() --------------------------------------- */ -int SM_SCSI_Read_Capacity(struct us_data *us, struct scsi_cmnd *srb) +static int SM_SCSI_Read_Capacity(struct us_data *us, struct scsi_cmnd *srb) { unsigned int offset = 0; struct scatterlist *sg = NULL; @@ -133,7 +129,7 @@ int SM_SCSI_Read_Capacity(struct us_data *us, struct scsi_cmnd *srb) } /* ----- SM_SCSI_Read() -------------------------------------------------- */ -int SM_SCSI_Read(struct us_data *us, struct scsi_cmnd *srb) +static int SM_SCSI_Read(struct us_data *us, struct scsi_cmnd *srb) { int result = 0; PBYTE Cdb = srb->cmnd; @@ -165,7 +161,7 @@ int SM_SCSI_Read(struct us_data *us, struct scsi_cmnd *srb) } /* ----- SM_SCSI_Write() -------------------------------------------------- */ -int SM_SCSI_Write(struct us_data *us, struct scsi_cmnd *srb) +static int SM_SCSI_Write(struct us_data *us, struct scsi_cmnd *srb) { int result = 0; PBYTE Cdb = srb->cmnd; From ab46b7920cb1eabf2991f9f829094e53663650a0 Mon Sep 17 00:00:00 2001 From: Nandini Hanumanthagowda Date: Fri, 1 Nov 2013 22:03:55 +0530 Subject: [PATCH 062/238] staging: bcm: removed prohibited space before semicolon removed prohibited space before semicolon(;) to fix checkpatch warning Signed-off-by: Nandini Hanumanthagowda Reviewed-by: Josh Triplett Reviewed-by: Lisa Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/bcm/Bcmchar.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index 8c811439faba..ed45b2161d49 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -1190,7 +1190,7 @@ cntrlEnd: break; case IOCTL_BCM_CAL_INIT: { - UINT uiSectorSize = 0 ; + UINT uiSectorSize = 0; if (Adapter->eNVMType == NVM_FLASH) { if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer))) return -EFAULT; @@ -1403,7 +1403,7 @@ cntrlEnd: case IOCTL_BCM_FLASH2X_SECTION_READ: { struct bcm_flash2x_readwrite sFlash2xRead = {0}; - PUCHAR pReadBuff = NULL ; + PUCHAR pReadBuff = NULL; UINT NOB = 0; UINT BuffSize = 0; UINT ReadBytes = 0; @@ -1438,7 +1438,7 @@ cntrlEnd: else BuffSize = NOB; - ReadOffset = sFlash2xRead.offset ; + ReadOffset = sFlash2xRead.offset; OutPutBuff = IoBuffer.OutputBuffer; pReadBuff = (PCHAR)kzalloc(BuffSize , GFP_KERNEL); @@ -1483,7 +1483,7 @@ cntrlEnd: NOB = NOB - ReadBytes; if (NOB) { ReadOffset = ReadOffset + ReadBytes; - OutPutBuff = OutPutBuff + ReadBytes ; + OutPutBuff = OutPutBuff + ReadBytes; } } @@ -1538,7 +1538,7 @@ cntrlEnd: if (NOB > Adapter->uiSectorSize) BuffSize = Adapter->uiSectorSize; else - BuffSize = NOB ; + BuffSize = NOB; pWriteBuff = kmalloc(BuffSize, GFP_KERNEL); @@ -1841,10 +1841,10 @@ cntrlEnd: case IOCTL_BCM_NVM_RAW_READ: { struct bcm_nvm_readwrite stNVMRead; - INT NOB ; - INT BuffSize ; + INT NOB; + INT BuffSize; INT ReadOffset = 0; - UINT ReadBytes = 0 ; + UINT ReadBytes = 0; PUCHAR pReadBuff; void __user *OutPutBuff; From 8105705375676c11d3b7c5a4301016a1dcabb7a1 Mon Sep 17 00:00:00 2001 From: Nandini Hanumanthagowda Date: Sat, 2 Nov 2013 00:19:31 +0530 Subject: [PATCH 063/238] staging: bcm: fixed space related errors around operators removed any prohibited spaces and added required spaces around operators to follow linux coding style and hence fixed the checkpatch errors Signed-off-by: Nandini Hanumanthagowda Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/bcm/DDRInit.c | 1501 ++++++++++++++++----------------- 1 file changed, 749 insertions(+), 752 deletions(-) diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c index 9f7e30f637ea..6bddf723e06a 100644 --- a/drivers/staging/bcm/DDRInit.c +++ b/drivers/staging/bcm/DDRInit.c @@ -7,527 +7,527 @@ //DDR INIT-133Mhz #define T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 12 //index for 0x0F007000 -static struct bcm_ddr_setting asT3_DDRSetting133MHz[]= {// # DPLL Clock Setting - {0x0F000800,0x00007212}, - {0x0f000820,0x07F13FFF}, - {0x0f000810,0x00000F95}, - {0x0f000860,0x00000000}, - {0x0f000880,0x000003DD}, +static struct bcm_ddr_setting asT3_DDRSetting133MHz[] = {// # DPLL Clock Setting + {0x0F000800, 0x00007212}, + {0x0f000820, 0x07F13FFF}, + {0x0f000810, 0x00000F95}, + {0x0f000860, 0x00000000}, + {0x0f000880, 0x000003DD}, // Changed source for X-bar and MIPS clock to APLL - {0x0f000840,0x0FFF1B00}, - {0x0f000870,0x00000002}, - {0x0F00a044,0x1fffffff}, - {0x0F00a040,0x1f000000}, - {0x0F00a084,0x1Cffffff}, - {0x0F00a080,0x1C000000}, - {0x0F00a04C,0x0000000C}, + {0x0f000840, 0x0FFF1B00}, + {0x0f000870, 0x00000002}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0F00a084, 0x1Cffffff}, + {0x0F00a080, 0x1C000000}, + {0x0F00a04C, 0x0000000C}, //Memcontroller Default values - {0x0F007000,0x00010001}, - {0x0F007004,0x01010100}, - {0x0F007008,0x01000001}, - {0x0F00700c,0x00000000}, - {0x0F007010,0x01000000}, - {0x0F007014,0x01000100}, - {0x0F007018,0x01000000}, - {0x0F00701c,0x01020001},// POP - 0x00020001 Normal 0x01020001 - {0x0F007020,0x04030107}, //Normal - 0x04030107 POP - 0x05030107 - {0x0F007024,0x02000007}, - {0x0F007028,0x02020202}, - {0x0F00702c,0x0206060a},//ROB- 0x0205050a,//0x0206060a - {0x0F007030,0x05000000}, - {0x0F007034,0x00000003}, - {0x0F007038,0x110a0200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200 - {0x0F00703C,0x02101010},//ROB - 0x02101010,//0x02101018}, - {0x0F007040,0x45751200},//ROB - 0x45751200,//0x450f1200}, - {0x0F007044,0x110a0d00},//ROB - 0x110a0d00//0x111f0d00 - {0x0F007048,0x081b0306}, - {0x0F00704c,0x00000000}, - {0x0F007050,0x0000001c}, - {0x0F007054,0x00000000}, - {0x0F007058,0x00000000}, - {0x0F00705c,0x00000000}, - {0x0F007060,0x0010246c}, - {0x0F007064,0x00000010}, - {0x0F007068,0x00000000}, - {0x0F00706c,0x00000001}, - {0x0F007070,0x00007000}, - {0x0F007074,0x00000000}, - {0x0F007078,0x00000000}, - {0x0F00707C,0x00000000}, - {0x0F007080,0x00000000}, - {0x0F007084,0x00000000}, + {0x0F007000, 0x00010001}, + {0x0F007004, 0x01010100}, + {0x0F007008, 0x01000001}, + {0x0F00700c, 0x00000000}, + {0x0F007010, 0x01000000}, + {0x0F007014, 0x01000100}, + {0x0F007018, 0x01000000}, + {0x0F00701c, 0x01020001},// POP - 0x00020001 Normal 0x01020001 + {0x0F007020, 0x04030107}, //Normal - 0x04030107 POP - 0x05030107 + {0x0F007024, 0x02000007}, + {0x0F007028, 0x02020202}, + {0x0F00702c, 0x0206060a},//ROB- 0x0205050a,//0x0206060a + {0x0F007030, 0x05000000}, + {0x0F007034, 0x00000003}, + {0x0F007038, 0x110a0200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200 + {0x0F00703C, 0x02101010},//ROB - 0x02101010,//0x02101018}, + {0x0F007040, 0x45751200},//ROB - 0x45751200,//0x450f1200}, + {0x0F007044, 0x110a0d00},//ROB - 0x110a0d00//0x111f0d00 + {0x0F007048, 0x081b0306}, + {0x0F00704c, 0x00000000}, + {0x0F007050, 0x0000001c}, + {0x0F007054, 0x00000000}, + {0x0F007058, 0x00000000}, + {0x0F00705c, 0x00000000}, + {0x0F007060, 0x0010246c}, + {0x0F007064, 0x00000010}, + {0x0F007068, 0x00000000}, + {0x0F00706c, 0x00000001}, + {0x0F007070, 0x00007000}, + {0x0F007074, 0x00000000}, + {0x0F007078, 0x00000000}, + {0x0F00707C, 0x00000000}, + {0x0F007080, 0x00000000}, + {0x0F007084, 0x00000000}, //# Enable BW improvement within memory controller - {0x0F007094,0x00000104}, + {0x0F007094, 0x00000104}, //# Enable 2 ports within X-bar - {0x0F00A000,0x00000016}, + {0x0F00A000, 0x00000016}, //# Enable start bit within memory controller - {0x0F007018,0x01010000} + {0x0F007018, 0x01010000} }; //80Mhz #define T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 10 //index for 0x0F007000 -static struct bcm_ddr_setting asT3_DDRSetting80MHz[]= {// # DPLL Clock Setting - {0x0f000810,0x00000F95}, - {0x0f000820,0x07f1ffff}, - {0x0f000860,0x00000000}, - {0x0f000880,0x000003DD}, - {0x0F00a044,0x1fffffff}, - {0x0F00a040,0x1f000000}, - {0x0F00a084,0x1Cffffff}, - {0x0F00a080,0x1C000000}, - {0x0F00a000,0x00000016}, - {0x0F00a04C,0x0000000C}, +static struct bcm_ddr_setting asT3_DDRSetting80MHz[] = {// # DPLL Clock Setting + {0x0f000810, 0x00000F95}, + {0x0f000820, 0x07f1ffff}, + {0x0f000860, 0x00000000}, + {0x0f000880, 0x000003DD}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0F00a084, 0x1Cffffff}, + {0x0F00a080, 0x1C000000}, + {0x0F00a000, 0x00000016}, + {0x0F00a04C, 0x0000000C}, //Memcontroller Default values - {0x0F007000,0x00010001}, - {0x0F007004,0x01000000}, - {0x0F007008,0x01000001}, - {0x0F00700c,0x00000000}, - {0x0F007010,0x01000000}, - {0x0F007014,0x01000100}, - {0x0F007018,0x01000000}, - {0x0F00701c,0x01020000}, - {0x0F007020,0x04020107}, - {0x0F007024,0x00000007}, - {0x0F007028,0x02020201}, - {0x0F00702c,0x0204040a}, - {0x0F007030,0x04000000}, - {0x0F007034,0x00000002}, - {0x0F007038,0x1F060200}, - {0x0F00703C,0x1C22221F}, - {0x0F007040,0x8A006600}, - {0x0F007044,0x221a0800}, - {0x0F007048,0x02690204}, - {0x0F00704c,0x00000000}, - {0x0F007050,0x0000001c}, - {0x0F007054,0x00000000}, - {0x0F007058,0x00000000}, - {0x0F00705c,0x00000000}, - {0x0F007060,0x000A15D6}, - {0x0F007064,0x0000000A}, - {0x0F007068,0x00000000}, - {0x0F00706c,0x00000001}, - {0x0F007070,0x00004000}, - {0x0F007074,0x00000000}, - {0x0F007078,0x00000000}, - {0x0F00707C,0x00000000}, - {0x0F007080,0x00000000}, - {0x0F007084,0x00000000}, - {0x0F007094,0x00000104}, + {0x0F007000, 0x00010001}, + {0x0F007004, 0x01000000}, + {0x0F007008, 0x01000001}, + {0x0F00700c, 0x00000000}, + {0x0F007010, 0x01000000}, + {0x0F007014, 0x01000100}, + {0x0F007018, 0x01000000}, + {0x0F00701c, 0x01020000}, + {0x0F007020, 0x04020107}, + {0x0F007024, 0x00000007}, + {0x0F007028, 0x02020201}, + {0x0F00702c, 0x0204040a}, + {0x0F007030, 0x04000000}, + {0x0F007034, 0x00000002}, + {0x0F007038, 0x1F060200}, + {0x0F00703C, 0x1C22221F}, + {0x0F007040, 0x8A006600}, + {0x0F007044, 0x221a0800}, + {0x0F007048, 0x02690204}, + {0x0F00704c, 0x00000000}, + {0x0F007050, 0x0000001c}, + {0x0F007054, 0x00000000}, + {0x0F007058, 0x00000000}, + {0x0F00705c, 0x00000000}, + {0x0F007060, 0x000A15D6}, + {0x0F007064, 0x0000000A}, + {0x0F007068, 0x00000000}, + {0x0F00706c, 0x00000001}, + {0x0F007070, 0x00004000}, + {0x0F007074, 0x00000000}, + {0x0F007078, 0x00000000}, + {0x0F00707C, 0x00000000}, + {0x0F007080, 0x00000000}, + {0x0F007084, 0x00000000}, + {0x0F007094, 0x00000104}, //# Enable start bit within memory controller - {0x0F007018,0x01010000} + {0x0F007018, 0x01010000} }; //100Mhz #define T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 13 //index for 0x0F007000 -static struct bcm_ddr_setting asT3_DDRSetting100MHz[]= {// # DPLL Clock Setting - {0x0F000800,0x00007008}, - {0x0f000810,0x00000F95}, - {0x0f000820,0x07F13E3F}, - {0x0f000860,0x00000000}, - {0x0f000880,0x000003DD}, +static struct bcm_ddr_setting asT3_DDRSetting100MHz[] = {// # DPLL Clock Setting + {0x0F000800, 0x00007008}, + {0x0f000810, 0x00000F95}, + {0x0f000820, 0x07F13E3F}, + {0x0f000860, 0x00000000}, + {0x0f000880, 0x000003DD}, // Changed source for X-bar and MIPS clock to APLL //0x0f000840,0x0FFF1800, - {0x0f000840,0x0FFF1B00}, - {0x0f000870,0x00000002}, - {0x0F00a044,0x1fffffff}, - {0x0F00a040,0x1f000000}, - {0x0F00a084,0x1Cffffff}, - {0x0F00a080,0x1C000000}, - {0x0F00a04C,0x0000000C}, + {0x0f000840, 0x0FFF1B00}, + {0x0f000870, 0x00000002}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0F00a084, 0x1Cffffff}, + {0x0F00a080, 0x1C000000}, + {0x0F00a04C, 0x0000000C}, //# Enable 2 ports within X-bar - {0x0F00A000,0x00000016}, + {0x0F00A000, 0x00000016}, //Memcontroller Default values - {0x0F007000,0x00010001}, - {0x0F007004,0x01010100}, - {0x0F007008,0x01000001}, - {0x0F00700c,0x00000000}, - {0x0F007010,0x01000000}, - {0x0F007014,0x01000100}, - {0x0F007018,0x01000000}, - {0x0F00701c,0x01020001}, // POP - 0x00020000 Normal 0x01020000 - {0x0F007020,0x04020107},//Normal - 0x04030107 POP - 0x05030107 - {0x0F007024,0x00000007}, - {0x0F007028,0x01020201}, - {0x0F00702c,0x0204040A}, - {0x0F007030,0x06000000}, - {0x0F007034,0x00000004}, - {0x0F007038,0x20080200}, - {0x0F00703C,0x02030320}, - {0x0F007040,0x6E7F1200}, - {0x0F007044,0x01190A00}, - {0x0F007048,0x06120305},//0x02690204 // 0x06120305 - {0x0F00704c,0x00000000}, - {0x0F007050,0x0000001C}, - {0x0F007054,0x00000000}, - {0x0F007058,0x00000000}, - {0x0F00705c,0x00000000}, - {0x0F007060,0x00082ED6}, - {0x0F007064,0x0000000A}, - {0x0F007068,0x00000000}, - {0x0F00706c,0x00000001}, - {0x0F007070,0x00005000}, - {0x0F007074,0x00000000}, - {0x0F007078,0x00000000}, - {0x0F00707C,0x00000000}, - {0x0F007080,0x00000000}, - {0x0F007084,0x00000000}, + {0x0F007000, 0x00010001}, + {0x0F007004, 0x01010100}, + {0x0F007008, 0x01000001}, + {0x0F00700c, 0x00000000}, + {0x0F007010, 0x01000000}, + {0x0F007014, 0x01000100}, + {0x0F007018, 0x01000000}, + {0x0F00701c, 0x01020001}, // POP - 0x00020000 Normal 0x01020000 + {0x0F007020, 0x04020107},//Normal - 0x04030107 POP - 0x05030107 + {0x0F007024, 0x00000007}, + {0x0F007028, 0x01020201}, + {0x0F00702c, 0x0204040A}, + {0x0F007030, 0x06000000}, + {0x0F007034, 0x00000004}, + {0x0F007038, 0x20080200}, + {0x0F00703C, 0x02030320}, + {0x0F007040, 0x6E7F1200}, + {0x0F007044, 0x01190A00}, + {0x0F007048, 0x06120305},//0x02690204 // 0x06120305 + {0x0F00704c, 0x00000000}, + {0x0F007050, 0x0000001C}, + {0x0F007054, 0x00000000}, + {0x0F007058, 0x00000000}, + {0x0F00705c, 0x00000000}, + {0x0F007060, 0x00082ED6}, + {0x0F007064, 0x0000000A}, + {0x0F007068, 0x00000000}, + {0x0F00706c, 0x00000001}, + {0x0F007070, 0x00005000}, + {0x0F007074, 0x00000000}, + {0x0F007078, 0x00000000}, + {0x0F00707C, 0x00000000}, + {0x0F007080, 0x00000000}, + {0x0F007084, 0x00000000}, //# Enable BW improvement within memory controller - {0x0F007094,0x00000104}, + {0x0F007094, 0x00000104}, //# Enable start bit within memory controller - {0x0F007018,0x01010000} + {0x0F007018, 0x01010000} }; //Net T3B DDR Settings //DDR INIT-133Mhz static struct bcm_ddr_setting asDPLL_266MHZ[] = { - {0x0F000800,0x00007212}, - {0x0f000820,0x07F13FFF}, - {0x0f000810,0x00000F95}, - {0x0f000860,0x00000000}, - {0x0f000880,0x000003DD}, + {0x0F000800, 0x00007212}, + {0x0f000820, 0x07F13FFF}, + {0x0f000810, 0x00000F95}, + {0x0f000860, 0x00000000}, + {0x0f000880, 0x000003DD}, // Changed source for X-bar and MIPS clock to APLL - {0x0f000840,0x0FFF1B00}, - {0x0f000870,0x00000002} + {0x0f000840, 0x0FFF1B00}, + {0x0f000870, 0x00000002} }; #define T3B_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 11 //index for 0x0F007000 static struct bcm_ddr_setting asT3B_DDRSetting133MHz[] = {// # DPLL Clock Setting - {0x0f000810,0x00000F95}, - {0x0f000810,0x00000F95}, - {0x0f000810,0x00000F95}, - {0x0f000820,0x07F13652}, - {0x0f000840,0x0FFF0800}, + {0x0f000810, 0x00000F95}, + {0x0f000810, 0x00000F95}, + {0x0f000810, 0x00000F95}, + {0x0f000820, 0x07F13652}, + {0x0f000840, 0x0FFF0800}, // Changed source for X-bar and MIPS clock to APLL - {0x0f000880,0x000003DD}, - {0x0f000860,0x00000000}, + {0x0f000880, 0x000003DD}, + {0x0f000860, 0x00000000}, // Changed source for X-bar and MIPS clock to APLL - {0x0F00a044,0x1fffffff}, - {0x0F00a040,0x1f000000}, - {0x0F00a084,0x1Cffffff}, - {0x0F00a080,0x1C000000}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0F00a084, 0x1Cffffff}, + {0x0F00a080, 0x1C000000}, //# Enable 2 ports within X-bar - {0x0F00A000,0x00000016}, + {0x0F00A000, 0x00000016}, //Memcontroller Default values - {0x0F007000,0x00010001}, - {0x0F007004,0x01010100}, - {0x0F007008,0x01000001}, - {0x0F00700c,0x00000000}, - {0x0F007010,0x01000000}, - {0x0F007014,0x01000100}, - {0x0F007018,0x01000000}, - {0x0F00701c,0x01020001},// POP - 0x00020001 Normal 0x01020001 - {0x0F007020,0x04030107}, //Normal - 0x04030107 POP - 0x05030107 - {0x0F007024,0x02000007}, - {0x0F007028,0x02020202}, - {0x0F00702c,0x0206060a},//ROB- 0x0205050a,//0x0206060a - {0x0F007030,0x05000000}, - {0x0F007034,0x00000003}, - {0x0F007038,0x130a0200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200 - {0x0F00703C,0x02101012},//ROB - 0x02101010,//0x02101018}, - {0x0F007040,0x457D1200},//ROB - 0x45751200,//0x450f1200}, - {0x0F007044,0x11130d00},//ROB - 0x110a0d00//0x111f0d00 - {0x0F007048,0x040D0306}, - {0x0F00704c,0x00000000}, - {0x0F007050,0x0000001c}, - {0x0F007054,0x00000000}, - {0x0F007058,0x00000000}, - {0x0F00705c,0x00000000}, - {0x0F007060,0x0010246c}, - {0x0F007064,0x00000012}, - {0x0F007068,0x00000000}, - {0x0F00706c,0x00000001}, - {0x0F007070,0x00007000}, - {0x0F007074,0x00000000}, - {0x0F007078,0x00000000}, - {0x0F00707C,0x00000000}, - {0x0F007080,0x00000000}, - {0x0F007084,0x00000000}, + {0x0F007000, 0x00010001}, + {0x0F007004, 0x01010100}, + {0x0F007008, 0x01000001}, + {0x0F00700c, 0x00000000}, + {0x0F007010, 0x01000000}, + {0x0F007014, 0x01000100}, + {0x0F007018, 0x01000000}, + {0x0F00701c, 0x01020001},// POP - 0x00020001 Normal 0x01020001 + {0x0F007020, 0x04030107}, //Normal - 0x04030107 POP - 0x05030107 + {0x0F007024, 0x02000007}, + {0x0F007028, 0x02020202}, + {0x0F00702c, 0x0206060a},//ROB- 0x0205050a,//0x0206060a + {0x0F007030, 0x05000000}, + {0x0F007034, 0x00000003}, + {0x0F007038, 0x130a0200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200 + {0x0F00703C, 0x02101012},//ROB - 0x02101010,//0x02101018}, + {0x0F007040, 0x457D1200},//ROB - 0x45751200,//0x450f1200}, + {0x0F007044, 0x11130d00},//ROB - 0x110a0d00//0x111f0d00 + {0x0F007048, 0x040D0306}, + {0x0F00704c, 0x00000000}, + {0x0F007050, 0x0000001c}, + {0x0F007054, 0x00000000}, + {0x0F007058, 0x00000000}, + {0x0F00705c, 0x00000000}, + {0x0F007060, 0x0010246c}, + {0x0F007064, 0x00000012}, + {0x0F007068, 0x00000000}, + {0x0F00706c, 0x00000001}, + {0x0F007070, 0x00007000}, + {0x0F007074, 0x00000000}, + {0x0F007078, 0x00000000}, + {0x0F00707C, 0x00000000}, + {0x0F007080, 0x00000000}, + {0x0F007084, 0x00000000}, //# Enable BW improvement within memory controller - {0x0F007094,0x00000104}, + {0x0F007094, 0x00000104}, //# Enable start bit within memory controller - {0x0F007018,0x01010000}, + {0x0F007018, 0x01010000}, }; #define T3B_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 9 //index for 0x0F007000 static struct bcm_ddr_setting asT3B_DDRSetting80MHz[] = {// # DPLL Clock Setting - {0x0f000810,0x00000F95}, - {0x0f000820,0x07F13FFF}, - {0x0f000840,0x0FFF1F00}, - {0x0f000880,0x000003DD}, - {0x0f000860,0x00000000}, + {0x0f000810, 0x00000F95}, + {0x0f000820, 0x07F13FFF}, + {0x0f000840, 0x0FFF1F00}, + {0x0f000880, 0x000003DD}, + {0x0f000860, 0x00000000}, - {0x0F00a044,0x1fffffff}, - {0x0F00a040,0x1f000000}, - {0x0F00a084,0x1Cffffff}, - {0x0F00a080,0x1C000000}, - {0x0F00a000,0x00000016}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0F00a084, 0x1Cffffff}, + {0x0F00a080, 0x1C000000}, + {0x0F00a000, 0x00000016}, //Memcontroller Default values - {0x0F007000,0x00010001}, - {0x0F007004,0x01000000}, - {0x0F007008,0x01000001}, - {0x0F00700c,0x00000000}, - {0x0F007010,0x01000000}, - {0x0F007014,0x01000100}, - {0x0F007018,0x01000000}, - {0x0F00701c,0x01020000}, - {0x0F007020,0x04020107}, - {0x0F007024,0x00000007}, - {0x0F007028,0x02020201}, - {0x0F00702c,0x0204040a}, - {0x0F007030,0x04000000}, - {0x0F007034,0x02000002}, - {0x0F007038,0x1F060202}, - {0x0F00703C,0x1C22221F}, - {0x0F007040,0x8A006600}, - {0x0F007044,0x221a0800}, - {0x0F007048,0x02690204}, - {0x0F00704c,0x00000000}, - {0x0F007050,0x0100001c}, - {0x0F007054,0x00000000}, - {0x0F007058,0x00000000}, - {0x0F00705c,0x00000000}, - {0x0F007060,0x000A15D6}, - {0x0F007064,0x0000000A}, - {0x0F007068,0x00000000}, - {0x0F00706c,0x00000001}, - {0x0F007070,0x00004000}, - {0x0F007074,0x00000000}, - {0x0F007078,0x00000000}, - {0x0F00707C,0x00000000}, - {0x0F007080,0x00000000}, - {0x0F007084,0x00000000}, - {0x0F007094,0x00000104}, + {0x0F007000, 0x00010001}, + {0x0F007004, 0x01000000}, + {0x0F007008, 0x01000001}, + {0x0F00700c, 0x00000000}, + {0x0F007010, 0x01000000}, + {0x0F007014, 0x01000100}, + {0x0F007018, 0x01000000}, + {0x0F00701c, 0x01020000}, + {0x0F007020, 0x04020107}, + {0x0F007024, 0x00000007}, + {0x0F007028, 0x02020201}, + {0x0F00702c, 0x0204040a}, + {0x0F007030, 0x04000000}, + {0x0F007034, 0x02000002}, + {0x0F007038, 0x1F060202}, + {0x0F00703C, 0x1C22221F}, + {0x0F007040, 0x8A006600}, + {0x0F007044, 0x221a0800}, + {0x0F007048, 0x02690204}, + {0x0F00704c, 0x00000000}, + {0x0F007050, 0x0100001c}, + {0x0F007054, 0x00000000}, + {0x0F007058, 0x00000000}, + {0x0F00705c, 0x00000000}, + {0x0F007060, 0x000A15D6}, + {0x0F007064, 0x0000000A}, + {0x0F007068, 0x00000000}, + {0x0F00706c, 0x00000001}, + {0x0F007070, 0x00004000}, + {0x0F007074, 0x00000000}, + {0x0F007078, 0x00000000}, + {0x0F00707C, 0x00000000}, + {0x0F007080, 0x00000000}, + {0x0F007084, 0x00000000}, + {0x0F007094, 0x00000104}, //# Enable start bit within memory controller - {0x0F007018,0x01010000} + {0x0F007018, 0x01010000} }; //100Mhz #define T3B_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 9 //index for 0x0F007000 static struct bcm_ddr_setting asT3B_DDRSetting100MHz[] = {// # DPLL Clock Setting - {0x0f000810,0x00000F95}, - {0x0f000820,0x07F1369B}, - {0x0f000840,0x0FFF0800}, - {0x0f000880,0x000003DD}, - {0x0f000860,0x00000000}, - {0x0F00a044,0x1fffffff}, - {0x0F00a040,0x1f000000}, - {0x0F00a084,0x1Cffffff}, - {0x0F00a080,0x1C000000}, + {0x0f000810, 0x00000F95}, + {0x0f000820, 0x07F1369B}, + {0x0f000840, 0x0FFF0800}, + {0x0f000880, 0x000003DD}, + {0x0f000860, 0x00000000}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0F00a084, 0x1Cffffff}, + {0x0F00a080, 0x1C000000}, //# Enable 2 ports within X-bar - {0x0F00A000,0x00000016}, + {0x0F00A000, 0x00000016}, //Memcontroller Default values - {0x0F007000,0x00010001}, - {0x0F007004,0x01010100}, - {0x0F007008,0x01000001}, - {0x0F00700c,0x00000000}, - {0x0F007010,0x01000000}, - {0x0F007014,0x01000100}, - {0x0F007018,0x01000000}, - {0x0F00701c,0x01020000}, // POP - 0x00020000 Normal 0x01020000 - {0x0F007020,0x04020107},//Normal - 0x04030107 POP - 0x05030107 - {0x0F007024,0x00000007}, - {0x0F007028,0x01020201}, - {0x0F00702c,0x0204040A}, - {0x0F007030,0x06000000}, - {0x0F007034,0x02000004}, - {0x0F007038,0x20080200}, - {0x0F00703C,0x02030320}, - {0x0F007040,0x6E7F1200}, - {0x0F007044,0x01190A00}, - {0x0F007048,0x06120305},//0x02690204 // 0x06120305 - {0x0F00704c,0x00000000}, - {0x0F007050,0x0100001C}, - {0x0F007054,0x00000000}, - {0x0F007058,0x00000000}, - {0x0F00705c,0x00000000}, - {0x0F007060,0x00082ED6}, - {0x0F007064,0x0000000A}, - {0x0F007068,0x00000000}, - {0x0F00706c,0x00000001}, - {0x0F007070,0x00005000}, - {0x0F007074,0x00000000}, - {0x0F007078,0x00000000}, - {0x0F00707C,0x00000000}, - {0x0F007080,0x00000000}, - {0x0F007084,0x00000000}, + {0x0F007000, 0x00010001}, + {0x0F007004, 0x01010100}, + {0x0F007008, 0x01000001}, + {0x0F00700c, 0x00000000}, + {0x0F007010, 0x01000000}, + {0x0F007014, 0x01000100}, + {0x0F007018, 0x01000000}, + {0x0F00701c, 0x01020000}, // POP - 0x00020000 Normal 0x01020000 + {0x0F007020, 0x04020107},//Normal - 0x04030107 POP - 0x05030107 + {0x0F007024, 0x00000007}, + {0x0F007028, 0x01020201}, + {0x0F00702c, 0x0204040A}, + {0x0F007030, 0x06000000}, + {0x0F007034, 0x02000004}, + {0x0F007038, 0x20080200}, + {0x0F00703C, 0x02030320}, + {0x0F007040, 0x6E7F1200}, + {0x0F007044, 0x01190A00}, + {0x0F007048, 0x06120305},//0x02690204 // 0x06120305 + {0x0F00704c, 0x00000000}, + {0x0F007050, 0x0100001C}, + {0x0F007054, 0x00000000}, + {0x0F007058, 0x00000000}, + {0x0F00705c, 0x00000000}, + {0x0F007060, 0x00082ED6}, + {0x0F007064, 0x0000000A}, + {0x0F007068, 0x00000000}, + {0x0F00706c, 0x00000001}, + {0x0F007070, 0x00005000}, + {0x0F007074, 0x00000000}, + {0x0F007078, 0x00000000}, + {0x0F00707C, 0x00000000}, + {0x0F007080, 0x00000000}, + {0x0F007084, 0x00000000}, //# Enable BW improvement within memory controller - {0x0F007094,0x00000104}, + {0x0F007094, 0x00000104}, //# Enable start bit within memory controller - {0x0F007018,0x01010000} + {0x0F007018, 0x01010000} }; #define T3LP_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 9 //index for 0x0F007000 -static struct bcm_ddr_setting asT3LP_DDRSetting133MHz[]= {// # DPLL Clock Setting - {0x0f000820,0x03F1365B}, - {0x0f000810,0x00002F95}, - {0x0f000880,0x000003DD}, +static struct bcm_ddr_setting asT3LP_DDRSetting133MHz[] = {// # DPLL Clock Setting + {0x0f000820, 0x03F1365B}, + {0x0f000810, 0x00002F95}, + {0x0f000880, 0x000003DD}, // Changed source for X-bar and MIPS clock to APLL - {0x0f000840,0x0FFF0000}, - {0x0f000860,0x00000000}, - {0x0F00a044,0x1fffffff}, - {0x0F00a040,0x1f000000}, - {0x0F00a084,0x1Cffffff}, - {0x0F00a080,0x1C000000}, - {0x0F00A000,0x00000016}, + {0x0f000840, 0x0FFF0000}, + {0x0f000860, 0x00000000}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0F00a084, 0x1Cffffff}, + {0x0F00a080, 0x1C000000}, + {0x0F00A000, 0x00000016}, //Memcontroller Default values - {0x0F007000,0x00010001}, - {0x0F007004,0x01010100}, - {0x0F007008,0x01000001}, - {0x0F00700c,0x00000000}, - {0x0F007010,0x01000000}, - {0x0F007014,0x01000100}, - {0x0F007018,0x01000000}, - {0x0F00701c,0x01020001},// POP - 0x00020001 Normal 0x01020001 - {0x0F007020,0x04030107}, //Normal - 0x04030107 POP - 0x05030107 - {0x0F007024,0x02000007}, - {0x0F007028,0x02020200}, - {0x0F00702c,0x0206060a},//ROB- 0x0205050a,//0x0206060a - {0x0F007030,0x05000000}, - {0x0F007034,0x00000003}, - {0x0F007038,0x200a0200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200 - {0x0F00703C,0x02101020},//ROB - 0x02101010,//0x02101018, - {0x0F007040,0x45711200},//ROB - 0x45751200,//0x450f1200, - {0x0F007044,0x110D0D00},//ROB - 0x110a0d00//0x111f0d00 - {0x0F007048,0x04080306}, - {0x0F00704c,0x00000000}, - {0x0F007050,0x0100001c}, - {0x0F007054,0x00000000}, - {0x0F007058,0x00000000}, - {0x0F00705c,0x00000000}, - {0x0F007060,0x0010245F}, - {0x0F007064,0x00000010}, - {0x0F007068,0x00000000}, - {0x0F00706c,0x00000001}, - {0x0F007070,0x00007000}, - {0x0F007074,0x00000000}, - {0x0F007078,0x00000000}, - {0x0F00707C,0x00000000}, - {0x0F007080,0x00000000}, - {0x0F007084,0x00000000}, - {0x0F007088,0x01000001}, - {0x0F00708c,0x00000101}, - {0x0F007090,0x00000000}, + {0x0F007000, 0x00010001}, + {0x0F007004, 0x01010100}, + {0x0F007008, 0x01000001}, + {0x0F00700c, 0x00000000}, + {0x0F007010, 0x01000000}, + {0x0F007014, 0x01000100}, + {0x0F007018, 0x01000000}, + {0x0F00701c, 0x01020001},// POP - 0x00020001 Normal 0x01020001 + {0x0F007020, 0x04030107}, //Normal - 0x04030107 POP - 0x05030107 + {0x0F007024, 0x02000007}, + {0x0F007028, 0x02020200}, + {0x0F00702c, 0x0206060a},//ROB- 0x0205050a,//0x0206060a + {0x0F007030, 0x05000000}, + {0x0F007034, 0x00000003}, + {0x0F007038, 0x200a0200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200 + {0x0F00703C, 0x02101020},//ROB - 0x02101010,//0x02101018, + {0x0F007040, 0x45711200},//ROB - 0x45751200,//0x450f1200, + {0x0F007044, 0x110D0D00},//ROB - 0x110a0d00//0x111f0d00 + {0x0F007048, 0x04080306}, + {0x0F00704c, 0x00000000}, + {0x0F007050, 0x0100001c}, + {0x0F007054, 0x00000000}, + {0x0F007058, 0x00000000}, + {0x0F00705c, 0x00000000}, + {0x0F007060, 0x0010245F}, + {0x0F007064, 0x00000010}, + {0x0F007068, 0x00000000}, + {0x0F00706c, 0x00000001}, + {0x0F007070, 0x00007000}, + {0x0F007074, 0x00000000}, + {0x0F007078, 0x00000000}, + {0x0F00707C, 0x00000000}, + {0x0F007080, 0x00000000}, + {0x0F007084, 0x00000000}, + {0x0F007088, 0x01000001}, + {0x0F00708c, 0x00000101}, + {0x0F007090, 0x00000000}, //# Enable BW improvement within memory controller - {0x0F007094,0x00040000}, - {0x0F007098,0x00000000}, - {0x0F0070c8,0x00000104}, + {0x0F007094, 0x00040000}, + {0x0F007098, 0x00000000}, + {0x0F0070c8, 0x00000104}, //# Enable 2 ports within X-bar //# Enable start bit within memory controller - {0x0F007018,0x01010000} + {0x0F007018, 0x01010000} }; #define T3LP_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 11 //index for 0x0F007000 -static struct bcm_ddr_setting asT3LP_DDRSetting100MHz[]= {// # DPLL Clock Setting - {0x0f000810,0x00002F95}, - {0x0f000820,0x03F1369B}, - {0x0f000840,0x0fff0000}, - {0x0f000860,0x00000000}, - {0x0f000880,0x000003DD}, +static struct bcm_ddr_setting asT3LP_DDRSetting100MHz[] = {// # DPLL Clock Setting + {0x0f000810, 0x00002F95}, + {0x0f000820, 0x03F1369B}, + {0x0f000840, 0x0fff0000}, + {0x0f000860, 0x00000000}, + {0x0f000880, 0x000003DD}, // Changed source for X-bar and MIPS clock to APLL - {0x0f000840,0x0FFF0000}, - {0x0F00a044,0x1fffffff}, - {0x0F00a040,0x1f000000}, - {0x0F00a084,0x1Cffffff}, - {0x0F00a080,0x1C000000}, + {0x0f000840, 0x0FFF0000}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0F00a084, 0x1Cffffff}, + {0x0F00a080, 0x1C000000}, //Memcontroller Default values - {0x0F007000,0x00010001}, - {0x0F007004,0x01010100}, - {0x0F007008,0x01000001}, - {0x0F00700c,0x00000000}, - {0x0F007010,0x01000000}, - {0x0F007014,0x01000100}, - {0x0F007018,0x01000000}, - {0x0F00701c,0x01020000},// POP - 0x00020001 Normal 0x01020001 - {0x0F007020,0x04020107}, //Normal - 0x04030107 POP - 0x05030107 - {0x0F007024,0x00000007}, - {0x0F007028,0x01020200}, - {0x0F00702c,0x0204040a},//ROB- 0x0205050a,//0x0206060a - {0x0F007030,0x06000000}, - {0x0F007034,0x00000004}, - {0x0F007038,0x1F080200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200 - {0x0F00703C,0x0203031F},//ROB - 0x02101010,//0x02101018, - {0x0F007040,0x6e001200},//ROB - 0x45751200,//0x450f1200, - {0x0F007044,0x011a0a00},//ROB - 0x110a0d00//0x111f0d00 - {0x0F007048,0x03000305}, - {0x0F00704c,0x00000000}, - {0x0F007050,0x0100001c}, - {0x0F007054,0x00000000}, - {0x0F007058,0x00000000}, - {0x0F00705c,0x00000000}, - {0x0F007060,0x00082ED6}, - {0x0F007064,0x0000000A}, - {0x0F007068,0x00000000}, - {0x0F00706c,0x00000001}, - {0x0F007070,0x00005000}, - {0x0F007074,0x00000000}, - {0x0F007078,0x00000000}, - {0x0F00707C,0x00000000}, - {0x0F007080,0x00000000}, - {0x0F007084,0x00000000}, - {0x0F007088,0x01000001}, - {0x0F00708c,0x00000101}, - {0x0F007090,0x00000000}, - {0x0F007094,0x00010000}, - {0x0F007098,0x00000000}, - {0x0F0070C8,0x00000104}, + {0x0F007000, 0x00010001}, + {0x0F007004, 0x01010100}, + {0x0F007008, 0x01000001}, + {0x0F00700c, 0x00000000}, + {0x0F007010, 0x01000000}, + {0x0F007014, 0x01000100}, + {0x0F007018, 0x01000000}, + {0x0F00701c, 0x01020000},// POP - 0x00020001 Normal 0x01020001 + {0x0F007020, 0x04020107}, //Normal - 0x04030107 POP - 0x05030107 + {0x0F007024, 0x00000007}, + {0x0F007028, 0x01020200}, + {0x0F00702c, 0x0204040a},//ROB- 0x0205050a,//0x0206060a + {0x0F007030, 0x06000000}, + {0x0F007034, 0x00000004}, + {0x0F007038, 0x1F080200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200 + {0x0F00703C, 0x0203031F},//ROB - 0x02101010,//0x02101018, + {0x0F007040, 0x6e001200},//ROB - 0x45751200,//0x450f1200, + {0x0F007044, 0x011a0a00},//ROB - 0x110a0d00//0x111f0d00 + {0x0F007048, 0x03000305}, + {0x0F00704c, 0x00000000}, + {0x0F007050, 0x0100001c}, + {0x0F007054, 0x00000000}, + {0x0F007058, 0x00000000}, + {0x0F00705c, 0x00000000}, + {0x0F007060, 0x00082ED6}, + {0x0F007064, 0x0000000A}, + {0x0F007068, 0x00000000}, + {0x0F00706c, 0x00000001}, + {0x0F007070, 0x00005000}, + {0x0F007074, 0x00000000}, + {0x0F007078, 0x00000000}, + {0x0F00707C, 0x00000000}, + {0x0F007080, 0x00000000}, + {0x0F007084, 0x00000000}, + {0x0F007088, 0x01000001}, + {0x0F00708c, 0x00000101}, + {0x0F007090, 0x00000000}, + {0x0F007094, 0x00010000}, + {0x0F007098, 0x00000000}, + {0x0F0070C8, 0x00000104}, //# Enable 2 ports within X-bar - {0x0F00A000,0x00000016}, + {0x0F00A000, 0x00000016}, //# Enable start bit within memory controller - {0x0F007018,0x01010000} + {0x0F007018, 0x01010000} }; #define T3LP_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 9 //index for 0x0F007000 -static struct bcm_ddr_setting asT3LP_DDRSetting80MHz[]= {// # DPLL Clock Setting - {0x0f000820,0x07F13FFF}, - {0x0f000810,0x00002F95}, - {0x0f000860,0x00000000}, - {0x0f000880,0x000003DD}, - {0x0f000840,0x0FFF1F00}, - {0x0F00a044,0x1fffffff}, - {0x0F00a040,0x1f000000}, - {0x0F00a084,0x1Cffffff}, - {0x0F00a080,0x1C000000}, - {0x0F00A000,0x00000016}, - {0x0f007000,0x00010001}, - {0x0f007004,0x01000000}, - {0x0f007008,0x01000001}, - {0x0f00700c,0x00000000}, - {0x0f007010,0x01000000}, - {0x0f007014,0x01000100}, - {0x0f007018,0x01000000}, - {0x0f00701c,0x01020000}, - {0x0f007020,0x04020107}, - {0x0f007024,0x00000007}, - {0x0f007028,0x02020200}, - {0x0f00702c,0x0204040a}, - {0x0f007030,0x04000000}, - {0x0f007034,0x00000002}, - {0x0f007038,0x1d060200}, - {0x0f00703c,0x1c22221d}, - {0x0f007040,0x8A116600}, - {0x0f007044,0x222d0800}, - {0x0f007048,0x02690204}, - {0x0f00704c,0x00000000}, - {0x0f007050,0x0100001c}, - {0x0f007054,0x00000000}, - {0x0f007058,0x00000000}, - {0x0f00705c,0x00000000}, - {0x0f007060,0x000A15D6}, - {0x0f007064,0x0000000A}, - {0x0f007068,0x00000000}, - {0x0f00706c,0x00000001}, - {0x0f007070,0x00004000}, - {0x0f007074,0x00000000}, - {0x0f007078,0x00000000}, - {0x0f00707c,0x00000000}, - {0x0f007080,0x00000000}, - {0x0f007084,0x00000000}, - {0x0f007088,0x01000001}, - {0x0f00708c,0x00000101}, - {0x0f007090,0x00000000}, - {0x0f007094,0x00010000}, - {0x0f007098,0x00000000}, - {0x0F0070C8,0x00000104}, - {0x0F007018,0x01010000} +static struct bcm_ddr_setting asT3LP_DDRSetting80MHz[] = {// # DPLL Clock Setting + {0x0f000820, 0x07F13FFF}, + {0x0f000810, 0x00002F95}, + {0x0f000860, 0x00000000}, + {0x0f000880, 0x000003DD}, + {0x0f000840, 0x0FFF1F00}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0F00a084, 0x1Cffffff}, + {0x0F00a080, 0x1C000000}, + {0x0F00A000, 0x00000016}, + {0x0f007000, 0x00010001}, + {0x0f007004, 0x01000000}, + {0x0f007008, 0x01000001}, + {0x0f00700c, 0x00000000}, + {0x0f007010, 0x01000000}, + {0x0f007014, 0x01000100}, + {0x0f007018, 0x01000000}, + {0x0f00701c, 0x01020000}, + {0x0f007020, 0x04020107}, + {0x0f007024, 0x00000007}, + {0x0f007028, 0x02020200}, + {0x0f00702c, 0x0204040a}, + {0x0f007030, 0x04000000}, + {0x0f007034, 0x00000002}, + {0x0f007038, 0x1d060200}, + {0x0f00703c, 0x1c22221d}, + {0x0f007040, 0x8A116600}, + {0x0f007044, 0x222d0800}, + {0x0f007048, 0x02690204}, + {0x0f00704c, 0x00000000}, + {0x0f007050, 0x0100001c}, + {0x0f007054, 0x00000000}, + {0x0f007058, 0x00000000}, + {0x0f00705c, 0x00000000}, + {0x0f007060, 0x000A15D6}, + {0x0f007064, 0x0000000A}, + {0x0f007068, 0x00000000}, + {0x0f00706c, 0x00000001}, + {0x0f007070, 0x00004000}, + {0x0f007074, 0x00000000}, + {0x0f007078, 0x00000000}, + {0x0f00707c, 0x00000000}, + {0x0f007080, 0x00000000}, + {0x0f007084, 0x00000000}, + {0x0f007088, 0x01000001}, + {0x0f00708c, 0x00000101}, + {0x0f007090, 0x00000000}, + {0x0f007094, 0x00010000}, + {0x0f007098, 0x00000000}, + {0x0F0070C8, 0x00000104}, + {0x0F007018, 0x01010000} }; @@ -536,246 +536,245 @@ static struct bcm_ddr_setting asT3LP_DDRSetting80MHz[]= {// # DPLL Clock Setting ///T3 LP-B (UMA-B) #define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_160MHZ 7 //index for 0x0F007000 -static struct bcm_ddr_setting asT3LPB_DDRSetting160MHz[]= {// # DPLL Clock Setting - - {0x0f000820,0x03F137DB}, - {0x0f000810,0x01842795}, - {0x0f000860,0x00000000}, - {0x0f000880,0x000003DD}, - {0x0f000840,0x0FFF0400}, - {0x0F00a044,0x1fffffff}, - {0x0F00a040,0x1f000000}, - {0x0f003050,0x00000021},//this is flash/eeprom clock divisor which set the flash clock to 20 MHz - {0x0F00a084,0x1Cffffff},//Now dump from her in internal memory - {0x0F00a080,0x1C000000}, - {0x0F00A000,0x00000016}, - {0x0f007000,0x00010001}, - {0x0f007004,0x01000001}, - {0x0f007008,0x01000101}, - {0x0f00700c,0x00000000}, - {0x0f007010,0x01000100}, - {0x0f007014,0x01000100}, - {0x0f007018,0x01000000}, - {0x0f00701c,0x01020000}, - {0x0f007020,0x04030107}, - {0x0f007024,0x02000007}, - {0x0f007028,0x02020200}, - {0x0f00702c,0x0206060a}, - {0x0f007030,0x050d0d00}, - {0x0f007034,0x00000003}, - {0x0f007038,0x170a0200}, - {0x0f00703c,0x02101012}, - {0x0f007040,0x45161200}, - {0x0f007044,0x11250c00}, - {0x0f007048,0x04da0307}, - {0x0f00704c,0x00000000}, - {0x0f007050,0x0000001c}, - {0x0f007054,0x00000000}, - {0x0f007058,0x00000000}, - {0x0f00705c,0x00000000}, - {0x0f007060,0x00142bb6}, - {0x0f007064,0x20430014}, - {0x0f007068,0x00000000}, - {0x0f00706c,0x00000001}, - {0x0f007070,0x00009000}, - {0x0f007074,0x00000000}, - {0x0f007078,0x00000000}, - {0x0f00707c,0x00000000}, - {0x0f007080,0x00000000}, - {0x0f007084,0x00000000}, - {0x0f007088,0x01000001}, - {0x0f00708c,0x00000101}, - {0x0f007090,0x00000000}, - {0x0f007094,0x00040000}, - {0x0f007098,0x00000000}, - {0x0F0070C8,0x00000104}, - {0x0F007018,0x01010000} +static struct bcm_ddr_setting asT3LPB_DDRSetting160MHz[] = {// # DPLL Clock Setting + {0x0f000820, 0x03F137DB}, + {0x0f000810, 0x01842795}, + {0x0f000860, 0x00000000}, + {0x0f000880, 0x000003DD}, + {0x0f000840, 0x0FFF0400}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0f003050, 0x00000021},//this is flash/eeprom clock divisor which set the flash clock to 20 MHz + {0x0F00a084, 0x1Cffffff},//Now dump from her in internal memory + {0x0F00a080, 0x1C000000}, + {0x0F00A000, 0x00000016}, + {0x0f007000, 0x00010001}, + {0x0f007004, 0x01000001}, + {0x0f007008, 0x01000101}, + {0x0f00700c, 0x00000000}, + {0x0f007010, 0x01000100}, + {0x0f007014, 0x01000100}, + {0x0f007018, 0x01000000}, + {0x0f00701c, 0x01020000}, + {0x0f007020, 0x04030107}, + {0x0f007024, 0x02000007}, + {0x0f007028, 0x02020200}, + {0x0f00702c, 0x0206060a}, + {0x0f007030, 0x050d0d00}, + {0x0f007034, 0x00000003}, + {0x0f007038, 0x170a0200}, + {0x0f00703c, 0x02101012}, + {0x0f007040, 0x45161200}, + {0x0f007044, 0x11250c00}, + {0x0f007048, 0x04da0307}, + {0x0f00704c, 0x00000000}, + {0x0f007050, 0x0000001c}, + {0x0f007054, 0x00000000}, + {0x0f007058, 0x00000000}, + {0x0f00705c, 0x00000000}, + {0x0f007060, 0x00142bb6}, + {0x0f007064, 0x20430014}, + {0x0f007068, 0x00000000}, + {0x0f00706c, 0x00000001}, + {0x0f007070, 0x00009000}, + {0x0f007074, 0x00000000}, + {0x0f007078, 0x00000000}, + {0x0f00707c, 0x00000000}, + {0x0f007080, 0x00000000}, + {0x0f007084, 0x00000000}, + {0x0f007088, 0x01000001}, + {0x0f00708c, 0x00000101}, + {0x0f007090, 0x00000000}, + {0x0f007094, 0x00040000}, + {0x0f007098, 0x00000000}, + {0x0F0070C8, 0x00000104}, + {0x0F007018, 0x01010000} }; #define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 7 //index for 0x0F007000 -static struct bcm_ddr_setting asT3LPB_DDRSetting133MHz[]= {// # DPLL Clock Setting - {0x0f000820,0x03F1365B}, - {0x0f000810,0x00002F95}, - {0x0f000880,0x000003DD}, +static struct bcm_ddr_setting asT3LPB_DDRSetting133MHz[] = {// # DPLL Clock Setting + {0x0f000820, 0x03F1365B}, + {0x0f000810, 0x00002F95}, + {0x0f000880, 0x000003DD}, // Changed source for X-bar and MIPS clock to APLL - {0x0f000840,0x0FFF0000}, - {0x0f000860,0x00000000}, - {0x0F00a044,0x1fffffff}, - {0x0F00a040,0x1f000000}, - {0x0f003050,0x00000021},//flash/eeprom clock divisor which set the flash clock to 20 MHz - {0x0F00a084,0x1Cffffff},//dump from here in internal memory - {0x0F00a080,0x1C000000}, - {0x0F00A000,0x00000016}, + {0x0f000840, 0x0FFF0000}, + {0x0f000860, 0x00000000}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0f003050, 0x00000021},//flash/eeprom clock divisor which set the flash clock to 20 MHz + {0x0F00a084, 0x1Cffffff},//dump from here in internal memory + {0x0F00a080, 0x1C000000}, + {0x0F00A000, 0x00000016}, //Memcontroller Default values - {0x0F007000,0x00010001}, - {0x0F007004,0x01010100}, - {0x0F007008,0x01000001}, - {0x0F00700c,0x00000000}, - {0x0F007010,0x01000000}, - {0x0F007014,0x01000100}, - {0x0F007018,0x01000000}, - {0x0F00701c,0x01020001},// POP - 0x00020001 Normal 0x01020001 - {0x0F007020,0x04030107}, //Normal - 0x04030107 POP - 0x05030107 - {0x0F007024,0x02000007}, - {0x0F007028,0x02020200}, - {0x0F00702c,0x0206060a},//ROB- 0x0205050a,//0x0206060a - {0x0F007030,0x05000000}, - {0x0F007034,0x00000003}, - {0x0F007038,0x190a0200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200 - {0x0F00703C,0x02101017},//ROB - 0x02101010,//0x02101018, - {0x0F007040,0x45171200},//ROB - 0x45751200,//0x450f1200, - {0x0F007044,0x11290D00},//ROB - 0x110a0d00//0x111f0d00 - {0x0F007048,0x04080306}, - {0x0F00704c,0x00000000}, - {0x0F007050,0x0100001c}, - {0x0F007054,0x00000000}, - {0x0F007058,0x00000000}, - {0x0F00705c,0x00000000}, - {0x0F007060,0x0010245F}, - {0x0F007064,0x00000010}, - {0x0F007068,0x00000000}, - {0x0F00706c,0x00000001}, - {0x0F007070,0x00007000}, - {0x0F007074,0x00000000}, - {0x0F007078,0x00000000}, - {0x0F00707C,0x00000000}, - {0x0F007080,0x00000000}, - {0x0F007084,0x00000000}, - {0x0F007088,0x01000001}, - {0x0F00708c,0x00000101}, - {0x0F007090,0x00000000}, + {0x0F007000, 0x00010001}, + {0x0F007004, 0x01010100}, + {0x0F007008, 0x01000001}, + {0x0F00700c, 0x00000000}, + {0x0F007010, 0x01000000}, + {0x0F007014, 0x01000100}, + {0x0F007018, 0x01000000}, + {0x0F00701c, 0x01020001},// POP - 0x00020001 Normal 0x01020001 + {0x0F007020, 0x04030107}, //Normal - 0x04030107 POP - 0x05030107 + {0x0F007024, 0x02000007}, + {0x0F007028, 0x02020200}, + {0x0F00702c, 0x0206060a},//ROB- 0x0205050a,//0x0206060a + {0x0F007030, 0x05000000}, + {0x0F007034, 0x00000003}, + {0x0F007038, 0x190a0200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200 + {0x0F00703C, 0x02101017},//ROB - 0x02101010,//0x02101018, + {0x0F007040, 0x45171200},//ROB - 0x45751200,//0x450f1200, + {0x0F007044, 0x11290D00},//ROB - 0x110a0d00//0x111f0d00 + {0x0F007048, 0x04080306}, + {0x0F00704c, 0x00000000}, + {0x0F007050, 0x0100001c}, + {0x0F007054, 0x00000000}, + {0x0F007058, 0x00000000}, + {0x0F00705c, 0x00000000}, + {0x0F007060, 0x0010245F}, + {0x0F007064, 0x00000010}, + {0x0F007068, 0x00000000}, + {0x0F00706c, 0x00000001}, + {0x0F007070, 0x00007000}, + {0x0F007074, 0x00000000}, + {0x0F007078, 0x00000000}, + {0x0F00707C, 0x00000000}, + {0x0F007080, 0x00000000}, + {0x0F007084, 0x00000000}, + {0x0F007088, 0x01000001}, + {0x0F00708c, 0x00000101}, + {0x0F007090, 0x00000000}, //# Enable BW improvement within memory controller - {0x0F007094,0x00040000}, - {0x0F007098,0x00000000}, - {0x0F0070c8,0x00000104}, + {0x0F007094, 0x00040000}, + {0x0F007098, 0x00000000}, + {0x0F0070c8, 0x00000104}, //# Enable 2 ports within X-bar //# Enable start bit within memory controller - {0x0F007018,0x01010000} + {0x0F007018, 0x01010000} }; #define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 8 //index for 0x0F007000 -static struct bcm_ddr_setting asT3LPB_DDRSetting100MHz[]= {// # DPLL Clock Setting - {0x0f000810,0x00002F95}, - {0x0f000820,0x03F1369B}, - {0x0f000840,0x0fff0000}, - {0x0f000860,0x00000000}, - {0x0f000880,0x000003DD}, +static struct bcm_ddr_setting asT3LPB_DDRSetting100MHz[] = {// # DPLL Clock Setting + {0x0f000810, 0x00002F95}, + {0x0f000820, 0x03F1369B}, + {0x0f000840, 0x0fff0000}, + {0x0f000860, 0x00000000}, + {0x0f000880, 0x000003DD}, // Changed source for X-bar and MIPS clock to APLL - {0x0f000840,0x0FFF0000}, - {0x0F00a044,0x1fffffff}, - {0x0F00a040,0x1f000000}, - {0x0f003050,0x00000021},//flash/eeprom clock divisor which set the flash clock to 20 MHz - {0x0F00a084,0x1Cffffff}, //dump from here in internal memory - {0x0F00a080,0x1C000000}, + {0x0f000840, 0x0FFF0000}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0f003050, 0x00000021},//flash/eeprom clock divisor which set the flash clock to 20 MHz + {0x0F00a084, 0x1Cffffff}, //dump from here in internal memory + {0x0F00a080, 0x1C000000}, //Memcontroller Default values - {0x0F007000,0x00010001}, - {0x0F007004,0x01010100}, - {0x0F007008,0x01000001}, - {0x0F00700c,0x00000000}, - {0x0F007010,0x01000000}, - {0x0F007014,0x01000100}, - {0x0F007018,0x01000000}, - {0x0F00701c,0x01020000},// POP - 0x00020001 Normal 0x01020001 - {0x0F007020,0x04020107}, //Normal - 0x04030107 POP - 0x05030107 - {0x0F007024,0x00000007}, - {0x0F007028,0x01020200}, - {0x0F00702c,0x0204040a},//ROB- 0x0205050a,//0x0206060a - {0x0F007030,0x06000000}, - {0x0F007034,0x00000004}, - {0x0F007038,0x1F080200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200 - {0x0F00703C,0x0203031F},//ROB - 0x02101010,//0x02101018, - {0x0F007040,0x6e001200},//ROB - 0x45751200,//0x450f1200, - {0x0F007044,0x011a0a00},//ROB - 0x110a0d00//0x111f0d00 - {0x0F007048,0x03000305}, - {0x0F00704c,0x00000000}, - {0x0F007050,0x0100001c}, - {0x0F007054,0x00000000}, - {0x0F007058,0x00000000}, - {0x0F00705c,0x00000000}, - {0x0F007060,0x00082ED6}, - {0x0F007064,0x0000000A}, - {0x0F007068,0x00000000}, - {0x0F00706c,0x00000001}, - {0x0F007070,0x00005000}, - {0x0F007074,0x00000000}, - {0x0F007078,0x00000000}, - {0x0F00707C,0x00000000}, - {0x0F007080,0x00000000}, - {0x0F007084,0x00000000}, - {0x0F007088,0x01000001}, - {0x0F00708c,0x00000101}, - {0x0F007090,0x00000000}, - {0x0F007094,0x00010000}, - {0x0F007098,0x00000000}, - {0x0F0070C8,0x00000104}, + {0x0F007000, 0x00010001}, + {0x0F007004, 0x01010100}, + {0x0F007008, 0x01000001}, + {0x0F00700c, 0x00000000}, + {0x0F007010, 0x01000000}, + {0x0F007014, 0x01000100}, + {0x0F007018, 0x01000000}, + {0x0F00701c, 0x01020000},// POP - 0x00020001 Normal 0x01020001 + {0x0F007020, 0x04020107}, //Normal - 0x04030107 POP - 0x05030107 + {0x0F007024, 0x00000007}, + {0x0F007028, 0x01020200}, + {0x0F00702c, 0x0204040a},//ROB- 0x0205050a,//0x0206060a + {0x0F007030, 0x06000000}, + {0x0F007034, 0x00000004}, + {0x0F007038, 0x1F080200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200 + {0x0F00703C, 0x0203031F},//ROB - 0x02101010,//0x02101018, + {0x0F007040, 0x6e001200},//ROB - 0x45751200,//0x450f1200, + {0x0F007044, 0x011a0a00},//ROB - 0x110a0d00//0x111f0d00 + {0x0F007048, 0x03000305}, + {0x0F00704c, 0x00000000}, + {0x0F007050, 0x0100001c}, + {0x0F007054, 0x00000000}, + {0x0F007058, 0x00000000}, + {0x0F00705c, 0x00000000}, + {0x0F007060, 0x00082ED6}, + {0x0F007064, 0x0000000A}, + {0x0F007068, 0x00000000}, + {0x0F00706c, 0x00000001}, + {0x0F007070, 0x00005000}, + {0x0F007074, 0x00000000}, + {0x0F007078, 0x00000000}, + {0x0F00707C, 0x00000000}, + {0x0F007080, 0x00000000}, + {0x0F007084, 0x00000000}, + {0x0F007088, 0x01000001}, + {0x0F00708c, 0x00000101}, + {0x0F007090, 0x00000000}, + {0x0F007094, 0x00010000}, + {0x0F007098, 0x00000000}, + {0x0F0070C8, 0x00000104}, //# Enable 2 ports within X-bar - {0x0F00A000,0x00000016}, + {0x0F00A000, 0x00000016}, //# Enable start bit within memory controller - {0x0F007018,0x01010000} + {0x0F007018, 0x01010000} }; #define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 7 //index for 0x0F007000 -static struct bcm_ddr_setting asT3LPB_DDRSetting80MHz[]= {// # DPLL Clock Setting - {0x0f000820,0x07F13FFF}, - {0x0f000810,0x00002F95}, - {0x0f000860,0x00000000}, - {0x0f000880,0x000003DD}, - {0x0f000840,0x0FFF1F00}, - {0x0F00a044,0x1fffffff}, - {0x0F00a040,0x1f000000}, - {0x0f003050,0x00000021},//flash/eeprom clock divisor which set the flash clock to 20 MHz - {0x0F00a084,0x1Cffffff},// dump from here in internal memory - {0x0F00a080,0x1C000000}, - {0x0F00A000,0x00000016}, - {0x0f007000,0x00010001}, - {0x0f007004,0x01000000}, - {0x0f007008,0x01000001}, - {0x0f00700c,0x00000000}, - {0x0f007010,0x01000000}, - {0x0f007014,0x01000100}, - {0x0f007018,0x01000000}, - {0x0f00701c,0x01020000}, - {0x0f007020,0x04020107}, - {0x0f007024,0x00000007}, - {0x0f007028,0x02020200}, - {0x0f00702c,0x0204040a}, - {0x0f007030,0x04000000}, - {0x0f007034,0x00000002}, - {0x0f007038,0x1d060200}, - {0x0f00703c,0x1c22221d}, - {0x0f007040,0x8A116600}, - {0x0f007044,0x222d0800}, - {0x0f007048,0x02690204}, - {0x0f00704c,0x00000000}, - {0x0f007050,0x0100001c}, - {0x0f007054,0x00000000}, - {0x0f007058,0x00000000}, - {0x0f00705c,0x00000000}, - {0x0f007060,0x000A15D6}, - {0x0f007064,0x0000000A}, - {0x0f007068,0x00000000}, - {0x0f00706c,0x00000001}, - {0x0f007070,0x00004000}, - {0x0f007074,0x00000000}, - {0x0f007078,0x00000000}, - {0x0f00707c,0x00000000}, - {0x0f007080,0x00000000}, - {0x0f007084,0x00000000}, - {0x0f007088,0x01000001}, - {0x0f00708c,0x00000101}, - {0x0f007090,0x00000000}, - {0x0f007094,0x00010000}, - {0x0f007098,0x00000000}, - {0x0F0070C8,0x00000104}, - {0x0F007018,0x01010000} +static struct bcm_ddr_setting asT3LPB_DDRSetting80MHz[] = {// # DPLL Clock Setting + {0x0f000820, 0x07F13FFF}, + {0x0f000810, 0x00002F95}, + {0x0f000860, 0x00000000}, + {0x0f000880, 0x000003DD}, + {0x0f000840, 0x0FFF1F00}, + {0x0F00a044, 0x1fffffff}, + {0x0F00a040, 0x1f000000}, + {0x0f003050, 0x00000021},//flash/eeprom clock divisor which set the flash clock to 20 MHz + {0x0F00a084, 0x1Cffffff},// dump from here in internal memory + {0x0F00a080, 0x1C000000}, + {0x0F00A000, 0x00000016}, + {0x0f007000, 0x00010001}, + {0x0f007004, 0x01000000}, + {0x0f007008, 0x01000001}, + {0x0f00700c, 0x00000000}, + {0x0f007010, 0x01000000}, + {0x0f007014, 0x01000100}, + {0x0f007018, 0x01000000}, + {0x0f00701c, 0x01020000}, + {0x0f007020, 0x04020107}, + {0x0f007024, 0x00000007}, + {0x0f007028, 0x02020200}, + {0x0f00702c, 0x0204040a}, + {0x0f007030, 0x04000000}, + {0x0f007034, 0x00000002}, + {0x0f007038, 0x1d060200}, + {0x0f00703c, 0x1c22221d}, + {0x0f007040, 0x8A116600}, + {0x0f007044, 0x222d0800}, + {0x0f007048, 0x02690204}, + {0x0f00704c, 0x00000000}, + {0x0f007050, 0x0100001c}, + {0x0f007054, 0x00000000}, + {0x0f007058, 0x00000000}, + {0x0f00705c, 0x00000000}, + {0x0f007060, 0x000A15D6}, + {0x0f007064, 0x0000000A}, + {0x0f007068, 0x00000000}, + {0x0f00706c, 0x00000001}, + {0x0f007070, 0x00004000}, + {0x0f007074, 0x00000000}, + {0x0f007078, 0x00000000}, + {0x0f00707c, 0x00000000}, + {0x0f007080, 0x00000000}, + {0x0f007084, 0x00000000}, + {0x0f007088, 0x01000001}, + {0x0f00708c, 0x00000101}, + {0x0f007090, 0x00000000}, + {0x0f007094, 0x00010000}, + {0x0f007098, 0x00000000}, + {0x0F0070C8, 0x00000104}, + {0x0F007018, 0x01010000} }; int ddr_init(struct bcm_mini_adapter *Adapter) { - struct bcm_ddr_setting *psDDRSetting=NULL; - ULONG RegCount=0; + struct bcm_ddr_setting *psDDRSetting = NULL; + ULONG RegCount = 0; UINT value = 0; UINT uiResetValue = 0; UINT uiClockSetting = 0; @@ -787,20 +786,20 @@ int ddr_init(struct bcm_mini_adapter *Adapter) switch (Adapter->DDRSetting) { case DDR_80_MHZ: - psDDRSetting=asT3LP_DDRSetting80MHz; - RegCount=(sizeof(asT3LP_DDRSetting80MHz)/ + psDDRSetting = asT3LP_DDRSetting80MHz; + RegCount = (sizeof(asT3LP_DDRSetting80MHz)/ sizeof(struct bcm_ddr_setting)); break; case DDR_100_MHZ: - psDDRSetting=asT3LP_DDRSetting100MHz; - RegCount=(sizeof(asT3LP_DDRSetting100MHz)/ + psDDRSetting = asT3LP_DDRSetting100MHz; + RegCount = (sizeof(asT3LP_DDRSetting100MHz)/ sizeof(struct bcm_ddr_setting)); break; case DDR_133_MHZ: - psDDRSetting=asT3LP_DDRSetting133MHz; - RegCount=(sizeof(asT3LP_DDRSetting133MHz)/ + psDDRSetting = asT3LP_DDRSetting133MHz; + RegCount = (sizeof(asT3LP_DDRSetting133MHz)/ sizeof(struct bcm_ddr_setting)); - if(Adapter->bMipsConfig == MIPS_200_MHZ) + if (Adapter->bMipsConfig == MIPS_200_MHZ) { uiClockSetting = 0x03F13652; } @@ -818,47 +817,47 @@ int ddr_init(struct bcm_mini_adapter *Adapter) case BCS220_2: case BCS220_2BC: case BCS250_BC: - case BCS220_3 : + case BCS220_3: /* Set bit 2 and bit 6 to 1 for BBIC 2mA drive * (please check current value and additionally set these bits) */ - if( (Adapter->chip_id != BCS220_2) && + if ((Adapter->chip_id != BCS220_2) && (Adapter->chip_id != BCS220_2BC) && - (Adapter->chip_id != BCS220_3) ) + (Adapter->chip_id != BCS220_3)) { - retval= rdmalt(Adapter,(UINT)0x0f000830, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + retval = rdmalt(Adapter,(UINT)0x0f000830, &uiResetValue, sizeof(uiResetValue)); + if (retval < 0) { BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } uiResetValue |= 0x44; retval = wrmalt(Adapter,(UINT)0x0f000830, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } } - switch(Adapter->DDRSetting) + switch (Adapter->DDRSetting) { case DDR_80_MHZ: psDDRSetting = asT3LPB_DDRSetting80MHz; - RegCount=(sizeof(asT3B_DDRSetting80MHz)/ + RegCount = (sizeof(asT3B_DDRSetting80MHz)/ sizeof(struct bcm_ddr_setting)); break; case DDR_100_MHZ: - psDDRSetting=asT3LPB_DDRSetting100MHz; - RegCount=(sizeof(asT3B_DDRSetting100MHz)/ + psDDRSetting = asT3LPB_DDRSetting100MHz; + RegCount = (sizeof(asT3B_DDRSetting100MHz)/ sizeof(struct bcm_ddr_setting)); break; case DDR_133_MHZ: psDDRSetting = asT3LPB_DDRSetting133MHz; - RegCount=(sizeof(asT3B_DDRSetting133MHz)/ + RegCount = (sizeof(asT3B_DDRSetting133MHz)/ sizeof(struct bcm_ddr_setting)); - if(Adapter->bMipsConfig == MIPS_200_MHZ) + if (Adapter->bMipsConfig == MIPS_200_MHZ) { uiClockSetting = 0x03F13652; } @@ -872,7 +871,7 @@ int ddr_init(struct bcm_mini_adapter *Adapter) psDDRSetting = asT3LPB_DDRSetting160MHz; RegCount = sizeof(asT3LPB_DDRSetting160MHz)/sizeof(struct bcm_ddr_setting); - if(Adapter->bMipsConfig == MIPS_200_MHZ) + if (Adapter->bMipsConfig == MIPS_200_MHZ) { uiClockSetting = 0x03F137D2; } @@ -915,30 +914,30 @@ int ddr_init(struct bcm_mini_adapter *Adapter) { case DDR_80_MHZ: psDDRSetting = asT3B_DDRSetting80MHz; - RegCount=(sizeof(asT3B_DDRSetting80MHz)/ + RegCount = (sizeof(asT3B_DDRSetting80MHz)/ sizeof(struct bcm_ddr_setting)); break; case DDR_100_MHZ: - psDDRSetting=asT3B_DDRSetting100MHz; - RegCount=(sizeof(asT3B_DDRSetting100MHz)/ + psDDRSetting = asT3B_DDRSetting100MHz; + RegCount = (sizeof(asT3B_DDRSetting100MHz)/ sizeof(struct bcm_ddr_setting)); break; case DDR_133_MHZ: - if(Adapter->bDPLLConfig == PLL_266_MHZ)//266Mhz PLL selected. + if (Adapter->bDPLLConfig == PLL_266_MHZ)//266Mhz PLL selected. { memcpy(asT3B_DDRSetting133MHz, asDPLL_266MHZ, sizeof(asDPLL_266MHZ)); psDDRSetting = asT3B_DDRSetting133MHz; - RegCount=(sizeof(asT3B_DDRSetting133MHz)/ + RegCount = (sizeof(asT3B_DDRSetting133MHz)/ sizeof(struct bcm_ddr_setting)); } else { psDDRSetting = asT3B_DDRSetting133MHz; - RegCount=(sizeof(asT3B_DDRSetting133MHz)/ + RegCount = (sizeof(asT3B_DDRSetting133MHz)/ sizeof(struct bcm_ddr_setting)); - if(Adapter->bMipsConfig == MIPS_200_MHZ) + if (Adapter->bMipsConfig == MIPS_200_MHZ) { uiClockSetting = 0x07F13652; } @@ -958,11 +957,11 @@ int ddr_init(struct bcm_mini_adapter *Adapter) return -EINVAL; } - value=0; + value = 0; BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Register Count is =%lu\n", RegCount); - while(RegCount && !retval) + while (RegCount && !retval) { - if(uiClockSetting && psDDRSetting->ulRegAddress == MIPS_CLOCK_REG) + if (uiClockSetting && psDDRSetting->ulRegAddress == MIPS_CLOCK_REG) { value = uiClockSetting; } @@ -971,7 +970,7 @@ int ddr_init(struct bcm_mini_adapter *Adapter) value = psDDRSetting->ulRegValue; } retval = wrmalt(Adapter, psDDRSetting->ulRegAddress, &value, sizeof(value)); - if(STATUS_SUCCESS != retval) { + if (STATUS_SUCCESS != retval) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "%s:%d\n", __func__, __LINE__); break; } @@ -980,36 +979,36 @@ int ddr_init(struct bcm_mini_adapter *Adapter) psDDRSetting++; } - if(Adapter->chip_id >= 0xbece3300 ) + if (Adapter->chip_id >= 0xbece3300) { mdelay(3); - if( (Adapter->chip_id != BCS220_2)&& - (Adapter->chip_id != BCS220_2BC)&& + if ((Adapter->chip_id != BCS220_2) && + (Adapter->chip_id != BCS220_2BC) && (Adapter->chip_id != BCS220_3)) { /* drive MDDR to half in case of UMA-B: */ uiResetValue = 0x01010001; retval = wrmalt(Adapter, (UINT)0x0F007018, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } uiResetValue = 0x00040020; retval = wrmalt(Adapter, (UINT)0x0F007094, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } uiResetValue = 0x01020101; retval = wrmalt(Adapter, (UINT)0x0F00701c, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } uiResetValue = 0x01010000; retval = wrmalt(Adapter, (UINT)0x0F007018, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } @@ -1022,73 +1021,73 @@ int ddr_init(struct bcm_mini_adapter *Adapter) * and since we dont have internal PMU lets do it under UMA-B chip id. * we will change this when we will have internal PMU. */ - if(Adapter->PmuMode == HYBRID_MODE_7C) + if (Adapter->PmuMode == HYBRID_MODE_7C) { retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } uiResetValue = 0x1322a8; retval = wrmalt(Adapter, (UINT)0x0f000d1c, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } uiResetValue = 0x132296; retval = wrmalt(Adapter, (UINT)0x0f000d14, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } } - else if(Adapter->PmuMode == HYBRID_MODE_6 ) + else if (Adapter->PmuMode == HYBRID_MODE_6) { retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } uiResetValue = 0x6003229a; retval = wrmalt(Adapter, (UINT)0x0f000d14, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } uiResetValue = 0x1322a8; retval = wrmalt(Adapter, (UINT)0x0f000d1c, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } @@ -1101,8 +1100,8 @@ int ddr_init(struct bcm_mini_adapter *Adapter) int download_ddr_settings(struct bcm_mini_adapter *Adapter) { - struct bcm_ddr_setting *psDDRSetting=NULL; - ULONG RegCount=0; + struct bcm_ddr_setting *psDDRSetting = NULL; + ULONG RegCount = 0; unsigned long ul_ddr_setting_load_addr = DDR_DUMP_INTERNAL_DEVICE_MEMORY; UINT value = 0; int retval = STATUS_SUCCESS; @@ -1116,20 +1115,20 @@ int download_ddr_settings(struct bcm_mini_adapter *Adapter) case DDR_80_MHZ: psDDRSetting = asT3LP_DDRSetting80MHz; RegCount = ARRAY_SIZE(asT3LP_DDRSetting80MHz); - RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_80MHZ ; + RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_80MHZ; psDDRSetting += T3LP_SKIP_CLOCK_PROGRAM_DUMP_80MHZ; break; case DDR_100_MHZ: psDDRSetting = asT3LP_DDRSetting100MHz; RegCount = ARRAY_SIZE(asT3LP_DDRSetting100MHz); - RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_100MHZ ; + RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_100MHZ; psDDRSetting += T3LP_SKIP_CLOCK_PROGRAM_DUMP_100MHZ; break; case DDR_133_MHZ: bOverrideSelfRefresh = TRUE; psDDRSetting = asT3LP_DDRSetting133MHz; RegCount = ARRAY_SIZE(asT3LP_DDRSetting133MHz); - RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ; + RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_133MHZ; psDDRSetting += T3LP_SKIP_CLOCK_PROGRAM_DUMP_133MHZ; break; default: @@ -1141,26 +1140,26 @@ int download_ddr_settings(struct bcm_mini_adapter *Adapter) case BCS220_2: case BCS220_2BC: case BCS250_BC: - case BCS220_3 : + case BCS220_3: switch (Adapter->DDRSetting) { case DDR_80_MHZ: psDDRSetting = asT3LPB_DDRSetting80MHz; - RegCount=ARRAY_SIZE(asT3LPB_DDRSetting80MHz); - RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_80MHZ ; + RegCount = ARRAY_SIZE(asT3LPB_DDRSetting80MHz); + RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_80MHZ; psDDRSetting += T3LPB_SKIP_CLOCK_PROGRAM_DUMP_80MHZ; break; case DDR_100_MHZ: psDDRSetting = asT3LPB_DDRSetting100MHz; RegCount = ARRAY_SIZE(asT3LPB_DDRSetting100MHz); - RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_100MHZ ; + RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_100MHZ; psDDRSetting += T3LPB_SKIP_CLOCK_PROGRAM_DUMP_100MHZ; break; case DDR_133_MHZ: bOverrideSelfRefresh = TRUE; psDDRSetting = asT3LPB_DDRSetting133MHz; RegCount = ARRAY_SIZE(asT3LPB_DDRSetting133MHz); - RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ; + RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_133MHZ; psDDRSetting += T3LPB_SKIP_CLOCK_PROGRAM_DUMP_133MHZ; break; @@ -1182,20 +1181,20 @@ int download_ddr_settings(struct bcm_mini_adapter *Adapter) case DDR_80_MHZ: psDDRSetting = asT3_DDRSetting80MHz; RegCount = ARRAY_SIZE(asT3_DDRSetting80MHz); - RegCount-=T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ ; + RegCount -= T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ; psDDRSetting += T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ; break; case DDR_100_MHZ: psDDRSetting = asT3_DDRSetting100MHz; RegCount = ARRAY_SIZE(asT3_DDRSetting100MHz); - RegCount-=T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ ; + RegCount -= T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ; psDDRSetting += T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ; break; case DDR_133_MHZ: psDDRSetting = asT3_DDRSetting133MHz; RegCount = ARRAY_SIZE(asT3_DDRSetting133MHz); - RegCount-=T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ; - psDDRSetting += T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ; + RegCount -= T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ; + psDDRSetting += T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ; break; default: return -EINVAL; @@ -1208,20 +1207,20 @@ int download_ddr_settings(struct bcm_mini_adapter *Adapter) case DDR_80_MHZ: psDDRSetting = asT3B_DDRSetting80MHz; RegCount = ARRAY_SIZE(asT3B_DDRSetting80MHz); - RegCount -= T3B_SKIP_CLOCK_PROGRAM_DUMP_80MHZ ; + RegCount -= T3B_SKIP_CLOCK_PROGRAM_DUMP_80MHZ; psDDRSetting += T3B_SKIP_CLOCK_PROGRAM_DUMP_80MHZ; break; case DDR_100_MHZ: psDDRSetting = asT3B_DDRSetting100MHz; RegCount = ARRAY_SIZE(asT3B_DDRSetting100MHz); - RegCount -= T3B_SKIP_CLOCK_PROGRAM_DUMP_100MHZ ; + RegCount -= T3B_SKIP_CLOCK_PROGRAM_DUMP_100MHZ; psDDRSetting += T3B_SKIP_CLOCK_PROGRAM_DUMP_100MHZ; break; case DDR_133_MHZ: bOverrideSelfRefresh = TRUE; psDDRSetting = asT3B_DDRSetting133MHz; RegCount = ARRAY_SIZE(asT3B_DDRSetting133MHz); - RegCount -= T3B_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ; + RegCount -= T3B_SKIP_CLOCK_PROGRAM_DUMP_133MHZ; psDDRSetting += T3B_SKIP_CLOCK_PROGRAM_DUMP_133MHZ; break; } @@ -1231,9 +1230,9 @@ int download_ddr_settings(struct bcm_mini_adapter *Adapter) return -EINVAL; } //total number of Register that has to be dumped - value =RegCount ; + value = RegCount; retval = wrmalt(Adapter, ul_ddr_setting_load_addr, &value, sizeof(value)); - if(retval) + if (retval) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "%s:%d\n", __func__, __LINE__); @@ -1241,29 +1240,29 @@ int download_ddr_settings(struct bcm_mini_adapter *Adapter) } ul_ddr_setting_load_addr += sizeof(ULONG); /*signature */ - value =(0x1d1e0dd0); + value = (0x1d1e0dd0); retval = wrmalt(Adapter, ul_ddr_setting_load_addr, &value, sizeof(value)); - if(retval) + if (retval) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "%s:%d\n", __func__, __LINE__); return retval; } ul_ddr_setting_load_addr += sizeof(ULONG); - RegCount*=(sizeof(struct bcm_ddr_setting)/sizeof(ULONG)); + RegCount *= (sizeof(struct bcm_ddr_setting)/sizeof(ULONG)); - while(RegCount && !retval) + while (RegCount && !retval) { - value = psDDRSetting->ulRegAddress ; - retval = wrmalt( Adapter, ul_ddr_setting_load_addr, &value, sizeof(value)); + value = psDDRSetting->ulRegAddress; + retval = wrmalt(Adapter, ul_ddr_setting_load_addr, &value, sizeof(value)); ul_ddr_setting_load_addr += sizeof(ULONG); - if(!retval) + if (!retval) { - if(bOverrideSelfRefresh && (psDDRSetting->ulRegAddress == 0x0F007018)) + if (bOverrideSelfRefresh && (psDDRSetting->ulRegAddress == 0x0F007018)) { value = (psDDRSetting->ulRegValue |(1<<8)); - if(STATUS_SUCCESS != wrmalt(Adapter, ul_ddr_setting_load_addr, - &value, sizeof(value))){ + if (STATUS_SUCCESS != wrmalt(Adapter, ul_ddr_setting_load_addr, + &value, sizeof(value))) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "%s:%d\n", __func__, __LINE__); break; } @@ -1272,8 +1271,8 @@ int download_ddr_settings(struct bcm_mini_adapter *Adapter) { value = psDDRSetting->ulRegValue; - if(STATUS_SUCCESS != wrmalt(Adapter, ul_ddr_setting_load_addr , - &value, sizeof(value))){ + if (STATUS_SUCCESS != wrmalt(Adapter, ul_ddr_setting_load_addr , + &value, sizeof(value))) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "%s:%d\n", __func__, __LINE__); break; } @@ -1285,5 +1284,3 @@ int download_ddr_settings(struct bcm_mini_adapter *Adapter) } return retval; } - - From 7fae8b0a0b09b59539e8056f943b3cf0c60b738f Mon Sep 17 00:00:00 2001 From: Ingrid Cheung Date: Sat, 9 Nov 2013 20:53:21 -0500 Subject: [PATCH 064/238] Staging: bcm: Fix checkpatch warning for long line. Fixed a line that was over 80 characters in Bcmchar.c. Signed-off-by: Ingrid Cheung Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/bcm/Bcmchar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index ed45b2161d49..2cf64df22938 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -160,7 +160,9 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) 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); + 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); if (_IOC_TYPE(cmd) != BCM_IOCTL) return -EFAULT; From 5570de180d4a69f582564db82e89b08bfa09a151 Mon Sep 17 00:00:00 2001 From: Ingrid Cheung Date: Sat, 9 Nov 2013 23:02:50 -0500 Subject: [PATCH 065/238] Staging: bcm: Fix checkpatch warnings for long lines. Fixes multiple checkpatch warnings for long lines in Bcmchar.c. Signed-off-by: Ingrid Cheung Signed-off-by: Greg Kroah-Hartman --- drivers/staging/bcm/Bcmchar.c | 116 ++++++++++++++++++++++++---------- 1 file changed, 83 insertions(+), 33 deletions(-) diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index 2cf64df22938..6385b57572fa 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -268,7 +268,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) (uiTempVar == EEPROM_REJECT_REG_3) || (uiTempVar == EEPROM_REJECT_REG_4))) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "EEPROM Access Denied, not in VSG Mode\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, + "EEPROM Access Denied, not in VSG Mode\n"); return -EFAULT; } @@ -276,9 +277,11 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) (PUINT)sWrmBuffer.Data, sizeof(ULONG)); if (Status == STATUS_SUCCESS) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "WRM Done\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, + DBG_LVL_ALL, "WRM Done\n"); } else { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "WRM Failed\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, + DBG_LVL_ALL, "WRM Failed\n"); Status = -EFAULT; } break; @@ -293,7 +296,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) (Adapter->bShutStatus == TRUE) || (Adapter->bPreparingForLowPowerMode == TRUE)) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Device in Idle Mode, Blocking Rdms\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, + "Device in Idle Mode, Blocking Rdms\n"); return -EACCES; } @@ -319,7 +323,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) if ((((ULONG)sRdmBuffer.Register & 0x0F000000) != 0x0F000000) || ((ULONG)sRdmBuffer.Register & 0x3)) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "RDM Done On invalid Address : %x Access Denied.\n", + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, + "RDM Done On invalid Address : %x Access Denied.\n", (int)sRdmBuffer.Register); kfree(temp_buff); @@ -327,7 +332,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) } uiTempVar = sRdmBuffer.Register & EEPROM_REJECT_MASK; - bytes = rdmaltWithLock(Adapter, (UINT)sRdmBuffer.Register, (PUINT)temp_buff, IoBuffer.OutputLength); + bytes = rdmaltWithLock(Adapter, (UINT)sRdmBuffer.Register, + (PUINT)temp_buff, IoBuffer.OutputLength); if (bytes > 0) { Status = STATUS_SUCCESS; @@ -351,7 +357,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) (Adapter->bShutStatus == TRUE) || (Adapter->bPreparingForLowPowerMode == TRUE)) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Device in Idle Mode, Blocking Wrms\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, + "Device in Idle Mode, Blocking Wrms\n"); return -EACCES; } @@ -369,7 +376,9 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) if ((((ULONG)sWrmBuffer.Register & 0x0F000000) != 0x0F000000) || ((ULONG)sWrmBuffer.Register & 0x3)) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "WRM Done On invalid Address : %x Access Denied.\n", (int)sWrmBuffer.Register); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, + "WRM Done On invalid Address : %x Access Denied.\n", + (int)sWrmBuffer.Register); return -EINVAL; } @@ -381,17 +390,21 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) (uiTempVar == EEPROM_REJECT_REG_4)) && (cmd == IOCTL_BCM_REGISTER_WRITE)) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "EEPROM Access Denied, not in VSG Mode\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, + "EEPROM Access Denied, not in VSG Mode\n"); return -EFAULT; } Status = wrmaltWithLock(Adapter, (UINT)sWrmBuffer.Register, - (PUINT)sWrmBuffer.Data, sWrmBuffer.Length); + (PUINT)sWrmBuffer.Data, + sWrmBuffer.Length); if (Status == STATUS_SUCCESS) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, OSAL_DBG, DBG_LVL_ALL, "WRM Done\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, OSAL_DBG, + DBG_LVL_ALL, "WRM Done\n"); } else { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "WRM Failed\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, + DBG_LVL_ALL, "WRM Failed\n"); Status = -EFAULT; } break; @@ -407,7 +420,9 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) (Adapter->bShutStatus == TRUE) || (Adapter->bPreparingForLowPowerMode == TRUE)) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "GPIO Can't be set/clear in Low power Mode"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, + DBG_LVL_ALL, + "GPIO Can't be set/clear in Low power Mode"); return -EACCES; } @@ -425,7 +440,10 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) value = (1< is not correspond to LED !!!", value); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, + DBG_LVL_ALL, + "Sorry, Requested GPIO<0x%X> is not correspond to LED !!!", + value); Status = -EINVAL; break; } @@ -433,27 +451,42 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) /* Set - setting 1 */ if (uiOperation) { /* Set the gpio output register */ - Status = wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_SET_REG, (PUINT)(&value), sizeof(UINT)); + Status = wrmaltWithLock(Adapter, + BCM_GPIO_OUTPUT_SET_REG, + (PUINT)(&value), sizeof(UINT)); if (Status == STATUS_SUCCESS) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Set the GPIO bit\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, + OSAL_DBG, DBG_LVL_ALL, + "Set the GPIO bit\n"); } else { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Failed to set the %dth GPIO\n", uiBit); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, + OSAL_DBG, DBG_LVL_ALL, + "Failed to set the %dth GPIO\n", + uiBit); break; } } else { /* Set the gpio output register */ - Status = wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_CLR_REG, (PUINT)(&value), sizeof(UINT)); + Status = wrmaltWithLock(Adapter, + BCM_GPIO_OUTPUT_CLR_REG, + (PUINT)(&value), sizeof(UINT)); if (Status == STATUS_SUCCESS) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Set the GPIO bit\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, + OSAL_DBG, DBG_LVL_ALL, + "Set the GPIO bit\n"); } else { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Failed to clear the %dth GPIO\n", uiBit); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, + OSAL_DBG, DBG_LVL_ALL, + "Failed to clear the %dth GPIO\n", + uiBit); break; } } - bytes = rdmaltWithLock(Adapter, (UINT)GPIO_MODE_REGISTER, (PUINT)ucResetValue, sizeof(UINT)); + bytes = rdmaltWithLock(Adapter, (UINT)GPIO_MODE_REGISTER, + (PUINT)ucResetValue, sizeof(UINT)); if (bytes < 0) { Status = bytes; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, @@ -469,9 +502,13 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) (PUINT)ucResetValue, sizeof(UINT)); if (Status == STATUS_SUCCESS) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Set the GPIO to output Mode\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, + DBG_LVL_ALL, + "Set the GPIO to output Mode\n"); } else { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Failed to put GPIO in Output Mode\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, + DBG_LVL_ALL, + "Failed to put GPIO in Output Mode\n"); break; } } @@ -479,13 +516,16 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) case BCM_LED_THREAD_STATE_CHANGE_REQ: { struct bcm_user_thread_req threadReq = {0}; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "User made LED thread InActive"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, + "User made LED thread InActive"); if ((Adapter->IdleMode == TRUE) || (Adapter->bShutStatus == TRUE) || (Adapter->bPreparingForLowPowerMode == TRUE)) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "GPIO Can't be set/clear in Low power Mode"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, + DBG_LVL_ALL, + "GPIO Can't be set/clear in Low power Mode"); Status = -EACCES; break; } @@ -502,10 +542,14 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) /* if LED thread is running(Actively or Inactively) set it state to make inactive */ if (Adapter->LEDInfo.led_thread_running) { if (threadReq.ThreadState == LED_THREAD_ACTIVATION_REQ) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Activating thread req"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, + OSAL_DBG, DBG_LVL_ALL, + "Activating thread req"); Adapter->DriverState = LED_THREAD_ACTIVE; } else { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "DeActivating Thread req....."); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, + OSAL_DBG, DBG_LVL_ALL, + "DeActivating Thread req....."); Adapter->DriverState = LED_THREAD_INACTIVE; } @@ -542,7 +586,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) if (bytes < 0) { Status = bytes; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "RDM Failed\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, + "RDM Failed\n"); return Status; } else { Status = STATUS_SUCCESS; @@ -572,9 +617,11 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) return -EFAULT; if (IsReqGpioIsLedInNVM(Adapter, pgpio_multi_info[WIMAX_IDX].uiGPIOMask) == false) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, + DBG_LVL_ALL, "Sorry, Requested GPIO<0x%X> is not correspond to NVM LED bit map<0x%X>!!!", - pgpio_multi_info[WIMAX_IDX].uiGPIOMask, Adapter->gpioBitMap); + pgpio_multi_info[WIMAX_IDX].uiGPIOMask, + Adapter->gpioBitMap); Status = -EINVAL; break; } @@ -592,7 +639,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) (PUINT)ucResetValue, sizeof(ULONG)); if (Status != STATUS_SUCCESS) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "WRM to BCM_GPIO_OUTPUT_SET_REG Failed."); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, + "WRM to BCM_GPIO_OUTPUT_SET_REG Failed."); return Status; } @@ -605,7 +653,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) Status = wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_CLR_REG, (PUINT)ucResetValue, sizeof(ULONG)); if (Status != STATUS_SUCCESS) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "WRM to BCM_GPIO_OUTPUT_CLR_REG Failed."); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, + "WRM to BCM_GPIO_OUTPUT_CLR_REG Failed."); return Status; } } @@ -615,7 +664,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg) if (bytes < 0) { Status = bytes; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "RDM to GPIO_PIN_STATE_REGISTER Failed."); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, + "RDM to GPIO_PIN_STATE_REGISTER Failed."); return Status; } else { Status = STATUS_SUCCESS; From 8bf961c8c2e3a5c8f0148a49cccda866f166e060 Mon Sep 17 00:00:00 2001 From: Ebru Akagunduz Date: Fri, 1 Nov 2013 19:00:38 +0200 Subject: [PATCH 066/238] Staging: media: fix space prohibited before semicolon Fix checkpatch.pl issues with space prohibited before semicolon in dm365_ipipe.c Signed-off-by: Ebru Akagunduz Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/davinci_vpfe/dm365_ipipe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c index 766a071b0a22..b7044a380fe3 100644 --- a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c +++ b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c @@ -1009,7 +1009,7 @@ static int ipipe_validate_yee_params(struct vpfe_ipipe_yee *yee) yee->es_ofst_grad > YEE_THR_MASK) return -EINVAL; - for (i = 0; i < VPFE_IPIPE_MAX_SIZE_YEE_LUT ; i++) + for (i = 0; i < VPFE_IPIPE_MAX_SIZE_YEE_LUT; i++) if (yee->table[i] > YEE_ENTRY_MASK) return -EINVAL; From 5c72afd8f49b0b7c1a8fce7930c94e9ba7eef855 Mon Sep 17 00:00:00 2001 From: Himangi Saraogi Date: Sat, 2 Nov 2013 17:50:56 +0530 Subject: [PATCH 067/238] staging:media:go7007:go7007-fw.c: move trailing statement to next line This patch removes the checkpatch.pl error "trailing statements should be on next line" in go7007-fw.c. Signed-off-by: Himangi Saraogi Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/go7007/go7007-fw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/go7007/go7007-fw.c b/drivers/staging/media/go7007/go7007-fw.c index c2d0e58afc34..479953b2d983 100644 --- a/drivers/staging/media/go7007/go7007-fw.c +++ b/drivers/staging/media/go7007/go7007-fw.c @@ -722,7 +722,8 @@ static int vti_bitlen(struct go7007 *go) { unsigned int i, max_time_incr = go->sensor_framerate / go->fps_scale; - for (i = 31; (max_time_incr & ((1 << i) - 1)) == max_time_incr; --i); + for (i = 31; (max_time_incr & ((1 << i) - 1)) == max_time_incr; --i) + ; return i + 1; } From 432b29c4175b7e3895760a7180ec13a687cca839 Mon Sep 17 00:00:00 2001 From: Himangi Saraogi Date: Sat, 2 Nov 2013 22:42:22 +0530 Subject: [PATCH 068/238] staging:media:go7007:saa7134-go7007.c: Remove space before tabs This patch removes the checkpatch.pl warning "please, no space before tabs" in saa7134-go7007.c by converting space followed by tab to tab followed by tab. Signed-off-by: Himangi Saraogi Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/go7007/saa7134-go7007.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/go7007/saa7134-go7007.c b/drivers/staging/media/go7007/saa7134-go7007.c index d80b235d72ee..6e2ca338cdd9 100644 --- a/drivers/staging/media/go7007/saa7134-go7007.c +++ b/drivers/staging/media/go7007/saa7134-go7007.c @@ -86,7 +86,7 @@ static const struct go7007_board_info board_voyager = { .audio_main_div = 2, .hpi_buffer_cap = 7, .num_inputs = 1, - .inputs = { + .inputs = { { .name = "SAA7134", }, From 430dfd55eea22bff4b3a6b0f5de933af4a2a011d Mon Sep 17 00:00:00 2001 From: Archana kumari Date: Sun, 3 Nov 2013 11:51:31 +0530 Subject: [PATCH 069/238] staging: media: davinci_vpfe:Removed space before semicolon in dm365_ipipe_hw.c This patch fixes "space prohibted before semicolon" warning in dm365_ipipe_hw.cdetected via checkpatch.pl Signed-off-by: Archana kumari Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c b/drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c index e027b92b54ef..2d36b60bdbf1 100644 --- a/drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c +++ b/drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c @@ -791,7 +791,7 @@ ipipe_set_3d_lut_regs(void *__iomem base_addr, void *__iomem isp5_base_addr, /* valied table */ tbl = lut_3d->table; - for (i = 0 ; i < VPFE_IPIPE_MAX_SIZE_3D_LUT; i++) { + for (i = 0; i < VPFE_IPIPE_MAX_SIZE_3D_LUT; i++) { /* Each entry has 0-9 (B), 10-19 (G) and 20-29 R values */ val = tbl[i].b & D3_LUT_ENTRY_MASK; @@ -899,7 +899,7 @@ ipipe_set_gbce_regs(void *__iomem base_addr, void *__iomem isp5_base_addr, if (!gbce->table) return; - for (count = 0; count < VPFE_IPIPE_MAX_SIZE_GBCE_LUT ; count += 2) + for (count = 0; count < VPFE_IPIPE_MAX_SIZE_GBCE_LUT; count += 2) w_ip_table(isp5_base_addr, ((gbce->table[count + 1] & mask) << GBCE_ENTRY_SHIFT) | (gbce->table[count] & mask), ((count/2) << 2) + GBCE_TB_START_ADDR); From bb1da756e03c7929bf8b101788588a88aaadb523 Mon Sep 17 00:00:00 2001 From: Himangi Saraogi Date: Sat, 2 Nov 2013 18:02:38 +0530 Subject: [PATCH 070/238] staging:wlan-ng:cfg80211.c: Shorten lines to 80 characters This patch removes checkpatch.pl warnings "line over 80 characters" in cfg80211.c. Signed-off-by: Himangi Saraogi Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/cfg80211.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c index a4fd5c4717a8..a7d24c95191d 100644 --- a/drivers/staging/wlan-ng/cfg80211.c +++ b/drivers/staging/wlan-ng/cfg80211.c @@ -73,7 +73,8 @@ static int prism2_result2err(int prism2_result) static int prism2_domibset_uint32(wlandevice_t *wlandev, u32 did, u32 data) { struct p80211msg_dot11req_mibset msg; - p80211item_uint32_t *mibitem = (p80211item_uint32_t *) &msg.mibattribute.data; + p80211item_uint32_t *mibitem = + (p80211item_uint32_t *) &msg.mibattribute.data; msg.msgcode = DIDmsg_dot11req_mibset; mibitem->did = did; @@ -86,7 +87,8 @@ static int prism2_domibset_pstr32(wlandevice_t *wlandev, u32 did, u8 len, u8 *data) { struct p80211msg_dot11req_mibset msg; - p80211item_pstr32_t *mibitem = (p80211item_pstr32_t *) &msg.mibattribute.data; + p80211item_pstr32_t *mibitem = + (p80211item_pstr32_t *) &msg.mibattribute.data; msg.msgcode = DIDmsg_dot11req_mibset; mibitem->did = did; @@ -182,7 +184,8 @@ static int prism2_add_key(struct wiphy *wiphy, struct net_device *dev, goto exit; } - result = prism2_domibset_pstr32(wlandev, did, params->key_len, params->key); + result = prism2_domibset_pstr32(wlandev, did, + params->key_len, params->key); if (result) goto exit; break; @@ -328,7 +331,8 @@ static int prism2_get_station(struct wiphy *wiphy, struct net_device *dev, return result; } -static int prism2_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) +static int prism2_scan(struct wiphy *wiphy, + struct cfg80211_scan_request *request) { struct net_device *dev; struct prism2_wiphy_private *priv = wiphy_priv(wiphy); @@ -380,7 +384,8 @@ static int prism2_scan(struct wiphy *wiphy, struct cfg80211_scan_request *reques (i < request->n_channels) && i < ARRAY_SIZE(prism2_channels); i++) msg1.channellist.data.data[i] = - ieee80211_frequency_to_channel(request->channels[i]->center_freq); + ieee80211_frequency_to_channel( + request->channels[i]->center_freq); msg1.channellist.data.len = request->n_channels; msg1.maxchanneltime.data = 250; @@ -410,7 +415,8 @@ static int prism2_scan(struct wiphy *wiphy, struct cfg80211_scan_request *reques ie_len = ie_buf[1] + 2; memcpy(&ie_buf[2], &(msg2.ssid.data.data), msg2.ssid.data.len); bss = cfg80211_inform_bss(wiphy, - ieee80211_get_channel(wiphy, ieee80211_dsss_chan_to_freq(msg2.dschannel.data)), + ieee80211_get_channel(wiphy, + ieee80211_dsss_chan_to_freq(msg2.dschannel.data)), (const u8 *) &(msg2.bssid.data.data), msg2.timestamp.data, msg2.capinfo.data, msg2.beaconperiod.data, From b21199116a0ed9a27326b0cb85b1cdcc3997b879 Mon Sep 17 00:00:00 2001 From: Himangi Saraogi Date: Sat, 2 Nov 2013 18:11:44 +0530 Subject: [PATCH 071/238] staging:wlan-ng:hfa384x.h: remove typedef struct hfa384x_bytestr __packed hfa384x_bytestr_t This patch removes the checkpatch.pl warning "do not add new typedefs" and changes all source files that use that typedef. Also lines were shortened to 80 characters to do away with the checkpatch.pl warning "line over 80 characters" generated due to replacement of the hfa384x_bytestr_t by struct hfa384x_bytestr in prism2mgmt.c, prism2mgmt.h, prism2mib.c, prism2sta.c. Signed-off-by: Himangi Saraogi Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/hfa384x.h | 4 ++-- drivers/staging/wlan-ng/prism2mgmt.c | 4 ++-- drivers/staging/wlan-ng/prism2mgmt.h | 6 ++++-- drivers/staging/wlan-ng/prism2mib.c | 6 ++++-- drivers/staging/wlan-ng/prism2sta.c | 6 +++--- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/staging/wlan-ng/hfa384x.h b/drivers/staging/wlan-ng/hfa384x.h index 3dfa85ccc504..333a2f693e49 100644 --- a/drivers/staging/wlan-ng/hfa384x.h +++ b/drivers/staging/wlan-ng/hfa384x.h @@ -350,10 +350,10 @@ PD Record codes /*-------------------------------------------------------------*/ /* Commonly used basic types */ -typedef struct hfa384x_bytestr { +struct hfa384x_bytestr { u16 len; u8 data[0]; -} __packed hfa384x_bytestr_t; +} __packed; typedef struct hfa384x_bytestr32 { u16 len; diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c index d22db43e8031..a9909f6b0001 100644 --- a/drivers/staging/wlan-ng/prism2mgmt.c +++ b/drivers/staging/wlan-ng/prism2mgmt.c @@ -525,7 +525,7 @@ int prism2mgmt_start(wlandevice_t *wlandev, void *msgp) p80211pstrd_t *pstr; u8 bytebuf[80]; - hfa384x_bytestr_t *p2bytestr = (hfa384x_bytestr_t *) bytebuf; + struct hfa384x_bytestr *p2bytestr = (struct hfa384x_bytestr *) bytebuf; u16 word; wlandev->macmode = WLAN_MACMODE_NONE; @@ -1019,7 +1019,7 @@ int prism2mgmt_autojoin(wlandevice_t *wlandev, void *msgp) struct p80211msg_lnxreq_autojoin *msg = msgp; p80211pstrd_t *pstr; u8 bytebuf[256]; - hfa384x_bytestr_t *p2bytestr = (hfa384x_bytestr_t *) bytebuf; + struct hfa384x_bytestr *p2bytestr = (struct hfa384x_bytestr *) bytebuf; wlandev->macmode = WLAN_MACMODE_NONE; diff --git a/drivers/staging/wlan-ng/prism2mgmt.h b/drivers/staging/wlan-ng/prism2mgmt.h index 07eecebeb6cc..190d390c8490 100644 --- a/drivers/staging/wlan-ng/prism2mgmt.h +++ b/drivers/staging/wlan-ng/prism2mgmt.h @@ -92,8 +92,10 @@ void prism2mgmt_pstr2bytearea(u8 *bytearea, p80211pstrd_t *pstr); void prism2mgmt_bytearea2pstr(u8 *bytearea, p80211pstrd_t *pstr, int len); /* byte string conversion functions*/ -void prism2mgmt_pstr2bytestr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr); -void prism2mgmt_bytestr2pstr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr); +void prism2mgmt_pstr2bytestr(struct hfa384x_bytestr *bytestr, + p80211pstrd_t *pstr); +void prism2mgmt_bytestr2pstr(struct hfa384x_bytestr *bytestr, + p80211pstrd_t *pstr); /* functions to convert Group Addresses */ void prism2mgmt_get_grpaddr(u32 did, p80211pstrd_t *pstr, hfa384x_t *priv); diff --git a/drivers/staging/wlan-ng/prism2mib.c b/drivers/staging/wlan-ng/prism2mib.c index d3a06fa0b4f6..9b5f3b72d3ca 100644 --- a/drivers/staging/wlan-ng/prism2mib.c +++ b/drivers/staging/wlan-ng/prism2mib.c @@ -763,7 +763,8 @@ static int prism2mib_priv(struct mibrec *mib, * ----------------------------------------------------------------*/ -void prism2mgmt_pstr2bytestr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr) +void prism2mgmt_pstr2bytestr(struct hfa384x_bytestr *bytestr, + p80211pstrd_t *pstr) { bytestr->len = cpu_to_le16((u16) (pstr->len)); memcpy(bytestr->data, pstr->data, pstr->len); @@ -804,7 +805,8 @@ void prism2mgmt_pstr2bytearea(u8 *bytearea, p80211pstrd_t *pstr) * ----------------------------------------------------------------*/ -void prism2mgmt_bytestr2pstr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr) +void prism2mgmt_bytestr2pstr(struct hfa384x_bytestr *bytestr, + p80211pstrd_t *pstr) { pstr->len = (u8) (le16_to_cpu((u16) (bytestr->len))); memcpy(pstr->data, bytestr->data, pstr->len); diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c index 76374b220228..46f9491d10d3 100644 --- a/drivers/staging/wlan-ng/prism2sta.c +++ b/drivers/staging/wlan-ng/prism2sta.c @@ -1279,7 +1279,7 @@ void prism2sta_processing_defer(struct work_struct *data) HFA384x_RID_CURRENTSSID, result); return; } - prism2mgmt_bytestr2pstr((hfa384x_bytestr_t *) &ssid, + prism2mgmt_bytestr2pstr((struct hfa384x_bytestr *) &ssid, (p80211pstrd_t *) & wlandev->ssid); @@ -1361,7 +1361,7 @@ void prism2sta_processing_defer(struct work_struct *data) HFA384x_RID_CURRENTSSID, result); return; } - prism2mgmt_bytestr2pstr((hfa384x_bytestr_t *) &ssid, + prism2mgmt_bytestr2pstr((struct hfa384x_bytestr *) &ssid, (p80211pstrd_t *) &wlandev->ssid); hw->link_status = HFA384x_LINK_CONNECTED; @@ -2037,7 +2037,7 @@ void prism2sta_commsqual_defer(struct work_struct *data) HFA384x_RID_CURRENTSSID, result); return; } - prism2mgmt_bytestr2pstr((hfa384x_bytestr_t *) &ssid, + prism2mgmt_bytestr2pstr((struct hfa384x_bytestr *) &ssid, (p80211pstrd_t *) &wlandev->ssid); /* Reschedule timer */ From 5fb4471ef3363bb512ad1a97292e9a321c065eac Mon Sep 17 00:00:00 2001 From: Himangi Saraogi Date: Sat, 2 Nov 2013 17:31:22 +0530 Subject: [PATCH 072/238] staging:usbip:stub_rx.c: Remove warning quoted string split across lines This patch removes the checkpatch.pl warnings "quoted string split across lines" in stub_rx.c by merging the quoted strings and the ensuring that the lines are not more than 80 characters long. Signed-off-by: Himangi Saraogi Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/usbip/stub_rx.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/staging/usbip/stub_rx.c b/drivers/staging/usbip/stub_rx.c index db48a789d308..5d1d4a183300 100644 --- a/drivers/staging/usbip/stub_rx.c +++ b/drivers/staging/usbip/stub_rx.c @@ -102,11 +102,13 @@ static int tweak_clear_halt_cmd(struct urb *urb) ret = usb_clear_halt(urb->dev, target_pipe); if (ret < 0) - dev_err(&urb->dev->dev, "usb_clear_halt error: devnum %d endp " - "%d ret %d\n", urb->dev->devnum, target_endp, ret); + dev_err(&urb->dev->dev, + "usb_clear_halt error: devnum %d endp %d ret %d\n", + urb->dev->devnum, target_endp, ret); else - dev_info(&urb->dev->dev, "usb_clear_halt done: devnum %d endp " - "%d\n", urb->dev->devnum, target_endp); + dev_info(&urb->dev->dev, + "usb_clear_halt done: devnum %d endp %d\n", + urb->dev->devnum, target_endp); return ret; } @@ -127,11 +129,13 @@ static int tweak_set_interface_cmd(struct urb *urb) ret = usb_set_interface(urb->dev, interface, alternate); if (ret < 0) - dev_err(&urb->dev->dev, "usb_set_interface error: inf %u alt " - "%u ret %d\n", interface, alternate, ret); + dev_err(&urb->dev->dev, + "usb_set_interface error: inf %u alt %u ret %d\n", + interface, alternate, ret); else - dev_info(&urb->dev->dev, "usb_set_interface done: inf %u alt " - "%u\n", interface, alternate); + dev_info(&urb->dev->dev, + "usb_set_interface done: inf %u alt %u\n", + interface, alternate); return ret; } From b482da2b98a3a716d823995b0678405ff398c0c3 Mon Sep 17 00:00:00 2001 From: Himangi Saraogi Date: Sat, 2 Nov 2013 17:38:10 +0530 Subject: [PATCH 073/238] staging:usbip:usbip_common.c: Join quoted string split accross lines This patch removes the checkpatch.pl warnings "quoted string split accross lines" in usbip_common.c. Signed-off-by: Himangi Saraogi Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/usbip/usbip_common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c index e3fc749c1e7e..4470cd321d65 100644 --- a/drivers/staging/usbip/usbip_common.c +++ b/drivers/staging/usbip/usbip_common.c @@ -155,8 +155,9 @@ static void usbip_dump_usb_device(struct usb_device *udev) dev_dbg(dev, "parent %p, bus %p\n", udev->parent, udev->bus); - dev_dbg(dev, "descriptor %p, config %p, actconfig %p, " - "rawdescriptors %p\n", &udev->descriptor, udev->config, + dev_dbg(dev, + "descriptor %p, config %p, actconfig %p, rawdescriptors %p\n", + &udev->descriptor, udev->config, udev->actconfig, udev->rawdescriptors); dev_dbg(dev, "have_langid %d, string_langid %d\n", From d0306a514da25976fde942d21f85b12384dd4c1f Mon Sep 17 00:00:00 2001 From: Teodora Baluta Date: Mon, 4 Nov 2013 13:12:12 +0200 Subject: [PATCH 074/238] staging: usbip: fix sparse warnings regarding endianness The wHubCharacteristics field in usb_hub_descriptor structure is __le16 so there is no need for cast. The cpu_to_le16 returns a __le16 type for a u16 type. Used cpu_to_le16 to silence last sparse error. drivers/staging/usbip/vhci_hcd.c:223:35: warning: incorrect type in assignment (different base types) drivers/staging/usbip/vhci_hcd.c:223:35: expected restricted __le16 [usertype] wHubCharacteristics drivers/staging/usbip/vhci_hcd.c:223:35: got unsigned short [unsigned] [usertype] drivers/staging/usbip/vhci_hcd.c:351:34: warning: incorrect type in assignment (different base types) drivers/staging/usbip/vhci_hcd.c:351:34: expected unsigned short [unsigned] [short] [usertype] drivers/staging/usbip/vhci_hcd.c:351:34: got restricted __le16 [usertype] drivers/staging/usbip/vhci_hcd.c:352:34: warning: incorrect type in assignment (different base types) drivers/staging/usbip/vhci_hcd.c:352:34: expected unsigned short [unsigned] [short] [usertype] drivers/staging/usbip/vhci_hcd.c:352:34: got restricted __le16 [usertype] drivers/staging/usbip/vhci_hcd.c:540:36: warning: restricted __le16 degrades to integer Signed-off-by: Teodora Baluta Signed-off-by: Greg Kroah-Hartman --- drivers/staging/usbip/vhci_hcd.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c index e810ad53e2ac..e37c6c1a9931 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c @@ -220,8 +220,7 @@ static inline void hub_descriptor(struct usb_hub_descriptor *desc) memset(desc, 0, sizeof(*desc)); desc->bDescriptorType = 0x29; desc->bDescLength = 9; - desc->wHubCharacteristics = (__force __u16) - (__constant_cpu_to_le16(0x0001)); + desc->wHubCharacteristics = (__constant_cpu_to_le16(0x0001)); desc->bNbrPorts = VHCI_NPORTS; desc->u.hs.DeviceRemovable[0] = 0xff; desc->u.hs.DeviceRemovable[1] = 0xff; @@ -348,8 +347,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, USB_PORT_STAT_ENABLE; } } - ((u16 *) buf)[0] = cpu_to_le16(dum->port_status[rhport]); - ((u16 *) buf)[1] = cpu_to_le16(dum->port_status[rhport] >> 16); + ((__le16 *) buf)[0] = cpu_to_le16(dum->port_status[rhport]); + ((__le16 *) buf)[1] = cpu_to_le16(dum->port_status[rhport] >> 16); usbip_dbg_vhci_rh(" GetPortStatus bye %x %x\n", ((u16 *)buf)[0], ((u16 *)buf)[1]); @@ -537,7 +536,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, goto no_need_xmit; case USB_REQ_GET_DESCRIPTOR: - if (ctrlreq->wValue == (USB_DT_DEVICE << 8)) + if (ctrlreq->wValue == cpu_to_le16(USB_DT_DEVICE << 8)) usbip_dbg_vhci_hc("Not yet?: " "Get_Descriptor to device 0 " "(get max pipe size)\n"); From 1f5a0d0cd43f2a02af16a1c23fba8ae14f707d49 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sat, 2 Nov 2013 23:34:44 +0530 Subject: [PATCH 075/238] Staging: rtl8192e: Fix incorrect type in assignment in rtllib_rx.c This patch fixes the following Sparse warning in rtllib_rx.c- drivers/staging/rtl8192e/rtllib_rx.c:493:37: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtllib_rx.c:493:37: expected unsigned short [unsigned] [usertype] len drivers/staging/rtl8192e/rtllib_rx.c:493:37: got restricted __be16 [usertype] drivers/staging/rtl8192e/rtllib_rx.c:1227:37: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtllib_rx.c:1227:37: expected unsigned short [unsigned] [usertype] len drivers/staging/rtl8192e/rtllib_rx.c:1227:37: got restricted __be16 [usertype] drivers/staging/rtl8192e/rtllib_rx.c:1635:40: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtllib_rx.c:1635:40: expected restricted __le16 drivers/staging/rtl8192e/rtllib_rx.c:1635:40: got int drivers/staging/rtl8192e/rtllib_rx.c:1637:40: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtllib_rx.c:1637:40: expected restricted __le16 drivers/staging/rtl8192e/rtllib_rx.c:1637:40: got int drivers/staging/rtl8192e/rtllib_rx.c:1641:45: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtllib_rx.c:1641:45: expected restricted __le16 drivers/staging/rtl8192e/rtllib_rx.c:1641:45: got unsigned short [unsigned] [usertype] Signed-off-by: Rashika Kheria Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_rx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 1a011b9b9da6..6aa837e1c512 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -490,7 +490,7 @@ void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb **prx } else { u16 len; /* Leave Ethernet header part of hdr and full payload */ - len = htons(sub_skb->len); + len = sub_skb->len; memcpy(skb_push(sub_skb, 2), &len, 2); memcpy(skb_push(sub_skb, ETH_ALEN), prxb->src, ETH_ALEN); memcpy(skb_push(sub_skb, ETH_ALEN), prxb->dst, ETH_ALEN); @@ -1224,7 +1224,7 @@ static void rtllib_rx_indicate_pkt_legacy(struct rtllib_device *ieee, } else { u16 len; /* Leave Ethernet header part of hdr and full payload */ - len = htons(sub_skb->len); + len = sub_skb->len; memcpy(skb_push(sub_skb, 2), &len, 2); memcpy(skb_push(sub_skb, ETH_ALEN), src, ETH_ALEN); memcpy(skb_push(sub_skb, ETH_ALEN), dst, ETH_ALEN); @@ -1632,13 +1632,13 @@ static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info /* WMM spec P.11: The minimum value for AIFSN shall be 2 */ qos_param->aifs[aci] = (qos_param->aifs[aci] < 2) ? 2 : qos_param->aifs[aci]; - qos_param->cw_min[aci] = ac_params->ecw_min_max & 0x0F; + qos_param->cw_min[aci] = cpu_to_le16(ac_params->ecw_min_max & 0x0F); - qos_param->cw_max[aci] = (ac_params->ecw_min_max & 0xF0) >> 4; + qos_param->cw_max[aci] = cpu_to_le16((ac_params->ecw_min_max & 0xF0) >> 4); qos_param->flag[aci] = (ac_params->aci_aifsn & 0x10) ? 0x01 : 0x00; - qos_param->tx_op_limit[aci] = le16_to_cpu(ac_params->tx_op_limit); + qos_param->tx_op_limit[aci] = ac_params->tx_op_limit; } return rc; } From 26a6b074971cfb8568e2bf1f972c6f7c10c2c749 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sat, 2 Nov 2013 23:36:12 +0530 Subject: [PATCH 076/238] Staging: rtl8192e: Fix Sparse warning of restricted __le16 degrades to integer in rtllib_rx.c This patch fixes the following sparse warning in rtllib_rx.c- warning: restricted __le16 degrades to integer Signed-off-by: Rashika Kheria Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_rx.c | 58 +++++++++++++++------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 6aa837e1c512..6b46af596b35 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -2528,29 +2528,30 @@ static inline void rtllib_process_probe_response( "'%s' ( %pM ): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n", escape_essid(info_element->data, info_element->len), beacon->header.addr3, - (beacon->capability & (1<<0xf)) ? '1' : '0', - (beacon->capability & (1<<0xe)) ? '1' : '0', - (beacon->capability & (1<<0xd)) ? '1' : '0', - (beacon->capability & (1<<0xc)) ? '1' : '0', - (beacon->capability & (1<<0xb)) ? '1' : '0', - (beacon->capability & (1<<0xa)) ? '1' : '0', - (beacon->capability & (1<<0x9)) ? '1' : '0', - (beacon->capability & (1<<0x8)) ? '1' : '0', - (beacon->capability & (1<<0x7)) ? '1' : '0', - (beacon->capability & (1<<0x6)) ? '1' : '0', - (beacon->capability & (1<<0x5)) ? '1' : '0', - (beacon->capability & (1<<0x4)) ? '1' : '0', - (beacon->capability & (1<<0x3)) ? '1' : '0', - (beacon->capability & (1<<0x2)) ? '1' : '0', - (beacon->capability & (1<<0x1)) ? '1' : '0', - (beacon->capability & (1<<0x0)) ? '1' : '0'); + (le16_to_cpu(beacon->capability) & (1<<0xf)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1<<0xe)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1<<0xd)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1<<0xc)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1<<0xb)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1<<0xa)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1<<0x9)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1<<0x8)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1<<0x7)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1<<0x6)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1<<0x5)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1<<0x4)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1<<0x3)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1<<0x2)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1<<0x1)) ? '1' : '0', + (le16_to_cpu(beacon->capability) & (1<<0x0)) ? '1' : '0'); if (rtllib_network_init(ieee, beacon, network, stats)) { RTLLIB_DEBUG_SCAN("Dropped '%s' ( %pM) via %s.\n", escape_essid(info_element->data, info_element->len), beacon->header.addr3, - WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == + WLAN_FC_GET_STYPE( + le16_to_cpu(beacon->header.frame_ctl)) == RTLLIB_STYPE_PROBE_RESP ? "PROBE RESPONSE" : "BEACON"); goto free_network; @@ -2560,7 +2561,7 @@ static inline void rtllib_process_probe_response( if (!rtllib_legal_channel(ieee, network->channel)) goto free_network; - if (WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == + if (WLAN_FC_GET_STYPE(le16_to_cpu(beacon->header.frame_ctl)) == RTLLIB_STYPE_PROBE_RESP) { if (IsPassiveChannel(ieee, network->channel)) { printk(KERN_INFO "GetScanInfo(): For Global Domain, " @@ -2629,7 +2630,8 @@ static inline void rtllib_process_probe_response( RTLLIB_DEBUG_SCAN("Adding '%s' ( %pM) via %s.\n", escape_essid(network->ssid, network->ssid_len), network->bssid, - WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == + WLAN_FC_GET_STYPE( + le16_to_cpu(beacon->header.frame_ctl)) == RTLLIB_STYPE_PROBE_RESP ? "PROBE RESPONSE" : "BEACON"); memcpy(target, network, sizeof(*target)); @@ -2640,7 +2642,8 @@ static inline void rtllib_process_probe_response( RTLLIB_DEBUG_SCAN("Updating '%s' ( %pM) via %s.\n", escape_essid(target->ssid, target->ssid_len), target->bssid, - WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == + WLAN_FC_GET_STYPE( + le16_to_cpu(beacon->header.frame_ctl)) == RTLLIB_STYPE_PROBE_RESP ? "PROBE RESPONSE" : "BEACON"); @@ -2682,15 +2685,17 @@ void rtllib_rx_mgt(struct rtllib_device *ieee, { struct rtllib_hdr_4addr *header = (struct rtllib_hdr_4addr *)skb->data ; - if (WLAN_FC_GET_STYPE(header->frame_ctl) != RTLLIB_STYPE_PROBE_RESP && - WLAN_FC_GET_STYPE(header->frame_ctl) != RTLLIB_STYPE_BEACON) + if ((WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl)) != + RTLLIB_STYPE_PROBE_RESP) && + (WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl)) != + RTLLIB_STYPE_BEACON)) ieee->last_rx_ps_time = jiffies; - switch (WLAN_FC_GET_STYPE(header->frame_ctl)) { + switch (WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl))) { case RTLLIB_STYPE_BEACON: RTLLIB_DEBUG_MGMT("received BEACON (%d)\n", - WLAN_FC_GET_STYPE(header->frame_ctl)); + WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl))); RTLLIB_DEBUG_SCAN("Beacon\n"); rtllib_process_probe_response( ieee, (struct rtllib_probe_response *)header, @@ -2705,14 +2710,15 @@ void rtllib_rx_mgt(struct rtllib_device *ieee, case RTLLIB_STYPE_PROBE_RESP: RTLLIB_DEBUG_MGMT("received PROBE RESPONSE (%d)\n", - WLAN_FC_GET_STYPE(header->frame_ctl)); + WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl))); RTLLIB_DEBUG_SCAN("Probe response\n"); rtllib_process_probe_response(ieee, (struct rtllib_probe_response *)header, stats); break; case RTLLIB_STYPE_PROBE_REQ: RTLLIB_DEBUG_MGMT("received PROBE RESQUEST (%d)\n", - WLAN_FC_GET_STYPE(header->frame_ctl)); + WLAN_FC_GET_STYPE( + le16_to_cpu(header->frame_ctl))); RTLLIB_DEBUG_SCAN("Probe request\n"); if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) && ((ieee->iw_mode == IW_MODE_ADHOC || From e0b1ca6055d454d7f4c1fa9c7db5bf5da5a8a885 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sat, 2 Nov 2013 23:37:04 +0530 Subject: [PATCH 077/238] Staging: rtl8192e: Fix incorrect casting in rtllib_rx.c This patch fixes the following sparse warning in rtllib_rx.c- drivers/staging/rtl8192e/rtllib_rx.c:2267:34: warning: cast to restricted __le32 drivers/staging/rtl8192e/rtllib_rx.c:2268:34: warning: cast to restricted __le32 drivers/staging/rtl8192e/rtllib_rx.c:2269:36: warning: cast to restricted __le32 drivers/staging/rtl8192e/rtllib_rx.c:2269:36: warning: cast from restricted __le16 Signed-off-by: Rashika Kheria Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_rx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 6b46af596b35..1fab69d313ba 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -2260,9 +2260,9 @@ static inline int rtllib_network_init( memcpy(network->bssid, beacon->header.addr3, ETH_ALEN); network->capability = le16_to_cpu(beacon->capability); network->last_scanned = jiffies; - network->time_stamp[0] = le32_to_cpu(beacon->time_stamp[0]); - network->time_stamp[1] = le32_to_cpu(beacon->time_stamp[1]); - network->beacon_interval = le32_to_cpu(beacon->beacon_interval); + network->time_stamp[0] = beacon->time_stamp[0]; + network->time_stamp[1] = beacon->time_stamp[1]; + network->beacon_interval = le16_to_cpu(beacon->beacon_interval); /* Where to pull this? beacon->listen_interval;*/ network->listen_interval = 0x0A; network->rates_len = network->rates_ex_len = 0; From cf8ab8cf9952ac26e8401eced227b6f988703480 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sat, 2 Nov 2013 23:38:00 +0530 Subject: [PATCH 078/238] Staging: rtl8192e: Fix Sparse Warning for Static Declarations in rtllib_module.c This patch fixes the following sparse warning in rtllib_module.c- drivers/staging/rtl8192e/rtllib_module.c:240:12: warning: symbol 'rtllib_init' was not declared. Should it be static? drivers/staging/rtl8192e/rtllib_module.c:260:13: warning: symbol 'rtllib_exit' was not declared. Should it be static? Signed-off-by: Rashika Kheria Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_module.c b/drivers/staging/rtl8192e/rtllib_module.c index 51d46e04d3f5..136909eff6d5 100644 --- a/drivers/staging/rtl8192e/rtllib_module.c +++ b/drivers/staging/rtl8192e/rtllib_module.c @@ -237,7 +237,7 @@ static const struct file_operations fops = { .release = single_release, }; -int __init rtllib_init(void) +static int __init rtllib_init(void) { struct proc_dir_entry *e; @@ -257,7 +257,7 @@ int __init rtllib_init(void) return 0; } -void __exit rtllib_exit(void) +static void __exit rtllib_exit(void) { if (rtllib_proc) { remove_proc_entry("debug_level", rtllib_proc); From 198e0d17c2f8081a8a1bb75d6047c7c89326fc66 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sat, 2 Nov 2013 23:39:22 +0530 Subject: [PATCH 079/238] Staging: rtl8192e: Fix incorrect type in assignment in rtllib_tx.c This patch fixes the following sparse warning in rtllib_tx.c- drivers/staging/rtl8192e/rtllib_tx.c:234:24: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtllib_tx.c:234:24: expected restricted __le16 [usertype] frag_size drivers/staging/rtl8192e/rtllib_tx.c:234:24: got int [signed] txb_size drivers/staging/rtl8192e/rtllib_tx.c:613:43: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtllib_tx.c:613:43: expected restricted __le16 [usertype] payload_size drivers/staging/rtl8192e/rtllib_tx.c:613:43: got unsigned int [unsigned] len drivers/staging/rtl8192e/rtllib_tx.c:767:35: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtllib_tx.c:767:35: expected restricted __le16 [usertype] payload_size drivers/staging/rtl8192e/rtllib_tx.c:767:35: got int [signed] [assigned] bytes drivers/staging/rtl8192e/rtllib_tx.c:814:51: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtllib_tx.c:814:51: expected restricted __le16 [usertype] seq_ctl drivers/staging/rtl8192e/rtllib_tx.c:814:51: got unsigned short drivers/staging/rtl8192e/rtllib_tx.c:174:36: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtllib_tx.c:174:36: expected unsigned short [unsigned] [short] [usertype] drivers/staging/rtl8192e/rtllib_tx.c:174:36: got restricted __be16 [usertype] drivers/staging/rtl8192e/rtllib_tx.c:873:35: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtllib_tx.c:873:35: expected restricted __le16 [usertype] payload_size drivers/staging/rtl8192e/rtllib_tx.c:873:35: got unsigned int [unsigned] len Signed-off-by: Rashika Kheria Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_tx.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c index 3183627823fb..8ff03f8675e8 100644 --- a/drivers/staging/rtl8192e/rtllib_tx.c +++ b/drivers/staging/rtl8192e/rtllib_tx.c @@ -171,7 +171,7 @@ inline int rtllib_put_snap(u8 *data, u16 h_proto) snap->oui[1] = oui[1]; snap->oui[2] = oui[2]; - *(u16 *)(data + SNAP_SIZE) = htons(h_proto); + *(u16 *)(data + SNAP_SIZE) = h_proto; return SNAP_SIZE + sizeof(u16); } @@ -231,7 +231,7 @@ static struct rtllib_txb *rtllib_alloc_txb(int nr_frags, int txb_size, memset(txb, 0, sizeof(struct rtllib_txb)); txb->nr_frags = nr_frags; - txb->frag_size = txb_size; + txb->frag_size = cpu_to_le16(txb_size); for (i = 0; i < nr_frags; i++) { txb->fragments[i] = dev_alloc_skb(txb_size); @@ -610,7 +610,7 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) } txb->encrypted = 0; - txb->payload_size = skb->len; + txb->payload_size = cpu_to_le16(skb->len); memcpy(skb_put(txb->fragments[0], skb->len), skb->data, skb->len); @@ -764,7 +764,7 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) goto failed; } txb->encrypted = encrypt; - txb->payload_size = bytes; + txb->payload_size = cpu_to_le16(bytes); if (qos_actived) txb->queue_index = UP2AC(skb->priority); @@ -812,8 +812,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) } if ((qos_actived) && (!bIsMulticast)) { frag_hdr->seq_ctl = - rtllib_query_seqnum(ieee, skb_frag, - header.addr1); + cpu_to_le16(rtllib_query_seqnum(ieee, skb_frag, + header.addr1)); frag_hdr->seq_ctl = cpu_to_le16(frag_hdr->seq_ctl<<4 | i); } else { @@ -870,7 +870,7 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) } txb->encrypted = 0; - txb->payload_size = skb->len; + txb->payload_size = cpu_to_le16(skb->len); memcpy(skb_put(txb->fragments[0], skb->len), skb->data, skb->len); } From 86005e169b35b3d276ff094c6142528acc1f0437 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sat, 2 Nov 2013 23:40:15 +0530 Subject: [PATCH 080/238] Staging: rtl8192e: Fix Sparse Warning of restricted __le16 degrades to integer in rtllib_tx.c This patch fixes the following sparse warning in rtllib_tx.c- warning: restricted __le16 degrades to integer Signed-off-by: Rashika Kheria Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c index 8ff03f8675e8..77964885b3f2 100644 --- a/drivers/staging/rtl8192e/rtllib_tx.c +++ b/drivers/staging/rtl8192e/rtllib_tx.c @@ -815,7 +815,7 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) cpu_to_le16(rtllib_query_seqnum(ieee, skb_frag, header.addr1)); frag_hdr->seq_ctl = - cpu_to_le16(frag_hdr->seq_ctl<<4 | i); + cpu_to_le16(le16_to_cpu(frag_hdr->seq_ctl)<<4 | i); } else { frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0]<<4 | i); From f7df1918b5f4fe140baf1eda68ff0853774bbcd6 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Thu, 7 Nov 2013 18:56:28 +0530 Subject: [PATCH 081/238] Staging: rtl8192e: Fix Sparse warning of restricted __le16 degrades to integer in rtllib_softmac.c This patch fixes the following Sparse warning in rtllib_softmac.c- drivers/staging/rtl8192e/rtllib_softmac.c:230:19: warning: restricted __le16 degrades to integer Signed-off-by: Rashika Kheria Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_softmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 933bd6deaca1..0ad159f52d4c 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -227,7 +227,7 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct rtllib_device *ieee) /* called with 2nd param 0, no mgmt lock required */ rtllib_sta_wakeup(ieee, 0); - if (header->frame_ctl == RTLLIB_STYPE_BEACON) + if (le16_to_cpu(header->frame_ctl) == RTLLIB_STYPE_BEACON) tcb_desc->queue_index = BEACON_QUEUE; else tcb_desc->queue_index = MGNT_QUEUE; From 7fe30a7d4af6a0cce07b6ca9dd2a624eead661d2 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Thu, 7 Nov 2013 18:57:37 +0530 Subject: [PATCH 082/238] Staging: rtl8192e: Fix Sparse Warning of invalid assignment '|=' in rtllib_softmac.c This patch fixes the following Sparse warning in rtllib_softmac.c- drivers/staging/rtl8192e/rtllib_softmac.c:812:40: warning: invalid assignment: |= drivers/staging/rtl8192e/rtllib_softmac.c:812:40: left side has type restricted __le16 drivers/staging/rtl8192e/rtllib_softmac.c:812:40: right side has type int drivers/staging/rtl8192e/rtllib_softmac.c:924:17: warning: invalid assignment: |= drivers/staging/rtl8192e/rtllib_softmac.c:924:17: left side has type restricted __le16 drivers/staging/rtl8192e/rtllib_softmac.c:924:17: right side has type int drivers/staging/rtl8192e/rtllib_softmac.c:924:17: error: cast from unknown type Signed-off-by: Rashika Kheria Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_softmac.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 0ad159f52d4c..721ee254b820 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -809,7 +809,7 @@ inline struct sk_buff *rtllib_authentication_req(struct rtllib_network *beacon, auth->header.frame_ctl = RTLLIB_STYPE_AUTH; if (challengelen) - auth->header.frame_ctl |= RTLLIB_FCTL_WEP; + auth->header.frame_ctl |= cpu_to_le16(RTLLIB_FCTL_WEP); auth->header.duration_id = 0x013a; memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN); @@ -921,8 +921,8 @@ static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee, u8 *dest) if (ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)) - cpu_to_le16((beacon_buf->capability |= - WLAN_CAPABILITY_SHORT_SLOT_TIME)); + beacon_buf->capability |= + cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME); crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; if (encrypt) From 1830a6d840d7bcc9fa3e4ad07b405e3432cc5282 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Thu, 7 Nov 2013 18:58:57 +0530 Subject: [PATCH 083/238] Staging: rtl8192e: Fix incorrect type in assignment in rtllib_softmac.c This patch fixes the following Sparse warning in rtllib_softmac.c- drivers/staging/rtl8192e/rtllib_softmac.c:298:12: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtllib_softmac.c:298:12: expected unsigned short [unsigned] [usertype] fc drivers/staging/rtl8192e/rtllib_softmac.c:298:12: got restricted __le16 [usertype] frame_ctl drivers/staging/rtl8192e/rtllib_softmac.c:810:32: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtllib_softmac.c:810:32: expected restricted __le16 [usertype] frame_ctl drivers/staging/rtl8192e/rtllib_softmac.c:810:32: got int drivers/staging/rtl8192e/rtllib_softmac.c:814:34: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtllib_softmac.c:814:34: expected restricted __le16 [usertype] duration_id drivers/staging/rtl8192e/rtllib_softmac.c:814:34: got int drivers/staging/rtl8192e/rtllib_softmac.c:821:33: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtllib_softmac.c:821:33: expected restricted __le16 [usertype] algorithm drivers/staging/rtl8192e/rtllib_softmac.c:821:33: got int drivers/staging/rtl8192e/rtllib_softmac.c:955:24: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtllib_softmac.c:955:24: expected unsigned short [unsigned] [usertype] val16 drivers/staging/rtl8192e/rtllib_softmac.c:955:24: got restricted __le16 [usertype] drivers/staging/rtl8192e/rtllib_softmac.c:1263:33: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtllib_softmac.c:1263:33: expected restricted __le16 [usertype] duration_id drivers/staging/rtl8192e/rtllib_softmac.c:1263:33: got int drivers/staging/rtl8192e/rtllib_softmac.c:1282:30: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtllib_softmac.c:1282:30: expected restricted __le16 [usertype] listen_interval drivers/staging/rtl8192e/rtllib_softmac.c:1282:30: got unsigned short [unsigned] [usertype] listen_interval Signed-off-by: Rashika Kheria Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_softmac.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 721ee254b820..31cb858d978e 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -295,7 +295,7 @@ inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, u16 fc, type, stype; struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + 8); - fc = header->frame_ctl; + fc = le16_to_cpu(header->frame_ctl); type = WLAN_FC_GET_TYPE(fc); stype = WLAN_FC_GET_STYPE(fc); @@ -807,18 +807,18 @@ inline struct sk_buff *rtllib_authentication_req(struct rtllib_network *beacon, auth = (struct rtllib_authentication *) skb_put(skb, sizeof(struct rtllib_authentication)); - auth->header.frame_ctl = RTLLIB_STYPE_AUTH; + auth->header.frame_ctl = cpu_to_le16(RTLLIB_STYPE_AUTH); if (challengelen) auth->header.frame_ctl |= cpu_to_le16(RTLLIB_FCTL_WEP); - auth->header.duration_id = 0x013a; + auth->header.duration_id = cpu_to_le16(0x013a); memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN); memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN); memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN); if (ieee->auth_mode == 0) auth->algorithm = WLAN_AUTH_OPEN; else if (ieee->auth_mode == 1) - auth->algorithm = WLAN_AUTH_SHARED_KEY; + auth->algorithm = cpu_to_le16(WLAN_AUTH_SHARED_KEY); else if (ieee->auth_mode == 2) auth->algorithm = WLAN_AUTH_OPEN; auth->transaction = cpu_to_le16(ieee->associate_seq); @@ -952,7 +952,7 @@ static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee, u8 *dest) u16 val16; *(tag++) = MFIE_TYPE_IBSS_SET; *(tag++) = 2; - val16 = cpu_to_le16(ieee->current_network.atim_window); + val16 = ieee->current_network.atim_window; memcpy((u8 *)tag, (u8 *)&val16, 2); tag += 2; } @@ -1260,7 +1260,7 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon, hdr->header.frame_ctl = RTLLIB_STYPE_ASSOC_REQ; - hdr->header.duration_id = 37; + hdr->header.duration_id = cpu_to_le16(37); memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN); memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN); memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN); @@ -1279,7 +1279,7 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon, hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME); - hdr->listen_interval = beacon->listen_interval; + hdr->listen_interval = cpu_to_le16(beacon->listen_interval); hdr->info_element[0].id = MFIE_TYPE_SSID; From c5654c0bf9718816535e3df661777d697c7b926e Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Thu, 7 Nov 2013 19:05:09 +0530 Subject: [PATCH 084/238] Staging: rtl8192e: Fix Sparse Warning for Static Declarations in rtllib_softmac.c This patch fixes the following Sparse warnings in rtllib_softmac.c- drivers/staging/rtl8192e/rtllib_softmac.c:3636:12: warning: symbol 'rtllib_MgntDisconnectIBSS' was not declared. Should it be static? drivers/staging/rtl8192e/rtllib_softmac.c:3661:13: warning: symbol 'rtllib_MlmeDisassociateRequest' was not declared. Should it be static? drivers/staging/rtl8192e/rtllib_softmac.c:3687:13: warning: symbol 'rtllib_MgntDisconnectAP' was not declared. Should it be static? Signed-off-by: Rashika Kheria Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_softmac.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 31cb858d978e..eeec19cde229 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -3633,7 +3633,7 @@ out: } EXPORT_SYMBOL(rtllib_wpa_supplicant_ioctl); -void rtllib_MgntDisconnectIBSS(struct rtllib_device *rtllib) +static void rtllib_MgntDisconnectIBSS(struct rtllib_device *rtllib) { u8 OpMode; u8 i; @@ -3658,7 +3658,7 @@ void rtllib_MgntDisconnectIBSS(struct rtllib_device *rtllib) } -void rtllib_MlmeDisassociateRequest(struct rtllib_device *rtllib, u8 *asSta, +static void rtllib_MlmeDisassociateRequest(struct rtllib_device *rtllib, u8 *asSta, u8 asRsn) { u8 i; @@ -3684,7 +3684,7 @@ void rtllib_MlmeDisassociateRequest(struct rtllib_device *rtllib, u8 *asSta, } -void +static void rtllib_MgntDisconnectAP( struct rtllib_device *rtllib, u8 asRsn From 450246465a76abc89c1d75882669fb63d5398c21 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Fri, 8 Nov 2013 18:26:20 +0530 Subject: [PATCH 085/238] Staging: rtl8192e: Fix incorrect type in assignment in rtl819x_BAProc.c This patch fixes the following Sparse warnings in rtl819x_BAProc.c- drivers/staging/rtl8192e/rtl819x_BAProc.c:118:21: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtl819x_BAProc.c:118:21: expected unsigned short [unsigned] [usertype] tmp drivers/staging/rtl8192e/rtl819x_BAProc.c:118:21: got restricted __le16 [usertype] drivers/staging/rtl8192e/rtl819x_BAProc.c:122:13: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtl819x_BAProc.c:122:13: expected unsigned short [unsigned] [addressable] [usertype] tmp drivers/staging/rtl8192e/rtl819x_BAProc.c:122:13: got restricted __le16 [usertype] drivers/staging/rtl8192e/rtl819x_BAProc.c:125:13: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtl819x_BAProc.c:125:13: expected unsigned short [unsigned] [addressable] [usertype] tmp drivers/staging/rtl8192e/rtl819x_BAProc.c:125:13: got restricted __le16 [usertype] drivers/staging/rtl8192e/rtl819x_BAProc.c:181:13: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtl819x_BAProc.c:181:13: expected unsigned short [unsigned] [usertype] tmp drivers/staging/rtl8192e/rtl819x_BAProc.c:181:13: got restricted __le16 [usertype] drivers/staging/rtl8192e/rtl819x_BAProc.c:184:13: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtl819x_BAProc.c:184:13: expected unsigned short [unsigned] [addressable] [usertype] tmp drivers/staging/rtl8192e/rtl819x_BAProc.c:184:13: got restricted __le16 [usertype] Signed-off-by: Rashika Kheria Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl819x_BAProc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl819x_BAProc.c b/drivers/staging/rtl8192e/rtl819x_BAProc.c index 32fbbc9d0d92..adc6cc7ca3d6 100644 --- a/drivers/staging/rtl8192e/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192e/rtl819x_BAProc.c @@ -115,14 +115,14 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst, if (ACT_ADDBARSP == type) { RT_TRACE(COMP_DBG, "====>to send ADDBARSP\n"); - tmp = cpu_to_le16(StatusCode); + tmp = StatusCode; memcpy(tag, (u8 *)&tmp, 2); tag += 2; } - tmp = cpu_to_le16(pBA->BaParamSet.shortData); + tmp = pBA->BaParamSet.shortData; memcpy(tag, (u8 *)&tmp, 2); tag += 2; - tmp = cpu_to_le16(pBA->BaTimeoutValue); + tmp = pBA->BaTimeoutValue; memcpy(tag, (u8 *)&tmp, 2); tag += 2; @@ -178,10 +178,10 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst, *tag ++= ACT_CAT_BA; *tag ++= ACT_DELBA; - tmp = cpu_to_le16(DelbaParamSet.shortData); + tmp = DelbaParamSet.shortData; memcpy(tag, (u8 *)&tmp, 2); tag += 2; - tmp = cpu_to_le16(ReasonCode); + tmp = ReasonCode; memcpy(tag, (u8 *)&tmp, 2); tag += 2; From 327ca222aeed7cda0ba1e378088e1aa4f239ca0f Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Thu, 7 Nov 2013 19:07:50 +0530 Subject: [PATCH 086/238] Staging: rtl8192e: Fix Sparse Warning for Static Declarations in rtllib_crypt_ccmp.c This patch fixes the following Sparse warnings in rtllib_crypt_ccmp.c- drivers/staging/rtl8192e/rtllib_crypt_ccmp.c:446:12: warning: symbol 'rtllib_crypto_ccmp_init' was not declared. Should it be static? drivers/staging/rtl8192e/rtllib_crypt_ccmp.c:452:13: warning: symbol 'rtllib_crypto_ccmp_exit' was not declared. Should it be static? Signed-off-by: Rashika Kheria Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_crypt_ccmp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c index e51cb49ce10e..5e5c76bcdbd0 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c @@ -443,13 +443,13 @@ static struct lib80211_crypto_ops rtllib_crypt_ccmp = { }; -int __init rtllib_crypto_ccmp_init(void) +static int __init rtllib_crypto_ccmp_init(void) { return lib80211_register_crypto_ops(&rtllib_crypt_ccmp); } -void __exit rtllib_crypto_ccmp_exit(void) +static void __exit rtllib_crypto_ccmp_exit(void) { lib80211_unregister_crypto_ops(&rtllib_crypt_ccmp); } From 99277c1f99627af12499b2c63b0b6666bebc1701 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Thu, 7 Nov 2013 19:09:25 +0530 Subject: [PATCH 087/238] Staging: rtl8192e: Fix Sparse warning of cast to restricted __le16 in rtllib_crypt_tkip.c This patch fixes the following Sparse warnings in rtllib_crypt_tkip.c- drivers/staging/rtl8192e/rtllib_crypt_tkip.c:176:16: warning: cast to restricted __le16 Signed-off-by: Rashika Kheria Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c index 5cfd73baf1cc..d85802ee528b 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c @@ -173,7 +173,7 @@ static inline u16 Mk16(u8 hi, u8 lo) static inline u16 Mk16_le(u16 *v) { - return le16_to_cpu(*v); + return *v; } From 316de3cabb5472225195a86f2dc150cf90698682 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Thu, 7 Nov 2013 19:10:18 +0530 Subject: [PATCH 088/238] Staging: rtl8192e: Fix Sparse Warning for Static Declarations in rtllib_crypt_tkip.c This patch fixes the following Sparse warnings in rtllib_crypt_tkip.c- drivers/staging/rtl8192e/rtllib_crypt_tkip.c:755:12: warning: symbol 'rtllib_crypto_tkip_init' was not declared. Should it be static? drivers/staging/rtl8192e/rtllib_crypt_tkip.c:761:13: warning: symbol 'rtllib_crypto_tkip_exit' was not declared. Should it be static? Signed-off-by: Rashika Kheria Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c index d85802ee528b..d2768986c53e 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c @@ -752,13 +752,13 @@ static struct lib80211_crypto_ops rtllib_crypt_tkip = { }; -int __init rtllib_crypto_tkip_init(void) +static int __init rtllib_crypto_tkip_init(void) { return lib80211_register_crypto_ops(&rtllib_crypt_tkip); } -void __exit rtllib_crypto_tkip_exit(void) +static void __exit rtllib_crypto_tkip_exit(void) { lib80211_unregister_crypto_ops(&rtllib_crypt_tkip); } From 20fc5afc32a642104d23efc2d00141fe3d1a2661 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Thu, 7 Nov 2013 19:11:31 +0530 Subject: [PATCH 089/238] Staging: rtl8192e: Fix Sparse Warning for Static Declarations in rtllib_crypt_wep.c This patch fixes the following Sparse warnings in rtllib_crypt_wep.c- drivers/staging/rtl8192e/rtllib_crypt_wep.c:273:12: warning: symbol 'rtllib_crypto_wep_init' was not declared. Should it be static? drivers/staging/rtl8192e/rtllib_crypt_wep.c:279:13: warning: symbol 'rtllib_crypto_wep_exit' was not declared. Should it be static? Signed-off-by: Rashika Kheria Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_crypt_wep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_crypt_wep.c b/drivers/staging/rtl8192e/rtllib_crypt_wep.c index c4df6e01ef74..b0e5f1ff07ee 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_wep.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_wep.c @@ -270,13 +270,13 @@ static struct lib80211_crypto_ops rtllib_crypt_wep = { }; -int __init rtllib_crypto_wep_init(void) +static int __init rtllib_crypto_wep_init(void) { return lib80211_register_crypto_ops(&rtllib_crypt_wep); } -void __exit rtllib_crypto_wep_exit(void) +static void __exit rtllib_crypto_wep_exit(void) { lib80211_unregister_crypto_ops(&rtllib_crypt_wep); } From d95cb1c7748d1021ae26499561aa3953d9b263a9 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Thu, 7 Nov 2013 19:12:28 +0530 Subject: [PATCH 090/238] Staging: rtl8192e: Fix Sparse warning of cast from restricted __le16 in r8192E_dev.c This patch fixes the following Sparse warning in rtl8192e/r8192E_dev.c- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c:196:34: warning: cast from restricted __le16 drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c:198:33: warning: cast from restricted __le16 drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c:200:33: warning: cast from restricted __le16 Signed-off-by: Rashika Kheria Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 2cace9a4525a..dc9d7d616a49 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -193,11 +193,12 @@ void rtl8192e_SetHwReg(struct net_device *dev, u8 variable, u8 *val) dm_init_edca_turbo(dev); - u4bAcParam = ((((u32)(qos_parameters->tx_op_limit[pAcParam])) << + u4bAcParam = (((le16_to_cpu( + qos_parameters->tx_op_limit[pAcParam])) << AC_PARAM_TXOP_LIMIT_OFFSET) | - (((u32)(qos_parameters->cw_max[pAcParam])) << + ((le16_to_cpu(qos_parameters->cw_max[pAcParam])) << AC_PARAM_ECW_MAX_OFFSET) | - (((u32)(qos_parameters->cw_min[pAcParam])) << + ((le16_to_cpu(qos_parameters->cw_min[pAcParam])) << AC_PARAM_ECW_MIN_OFFSET) | (((u32)u1bAIFS) << AC_PARAM_AIFS_OFFSET)); From 285cce0560fe9882373b26f16221ec0e2726c6af Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Thu, 7 Nov 2013 19:13:49 +0530 Subject: [PATCH 091/238] Staging: rtl8192e: Fix incorrect type in assignment in r8192E_dev.c This patch fixes the following sparse warning in rtl8192e/r8192E_dev.c- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c:1275:27: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c:1275:27: expected unsigned int [unsigned] [usertype] TxBuffAddr drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c:1275:27: got restricted __le32 [usertype] drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c:1305:27: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c:1305:27: expected unsigned int [unsigned] [usertype] TxBuffAddr drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c:1305:27: got restricted __le32 [usertype] Signed-off-by: Rashika Kheria Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index dc9d7d616a49..175c7a16695b 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -1272,7 +1272,7 @@ void rtl8192_tx_fill_desc(struct net_device *dev, struct tx_desc *pdesc, pdesc->LastSeg = 1; pdesc->TxBufferSize = skb->len; - pdesc->TxBuffAddr = cpu_to_le32(mapping); + pdesc->TxBuffAddr = mapping; } void rtl8192_tx_fill_cmd_desc(struct net_device *dev, @@ -1302,7 +1302,7 @@ void rtl8192_tx_fill_cmd_desc(struct net_device *dev, entry_tmp->RATid = (u8)DESC_PACKET_TYPE_INIT; } entry->TxBufferSize = skb->len; - entry->TxBuffAddr = cpu_to_le32(mapping); + entry->TxBuffAddr = mapping; entry->OWN = 1; } From fa63c9ce864012ac2ff26991f08f139d6a0debba Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Thu, 7 Nov 2013 19:14:56 +0530 Subject: [PATCH 092/238] Staging: rtl8192e: Fix Sparse Warning for Static Declarations in rtl_core.c This patch fixes the following sparse warning in rtl8192e/rtl_core.c- drivers/staging/rtl8192e/rtl8192e/rtl_core.c:58:5: warning: symbol 'hwwep' was not declared. Should it be static? drivers/staging/rtl8192e/rtl8192e/rtl_core.c:588:5: warning: symbol 'WDCAPARA_ADD' was not declared. Should it be static? drivers/staging/rtl8192e/rtl8192e/rtl_core.c:2695:13: warning: symbol 'rtl8192_interrupt' was not declared. Should it be static? Signed-off-by: Rashika Kheria Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 +--- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 ++ 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 175c7a16695b..4a35f9b5602d 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -30,7 +30,7 @@ #include "rtl_dm.h" #include "rtl_wx.h" -extern int WDCAPARA_ADD[]; +static int WDCAPARA_ADD[] = {EDCAPARA_BE, EDCAPARA_BK, EDCAPARA_VI, EDCAPARA_VO}; void rtl8192e_start_beacon(struct net_device *dev) { diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c index fa5603a562c3..c46c65c5542f 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c @@ -28,7 +28,6 @@ #include "r8190P_rtl8256.h" /* RTL8225 Radio frontend */ #include "r8192E_cmdpkt.h" -extern int hwwep; void CamResetAllEntry(struct net_device *dev) { u32 ulcommand = 0; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index d93caca9657d..ceb29c8032f3 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -585,8 +585,6 @@ static void rtl8192_update_beacon(void *data) rtl8192_update_cap(dev, net->capability); } -int WDCAPARA_ADD[] = {EDCAPARA_BE, EDCAPARA_BK, EDCAPARA_VI, EDCAPARA_VO}; - static void rtl8192_qos_activate(void *data) { struct r8192_priv *priv = container_of_work_rsl(data, struct r8192_priv, @@ -2692,7 +2690,7 @@ out: } -irqreturn_t rtl8192_interrupt(int irq, void *netdev) +static irqreturn_t rtl8192_interrupt(int irq, void *netdev) { struct net_device *dev = (struct net_device *) netdev; struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index b015bf61cf05..ce239be8f2f6 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -188,6 +188,8 @@ #define MAX_RX_COUNT 64 #define MAX_TX_QUEUE_COUNT 9 +extern int hwwep; + enum RTL819x_PHY_PARAM { RTL819X_PHY_MACPHY_REG = 0, RTL819X_PHY_MACPHY_REG_PG = 1, From 34e987e6ff615b97fbf8d3bb273ff343fa2ed8b6 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Thu, 7 Nov 2013 19:15:48 +0530 Subject: [PATCH 093/238] Staging: rtl8192e: Fix incorrect type in assignment in rtl_core.c This patch fixes the following sparse warning in rtl8192e/rtl_core.c- drivers/staging/rtl8192e/rtl8192e/rtl_core.c:565:10: warning: incorrect type in initializer (different base types) drivers/staging/rtl8192e/rtl8192e/rtl_core.c:565:10: expected restricted __le16 drivers/staging/rtl8192e/rtl8192e/rtl_core.c:565:10: got int drivers/staging/rtl8192e/rtl8192e/rtl_core.c:565:13: warning: incorrect type in initializer (different base types) drivers/staging/rtl8192e/rtl8192e/rtl_core.c:565:13: expected restricted __le16 drivers/staging/rtl8192e/rtl8192e/rtl_core.c:565:13: got int drivers/staging/rtl8192e/rtl8192e/rtl_core.c:565:16: warning: incorrect type in initializer (different base types) drivers/staging/rtl8192e/rtl8192e/rtl_core.c:565:16: expected restricted __le16 drivers/staging/rtl8192e/rtl8192e/rtl_core.c:565:16: got int drivers/staging/rtl8192e/rtl8192e/rtl_core.c:565:19: warning: incorrect type in initializer (different base types) drivers/staging/rtl8192e/rtl8192e/rtl_core.c:565:19: expected restricted __le16 drivers/staging/rtl8192e/rtl8192e/rtl_core.c:565:19: got int drivers/staging/rtl8192e/rtl8192e/rtl_core.c:566:10: warning: incorrect type in initializer (different base types) drivers/staging/rtl8192e/rtl8192e/rtl_core.c:566:10: expected restricted __le16 drivers/staging/rtl8192e/rtl8192e/rtl_core.c:566:10: got int drivers/staging/rtl8192e/rtl8192e/rtl_core.c:566:13: warning: incorrect type in initializer (different base types) drivers/staging/rtl8192e/rtl8192e/rtl_core.c:566:13: expected restricted __le16 drivers/staging/rtl8192e/rtl8192e/rtl_core.c:566:13: got int drivers/staging/rtl8192e/rtl8192e/rtl_core.c:566:16: warning: incorrect type in initializer (different base types) drivers/staging/rtl8192e/rtl8192e/rtl_core.c:566:16: expected restricted __le16 drivers/staging/rtl8192e/rtl8192e/rtl_core.c:566:16: got int drivers/staging/rtl8192e/rtl8192e/rtl_core.c:566:19: warning: incorrect type in initializer (different base types) drivers/staging/rtl8192e/rtl8192e/rtl_core.c:566:19: expected restricted __le16 drivers/staging/rtl8192e/rtl8192e/rtl_core.c:566:19: got int drivers/staging/rtl8192e/rtl8192e/rtl_core.c:2012:12: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtl8192e/rtl_core.c:2012:12: expected unsigned short [unsigned] [usertype] fc drivers/staging/rtl8192e/rtl8192e/rtl_core.c:2012:12: got restricted __le16 [usertype] frame_ctl drivers/staging/rtl8192e/rtl8192e/rtl_core.c:2102:46: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtl8192e/rtl_core.c:2102:46: expected unsigned int [unsigned] [usertype] BufferAddress drivers/staging/rtl8192e/rtl8192e/rtl_core.c:2102:46: got restricted __le32 [usertype] drivers/staging/rtl8192e/rtl8192e/rtl_core.c:2137:41: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192e/rtl8192e/rtl_core.c:2137:41: expected unsigned int [unsigned] [usertype] NextDescAddress drivers/staging/rtl8192e/rtl8192e/rtl_core.c:2137:41: got restricted __le32 [usertype] drivers/staging/rtl8192e/rtl8192e/rtl_core.c:2401:38: warning: incorrect type in assignment rtllib_softmac.c(different base types) drivers/staging/rtl8192e/rtl8192e/rtl_core.c:2401:38: expected unsigned int [unsigned] [usertype] BufferAddress drivers/staging/rtl8192e/rtl8192e/rtl_core.c:2401:38: got restricted __le32 [usertype] Signed-off-by: Rashika Kheria Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index ceb29c8032f3..d36d6bb91342 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -562,8 +562,8 @@ void rtl8192_update_cap(struct net_device *dev, u16 cap) } static struct rtllib_qos_parameters def_qos_parameters = { - {3, 3, 3, 3}, - {7, 7, 7, 7}, + {cpu_to_le16(3), cpu_to_le16(3), cpu_to_le16(3), cpu_to_le16(3)}, + {cpu_to_le16(7), cpu_to_le16(7), cpu_to_le16(7), cpu_to_le16(7)}, {2, 2, 2, 2}, {0, 0, 0, 0}, {0, 0, 0, 0} @@ -2009,7 +2009,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) fwinfo_size = sizeof(struct tx_fwinfo_8190pci); header = (struct rtllib_hdr_1addr *)(((u8 *)skb->data) + fwinfo_size); - fc = header->frame_ctl; + fc = le16_to_cpu(header->frame_ctl); type = WLAN_FC_GET_TYPE(fc); stype = WLAN_FC_GET_STYPE(fc); pda_addr = header->addr1; @@ -2099,7 +2099,7 @@ static short rtl8192_alloc_rx_desc_ring(struct net_device *dev) dev_kfree_skb_any(skb); return -1; } - entry->BufferAddress = cpu_to_le32(*mapping); + entry->BufferAddress = *mapping; entry->Length = priv->rxbuffersize; entry->OWN = 1; @@ -2135,8 +2135,8 @@ static int rtl8192_alloc_tx_desc_ring(struct net_device *dev, for (i = 0; i < entries; i++) ring[i].NextDescAddress = - cpu_to_le32((u32)dma + ((i + 1) % entries) * - sizeof(*ring)); + (u32)dma + ((i + 1) % entries) * + sizeof(*ring); return 0; } @@ -2398,7 +2398,7 @@ static void rtl8192_rx_normal(struct net_device *dev) } } done: - pdesc->BufferAddress = cpu_to_le32(*((dma_addr_t *)skb->cb)); + pdesc->BufferAddress = *((dma_addr_t *)skb->cb); pdesc->OWN = 1; pdesc->Length = priv->rxbuffersize; if (priv->rx_idx[rx_queue_idx] == priv->rxringcount-1) From 466bc7f2307e47ad53c0b520c56b0a4c45b6d0a2 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Thu, 7 Nov 2013 19:16:36 +0530 Subject: [PATCH 094/238] Staging: rtl8192e: Fix Sparse warning of cast to restricted __le32 in rtl_core.c This patch fixes the following sparse warnings in rtl8192e/rtl_core.c- drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1846:46: warning: cast to restricted __le32 drivers/staging/rtl8192e/rtl8192e/rtl_core.c:1951:46: warning: cast to restricted __le32 drivers/staging/rtl8192e/rtl8192e/rtl_core.c:2199:50: warning: cast to restricted __le32 Signed-off-by: Rashika Kheria Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index d36d6bb91342..c01abc23213e 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -1843,7 +1843,7 @@ static void rtl8192_free_tx_ring(struct net_device *dev, unsigned int prio) struct tx_desc *entry = &ring->desc[ring->idx]; struct sk_buff *skb = __skb_dequeue(&ring->queue); - pci_unmap_single(priv->pdev, le32_to_cpu(entry->TxBuffAddr), + pci_unmap_single(priv->pdev, entry->TxBuffAddr, skb->len, PCI_DMA_TODEVICE); kfree_skb(skb); ring->idx = (ring->idx + 1) % ring->entries; @@ -1948,7 +1948,7 @@ static void rtl8192_tx_isr(struct net_device *dev, int prio) } skb = __skb_dequeue(&ring->queue); - pci_unmap_single(priv->pdev, le32_to_cpu(entry->TxBuffAddr), + pci_unmap_single(priv->pdev, entry->TxBuffAddr, skb->len, PCI_DMA_TODEVICE); kfree_skb(skb); @@ -2196,7 +2196,7 @@ void rtl8192_pci_resetdescring(struct net_device *dev) __skb_dequeue(&ring->queue); pci_unmap_single(priv->pdev, - le32_to_cpu(entry->TxBuffAddr), + entry->TxBuffAddr, skb->len, PCI_DMA_TODEVICE); kfree_skb(skb); ring->idx = (ring->idx + 1) % ring->entries; From 1f9d82d29345b0bf6a4ce4eec13e63236b739272 Mon Sep 17 00:00:00 2001 From: Teodora Baluta Date: Fri, 8 Nov 2013 00:13:46 +0200 Subject: [PATCH 095/238] staging: rtl8188eu: correct code alignment This patch fixes incorrect code alignment due to mixed indenting with spaces and tabs. This patch was detected using coccinelle and silences the following warnings: drivers/staging/rtl8188eu/core/rtw_io.c:297:2-29: code aligned with following code on line 299 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c:4420:2-29: code aligned with following code on line 4422 drivers/staging/rtl8188eu/os_dep/osdep_service.c:54:2-17: code aligned with following code on line 55 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c:7229:2-17: code aligned with following code on line 7231 Signed-off-by: Teodora Baluta Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_io.c | 2 +- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 2 +- .../staging/rtl8188eu/os_dep/ioctl_linux.c | 34 +++++++++---------- .../staging/rtl8188eu/os_dep/osdep_service.c | 2 +- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_io.c b/drivers/staging/rtl8188eu/core/rtw_io.c index 10c9c6560b20..c47990a62b7c 100644 --- a/drivers/staging/rtl8188eu/core/rtw_io.c +++ b/drivers/staging/rtl8188eu/core/rtw_io.c @@ -296,7 +296,7 @@ u32 _rtw_write_port_and_wait(struct adapter *adapter, u32 addr, u32 cnt, u8 *pme if (ret == _SUCCESS) ret = rtw_sctx_wait(&sctx); - return ret; + return ret; } void _rtw_write_port_cancel(struct adapter *adapter) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index 7ab5ff039c88..6519a7b3f833 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -4419,7 +4419,7 @@ s32 dump_mgntframe_and_wait(struct adapter *padapter, struct xmit_frame *pmgntfr if (ret == _SUCCESS) ret = rtw_sctx_wait(&sctx); - return ret; + return ret; } s32 dump_mgntframe_and_wait_ack(struct adapter *padapter, struct xmit_frame *pmgntframe) diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c index ae5458770234..a002d2e75e9f 100644 --- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c @@ -7228,25 +7228,25 @@ static int rtw_mp_thermal(struct net_device *dev, if (copy_from_user(extra, wrqu->pointer, wrqu->length)) return -EFAULT; - bwrite = strncmp(extra, "write", 6); /* strncmp true is 0 */ + bwrite = strncmp(extra, "write", 6); /* strncmp true is 0 */ - Hal_GetThermalMeter(padapter, &val); + Hal_GetThermalMeter(padapter, &val); - if (bwrite == 0) { - EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (void *)&max_available_size, false); - if (2 > max_available_size) { - DBG_88E("no available efuse!\n"); - return -EFAULT; - } - if (rtw_efuse_map_write(padapter, addr, cnt, &val) == _FAIL) { - DBG_88E("rtw_efuse_map_write error\n"); - return -EFAULT; - } else { - sprintf(extra, " efuse write ok :%d", val); - } - } else { - sprintf(extra, "%d", val); - } + if (bwrite == 0) { + EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (void *)&max_available_size, false); + if (2 > max_available_size) { + DBG_88E("no available efuse!\n"); + return -EFAULT; + } + if (rtw_efuse_map_write(padapter, addr, cnt, &val) == _FAIL) { + DBG_88E("rtw_efuse_map_write error\n"); + return -EFAULT; + } else { + sprintf(extra, " efuse write ok :%d", val); + } + } else { + sprintf(extra, "%d", val); + } wrqu->length = strlen(extra); return 0; diff --git a/drivers/staging/rtl8188eu/os_dep/osdep_service.c b/drivers/staging/rtl8188eu/os_dep/osdep_service.c index 5a9e9e4558aa..7b3fb35dd5ce 100644 --- a/drivers/staging/rtl8188eu/os_dep/osdep_service.c +++ b/drivers/staging/rtl8188eu/os_dep/osdep_service.c @@ -52,7 +52,7 @@ u32 rtw_atoi(u8 *s) } if (flag == 1) num = num * -1; - return num; + return num; } inline u8 *_rtw_vmalloc(u32 sz) From 74772fcf61bbbb71a8f1b3eaf70d67d00b7bc752 Mon Sep 17 00:00:00 2001 From: Teodora Baluta Date: Fri, 8 Nov 2013 00:13:47 +0200 Subject: [PATCH 096/238] staging: rtl8188eu: remove unneeded semicolon This patch fixes the following issues detected by coccinelle: drivers/staging/rtl8188eu/core/rtw_xmit.c:688:75-76: Unneeded semicolon drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c:2307:64-65: Unneeded semicolon drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c:89:66-67: Unneeded semicolon Signed-off-by: Teodora Baluta Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_xmit.c | 2 +- drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c | 2 +- drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c index a594e51d2e1c..01662f78e53d 100644 --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c @@ -685,7 +685,7 @@ static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitfr _func_enter_; - hw_hdr_offset = TXDESC_SIZE + (pxmitframe->pkt_offset * PACKET_OFFSET_SZ);; + hw_hdr_offset = TXDESC_SIZE + (pxmitframe->pkt_offset * PACKET_OFFSET_SZ); if (pattrib->encrypt == _TKIP_) {/* if (psecuritypriv->dot11PrivacyAlgrthm == _TKIP_PRIVACY_) */ /* encode mic code */ diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c index 52b3fba0fae1..a291d7ae6f42 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c @@ -2304,7 +2304,7 @@ void Hal_ReadAntennaDiversity88E(struct adapter *pAdapter, u8 *PROMContent, bool if (registry_par->antdiv_cfg == 2) { /* 2:By EFUSE */ pHalData->AntDivCfg = (PROMContent[EEPROM_RF_BOARD_OPTION_88E]&0x18)>>3; if (PROMContent[EEPROM_RF_BOARD_OPTION_88E] == 0xFF) - pHalData->AntDivCfg = (EEPROM_DEFAULT_BOARD_OPTION&0x18)>>3;; + pHalData->AntDivCfg = (EEPROM_DEFAULT_BOARD_OPTION&0x18)>>3; } else { pHalData->AntDivCfg = registry_par->antdiv_cfg; /* 0:OFF , 1:ON, 2:By EFUSE */ } diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c index 05e2475cfd61..511f61cbb9e0 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c @@ -86,7 +86,7 @@ void update_recvframe_attrib_88e(union recv_frame *precvframe, struct recv_stat pattrib = &precvframe->u.hdr.attrib; _rtw_memset(pattrib, 0, sizeof(struct rx_pkt_attrib)); - pattrib->crc_err = (u8)((le32_to_cpu(report.rxdw0) >> 14) & 0x1);;/* u8)prxreport->crc32; */ + pattrib->crc_err = (u8)((le32_to_cpu(report.rxdw0) >> 14) & 0x1);/* u8)prxreport->crc32; */ /* update rx report to recv_frame attribute */ pattrib->pkt_rpt_type = (u8)((le32_to_cpu(report.rxdw3) >> 14) & 0x3);/* prxreport->rpt_sel; */ From fa7b3d028852e4a3ebecfcd7b642cb3d2c86f8b9 Mon Sep 17 00:00:00 2001 From: Himangi Saraogi Date: Sun, 10 Nov 2013 03:04:54 +0530 Subject: [PATCH 097/238] staging:rtl8192e: Rewrite macro definition as static inline function. This patch removes the checkpatch.pl error Macros "with complex values should be enclosed in parenthesis" in dot11d.h by rewriting it as a static inline function. Signed-off-by: Himangi Saraogi Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/dot11d.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192e/dot11d.h b/drivers/staging/rtl8192e/dot11d.h index fb7683fa5ffd..eeea50260f1d 100644 --- a/drivers/staging/rtl8192e/dot11d.h +++ b/drivers/staging/rtl8192e/dot11d.h @@ -87,7 +87,10 @@ static inline void cpMacAddr(unsigned char *des, unsigned char *src) #define CIE_WATCHDOG_TH 1 #define GET_CIE_WATCHDOG(__pIeeeDev) \ (GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog) -#define RESET_CIE_WATCHDOG(__pIeeeDev) GET_CIE_WATCHDOG(__pIeeeDev) = 0 +static inline void RESET_CIE_WATCHDOG(struct rtllib_device *__pIeeeDev) +{ + GET_CIE_WATCHDOG(__pIeeeDev) = 0; +} #define UPDATE_CIE_WATCHDOG(__pIeeeDev) (++GET_CIE_WATCHDOG(__pIeeeDev)) #define IS_DOT11D_STATE_DONE(__pIeeeDev) \ From f249da27e3615da41f2d072691503f358c220732 Mon Sep 17 00:00:00 2001 From: Archana kumari Date: Mon, 11 Nov 2013 00:04:04 +0530 Subject: [PATCH 098/238] staging: rtl8192e: Fixed space prohibited warning in dot11d.c This patch fixes space prohibited before semicolon warning in dot11d.c Signed-off-by: Archana kumari Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/dot11d.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192e/dot11d.c b/drivers/staging/rtl8192e/dot11d.c index 1260f10944ef..eb33c517fcc8 100644 --- a/drivers/staging/rtl8192e/dot11d.c +++ b/drivers/staging/rtl8192e/dot11d.c @@ -144,7 +144,7 @@ void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 *pTaddr, return; } - for (j = 0 ; j < pTriple->NumChnls; j++) { + for (j = 0; j < pTriple->NumChnls; j++) { pDot11dInfo->channel_map[pTriple->FirstChnl + j] = 1; pDot11dInfo->MaxTxPwrDbmList[pTriple->FirstChnl + j] = pTriple->MaxTxPowerInDbm; From c37da1c638685487d03f703c41e9740140939869 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sun, 10 Nov 2013 18:56:40 +0530 Subject: [PATCH 099/238] Staging: tidspbridge: Fix foo ** bar should be foo **bar in cmm.c This patch fixes the following checkpatch.pl warning in pmgr/cmm.c- ERROR: "foo ** bar" should be "foo **bar" Signed-off-by: Rashika Kheria Signed-off-by: Greg Kroah-Hartman --- drivers/staging/tidspbridge/pmgr/cmm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/tidspbridge/pmgr/cmm.c b/drivers/staging/tidspbridge/pmgr/cmm.c index 4a800dadd703..011145e46e0a 100644 --- a/drivers/staging/tidspbridge/pmgr/cmm.c +++ b/drivers/staging/tidspbridge/pmgr/cmm.c @@ -359,7 +359,7 @@ int cmm_free_buf(struct cmm_object *hcmm_mgr, void *buf_pa, u32 ul_seg_id) * Return the communication memory manager object for this device. * This is typically called from the client process. */ -int cmm_get_handle(void *hprocessor, struct cmm_object ** ph_cmm_mgr) +int cmm_get_handle(void *hprocessor, struct cmm_object **ph_cmm_mgr) { int status = 0; struct dev_object *hdev_obj; @@ -828,7 +828,7 @@ int cmm_xlator_free_buf(struct cmm_xlatorobject *xlator, void *buf_va) * Purpose: * Set/Get translator info. */ -int cmm_xlator_info(struct cmm_xlatorobject *xlator, u8 ** paddr, +int cmm_xlator_info(struct cmm_xlatorobject *xlator, u8 **paddr, u32 ul_size, u32 segm_id, bool set_info) { struct cmm_xlator *xlator_obj = (struct cmm_xlator *)xlator; From a5fdf083f2eeb0ecc24bd0816bb7e3d86a351029 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sun, 10 Nov 2013 18:57:21 +0530 Subject: [PATCH 100/238] Staging: tidspbridge: Fix quoted string split across lines in cmm.c This patch fixes the following checkpatch.pl warning in pmgr/cmm.c- WARNING: quoted string split across lines Signed-off-by: Rashika Kheria Signed-off-by: Greg Kroah-Hartman --- drivers/staging/tidspbridge/pmgr/cmm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/tidspbridge/pmgr/cmm.c b/drivers/staging/tidspbridge/pmgr/cmm.c index 011145e46e0a..f961e0ec9da8 100644 --- a/drivers/staging/tidspbridge/pmgr/cmm.c +++ b/drivers/staging/tidspbridge/pmgr/cmm.c @@ -449,8 +449,7 @@ int cmm_register_gppsm_seg(struct cmm_object *hcmm_mgr, struct cmm_mnode *new_node; s32 slot_seg; - dev_dbg(bridge, "%s: dw_gpp_base_pa %x ul_size %x dsp_addr_offset %x " - "dw_dsp_base %x ul_dsp_size %x gpp_base_va %x\n", + dev_dbg(bridge, "%s: dw_gpp_base_pa %x ul_size %x dsp_addr_offset %x dw_dsp_base %x ul_dsp_size %x gpp_base_va %x\n", __func__, dw_gpp_base_pa, ul_size, dsp_addr_offset, dw_dsp_base, ul_dsp_size, gpp_base_va); From 50e8f001847ce75ee4fe5210ba7d26be2ef68348 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sun, 10 Nov 2013 18:58:09 +0530 Subject: [PATCH 101/238] Staging: tidspbridge: Fix quoted string split across line in dbll.c This patch fixes the following checkpatch.pl warning in pmgr/dbll.c- WARNING: quoted string split across lines Signed-off-by: Rashika Kheria Signed-off-by: Greg Kroah-Hartman --- drivers/staging/tidspbridge/pmgr/dbll.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/staging/tidspbridge/pmgr/dbll.c b/drivers/staging/tidspbridge/pmgr/dbll.c index 41e88abe47af..941961e44020 100644 --- a/drivers/staging/tidspbridge/pmgr/dbll.c +++ b/drivers/staging/tidspbridge/pmgr/dbll.c @@ -378,8 +378,8 @@ int dbll_get_sect(struct dbll_library_obj *lib, char *name, u32 *paddr, opened_doff = false; } - dev_dbg(bridge, "%s: lib: %p name: %s paddr: %p psize: %p, " - "status 0x%x\n", __func__, lib, name, paddr, psize, status); + dev_dbg(bridge, "%s: lib: %p name: %s paddr: %p psize: %p, status 0x%x\n", + __func__, lib, name, paddr, psize, status); return status; } @@ -705,8 +705,8 @@ func_cont: opened_doff = false; } - dev_dbg(bridge, "%s: lib: %p name: %s buf: %p size: 0x%x, " - "status 0x%x\n", __func__, lib, name, buf, size, status); + dev_dbg(bridge, "%s: lib: %p name: %s buf: %p size: 0x%x, status 0x%x\n", + __func__, lib, name, buf, size, status); return status; } @@ -1172,8 +1172,7 @@ func_cont: if (!run_addr_flag) info->run_addr = info->load_addr; info->context = (u32) rmm_addr_obj.segid; - dev_dbg(bridge, "%s: %s base = 0x%x len = 0x%x, " - "info->run_addr 0x%x, info->load_addr 0x%x\n", + dev_dbg(bridge, "%s: %s base = 0x%x len = 0x%x, info->run_addr 0x%x, info->load_addr 0x%x\n", __func__, info->name, info->load_addr / DSPWORDSIZE, info->size / DSPWORDSIZE, info->run_addr, info->load_addr); From ae510a6a22300cc0e457bf2663ecd0f0ba352f83 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sun, 10 Nov 2013 18:58:44 +0530 Subject: [PATCH 102/238] Staging: tidspbridge: Fix no space before tabs in dbll.c This patch fixes the following checkpatch.pl warning in pmgr/dbll.c- WARNING: please, no space before tabs Signed-off-by: Rashika Kheria Signed-off-by: Greg Kroah-Hartman --- drivers/staging/tidspbridge/pmgr/dbll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/tidspbridge/pmgr/dbll.c b/drivers/staging/tidspbridge/pmgr/dbll.c index 941961e44020..c7d816e466c9 100644 --- a/drivers/staging/tidspbridge/pmgr/dbll.c +++ b/drivers/staging/tidspbridge/pmgr/dbll.c @@ -1398,7 +1398,7 @@ void find_symbol_callback(void *elem, void *user_data) * @sym_addr_output: Symbol Output address * @name_output: String with the dsp symbol * - * This function retrieves the dsp symbol from the dsp binary. + * This function retrieves the dsp symbol from the dsp binary. */ bool dbll_find_dsp_symbol(struct dbll_library_obj *zl_lib, u32 address, u32 offset_range, u32 *sym_addr_output, From b5f45d8eb6abe3e34fc43c119a2c12fc10b46d9b Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sun, 10 Nov 2013 18:59:17 +0530 Subject: [PATCH 103/238] Staging: tidspbridge: Fix no space at the start of the line in dbll.c This patch fixes the following checkpatch.pl warning in pmgr/dbll.c- WARNING: please, no space at the start of the line Signed-off-by: Rashika Kheria Signed-off-by: Greg Kroah-Hartman --- drivers/staging/tidspbridge/pmgr/dbll.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/tidspbridge/pmgr/dbll.c b/drivers/staging/tidspbridge/pmgr/dbll.c index c7d816e466c9..996a02d27d34 100644 --- a/drivers/staging/tidspbridge/pmgr/dbll.c +++ b/drivers/staging/tidspbridge/pmgr/dbll.c @@ -915,10 +915,10 @@ static struct dynload_symbol *dbll_find_symbol(struct dynamic_loader_sym *this, status = dbll_get_addr((struct dbll_library_obj *)lib, (char *)name, &dbll_sym); if (!status) { - status = - dbll_get_c_addr((struct dbll_library_obj *) - lib, (char *)name, - &dbll_sym); + status = dbll_get_c_addr( + (struct dbll_library_obj *) + lib, (char *)name, + &dbll_sym); } } } From 09ebd191f16a834f85ae8f8e9e7ae36c758589ff Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sun, 10 Nov 2013 18:59:51 +0530 Subject: [PATCH 104/238] Staging: tidspbridge: Fix foo * bar should be foo *bar in dev.c This patch fixes the following checkpatch.pl warning in pmgr/dev.c- ERROR: "foo * bar" should be "foo *bar" Signed-off-by: Rashika Kheria Signed-off-by: Greg Kroah-Hartman --- drivers/staging/tidspbridge/pmgr/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/tidspbridge/pmgr/dev.c b/drivers/staging/tidspbridge/pmgr/dev.c index 6234ffb5e8a3..e23e6a23daa2 100644 --- a/drivers/staging/tidspbridge/pmgr/dev.c +++ b/drivers/staging/tidspbridge/pmgr/dev.c @@ -606,7 +606,7 @@ int dev_get_node_manager(struct dev_object *hdev_obj, * ======== dev_get_symbol ======== */ int dev_get_symbol(struct dev_object *hdev_obj, - const char *str_sym, u32 * pul_value) + const char *str_sym, u32 *pul_value) { int status = 0; struct cod_manager *cod_mgr; From bf40d51a1c9490740e68815c28d449ab8d17af62 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sun, 10 Nov 2013 19:00:22 +0530 Subject: [PATCH 105/238] Staging: tidspbridge: Fix no space at the start of the line in dev.c This patch fixes the following checkpatch.pl warning in pmgr/dev.c- WARNING: please, no spaces at the start of a line Signed-off-by: Rashika Kheria Signed-off-by: Greg Kroah-Hartman --- drivers/staging/tidspbridge/pmgr/dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/tidspbridge/pmgr/dev.c b/drivers/staging/tidspbridge/pmgr/dev.c index e23e6a23daa2..616dc1f63070 100644 --- a/drivers/staging/tidspbridge/pmgr/dev.c +++ b/drivers/staging/tidspbridge/pmgr/dev.c @@ -916,8 +916,8 @@ static void store_interface_fxns(struct bridge_drv_interface *drv_fxns, /* Local helper macro: */ #define STORE_FXN(cast, pfn) \ - (intf_fxns->pfn = ((drv_fxns->pfn != NULL) ? drv_fxns->pfn : \ - (cast)fxn_not_implemented)) + (intf_fxns->pfn = ((drv_fxns->pfn != NULL) ? drv_fxns->pfn : \ + (cast)fxn_not_implemented)) bridge_version = MAKEVERSION(drv_fxns->brd_api_major_version, drv_fxns->brd_api_minor_version); From e2a6d03f9c8099a726aea105d4da8d92309e7f3f Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sun, 10 Nov 2013 19:00:54 +0530 Subject: [PATCH 106/238] Staging: tidspbridge: Fix quoted string split across line in dmm.c This patch fixes the following checkpatch.pl warning in pmgr/dmm.c- WARNING: quoted string split across lines Signed-off-by: Rashika Kheria Signed-off-by: Greg Kroah-Hartman --- drivers/staging/tidspbridge/pmgr/dmm.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/tidspbridge/pmgr/dmm.c b/drivers/staging/tidspbridge/pmgr/dmm.c index 7c9f83916068..01734196264b 100644 --- a/drivers/staging/tidspbridge/pmgr/dmm.c +++ b/drivers/staging/tidspbridge/pmgr/dmm.c @@ -217,8 +217,8 @@ int dmm_map_memory(struct dmm_object *dmm_mgr, u32 addr, u32 size) status = -ENOENT; spin_unlock(&dmm_obj->dmm_lock); - dev_dbg(bridge, "%s dmm_mgr %p, addr %x, size %x\n\tstatus %x, " - "chunk %p", __func__, dmm_mgr, addr, size, status, chunk); + dev_dbg(bridge, "%s dmm_mgr %p, addr %x, size %x\n\tstatus %x, chunk %p", + __func__, dmm_mgr, addr, size, status, chunk); return status; } @@ -268,9 +268,9 @@ int dmm_reserve_memory(struct dmm_object *dmm_mgr, u32 size, spin_unlock(&dmm_obj->dmm_lock); - dev_dbg(bridge, "%s dmm_mgr %p, size %x, prsv_addr %p\n\tstatus %x, " - "rsv_addr %x, rsv_size %x\n", __func__, dmm_mgr, size, - prsv_addr, status, rsv_addr, rsv_size); + dev_dbg(bridge, "%s dmm_mgr %p, size %x, prsv_addr %p\n\tstatus %x, rsv_addr %x, rsv_size %x\n", + __func__, dmm_mgr, size, + prsv_addr, status, rsv_addr, rsv_size); return status; } @@ -299,8 +299,8 @@ int dmm_un_map_memory(struct dmm_object *dmm_mgr, u32 addr, u32 *psize) } spin_unlock(&dmm_obj->dmm_lock); - dev_dbg(bridge, "%s: dmm_mgr %p, addr %x, psize %p\n\tstatus %x, " - "chunk %p\n", __func__, dmm_mgr, addr, psize, status, chunk); + dev_dbg(bridge, "%s: dmm_mgr %p, addr %x, psize %p\n\tstatus %x, chunk %p\n", + __func__, dmm_mgr, addr, psize, status, chunk); return status; } From 0431aa1b4e15d79a03a11cd229da35c888e1b590 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sun, 10 Nov 2013 19:01:26 +0530 Subject: [PATCH 107/238] Staging: tidspbridge: Remove unnecessary white space before a quoted newline in dmm.c This patch fixes the following checkpatch.pl warning in pmgr/dmm.c- WARNING: unnecessary whitespace before a quoted newline Signed-off-by: Rashika Kheria Signed-off-by: Greg Kroah-Hartman --- drivers/staging/tidspbridge/pmgr/dmm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/tidspbridge/pmgr/dmm.c b/drivers/staging/tidspbridge/pmgr/dmm.c index 01734196264b..e192823611f2 100644 --- a/drivers/staging/tidspbridge/pmgr/dmm.c +++ b/drivers/staging/tidspbridge/pmgr/dmm.c @@ -477,9 +477,9 @@ u32 dmm_mem_map_dump(struct dmm_object *dmm_mgr) spin_unlock(&dmm_mgr->dmm_lock); printk(KERN_INFO "Total DSP VA FREE memory = %d Mbytes\n", freemem / (1024 * 1024)); - printk(KERN_INFO "Total DSP VA USED memory= %d Mbytes \n", + printk(KERN_INFO "Total DSP VA USED memory= %d Mbytes\n", (((table_size * PG_SIZE4K) - freemem)) / (1024 * 1024)); - printk(KERN_INFO "DSP VA - Biggest FREE block = %d Mbytes \n\n", + printk(KERN_INFO "DSP VA - Biggest FREE block = %d Mbytes\n\n", (bigsize * PG_SIZE4K / (1024 * 1024))); return 0; From 6467f5c15e7f17b921bd57bccd662b1b3030927a Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sun, 10 Nov 2013 19:02:24 +0530 Subject: [PATCH 108/238] Staging: tidspbridge: Prefer dev_info() then printk() in dmm.c This patch fixes the following checkpatch.pl warning in pmgr/dmm.c- WARNING: Prefer netdev_info(netdev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ... Signed-off-by: Rashika Kheria Signed-off-by: Greg Kroah-Hartman --- drivers/staging/tidspbridge/pmgr/dmm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/tidspbridge/pmgr/dmm.c b/drivers/staging/tidspbridge/pmgr/dmm.c index e192823611f2..04a6b0669fa9 100644 --- a/drivers/staging/tidspbridge/pmgr/dmm.c +++ b/drivers/staging/tidspbridge/pmgr/dmm.c @@ -475,11 +475,11 @@ u32 dmm_mem_map_dump(struct dmm_object *dmm_mgr) } } spin_unlock(&dmm_mgr->dmm_lock); - printk(KERN_INFO "Total DSP VA FREE memory = %d Mbytes\n", + dev_info(bridge, "Total DSP VA FREE memory = %d Mbytes\n", freemem / (1024 * 1024)); - printk(KERN_INFO "Total DSP VA USED memory= %d Mbytes\n", + dev_info(bridge, "Total DSP VA USED memory= %d Mbytes\n", (((table_size * PG_SIZE4K) - freemem)) / (1024 * 1024)); - printk(KERN_INFO "DSP VA - Biggest FREE block = %d Mbytes\n\n", + dev_info(bridge, "DSP VA - Biggest FREE block = %d Mbytes\n\n", (bigsize * PG_SIZE4K / (1024 * 1024))); return 0; From 9279e0c6ed247ae467d0a369ac1390bca8f28519 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Sun, 10 Nov 2013 19:02:54 +0530 Subject: [PATCH 109/238] Staging: tidspbridge: Fix foo * bar should be foo *bar in dspapi.c This patch fixes the following checkpatch.pl warning in pmgr/dspapi.c- ERROR: "foo * bar" should be "foo *bar" Signed-off-by: Rashika Kheria Signed-off-by: Greg Kroah-Hartman --- drivers/staging/tidspbridge/pmgr/dspapi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/tidspbridge/pmgr/dspapi.c b/drivers/staging/tidspbridge/pmgr/dspapi.c index 70db4ff99ec6..b7d5c8cbb2a1 100644 --- a/drivers/staging/tidspbridge/pmgr/dspapi.c +++ b/drivers/staging/tidspbridge/pmgr/dspapi.c @@ -162,7 +162,7 @@ static u8 size_cmd[] = { ARRAY_SIZE(cmm_cmd), }; -static inline void _cp_fm_usr(void *to, const void __user * from, +static inline void _cp_fm_usr(void *to, const void __user *from, int *err, unsigned long bytes) { if (*err) @@ -507,7 +507,7 @@ u32 mgrwrap_wait_for_bridge_events(union trapped_args *args, void *pr_ctxt) /* * ======== MGRWRAP_GetProcessResourceInfo ======== */ -u32 __deprecated mgrwrap_get_process_resources_info(union trapped_args * args, +u32 __deprecated mgrwrap_get_process_resources_info(union trapped_args *args, void *pr_ctxt) { pr_err("%s: deprecated dspbridge ioctl\n", __func__); @@ -581,7 +581,7 @@ func_end: /* * ======== procwrap_detach ======== */ -u32 __deprecated procwrap_detach(union trapped_args * args, void *pr_ctxt) +u32 __deprecated procwrap_detach(union trapped_args *args, void *pr_ctxt) { /* proc_detach called at bridge_release only */ pr_err("%s: deprecated dspbridge ioctl\n", __func__); @@ -1564,7 +1564,7 @@ u32 strmwrap_free_buffer(union trapped_args *args, void *pr_ctxt) /* * ======== strmwrap_get_event_handle ======== */ -u32 __deprecated strmwrap_get_event_handle(union trapped_args * args, +u32 __deprecated strmwrap_get_event_handle(union trapped_args *args, void *pr_ctxt) { pr_err("%s: deprecated dspbridge ioctl\n", __func__); @@ -1793,7 +1793,7 @@ u32 strmwrap_select(union trapped_args *args, void *pr_ctxt) /* * ======== cmmwrap_calloc_buf ======== */ -u32 __deprecated cmmwrap_calloc_buf(union trapped_args * args, void *pr_ctxt) +u32 __deprecated cmmwrap_calloc_buf(union trapped_args *args, void *pr_ctxt) { /* This operation is done in kernel */ pr_err("%s: deprecated dspbridge ioctl\n", __func__); @@ -1803,7 +1803,7 @@ u32 __deprecated cmmwrap_calloc_buf(union trapped_args * args, void *pr_ctxt) /* * ======== cmmwrap_free_buf ======== */ -u32 __deprecated cmmwrap_free_buf(union trapped_args * args, void *pr_ctxt) +u32 __deprecated cmmwrap_free_buf(union trapped_args *args, void *pr_ctxt) { /* This operation is done in kernel */ pr_err("%s: deprecated dspbridge ioctl\n", __func__); From 4b5c08e85d5dbbe6c22e47b5cf4401be2639e9e5 Mon Sep 17 00:00:00 2001 From: Teodora Baluta Date: Mon, 4 Nov 2013 20:13:11 +0200 Subject: [PATCH 110/238] staging: comedi: remove unneeded semicolon There is no need for ';' after '}'. This minor fix was suggested by coccinelle. Signed-off-by: Teodora Baluta Reviewed-by: Lisa Nguyen Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcl818.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c index 9e4d7e860509..8b5e9c097349 100644 --- a/drivers/staging/comedi/drivers/pcl818.c +++ b/drivers/staging/comedi/drivers/pcl818.c @@ -753,7 +753,7 @@ static void pcl818_ai_mode13dma_int(int mode, struct comedi_device *dev, } else { devpriv->ai_mode = INT_TYPE_AI3_DMA; outb(0x86 | (dev->irq << 4), dev->iobase + PCL818_CONTROL); /* Ext trig+IRQ+DMA */ - }; + } } /* From 42a5a418b2e572ae7056a6381d4d8428008a18b3 Mon Sep 17 00:00:00 2001 From: Teodora Baluta Date: Mon, 4 Nov 2013 20:13:10 +0200 Subject: [PATCH 111/238] staging: comedi: change bool assignment to true This is a minor fix that was suggested by coccinelle. When defined as a bool, a variable should use true/false rather than 1/0. Signed-off-by: Teodora Baluta Reviewed-by: Lisa Nguyen Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_dio200_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c index 2e4bf284d52c..9c9559ffc643 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c @@ -513,7 +513,7 @@ static int dio200_subdev_intr_cmd(struct comedi_device *dev, int event = 0; spin_lock_irqsave(&subpriv->spinlock, flags); - subpriv->active = 1; + subpriv->active = true; /* Set up end of acquisition. */ switch (cmd->stop_src) { From f635bbd1376bcb82dabea4c88ddd90faea7e3d25 Mon Sep 17 00:00:00 2001 From: Nandini Hanumanthagowda Date: Tue, 5 Nov 2013 23:51:18 +0530 Subject: [PATCH 112/238] staging: ctxt1e1: Fixed sparse warning related to static declaration Fixed below thrown sparse warning by making the local variable declaration static: drivers/staging/cxt1e1/musycc.c:1:14: warning: symbol 'max_intcnt' was not declared. Should it be static? drivers/staging/cxt1e1/musycc.c:2:14: warning: symbol 'max_bh' was not declared. Should it be static? Signed-off-by: Nandini Hanumanthagowda Reviewed-by: Lisa Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/cxt1e1/musycc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/cxt1e1/musycc.c b/drivers/staging/cxt1e1/musycc.c index 0ba8c3ae673b..7a3a30cd0f7f 100644 --- a/drivers/staging/cxt1e1/musycc.c +++ b/drivers/staging/cxt1e1/musycc.c @@ -1,5 +1,5 @@ -unsigned int max_intcnt = 0; -unsigned int max_bh = 0; +static unsigned int max_intcnt = 0; +static unsigned int max_bh = 0; /*----------------------------------------------------------------------------- * musycc.c - From 4ed7eeceb576e3534e61a36c85a0c9d33ad829d9 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Thu, 7 Nov 2013 20:27:43 +0530 Subject: [PATCH 113/238] Staging: gdm724x: Remove confusing macro gdm_lte_rcv_with_cb in gdm_lte.c This patch removes confusing macro gdm_lte_rcv_with_cb as stated in TODO list in file gdm_lte.c. It then fixes the place where the macro is used. Signed-off-by: Rashika Kheria Reviewed-by: Rusty Russell Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm724x/gdm_lte.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/gdm724x/gdm_lte.c b/drivers/staging/gdm724x/gdm_lte.c index c57a6ba5d010..d061cd553053 100644 --- a/drivers/staging/gdm724x/gdm_lte.c +++ b/drivers/staging/gdm724x/gdm_lte.c @@ -53,9 +53,6 @@ #define gdm_lte_sdu_send(n, d, l, c, b, i, t) (\ n->phy_dev->send_sdu_func(n->phy_dev->priv_dev, d, l, n->pdn_table.dft_eps_id, 0, c, b, i, t)) -#define gdm_lte_rcv_with_cb(n, c, b, e) (\ - n->rcv_func(n->priv_dev, c, b, e)) - #define IP_VERSION_4 4 #define IP_VERSION_6 6 @@ -762,7 +759,7 @@ void start_rx_proc(struct phy_dev *phy_dev) int i; for (i = 0; i < MAX_RX_SUBMIT_COUNT; i++) - gdm_lte_rcv_with_cb(phy_dev, rx_complete, phy_dev, USB_COMPLETE); + phy_dev->rcv_func(phy_dev->priv_dev, rx_complete, phy_dev, USB_COMPLETE); } static struct net_device_ops gdm_netdev_ops = { From 04db9c6a2db7427e6046300413967bf6d6fd4b6b Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Thu, 7 Nov 2013 20:28:40 +0530 Subject: [PATCH 114/238] Staging: gdm724x: Remove confusing macro gdm_dev_endian in gdm_lte.c This patch removes confusing macro gdm_dev_endian as stated in TODO list in file gdm_lte.c. It then fixes the place where the macro is used. Signed-off-by: Rashika Kheria Reviewed-by: Rusty Russell Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm724x/gdm_lte.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/staging/gdm724x/gdm_lte.c b/drivers/staging/gdm724x/gdm_lte.c index d061cd553053..5cf0f6f7f8d3 100644 --- a/drivers/staging/gdm724x/gdm_lte.c +++ b/drivers/staging/gdm724x/gdm_lte.c @@ -44,9 +44,6 @@ */ #define DEFAULT_MTU_SIZE 1500 -#define gdm_dev_endian(n) (\ - n->phy_dev->get_endian(n->phy_dev->priv_dev)) - #define gdm_lte_hci_send(n, d, l) (\ n->phy_dev->send_hci_func(n->phy_dev->priv_dev, d, l, NULL, NULL)) @@ -500,7 +497,10 @@ static int gdm_lte_event_send(struct net_device *dev, char *buf, int len) sscanf(dev->name, "lte%d", &idx); return netlink_send(lte_event.sock, idx, 0, buf, - gdm_dev16_to_cpu(gdm_dev_endian(nic), hci->len) + HCI_HEADER_SIZE); + gdm_dev16_to_cpu( + nic->phy_dev->get_endian( + nic->phy_dev->priv_dev), hci->len) + + HCI_HEADER_SIZE); } static void gdm_lte_event_rcv(struct net_device *dev, u16 type, void *msg, int len) @@ -685,8 +685,14 @@ static void gdm_lte_pdn_table(struct net_device *dev, char *buf, int len) if (pdn_table->activate) { nic->pdn_table.activate = pdn_table->activate; - nic->pdn_table.dft_eps_id = gdm_dev32_to_cpu(gdm_dev_endian(nic), pdn_table->dft_eps_id); - nic->pdn_table.nic_type = gdm_dev32_to_cpu(gdm_dev_endian(nic), pdn_table->nic_type); + nic->pdn_table.dft_eps_id = gdm_dev32_to_cpu( + nic->phy_dev->get_endian( + nic->phy_dev->priv_dev), + pdn_table->dft_eps_id); + nic->pdn_table.nic_type = gdm_dev32_to_cpu( + nic->phy_dev->get_endian( + nic->phy_dev->priv_dev), + pdn_table->nic_type); netdev_info(dev, "pdn activated, nic_type=0x%x\n", nic->pdn_table.nic_type); From abb40c11c44d93d7d9d6fe42088c5cad9a852c2a Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Thu, 7 Nov 2013 20:29:23 +0530 Subject: [PATCH 115/238] Staging: gdm724x: Remove confusing macro gdm_lte_hci_send in gdm_lte.c This patch removes confusing macro gdm_lte_hci_send as stated in TODO list in file gdm_lte.c. It then fixes the place where the macro is used. Signed-off-by: Rashika Kheria Reviewed-by: Rusty Russell Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm724x/gdm_lte.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/gdm724x/gdm_lte.c b/drivers/staging/gdm724x/gdm_lte.c index 5cf0f6f7f8d3..723cc270deb9 100644 --- a/drivers/staging/gdm724x/gdm_lte.c +++ b/drivers/staging/gdm724x/gdm_lte.c @@ -44,9 +44,6 @@ */ #define DEFAULT_MTU_SIZE 1500 -#define gdm_lte_hci_send(n, d, l) (\ - n->phy_dev->send_hci_func(n->phy_dev->priv_dev, d, l, NULL, NULL)) - #define gdm_lte_sdu_send(n, d, l, c, b, i, t) (\ n->phy_dev->send_sdu_func(n->phy_dev->priv_dev, d, l, n->pdn_table.dft_eps_id, 0, c, b, i, t)) @@ -507,7 +504,8 @@ static void gdm_lte_event_rcv(struct net_device *dev, u16 type, void *msg, int l { struct nic *nic = netdev_priv(dev); - gdm_lte_hci_send(nic, msg, len); + nic->phy_dev->send_hci_func(nic->phy_dev->priv_dev, msg, len, NULL, + NULL); } int gdm_lte_event_init(void) From 29ef8a53542ab4a6e0151978459d03996750d54b Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Fri, 8 Nov 2013 18:09:44 +0530 Subject: [PATCH 116/238] Staging: gdm724x: Use ALIGN() macro for dummy_cnt in gdm_mux.c As suggested in TODO list, this patch uses ALIGN() macro for variable dummy_cnt in functions up_to_host() and gdm_mux_send() in file gdm_mux.c. The macro has already been defined in include/linux/kernel.h, hence is not defined again. Signed-off-by: Rashika Kheria Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm724x/gdm_mux.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/gdm724x/gdm_mux.c b/drivers/staging/gdm724x/gdm_mux.c index 62163673976c..2fa3a5a6580f 100644 --- a/drivers/staging/gdm724x/gdm_mux.c +++ b/drivers/staging/gdm724x/gdm_mux.c @@ -158,7 +158,6 @@ static int up_to_host(struct mux_rx *r) unsigned int start_flag; unsigned int payload_size; unsigned short packet_type; - int remain; int dummy_cnt; u32 packet_size_sum = r->offset; int index; @@ -176,8 +175,7 @@ static int up_to_host(struct mux_rx *r) break; } - remain = (MUX_HEADER_SIZE + payload_size) % 4; - dummy_cnt = remain ? (4-remain) : 0; + dummy_cnt = ALIGN(MUX_HEADER_SIZE + payload_size, 4); if (len - packet_size_sum < MUX_HEADER_SIZE + payload_size + dummy_cnt) { @@ -361,7 +359,6 @@ static int gdm_mux_send(void *priv_dev, void *data, int len, int tty_index, struct mux_pkt_header *mux_header; struct mux_tx *t = NULL; static u32 seq_num = 1; - int remain; int dummy_cnt; int total_len; int ret; @@ -375,8 +372,7 @@ static int gdm_mux_send(void *priv_dev, void *data, int len, int tty_index, spin_lock_irqsave(&mux_dev->write_lock, flags); - remain = (MUX_HEADER_SIZE + len) % 4; - dummy_cnt = remain ? (4 - remain) : 0; + dummy_cnt = ALIGN(MUX_HEADER_SIZE + len, 4); total_len = len + MUX_HEADER_SIZE + dummy_cnt; From 95ee28ec64c9d16f5bcf7e7749ff30f652177659 Mon Sep 17 00:00:00 2001 From: Himangi Saraogi Date: Fri, 8 Nov 2013 04:12:41 +0530 Subject: [PATCH 117/238] staging:wlags49_h2: Fix sparse warnings in sta_h25.c This patch fixes sparse warnings "Using plain integer as NULL pointer" in sta_h25.c Signed-off-by: Himangi Saraogi Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlags49_h2/sta_h25.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wlags49_h2/sta_h25.c b/drivers/staging/wlags49_h2/sta_h25.c index 5b6f670d8ef2..eccd780ef135 100644 --- a/drivers/staging/wlags49_h2/sta_h25.c +++ b/drivers/staging/wlags49_h2/sta_h25.c @@ -5211,7 +5211,7 @@ static const CFG_PROG_STRCT fw_image_code[] = { 0000, 0x000F429B, // Start execution address }, - { 0000, 0000, 0000, 0000, 00000000, 0000, 00000000} + { 0000, 0000, 0000, 0000, 00000000, 0000, NULL} }; static const CFG_RANGE20_STRCT fw_image_infocompat[] = { @@ -5247,8 +5247,8 @@ memimage fw_image = { "FUPU7D37dhfwci\001C", //signature, , C/Bin type (CFG_PROG_STRCT *) fw_image_code, 0x000F429B, - 00000000, //(dummy) pdaplug - 00000000, //(dummy) priplug + NULL, //(dummy) pdaplug + NULL, //(dummy) priplug (CFG_RANGE20_STRCT *) fw_image_infocompat, (CFG_IDENTITY_STRCT *) fw_image_infoidentity, }; From b596f52209ae6206dc01cd659008d26a5244d092 Mon Sep 17 00:00:00 2001 From: Ebru Akagunduz Date: Sun, 10 Nov 2013 23:16:58 +0200 Subject: [PATCH 118/238] Staging: rtl8187se: Fix Sparse Warnings This patch fixes the Sparse Warnings "symbol was not declared. Should it be static?" so it removes some extern expressions to r8180.h and it defines some extern expressions in ieee80211.h Signed-off-by: Ebru Akagunduz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/ieee80211/ieee80211.h | 3 +++ drivers/staging/rtl8187se/r8180.h | 10 ++++++++++ drivers/staging/rtl8187se/r8180_core.c | 10 ---------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211.h b/drivers/staging/rtl8187se/ieee80211/ieee80211.h index 7f015499cfae..ce8dcf79185c 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211.h @@ -90,6 +90,9 @@ #define IEEE_CRYPT_ALG_NAME_LEN 16 +extern int ieee80211_crypto_tkip_init(void); +extern void ieee80211_crypto_tkip_exit(void); + //by amy for ps typedef struct ieee_param { u32 cmd; diff --git a/drivers/staging/rtl8187se/r8180.h b/drivers/staging/rtl8187se/r8180.h index d052f4a9a839..84957be01b4f 100644 --- a/drivers/staging/rtl8187se/r8180.h +++ b/drivers/staging/rtl8187se/r8180.h @@ -687,3 +687,13 @@ void rtl8180_rate_adapter(struct work_struct * work); bool MgntActSet_RF_State(struct net_device *dev, RT_RF_POWER_STATE StateToSet, u32 ChangeSource); #endif + +/* fun with the built-in ieee80211 stack... */ +extern int ieee80211_crypto_init(void); +extern void ieee80211_crypto_deinit(void); +extern int ieee80211_crypto_tkip_init(void); +extern void ieee80211_crypto_tkip_exit(void); +extern int ieee80211_crypto_ccmp_init(void); +extern void ieee80211_crypto_ccmp_exit(void); +extern int ieee80211_crypto_wep_init(void); +extern void ieee80211_crypto_wep_exit(void); diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c index 2462ced68215..d4ba717ff0df 100644 --- a/drivers/staging/rtl8187se/r8180_core.c +++ b/drivers/staging/rtl8187se/r8180_core.c @@ -3310,16 +3310,6 @@ static void rtl8180_pci_remove(struct pci_dev *pdev) DMESG("wlan driver removed\n"); } -/* fun with the built-in ieee80211 stack... */ -extern int ieee80211_crypto_init(void); -extern void ieee80211_crypto_deinit(void); -extern int ieee80211_crypto_tkip_init(void); -extern void ieee80211_crypto_tkip_exit(void); -extern int ieee80211_crypto_ccmp_init(void); -extern void ieee80211_crypto_ccmp_exit(void); -extern int ieee80211_crypto_wep_init(void); -extern void ieee80211_crypto_wep_exit(void); - static int __init rtl8180_pci_module_init(void) { int ret; From 52fdda40f65422d6e88df599169607f442c36267 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Mon, 11 Nov 2013 20:38:20 +0530 Subject: [PATCH 119/238] Staging: keucr: Move the declaration of variable ErrXDCode in smilsub.c This patch moves the declaration of variable ErrXDCode to file smilsub.c since this is the only file which uses it. Hence, it also removes extern declaration from the header file smil.h and unnecessary declaration in smilmain.c Signed-off-by: Rashika Kheria Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/keucr/smil.h | 1 - drivers/staging/keucr/smilmain.c | 1 - drivers/staging/keucr/smilsub.c | 1 + 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/keucr/smil.h b/drivers/staging/keucr/smil.h index 1538d7bd600f..fe1d5dc7d530 100644 --- a/drivers/staging/keucr/smil.h +++ b/drivers/staging/keucr/smil.h @@ -193,7 +193,6 @@ struct keucr_media_area { extern BYTE IsSSFDCCompliance; extern BYTE IsXDCompliance; -extern DWORD ErrXDCode; extern DWORD ErrCode; extern WORD ReadBlock; extern WORD WriteBlock; diff --git a/drivers/staging/keucr/smilmain.c b/drivers/staging/keucr/smilmain.c index ed15c3531eb9..4e81c7adf74c 100644 --- a/drivers/staging/keucr/smilmain.c +++ b/drivers/staging/keucr/smilmain.c @@ -25,7 +25,6 @@ static int Make_D_LogTable(struct us_data *); static int MarkFail_D_PhyOneBlock(struct us_data *); -DWORD ErrXDCode; DWORD ErrCode; static BYTE WorkBuf[SECTSIZE]; static BYTE Redundant[REDTSIZE]; diff --git a/drivers/staging/keucr/smilsub.c b/drivers/staging/keucr/smilsub.c index ea3c747b3a28..a58c6c557a19 100644 --- a/drivers/staging/keucr/smilsub.c +++ b/drivers/staging/keucr/smilsub.c @@ -7,6 +7,7 @@ #include "smil.h" static BYTE _Check_D_DevCode(BYTE); +static DWORD ErrXDCode; struct keucr_media_info Ssfdc; struct keucr_media_address Media; From 665fba0e1d28df9f2f4659991063e90040d62917 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Mon, 11 Nov 2013 20:39:34 +0530 Subject: [PATCH 120/238] Staging: keucr: Move the declaration of variable ErrCode in smilmain.c This patch moves the declaration of variable ErrCode to file smilmain.c since this is the only file which uses it. Hence, it also removes extern declaration from the header file smil.h. Signed-off-by: Rashika Kheria Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/keucr/smil.h | 1 - drivers/staging/keucr/smilmain.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/keucr/smil.h b/drivers/staging/keucr/smil.h index fe1d5dc7d530..420529e884c6 100644 --- a/drivers/staging/keucr/smil.h +++ b/drivers/staging/keucr/smil.h @@ -193,7 +193,6 @@ struct keucr_media_area { extern BYTE IsSSFDCCompliance; extern BYTE IsXDCompliance; -extern DWORD ErrCode; extern WORD ReadBlock; extern WORD WriteBlock; extern DWORD MediaChange; diff --git a/drivers/staging/keucr/smilmain.c b/drivers/staging/keucr/smilmain.c index 4e81c7adf74c..02f73bfcd286 100644 --- a/drivers/staging/keucr/smilmain.c +++ b/drivers/staging/keucr/smilmain.c @@ -25,7 +25,7 @@ static int Make_D_LogTable(struct us_data *); static int MarkFail_D_PhyOneBlock(struct us_data *); -DWORD ErrCode; +static DWORD ErrCode; static BYTE WorkBuf[SECTSIZE]; static BYTE Redundant[REDTSIZE]; static BYTE WorkRedund[REDTSIZE]; From 91c954dde335ff48e95074e57e40321f09851d96 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Mon, 11 Nov 2013 20:41:04 +0530 Subject: [PATCH 121/238] Staging: keucr: Move the declaration of variable IsSSFDCCompliance in smilsub.c This patch moves the declaration of variable IsSSFDCCompliance to file smilsub.c since this is the only file which uses it. Hence, it also removes extern declaration from the header file smil.h and unnecessary declaration in smilmain.c Signed-off-by: Rashika Kheria Signed-off-by: Greg Kroah-Hartman --- drivers/staging/keucr/smil.h | 2 -- drivers/staging/keucr/smilmain.c | 1 - drivers/staging/keucr/smilsub.c | 1 + 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/keucr/smil.h b/drivers/staging/keucr/smil.h index 420529e884c6..b8851661c8f1 100644 --- a/drivers/staging/keucr/smil.h +++ b/drivers/staging/keucr/smil.h @@ -189,8 +189,6 @@ struct keucr_media_area { WORD PhyBlock; /* Physical Block Number on Zone 0 */ }; - -extern BYTE IsSSFDCCompliance; extern BYTE IsXDCompliance; extern WORD ReadBlock; diff --git a/drivers/staging/keucr/smilmain.c b/drivers/staging/keucr/smilmain.c index 02f73bfcd286..a2691f59391d 100644 --- a/drivers/staging/keucr/smilmain.c +++ b/drivers/staging/keucr/smilmain.c @@ -44,7 +44,6 @@ static BYTE BitData[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; #define Clr_D_Bit(a, b) (a[(BYTE)((b) / 8)] &= ~BitData[(b) % 8]) #define Chk_D_Bit(a, b) (a[(BYTE)((b) / 8)] & BitData[(b) % 8]) -BYTE IsSSFDCCompliance; BYTE IsXDCompliance; diff --git a/drivers/staging/keucr/smilsub.c b/drivers/staging/keucr/smilsub.c index a58c6c557a19..2f36e06c2718 100644 --- a/drivers/staging/keucr/smilsub.c +++ b/drivers/staging/keucr/smilsub.c @@ -8,6 +8,7 @@ static BYTE _Check_D_DevCode(BYTE); static DWORD ErrXDCode; +static BYTE IsSSFDCCompliance; struct keucr_media_info Ssfdc; struct keucr_media_address Media; From f6daf9e6880da85beaf38718ac264e8922988750 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Mon, 11 Nov 2013 20:42:35 +0530 Subject: [PATCH 122/238] Staging: keucr: Move the declaration of variable IsXDCompliance in smilsub.c This patch moves the declaration of variable IsXDCompliance to file smilsub.c since this is the only file which uses it. Hence, it also removes extern declaration from the header file smil.h and unnecessary declaration in smilmain.c Signed-off-by: Rashika Kheria Signed-off-by: Greg Kroah-Hartman --- drivers/staging/keucr/smil.h | 2 -- drivers/staging/keucr/smilmain.c | 3 --- drivers/staging/keucr/smilsub.c | 1 + 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/keucr/smil.h b/drivers/staging/keucr/smil.h index b8851661c8f1..fff6c9e6164a 100644 --- a/drivers/staging/keucr/smil.h +++ b/drivers/staging/keucr/smil.h @@ -189,8 +189,6 @@ struct keucr_media_area { WORD PhyBlock; /* Physical Block Number on Zone 0 */ }; -extern BYTE IsXDCompliance; - extern WORD ReadBlock; extern WORD WriteBlock; extern DWORD MediaChange; diff --git a/drivers/staging/keucr/smilmain.c b/drivers/staging/keucr/smilmain.c index a2691f59391d..9434cda885ca 100644 --- a/drivers/staging/keucr/smilmain.c +++ b/drivers/staging/keucr/smilmain.c @@ -44,9 +44,6 @@ static BYTE BitData[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; #define Clr_D_Bit(a, b) (a[(BYTE)((b) / 8)] &= ~BitData[(b) % 8]) #define Chk_D_Bit(a, b) (a[(BYTE)((b) / 8)] & BitData[(b) % 8]) -BYTE IsXDCompliance; - - /* ----- SM_FreeMem() ------------------------------------------------- */ int SM_FreeMem(void) { diff --git a/drivers/staging/keucr/smilsub.c b/drivers/staging/keucr/smilsub.c index 2f36e06c2718..16da9a9b4033 100644 --- a/drivers/staging/keucr/smilsub.c +++ b/drivers/staging/keucr/smilsub.c @@ -9,6 +9,7 @@ static BYTE _Check_D_DevCode(BYTE); static DWORD ErrXDCode; static BYTE IsSSFDCCompliance; +static BYTE IsXDCompliance; struct keucr_media_info Ssfdc; struct keucr_media_address Media; From 18278771f42ed5ab2fbf730947790f1f433ef8f1 Mon Sep 17 00:00:00 2001 From: Teodora Baluta Date: Mon, 11 Nov 2013 19:27:05 +0200 Subject: [PATCH 123/238] staging: vt6655: use netdev_* instead of printk Checkpatch.pl gave the following warnings WARNING: printk() should include KERN_ facility level After fixing these with KERN_INFO facility level, it was suggested to use netdev_ instead of printk() with KERN_INFO facility. Used netdev_dbg for the statements inside of PLICE_DEBUG #ifdef, as debugging shouldn't rely on compile options and netdev_info for one printk which wasn't inside any #ifdef PLICE_DEBUG. Signed-off-by: Teodora Baluta Reviewed-by: Lisa Nguyen Suggested-by: Greg Kroah-Hartman Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/bssdb.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/staging/vt6655/bssdb.c b/drivers/staging/vt6655/bssdb.c index 5995dc203c79..8214e4ba2b43 100644 --- a/drivers/staging/vt6655/bssdb.c +++ b/drivers/staging/vt6655/bssdb.c @@ -846,9 +846,8 @@ BSSvUpdateAPNode( pMgmt->sNodeDBTable[0].wTxDataRate = pMgmt->sNodeDBTable[0].wMaxSuppRate; pMgmt->sNodeDBTable[0].bShortPreamble = WLAN_GET_CAP_INFO_SHORTPREAMBLE(*pwCapInfo); pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND; -#ifdef PLICE_DEBUG - printk("BSSvUpdateAPNode:MaxSuppRate is %d\n", pMgmt->sNodeDBTable[0].wMaxSuppRate); -#endif + netdev_dbg(pDevice->dev, "BSSvUpdateAPNode:MaxSuppRate is %d\n", + pMgmt->sNodeDBTable[0].wMaxSuppRate); /* auto rate fallback function initiation */ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->sNodeDBTable[0].wTxDataRate = %d \n", pMgmt->sNodeDBTable[0].wTxDataRate); }; @@ -889,9 +888,9 @@ BSSvAddMulticastNode( &(pMgmt->sNodeDBTable[0].byTopOFDMBasicRate) ); pMgmt->sNodeDBTable[0].wTxDataRate = pMgmt->sNodeDBTable[0].wMaxBasicRate; -#ifdef PLICE_DEBUG - printk("BSSvAddMultiCastNode:pMgmt->sNodeDBTable[0].wTxDataRate is %d\n", pMgmt->sNodeDBTable[0].wTxDataRate); -#endif + netdev_dbg(pDevice->dev, + "BSSvAddMultiCastNode:pMgmt->sNodeDBTable[0].wTxDataRate is %d\n", + pMgmt->sNodeDBTable[0].wTxDataRate); pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND; }; @@ -990,7 +989,7 @@ start: pDevice->byReAssocCount++; /* 10 sec timeout */ if ((pDevice->byReAssocCount > 10) && (pDevice->bLinkPass != true)) { - printk("Re-association timeout!!!\n"); + netdev_info(pDevice->dev, "Re-association timeout!!!\n"); pDevice->byReAssocCount = 0; #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT { @@ -1054,13 +1053,13 @@ start: } else { /* ii = 0 reserved for unicast AP node (Infra STA) */ if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) -#ifdef PLICE_DEBUG - printk("SecondCallback:Before:TxDataRate is %d\n", pMgmt->sNodeDBTable[0].wTxDataRate); -#endif + netdev_dbg(pDevice->dev, + "SecondCallback:Before:TxDataRate is %d\n", + pMgmt->sNodeDBTable[0].wTxDataRate); RATEvTxRateFallBack((void *)pDevice, &(pMgmt->sNodeDBTable[ii])); -#ifdef PLICE_DEBUG - printk("SecondCallback:After:TxDataRate is %d\n", pMgmt->sNodeDBTable[0].wTxDataRate); -#endif + netdev_dbg(pDevice->dev, + "SecondCallback:After:TxDataRate is %d\n", + pMgmt->sNodeDBTable[0].wTxDataRate); } From a777289800a3b767cec3f5974b784e0e0a61c68e Mon Sep 17 00:00:00 2001 From: Teodora Baluta Date: Mon, 11 Nov 2013 19:27:06 +0200 Subject: [PATCH 124/238] staging: vt6655: delete unnecessary whitespace before a quoted newline This patch silences the following type of warnings: WARNING: unnecessary whitespace before a quoted newline Signed-off-by: Teodora Baluta Reviewed-by: Lisa Nguyen Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/bssdb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/vt6655/bssdb.c b/drivers/staging/vt6655/bssdb.c index 8214e4ba2b43..3c0a062cd098 100644 --- a/drivers/staging/vt6655/bssdb.c +++ b/drivers/staging/vt6655/bssdb.c @@ -849,7 +849,7 @@ BSSvUpdateAPNode( netdev_dbg(pDevice->dev, "BSSvUpdateAPNode:MaxSuppRate is %d\n", pMgmt->sNodeDBTable[0].wMaxSuppRate); /* auto rate fallback function initiation */ - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->sNodeDBTable[0].wTxDataRate = %d \n", pMgmt->sNodeDBTable[0].wTxDataRate); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->sNodeDBTable[0].wTxDataRate = %d\n", pMgmt->sNodeDBTable[0].wTxDataRate); }; /*+ @@ -1067,11 +1067,11 @@ start: /* check if pending PS queue */ if (pMgmt->sNodeDBTable[ii].wEnQueueCnt != 0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index= %d, Queue = %d pending \n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index= %d, Queue = %d pending\n", ii, pMgmt->sNodeDBTable[ii].wEnQueueCnt); if ((ii > 0) && (pMgmt->sNodeDBTable[ii].wEnQueueCnt > 15)) { BSSvRemoveOneNode(pDevice, ii); - DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Pending many queues PS STA Index = %d remove \n", ii); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Pending many queues PS STA Index = %d remove\n", ii); continue; } } From 2b0c2a48b62d57213fee4e780c28f06d066f1f71 Mon Sep 17 00:00:00 2001 From: Teodora Baluta Date: Mon, 11 Nov 2013 19:27:07 +0200 Subject: [PATCH 125/238] staging: vt6655: delete explicit comparison to bool This patch fixes all bool tests by deleting the comparison. Most of these were detected using coccinelle and silence the following type of coccinelle warnings for drivers/staging/vt6655/bssdb.c file: WARNING: Comparison to bool Signed-off-by: Teodora Baluta Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6655/bssdb.c | 50 ++++++++++++++++------------------ 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/drivers/staging/vt6655/bssdb.c b/drivers/staging/vt6655/bssdb.c index 3c0a062cd098..d7efd0173a9a 100644 --- a/drivers/staging/vt6655/bssdb.c +++ b/drivers/staging/vt6655/bssdb.c @@ -142,10 +142,10 @@ BSSpSearchBSSList( /* match BSSID first */ for (ii = 0; ii < MAX_BSS_NUM; ii++) { pCurrBSS = &(pMgmt->sBSSList[ii]); - if (pDevice->bLinkPass == false) + if (!pDevice->bLinkPass) pCurrBSS->bSelected = false; if ((pCurrBSS->bActive) && - (pCurrBSS->bSelected == false)) { + (!pCurrBSS->bSelected)) { if (ether_addr_equal(pCurrBSS->abyBSSID, pbyBSSID)) { if (pSSID != NULL) { @@ -390,7 +390,7 @@ BSSbInsertToBSSList( if (pBSSList->uChannel > CB_MAX_CHANNEL_24G) { pBSSList->eNetworkTypeInUse = PHY_TYPE_11A; } else { - if (pBSSList->sERP.bERPExist == true) + if (pBSSList->sERP.bERPExist) pBSSList->eNetworkTypeInUse = PHY_TYPE_11G; else pBSSList->eNetworkTypeInUse = PHY_TYPE_11B; @@ -431,7 +431,7 @@ BSSbInsertToBSSList( } } - if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || (pBSSList->bWPA2Valid == true)) { + if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || pBSSList->bWPA2Valid) { PSKeyItem pTransmitKey = NULL; bool bIs802_1x = false; @@ -441,13 +441,13 @@ BSSbInsertToBSSList( break; } } - if ((bIs802_1x == true) && (pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len) && + if (bIs802_1x && (pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len) && (!memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySSID, pSSID->len))) { bAdd_PMKID_Candidate((void *)pDevice, pBSSList->abyBSSID, &pBSSList->sRSNCapObj); - if ((pDevice->bLinkPass == true) && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { - if ((KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, PAIRWISE_KEY, &pTransmitKey) == true) || - (KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, GROUP_KEY, &pTransmitKey) == true)) { + if (pDevice->bLinkPass && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { + if (KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, PAIRWISE_KEY, &pTransmitKey) || + KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, GROUP_KEY, &pTransmitKey)) { pDevice->gsPMKIDCandidate.StatusType = Ndis802_11StatusType_PMKID_CandidateList; pDevice->gsPMKIDCandidate.Version = 1; @@ -466,13 +466,12 @@ BSSbInsertToBSSList( pBSSList->ldBmAverage[ii] = 0; } - if ((pIE_Country != NULL) && - (pMgmt->b11hEnable == true)) { + if ((pIE_Country != NULL) && pMgmt->b11hEnable) { set_country_info(pMgmt->pAdapter, pBSSList->eNetworkTypeInUse, pIE_Country); } - if ((bParsingQuiet == true) && (pIE_Quiet != NULL)) { + if (bParsingQuiet && (pIE_Quiet != NULL)) { if ((((PWLAN_IE_QUIET)pIE_Quiet)->len == 8) && (((PWLAN_IE_QUIET)pIE_Quiet)->byQuietCount != 0)) { /* valid EID */ @@ -498,8 +497,7 @@ BSSbInsertToBSSList( } } - if ((bParsingQuiet == true) && - (pQuiet != NULL)) { + if (bParsingQuiet && (pQuiet != NULL)) { CARDbStartQuiet(pMgmt->pAdapter); } @@ -580,7 +578,7 @@ BSSbUpdateToBSSList( if (pBSSList->uChannel > CB_MAX_CHANNEL_24G) { pBSSList->eNetworkTypeInUse = PHY_TYPE_11A; } else { - if (pBSSList->sERP.bERPExist == true) + if (pBSSList->sERP.bERPExist) pBSSList->eNetworkTypeInUse = PHY_TYPE_11G; else pBSSList->eNetworkTypeInUse = PHY_TYPE_11B; @@ -633,13 +631,12 @@ BSSbUpdateToBSSList( } } - if ((pIE_Country != NULL) && - (pMgmt->b11hEnable == true)) { + if ((pIE_Country != NULL) && pMgmt->b11hEnable) { set_country_info(pMgmt->pAdapter, pBSSList->eNetworkTypeInUse, pIE_Country); } - if ((bParsingQuiet == true) && (pIE_Quiet != NULL)) { + if (bParsingQuiet && (pIE_Quiet != NULL)) { if ((((PWLAN_IE_QUIET)pIE_Quiet)->len == 8) && (((PWLAN_IE_QUIET)pIE_Quiet)->byQuietCount != 0)) { /* valid EID */ @@ -665,8 +662,7 @@ BSSbUpdateToBSSList( } } - if ((bParsingQuiet == true) && - (pQuiet != NULL)) { + if (bParsingQuiet && (pQuiet != NULL)) { CARDbStartQuiet(pMgmt->pAdapter); } @@ -934,10 +930,12 @@ BSSvSecondCallBack( /* 2008-4-14 by chester for led issue */ #ifdef FOR_LED_ON_NOTEBOOK MACvGPIOIn(pDevice->PortOffset, &pDevice->byGPIO); - if (((!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->bHWRadioOff == false)) || ((pDevice->byGPIO & GPIO0_DATA) && (pDevice->bHWRadioOff == true))) && (cc == false)) { + if (((!(pDevice->byGPIO & GPIO0_DATA) && (!pDevice->bHWRadioOff)) || + ((pDevice->byGPIO & GPIO0_DATA) && pDevice->bHWRadioOff)) && + (!cc)) { cc = true; - } else if (cc == true) { - if (pDevice->bHWRadioOff == true) { + } else if (cc) { + if (pDevice->bHWRadioOff) { if (!(pDevice->byGPIO & GPIO0_DATA)) { if (status == 1) goto start; @@ -988,7 +986,7 @@ start: { pDevice->byReAssocCount++; /* 10 sec timeout */ - if ((pDevice->byReAssocCount > 10) && (pDevice->bLinkPass != true)) { + if ((pDevice->byReAssocCount > 10) && (!pDevice->bLinkPass)) { netdev_info(pDevice->dev, "Re-association timeout!!!\n"); pDevice->byReAssocCount = 0; #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT @@ -1000,7 +998,7 @@ start: wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); } #endif - } else if (pDevice->bLinkPass == true) + } else if (pDevice->bLinkPass) pDevice->byReAssocCount = 0; } @@ -1188,7 +1186,7 @@ start: * network manager support need not do * Roaming scan??? */ - if (pDevice->bWPASuppWextEnabled == true) + if (pDevice->bWPASuppWextEnabled) pDevice->uAutoReConnectTime = 0; #endif } else { @@ -1520,7 +1518,7 @@ void s_uCalculateLinkQual( TxOkRatio = (TxCnt < 6) ? 4000 : ((pDevice->scStatistic.TxNoRetryOkCount * 4000) / TxCnt); RxOkRatio = (RxCnt < 6) ? 2000 : ((pDevice->scStatistic.RxOkCnt * 2000) / RxCnt); /* decide link quality */ - if (pDevice->bLinkPass != true) { + if (!pDevice->bLinkPass) { pDevice->scStatistic.LinkQuality = 0; pDevice->scStatistic.SignalStren = 0; } else { From 2dce674891c1d2708715fecaad222362db53f815 Mon Sep 17 00:00:00 2001 From: Matina Maria Trompouki Date: Mon, 11 Nov 2013 00:22:51 +0000 Subject: [PATCH 126/238] Staging: ozwpan: fixed whitespace before semicolon This patch removes the following warning reported by checkpatch.pl WARNING: space prohibited before semicolon drivers/staging/ozwpan/ozproto.c Signed-off-by: Matina Maria Trompouki Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ozwpan/ozproto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ozwpan/ozproto.c b/drivers/staging/ozwpan/ozproto.c index 88714ec85705..9f2dffe6e131 100644 --- a/drivers/staging/ozwpan/ozproto.c +++ b/drivers/staging/ozwpan/ozproto.c @@ -337,7 +337,7 @@ static void oz_rx_frame(struct sk_buff *skb) oz_dbg(RX_FRAMES, "RX frame PN=0x%x LPN=0x%x control=0x%x\n", oz_hdr->pkt_num, oz_hdr->last_pkt_num, oz_hdr->control); mac_hdr = skb_mac_header(skb); - src_addr = &mac_hdr[ETH_ALEN] ; + src_addr = &mac_hdr[ETH_ALEN]; length = skb->len; /* Check the version field */ From 70a51d284be020a310d9f5ec989cfe2bbce5ecd6 Mon Sep 17 00:00:00 2001 From: Matina Maria Trompouki Date: Mon, 11 Nov 2013 01:11:22 +0000 Subject: [PATCH 127/238] Staging: lirc: fix quoted string split across lines This patch removes the following warning reported by checkpatch.pl WARNING: quoted string split across lines drivers/staging/media/lirc/lirc_igorplugusb.c drivers/staging/media/lirc/lirc_imon.c drivers/staging/media/lirc/lirc_serial.c drivers/staging/media/lirc/lirc_zilog.c Signed-off-by: Matina Maria Trompouki Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/lirc/lirc_igorplugusb.c | 4 ++-- drivers/staging/media/lirc/lirc_imon.c | 8 ++++---- drivers/staging/media/lirc/lirc_serial.c | 4 ++-- drivers/staging/media/lirc/lirc_zilog.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_igorplugusb.c b/drivers/staging/media/lirc/lirc_igorplugusb.c index 28c8b0bcf5b2..f2dcc4a292da 100644 --- a/drivers/staging/media/lirc/lirc_igorplugusb.c +++ b/drivers/staging/media/lirc/lirc_igorplugusb.c @@ -363,8 +363,8 @@ static int igorplugusb_remote_poll(void *data, struct lirc_buffer *buf) /*dummy*/ir->buf_in, /*dummy*/ir->len_in, /*timeout*/HZ * USB_CTRL_GET_TIMEOUT); if (ret < 0) - printk(DRIVER_NAME "[%d]: SET_INFRABUFFER_EMPTY: " - "error %d\n", ir->devnum, ret); + printk(DRIVER_NAME "[%d]: SET_INFRABUFFER_EMPTY: error %d\n", + ir->devnum, ret); return 0; } else if (ret < 0) printk(DRIVER_NAME "[%d]: GET_INFRACODE: error %d\n", diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c index ab2ae115b524..663c963b16df 100644 --- a/drivers/staging/media/lirc/lirc_imon.c +++ b/drivers/staging/media/lirc/lirc_imon.c @@ -878,8 +878,8 @@ static int imon_probe(struct usb_interface *interface, alloc_status = 7; goto unlock; } else - dev_info(dev, "Registered iMON driver " - "(lirc minor: %d)\n", lirc_minor); + dev_info(dev, "Registered iMON driver (lirc minor: %d)\n", + lirc_minor); /* Needed while unregistering! */ driver->minor = lirc_minor; @@ -923,8 +923,8 @@ static int imon_probe(struct usb_interface *interface, if (usb_register_dev(interface, &imon_class)) { /* Not a fatal error, so ignore */ - dev_info(dev, "%s: could not get a minor number for " - "display\n", __func__); + dev_info(dev, "%s: could not get a minor number for display\n", + __func__); } } diff --git a/drivers/staging/media/lirc/lirc_serial.c b/drivers/staging/media/lirc/lirc_serial.c index 23043bd70e7e..c1f965d42ab0 100644 --- a/drivers/staging/media/lirc/lirc_serial.c +++ b/drivers/staging/media/lirc/lirc_serial.c @@ -428,8 +428,8 @@ static int init_timing_params(unsigned int new_duty_cycle, period = 256 * 1000000L / freq; pulse_width = period * duty_cycle / 100; space_width = period - pulse_width; - dprintk("in init_timing_params, freq=%d pulse=%ld, " - "space=%ld\n", freq, pulse_width, space_width); + dprintk("in init_timing_params, freq=%d pulse=%ld, space=%ld\n", + freq, pulse_width, space_width); return 0; } #endif /* USE_RDTSC */ diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index 11d5338b4f2f..5c255ffcb877 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -764,8 +764,8 @@ static int fw_load(struct IR_tx *tx) /* Request codeset data file */ ret = request_firmware(&fw_entry, "haup-ir-blaster.bin", tx->ir->l.dev); if (ret != 0) { - zilog_error("firmware haup-ir-blaster.bin not available " - "(%d)\n", ret); + zilog_error("firmware haup-ir-blaster.bin not available (%d)\n", + ret); ret = ret < 0 ? ret : -EFAULT; goto out; } From c79bfed605337be42860398336523769aad19a13 Mon Sep 17 00:00:00 2001 From: Matina Maria Trompouki Date: Mon, 11 Nov 2013 00:29:12 +0000 Subject: [PATCH 128/238] Staging: lirc: fix line over 80 characters This patch removes the following warning reported by checkpatch.pl WARNING: line over 80 characters drivers/staging/media/lirc/lirc_imon.c Signed-off-by: Matina Maria Trompouki Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/lirc/lirc_imon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c index 663c963b16df..c7d6667e7d14 100644 --- a/drivers/staging/media/lirc/lirc_imon.c +++ b/drivers/staging/media/lirc/lirc_imon.c @@ -808,7 +808,8 @@ static int imon_probe(struct usb_interface *interface, /* Input endpoint is mandatory */ if (!ir_ep_found) { - dev_err(dev, "%s: no valid input (IR) endpoint found.\n", __func__); + dev_err(dev, "%s: no valid input (IR) endpoint found.\n", + __func__); retval = -ENODEV; alloc_status = 2; goto alloc_status_switch; From b73db54750482cf3910046c82a84ce8c1684dfbe Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Mon, 11 Nov 2013 11:52:31 +0530 Subject: [PATCH 129/238] Staging: dgrp: Refactor the function dgrp_receive() in drrp_net_ops.c The function dgrp_receive() in dgrp_net_ops.c is too long and can be refactored. It uses various switch statements and goto labels. I have removed a label called data and tried to extract a new function out of it called as handle_data_in_packet(). This helps to make the code more modularize and simple to read and understand. Signed-off-by: Rashika Kheria Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgrp/dgrp_net_ops.c | 330 +++++++++++++++------------- 1 file changed, 175 insertions(+), 155 deletions(-) diff --git a/drivers/staging/dgrp/dgrp_net_ops.c b/drivers/staging/dgrp/dgrp_net_ops.c index 33ac7fb88cbd..1f61b89eca44 100644 --- a/drivers/staging/dgrp/dgrp_net_ops.c +++ b/drivers/staging/dgrp/dgrp_net_ops.c @@ -2232,6 +2232,177 @@ done: return rtn; } +/* + * Common Packet Handling code + */ + +static void handle_data_in_packet(struct nd_struct *nd, struct ch_struct *ch, + long dlen, long plen, int n1, u8 *dbuf) +{ + char *error; + long n; + long remain; + u8 *buf; + u8 *b; + + remain = nd->nd_remain; + nd->nd_tx_work = 1; + + /* + * Otherwise data should appear only when we are + * in the CS_READY state. + */ + + if (ch->ch_state < CS_READY) { + error = "Data received before RWIN established"; + nd->nd_remain = 0; + nd->nd_state = NS_SEND_ERROR; + nd->nd_error = error; + } + + /* + * Assure that the data received is within the + * allowable window. + */ + + n = (ch->ch_s_rwin - ch->ch_s_rin) & 0xffff; + + if (dlen > n) { + error = "Receive data overrun"; + nd->nd_remain = 0; + nd->nd_state = NS_SEND_ERROR; + nd->nd_error = error; + } + + /* + * If we received 3 or less characters, + * assume it is a human typing, and set RTIME + * to 10 milliseconds. + * + * If we receive 10 or more characters, + * assume its not a human typing, and set RTIME + * to 100 milliseconds. + */ + + if (ch->ch_edelay != DGRP_RTIME) { + if (ch->ch_rtime != ch->ch_edelay) { + ch->ch_rtime = ch->ch_edelay; + ch->ch_flag |= CH_PARAM; + } + } else if (dlen <= 3) { + if (ch->ch_rtime != 10) { + ch->ch_rtime = 10; + ch->ch_flag |= CH_PARAM; + } + } else { + if (ch->ch_rtime != DGRP_RTIME) { + ch->ch_rtime = DGRP_RTIME; + ch->ch_flag |= CH_PARAM; + } + } + + /* + * If a portion of the packet is outside the + * buffer, shorten the effective length of the + * data packet to be the amount of data received. + */ + + if (remain < plen) + dlen -= plen - remain; + + /* + * Detect if receive flush is now complete. + */ + + if ((ch->ch_flag & CH_RX_FLUSH) != 0 && + ((ch->ch_flush_seq - nd->nd_seq_out) & SEQ_MASK) >= + ((nd->nd_seq_in - nd->nd_seq_out) & SEQ_MASK)) { + ch->ch_flag &= ~CH_RX_FLUSH; + } + + /* + * If we are ready to receive, move the data into + * the receive buffer. + */ + + ch->ch_s_rin = (ch->ch_s_rin + dlen) & 0xffff; + + if (ch->ch_state == CS_READY && + (ch->ch_tun.un_open_count != 0) && + (ch->ch_tun.un_flag & UN_CLOSING) == 0 && + (ch->ch_cflag & CF_CREAD) != 0 && + (ch->ch_flag & (CH_BAUD0 | CH_RX_FLUSH)) == 0 && + (ch->ch_send & RR_RX_FLUSH) == 0) { + + if (ch->ch_rin + dlen >= RBUF_MAX) { + n = RBUF_MAX - ch->ch_rin; + + memcpy(ch->ch_rbuf + ch->ch_rin, dbuf, n); + + ch->ch_rin = 0; + dbuf += n; + dlen -= n; + } + + memcpy(ch->ch_rbuf + ch->ch_rin, dbuf, dlen); + + ch->ch_rin += dlen; + + + /* + * If we are not in fastcook mode, or + * if there is a fastcook thread + * waiting for data, send the data to + * the line discipline. + */ + + if ((ch->ch_flag & CH_FAST_READ) == 0 || + ch->ch_inwait != 0) { + dgrp_input(ch); + } + + /* + * If there is a read thread waiting + * in select, and we are in fastcook + * mode, wake him up. + */ + + if (waitqueue_active(&ch->ch_tun.un_tty->read_wait) && + (ch->ch_flag & CH_FAST_READ) != 0) + wake_up_interruptible(&ch->ch_tun.un_tty->read_wait); + + /* + * Wake any thread waiting in the + * fastcook loop. + */ + + if ((ch->ch_flag & CH_INPUT) != 0) { + ch->ch_flag &= ~CH_INPUT; + wake_up_interruptible(&ch->ch_flag_wait); + } + } + + /* + * Fabricate and insert a data packet header to + * preced the remaining data when it comes in. + */ + + if (remain < plen) { + dlen = plen - remain; + b = buf; + + b[0] = 0x90 + n1; + put_unaligned_be16(dlen, b + 1); + + remain = 3; + if (remain > 0 && b != buf) + memcpy(buf, b, remain); + + nd->nd_remain = remain; + return; + } +} + /** * dgrp_receive() -- decode data packets received from the remote PortServer. * @nd: pointer to a node structure @@ -2306,7 +2477,8 @@ static void dgrp_receive(struct nd_struct *nd) plen = dlen + 1; dbuf = b + 1; - goto data; + handle_data_in_packet(nd, ch, dlen, plen, n1, dbuf); + break; /* * Process 2-byte header data packet. @@ -2320,7 +2492,8 @@ static void dgrp_receive(struct nd_struct *nd) plen = dlen + 2; dbuf = b + 2; - goto data; + handle_data_in_packet(nd, ch, dlen, plen, n1, dbuf); + break; /* * Process 3-byte header data packet. @@ -2335,159 +2508,6 @@ static void dgrp_receive(struct nd_struct *nd) dbuf = b + 3; - /* - * Common packet handling code. - */ - -data: - nd->nd_tx_work = 1; - - /* - * Otherwise data should appear only when we are - * in the CS_READY state. - */ - - if (ch->ch_state < CS_READY) { - error = "Data received before RWIN established"; - goto prot_error; - } - - /* - * Assure that the data received is within the - * allowable window. - */ - - n = (ch->ch_s_rwin - ch->ch_s_rin) & 0xffff; - - if (dlen > n) { - error = "Receive data overrun"; - goto prot_error; - } - - /* - * If we received 3 or less characters, - * assume it is a human typing, and set RTIME - * to 10 milliseconds. - * - * If we receive 10 or more characters, - * assume its not a human typing, and set RTIME - * to 100 milliseconds. - */ - - if (ch->ch_edelay != DGRP_RTIME) { - if (ch->ch_rtime != ch->ch_edelay) { - ch->ch_rtime = ch->ch_edelay; - ch->ch_flag |= CH_PARAM; - } - } else if (dlen <= 3) { - if (ch->ch_rtime != 10) { - ch->ch_rtime = 10; - ch->ch_flag |= CH_PARAM; - } - } else { - if (ch->ch_rtime != DGRP_RTIME) { - ch->ch_rtime = DGRP_RTIME; - ch->ch_flag |= CH_PARAM; - } - } - - /* - * If a portion of the packet is outside the - * buffer, shorten the effective length of the - * data packet to be the amount of data received. - */ - - if (remain < plen) - dlen -= plen - remain; - - /* - * Detect if receive flush is now complete. - */ - - if ((ch->ch_flag & CH_RX_FLUSH) != 0 && - ((ch->ch_flush_seq - nd->nd_seq_out) & SEQ_MASK) >= - ((nd->nd_seq_in - nd->nd_seq_out) & SEQ_MASK)) { - ch->ch_flag &= ~CH_RX_FLUSH; - } - - /* - * If we are ready to receive, move the data into - * the receive buffer. - */ - - ch->ch_s_rin = (ch->ch_s_rin + dlen) & 0xffff; - - if (ch->ch_state == CS_READY && - (ch->ch_tun.un_open_count != 0) && - (ch->ch_tun.un_flag & UN_CLOSING) == 0 && - (ch->ch_cflag & CF_CREAD) != 0 && - (ch->ch_flag & (CH_BAUD0 | CH_RX_FLUSH)) == 0 && - (ch->ch_send & RR_RX_FLUSH) == 0) { - - if (ch->ch_rin + dlen >= RBUF_MAX) { - n = RBUF_MAX - ch->ch_rin; - - memcpy(ch->ch_rbuf + ch->ch_rin, dbuf, n); - - ch->ch_rin = 0; - dbuf += n; - dlen -= n; - } - - memcpy(ch->ch_rbuf + ch->ch_rin, dbuf, dlen); - - ch->ch_rin += dlen; - - - /* - * If we are not in fastcook mode, or - * if there is a fastcook thread - * waiting for data, send the data to - * the line discipline. - */ - - if ((ch->ch_flag & CH_FAST_READ) == 0 || - ch->ch_inwait != 0) { - dgrp_input(ch); - } - - /* - * If there is a read thread waiting - * in select, and we are in fastcook - * mode, wake him up. - */ - - if (waitqueue_active(&ch->ch_tun.un_tty->read_wait) && - (ch->ch_flag & CH_FAST_READ) != 0) - wake_up_interruptible(&ch->ch_tun.un_tty->read_wait); - - /* - * Wake any thread waiting in the - * fastcook loop. - */ - - if ((ch->ch_flag & CH_INPUT) != 0) { - ch->ch_flag &= ~CH_INPUT; - - wake_up_interruptible(&ch->ch_flag_wait); - } - } - - /* - * Fabricate and insert a data packet header to - * preced the remaining data when it comes in. - */ - - if (remain < plen) { - dlen = plen - remain; - b = buf; - - b[0] = 0x90 + n1; - put_unaligned_be16(dlen, b + 1); - - remain = 3; - goto done; - } break; /* From a23bb460aa28063a83c9e2b923218044e3fb4aab Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Mon, 11 Nov 2013 12:09:58 +0530 Subject: [PATCH 130/238] Staging: gdm724x: Remove confusing macro gdm_lte_sdu_send in gdm_lte.c This patch removes confusing macro gdm_lte_sdu_send as stated in TODO list in file gdm_lte.c. It then fixes the place where the macro is used. Signed-off-by: Rashika Kheria Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm724x/gdm_lte.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/staging/gdm724x/gdm_lte.c b/drivers/staging/gdm724x/gdm_lte.c index 723cc270deb9..74a03608b2dd 100644 --- a/drivers/staging/gdm724x/gdm_lte.c +++ b/drivers/staging/gdm724x/gdm_lte.c @@ -44,9 +44,6 @@ */ #define DEFAULT_MTU_SIZE 1500 -#define gdm_lte_sdu_send(n, d, l, c, b, i, t) (\ - n->phy_dev->send_sdu_func(n->phy_dev->priv_dev, d, l, n->pdn_table.dft_eps_id, 0, c, b, i, t)) - #define IP_VERSION_4 4 #define IP_VERSION_6 6 @@ -449,13 +446,11 @@ static int gdm_lte_tx(struct sk_buff *skb, struct net_device *dev) sscanf(dev->name, "lte%d", &idx); - ret = gdm_lte_sdu_send(nic, - data_buf, - data_len, - tx_complete, - nic, - idx, - nic_type); + ret = nic->phy_dev->send_sdu_func(nic->phy_dev->priv_dev, + data_buf, data_len, + nic->pdn_table.dft_eps_id, 0, + tx_complete, nic, idx, + nic_type); if (ret == TX_NO_BUFFER || ret == TX_NO_SPC) { netif_stop_queue(dev); From 1fb35c297663e80aeee863997aa775ca285bf1c2 Mon Sep 17 00:00:00 2001 From: Rashika Kheria Date: Mon, 11 Nov 2013 12:35:12 +0530 Subject: [PATCH 131/238] Staging: tidspbridge: Remove unnecessary newline character in dmm.c This patch removes an extra newline character in pmgr/dmm.c. Signed-off-by: Rashika Kheria Suggested-by: Greg KH Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/tidspbridge/pmgr/dmm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/tidspbridge/pmgr/dmm.c b/drivers/staging/tidspbridge/pmgr/dmm.c index 04a6b0669fa9..fcf564aa566d 100644 --- a/drivers/staging/tidspbridge/pmgr/dmm.c +++ b/drivers/staging/tidspbridge/pmgr/dmm.c @@ -479,7 +479,7 @@ u32 dmm_mem_map_dump(struct dmm_object *dmm_mgr) freemem / (1024 * 1024)); dev_info(bridge, "Total DSP VA USED memory= %d Mbytes\n", (((table_size * PG_SIZE4K) - freemem)) / (1024 * 1024)); - dev_info(bridge, "DSP VA - Biggest FREE block = %d Mbytes\n\n", + dev_info(bridge, "DSP VA - Biggest FREE block = %d Mbytes\n", (bigsize * PG_SIZE4K / (1024 * 1024))); return 0; From b047a8dc30a84d272d230b76b41ca2d0730f0d97 Mon Sep 17 00:00:00 2001 From: Dulshani Gunawardhana Date: Mon, 11 Nov 2013 15:47:17 +0530 Subject: [PATCH 132/238] staging: lustre: Fix incorrect type in assignment Fix the following sparse warings in local_storage.c. drivers/staging/lustre/lustre/obdclass/local_storage.c:269:16:warning:incorrect type in assignment (different base types) Signed-off-by: Dulshani Gunawardhana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/local_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdclass/local_storage.c b/drivers/staging/lustre/lustre/obdclass/local_storage.c index cc19fbab0207..51ab7f413004 100644 --- a/drivers/staging/lustre/lustre/obdclass/local_storage.c +++ b/drivers/staging/lustre/lustre/obdclass/local_storage.c @@ -246,7 +246,7 @@ int local_object_create(const struct lu_env *env, struct dt_object_format *dof, struct thandle *th) { struct dt_thread_info *dti = dt_info(env); - obd_id lastid; + __le64 lastid; int rc; rc = dt_create(env, o, attr, NULL, dof, th); From 20a6264abf8bd77bbfcbfc9e7a279203f1630410 Mon Sep 17 00:00:00 2001 From: Dulshani Gunawardhana Date: Mon, 11 Nov 2013 15:30:44 +0530 Subject: [PATCH 133/238] staging:lustre: Fix variable type declaration Fix the following sparse warnings generated by AND-ing FMODE_* constant with a normal integer. drivers/staging/lustre/lustre/llite/file.c:102:32: warning: restricted fmode_t degrades to integer Signed-off-by: Dulshani Gunawardhana Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/include/lustre_lib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_lib.h b/drivers/staging/lustre/lustre/include/lustre_lib.h index 5e11107d4c66..b6fd03e45bb7 100644 --- a/drivers/staging/lustre/lustre/include/lustre_lib.h +++ b/drivers/staging/lustre/lustre/include/lustre_lib.h @@ -85,7 +85,7 @@ struct obd_client_handle { struct lu_fid och_fid; struct md_open_data *och_mod; __u32 och_magic; - int och_flags; + fmode_t och_flags; }; #define OBD_CLIENT_HANDLE_MAGIC 0xd15ea5ed From 5fb0a2fa24441a71275e1c42eac1590938a1ec9f Mon Sep 17 00:00:00 2001 From: Dulshani Gunawardhana Date: Mon, 11 Nov 2013 21:47:56 +0530 Subject: [PATCH 134/238] staging: lustre: Fix sparse warning for one-bit signed bitfield Fix the following sparse warning: drivers/staging/lustre/lustre/llite/llite_internal.h:461:49: error:dubious one-bit signed bitfield Signed-off-by: Dulshani Gunawardhana Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/llite_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 47e443d90fe1..fb7cbb5fa124 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -458,7 +458,7 @@ struct ll_sb_info { struct lu_fid ll_root_fid; /* root object fid */ int ll_flags; - int ll_umounting:1; + unsigned int ll_umounting:1; struct list_head ll_conn_chain; /* per-conn chain of SBs */ struct lustre_client_ocd ll_lco; From c265be0121154709a0b16f13c87ff58245ba81bc Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:22 +0000 Subject: [PATCH 135/238] staging: comedi: remove unused command callback support The 'kcomedilib' module used to provide functions to allow asynchronous comedi commands to be set up from another kernel module, but now commands can only be set up by ioctls from user space via the core comedi module. Since support for commands initiated from kernel space has been dropped, the `cb_func` and `cb_arg` members of `struct comedi_async` are never set (although the `cb_mask` member is still used to mask comedi events). The `SRF_USER` bit of the comedi subdevice runflags is no longer needed to distinguish commands from user and kernel space since they only come from user space. Don't bother setting or testing the `SRF_USER` flag, and get rid of it, along with the `cb_func` and `cb_arg` members. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 21 +++++++-------------- drivers/staging/comedi/comedidev.h | 4 ---- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index f3d59e2a1152..0d8565428abb 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -1469,8 +1469,7 @@ static int do_cmd_ioctl(struct comedi_device *dev, if (async->cmd.flags & TRIG_WAKE_EOS) async->cb_mask |= COMEDI_CB_EOS; - comedi_set_subdevice_runflags(s, SRF_USER | SRF_ERROR | SRF_RUNNING, - SRF_USER | SRF_RUNNING); + comedi_set_subdevice_runflags(s, SRF_ERROR | SRF_RUNNING, SRF_RUNNING); /* set s->busy _after_ setting SRF_RUNNING flag to avoid race with * comedi_read() or comedi_write() */ @@ -1700,8 +1699,7 @@ static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg, return -EBUSY; ret = do_cancel(dev, s); - if (comedi_get_subdevice_runflags(s) & SRF_USER) - wake_up_interruptible(&s->async->wait_head); + wake_up_interruptible(&s->async->wait_head); return ret; } @@ -2368,16 +2366,11 @@ void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s) } if (async->cb_mask & s->async->events) { - if (comedi_get_subdevice_runflags(s) & SRF_USER) { - wake_up_interruptible(&async->wait_head); - if (s->subdev_flags & SDF_CMD_READ) - kill_fasync(&dev->async_queue, SIGIO, POLL_IN); - if (s->subdev_flags & SDF_CMD_WRITE) - kill_fasync(&dev->async_queue, SIGIO, POLL_OUT); - } else { - if (async->cb_func) - async->cb_func(s->async->events, async->cb_arg); - } + wake_up_interruptible(&async->wait_head); + if (s->subdev_flags & SDF_CMD_READ) + kill_fasync(&dev->async_queue, SIGIO, POLL_IN); + if (s->subdev_flags & SDF_CMD_WRITE) + kill_fasync(&dev->async_queue, SIGIO, POLL_OUT); } s->async->events = 0; } diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 143be8076a2e..38a4eebcd818 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -141,10 +141,7 @@ struct comedi_async { wait_queue_head_t wait_head; - /* callback stuff */ unsigned int cb_mask; - int (*cb_func) (unsigned int flags, void *); - void *cb_arg; int (*inttrig) (struct comedi_device *dev, struct comedi_subdevice *s, unsigned int x); @@ -240,7 +237,6 @@ void stop_polling(struct comedi_device *); /* subdevice runflags */ enum subdevice_runflags { - SRF_USER = 0x00000001, SRF_RT = 0x00000002, /* indicates an COMEDI_CB_ERROR event has occurred since the last * command was started */ From ab3cb2e30ec8223777f6ea4696ba24191ffc5c72 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:23 +0000 Subject: [PATCH 136/238] staging: comedi: add a couple of #includes to comedidev.h Two structures defined in "comedidev.h" have an element of type `spinlock_t`, so add `#include ` to declare it. One structure has an element of type `struct mutex` so add `#include ` to declare it. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedidev.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 38a4eebcd818..e2432471c390 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -20,6 +20,8 @@ #define _COMEDIDEV_H #include +#include +#include #include "comedi.h" From 2f3fdcd7ce935f6f2899ceab57dc8fe5286db3e1 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:24 +0000 Subject: [PATCH 137/238] staging: comedi: add rw_semaphore to protect against device detachment The 'read' and 'write' file operations on comedi devices do not use the main mutex in the `struct comedi_device` to avoid contention with ioctls that may take a while to complete. However, it is necessary to protect against the device being detached while the operation is in progress. Add member `struct rw_semaphore attach_lock` to `struct comedi_device` for this purpose and initialize it on creation. The actual locking and unlocking will be implemented by subsequent patches. Tasks that are attaching or detaching comedi devices will write-acquire the new semaphore whilst also holding the main mutex in the `struct comedi_device`. Tasks that wish to protect against the comedi device being detached need to acquire either the main mutex, or read-acquire the new semaphore, or both in that order. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 1 + drivers/staging/comedi/comedidev.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 0d8565428abb..a1705ed0b844 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -91,6 +91,7 @@ static void comedi_device_init(struct comedi_device *dev) { spin_lock_init(&dev->spinlock); mutex_init(&dev->mutex); + init_rwsem(&dev->attach_lock); dev->minor = -1; } diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index e2432471c390..70de3558c74e 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -22,6 +22,7 @@ #include #include #include +#include #include "comedi.h" @@ -184,6 +185,7 @@ struct comedi_device { bool ioenabled:1; spinlock_t spinlock; struct mutex mutex; + struct rw_semaphore attach_lock; int n_subdevices; struct comedi_subdevice *subdevices; From bf11c134246e8f3cfa2582a3d2af84ed7dfd59b6 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:25 +0000 Subject: [PATCH 138/238] staging: comedi: use attach_lock semaphore during attach and detach Acquire the `attach_lock` semaphore in the `struct comedi_device` while modifying the `attached` flag. This is a "write" acquire. Note that the main mutex in the `struct comedi_device` is also held at this time. Tasks wishing to check the device is attached will need to either acquire the main mutex, or "read" acquire the `attach_lock` semaphore, or both in that order. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 8f02bf66e20b..c398422e073d 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -133,10 +133,12 @@ static void cleanup_device(struct comedi_device *dev) void comedi_device_detach(struct comedi_device *dev) { + down_write(&dev->attach_lock); dev->attached = false; if (dev->driver) dev->driver->detach(dev); cleanup_device(dev); + up_write(&dev->attach_lock); } static int poll_invalid(struct comedi_device *dev, struct comedi_subdevice *s) @@ -355,8 +357,9 @@ static int comedi_device_postconfig(struct comedi_device *dev) ret = __comedi_device_postconfig(dev); if (ret < 0) return ret; - smp_wmb(); + down_write(&dev->attach_lock); dev->attached = true; + up_write(&dev->attach_lock); return 0; } From 3867e20db4823c733710f11b65606a9ed7d297c2 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:26 +0000 Subject: [PATCH 139/238] staging: comedi: cleanup_device() -> comedi_device_detach_cleanup() Rename the local function `cleanup_device()` to `comedi_device_detach_cleanup()`. It is only called from the `comedi_device_detach()` function and that is called from `comedi_device_cleanup()` and other places. The more specific function name seems less confusing. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index c398422e073d..1f44f2939f6a 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -95,7 +95,7 @@ int comedi_alloc_subdevices(struct comedi_device *dev, int num_subdevices) } EXPORT_SYMBOL_GPL(comedi_alloc_subdevices); -static void cleanup_device(struct comedi_device *dev) +static void comedi_device_detach_cleanup(struct comedi_device *dev) { int i; struct comedi_subdevice *s; @@ -137,7 +137,7 @@ void comedi_device_detach(struct comedi_device *dev) dev->attached = false; if (dev->driver) dev->driver->detach(dev); - cleanup_device(dev); + comedi_device_detach_cleanup(dev); up_write(&dev->attach_lock); } From 8da8c86f52e5487adfa2e3bae4d539e46f2714dd Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:27 +0000 Subject: [PATCH 140/238] staging: comedi: wake up async waiters when become non-busy Wake up all waiters on the comedi subdevice's async wait queue whenever the subdevice is marked "non-busy". This happens when an asynchronous command is cancelled or when a command is terminated and all data has been read or written. Note: use `wake_up_interruptible_all()` as we only use interruptible waits. Remove the call to `wake_up_interruptible()` from `do_cancel_ioctl()` as it will call `wake_up_interruptible_all()` indirectly via `do_cancel()` and `do_become_nonbusy()`. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index a1705ed0b844..9c85f01e847b 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -563,12 +563,13 @@ static void do_become_nonbusy(struct comedi_device *dev, async->inttrig = NULL; kfree(async->cmd.chanlist); async->cmd.chanlist = NULL; + s->busy = NULL; + wake_up_interruptible_all(&s->async->wait_head); } else { dev_err(dev->class_dev, "BUG: (?) do_become_nonbusy called with async=NULL\n"); + s->busy = NULL; } - - s->busy = NULL; } static int do_cancel(struct comedi_device *dev, struct comedi_subdevice *s) @@ -1700,7 +1701,6 @@ static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg, return -EBUSY; ret = do_cancel(dev, s); - wake_up_interruptible(&s->async->wait_head); return ret; } From d19db51a0eeb659cd924a9d08b20a2ed4ee46b15 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:28 +0000 Subject: [PATCH 141/238] staging: comedi: cancel commands before detaching device The comedi core module's handling of the `COMEDI_DEVCONFIG` ioctl will not allow a device to be detached if it is busy. However, comedi devices can also be auto-detached due to a removal of a hardware device. One of the things we should do in that case is cancel any asynchronous commands that are running. Add a new function `comedi_device_cancel_all()` to do that and call it from `comedi_device_detach()`. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 15 +++++++++++++++ drivers/staging/comedi/comedi_internal.h | 1 + drivers/staging/comedi/drivers.c | 1 + 3 files changed, 17 insertions(+) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 9c85f01e847b..eafa18efdeea 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -584,6 +584,21 @@ static int do_cancel(struct comedi_device *dev, struct comedi_subdevice *s) return ret; } +void comedi_device_cancel_all(struct comedi_device *dev) +{ + struct comedi_subdevice *s; + int i; + + if (!dev->attached) + return; + + for (i = 0; i < dev->n_subdevices; i++) { + s = &dev->subdevices[i]; + if (s->async) + do_cancel(dev, s); + } +} + static int is_device_busy(struct comedi_device *dev) { struct comedi_subdevice *s; diff --git a/drivers/staging/comedi/comedi_internal.h b/drivers/staging/comedi/comedi_internal.h index fda1a7ba0e16..151693b11383 100644 --- a/drivers/staging/comedi/comedi_internal.h +++ b/drivers/staging/comedi/comedi_internal.h @@ -17,6 +17,7 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, unsigned long new_size); void comedi_buf_reset(struct comedi_async *async); unsigned int comedi_buf_write_n_allocated(struct comedi_async *async); +void comedi_device_cancel_all(struct comedi_device *dev); extern unsigned int comedi_default_buf_size_kb; extern unsigned int comedi_default_buf_maxsize_kb; diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 1f44f2939f6a..4f727731a72d 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -133,6 +133,7 @@ static void comedi_device_detach_cleanup(struct comedi_device *dev) void comedi_device_detach(struct comedi_device *dev) { + comedi_device_cancel_all(dev); down_write(&dev->attach_lock); dev->attached = false; if (dev->driver) From ef77c0b2570623f1d72527cb1c6c3f3d3c59793e Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:29 +0000 Subject: [PATCH 142/238] staging: comedi: add detachment counter for validity checks Add a member `detach_count` to `struct comedi_device` that is incremented every time the device gets detached. This will be used in some validity checks in the 'read' and 'write' file operations to make sure the attachment remains valid. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedidev.h | 1 + drivers/staging/comedi/drivers.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 70de3558c74e..05cc8dbcd515 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -173,6 +173,7 @@ struct comedi_device { struct device *class_dev; int minor; + unsigned int detach_count; /* hw_dev is passed to dma_alloc_coherent when allocating async buffers * for subdevices that have async_dma_dir set to something other than * DMA_NONE */ diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 4f727731a72d..15b1ab885e77 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -136,6 +136,7 @@ void comedi_device_detach(struct comedi_device *dev) comedi_device_cancel_all(dev); down_write(&dev->attach_lock); dev->attached = false; + dev->detach_count++; if (dev->driver) dev->driver->detach(dev); comedi_device_detach_cleanup(dev); From 9329f13956bb8e43c254e7137386dce0b35f24b6 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:30 +0000 Subject: [PATCH 143/238] staging: comedi: protect against detach during write operation The 'write' file operation for comedi devices does not use the main mutex in the `struct comedi_device` to avoid contention with some ioctls that may take a while to complete. Use the `attach_lock` semaphore to protect against detachment while the 'write' operation is in progress. This is a `struct rw_semaphore` and we read-lock it to protect against device detachment. Note that `comedi_device_cancel_all()` is called during device detachment, which cancels any ongoing asynchronous commands. This will wake up any blocked writers which will then release the `attach_lock` semaphore and complete the 'write' operation early. The only time the 'write' file operation does use the main mutex is at the end of the command when it has to call `do_become_nonbusy()` to mark the subdevice as no longer busy handling an asynchronous command. To avoid deadlock, it has to remove the task from the wait queue and release the `attach_lock` semaphore before acquiring the main mutex. It then needs to confirm that the device is still attached. Unfortunately, we do not yet protect against a dynamically allocated `struct comedi_device` being deleted during the operation. This will be addressed by a later patch. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 61 ++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 9 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index eafa18efdeea..1ae2bdf08646 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2023,38 +2023,77 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, DECLARE_WAITQUEUE(wait, current); const unsigned minor = iminor(file_inode(file)); struct comedi_device *dev = comedi_dev_from_minor(minor); + bool on_wait_queue = false; + bool attach_locked; + unsigned int old_detach_count; if (!dev) return -ENODEV; + /* Protect against device detachment during operation. */ + down_read(&dev->attach_lock); + attach_locked = true; + old_detach_count = dev->detach_count; + if (!dev->attached) { DPRINTK("no driver configured on comedi%i\n", dev->minor); - return -ENODEV; + retval = -ENODEV; + goto out; } s = comedi_write_subdevice(dev, minor); - if (!s || !s->async) - return -EIO; + if (!s || !s->async) { + retval = -EIO; + goto out; + } async = s->async; if (!s->busy || !nbytes) - return 0; - if (s->busy != file) - return -EACCES; + goto out; + if (s->busy != file) { + retval = -EACCES; + goto out; + } add_wait_queue(&async->wait_head, &wait); + on_wait_queue = true; while (nbytes > 0 && !retval) { set_current_state(TASK_INTERRUPTIBLE); if (!comedi_is_subdevice_running(s)) { if (count == 0) { - mutex_lock(&dev->mutex); + struct comedi_subdevice *new_s; + if (comedi_is_subdevice_in_error(s)) retval = -EPIPE; else retval = 0; - do_become_nonbusy(dev, s); + /* + * To avoid deadlock, cannot acquire dev->mutex + * while dev->attach_lock is held. Need to + * remove task from the async wait queue before + * releasing dev->attach_lock, as it might not + * be valid afterwards. + */ + remove_wait_queue(&async->wait_head, &wait); + on_wait_queue = false; + up_read(&dev->attach_lock); + attach_locked = false; + mutex_lock(&dev->mutex); + /* + * Become non-busy unless things have changed + * behind our back. Checking dev->detach_count + * is unchanged ought to be sufficient (unless + * there have been 2**32 detaches in the + * meantime!), but check the subdevice pointer + * as well just in case. + */ + new_s = comedi_write_subdevice(dev, minor); + if (dev->attached && + old_detach_count == dev->detach_count && + s == new_s && new_s->async == async) + do_become_nonbusy(dev, s); mutex_unlock(&dev->mutex); } break; @@ -2104,8 +2143,12 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, buf += n; break; /* makes device work like a pipe */ } +out: + if (on_wait_queue) + remove_wait_queue(&async->wait_head, &wait); set_current_state(TASK_RUNNING); - remove_wait_queue(&async->wait_head, &wait); + if (attach_locked) + up_read(&dev->attach_lock); return count ? count : retval; } From 45c2bc557ca333a2115bb9f812b026b482cca5fa Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:31 +0000 Subject: [PATCH 144/238] staging: comedi: protect against detach during read operation The 'read' file operation for comedi devices does not use the main mutex in the `struct comedi_device` to avoid contention with some ioctls that may take a while to complete. Use the `attach_lock` semaphore to protect against detachment while the 'read' operation is in progress. This is a `struct rw_semaphore` and we read-lock it to protect against device detachment. Note that `comedi_device_cancel_all()` is called during device detachment, which cancels any ongoing asynchronous commands. This will wake up any blocked readers which will then release the `attach_lock` semaphore and complete the 'read' operation early. The only time the 'read' file operation does use the main mutex is at the end of the command when it has to call `do_become_nonbusy()` to mark the subdevice as no longer busy handling an asynchronous command. To avoid deadlock, it has to remove the task from the wait queue and release the `attach_lock` semaphore before acquiring the main mutex. It then needs to confirm the device is still attached. Unfortunately, we do not yet protect against a dynamically allocated `struct comedi_device` being deleted during the operation. This will be addressed by a later patch. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 62 +++++++++++++++++++++------- 1 file changed, 48 insertions(+), 14 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 1ae2bdf08646..fa8da20df753 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2162,24 +2162,37 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, DECLARE_WAITQUEUE(wait, current); const unsigned minor = iminor(file_inode(file)); struct comedi_device *dev = comedi_dev_from_minor(minor); + unsigned int old_detach_count; + bool become_nonbusy = false; + bool attach_locked; if (!dev) return -ENODEV; + /* Protect against device detachment during operation. */ + down_read(&dev->attach_lock); + attach_locked = true; + old_detach_count = dev->detach_count; + if (!dev->attached) { DPRINTK("no driver configured on comedi%i\n", dev->minor); - return -ENODEV; + retval = -ENODEV; + goto out; } s = comedi_read_subdevice(dev, minor); - if (!s || !s->async) - return -EIO; + if (!s || !s->async) { + retval = -EIO; + goto out; + } async = s->async; if (!s->busy || !nbytes) - return 0; - if (s->busy != file) - return -EACCES; + goto out; + if (s->busy != file) { + retval = -EACCES; + goto out; + } add_wait_queue(&async->wait_head, &wait); while (nbytes > 0 && !retval) { @@ -2197,13 +2210,11 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, if (n == 0) { if (!comedi_is_subdevice_running(s)) { - mutex_lock(&dev->mutex); - do_become_nonbusy(dev, s); if (comedi_is_subdevice_in_error(s)) retval = -EPIPE; else retval = 0; - mutex_unlock(&dev->mutex); + become_nonbusy = true; break; } if (file->f_flags & O_NONBLOCK) { @@ -2241,14 +2252,37 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, buf += n; break; /* makes device work like a pipe */ } - if (comedi_is_subdevice_idle(s)) { + remove_wait_queue(&async->wait_head, &wait); + set_current_state(TASK_RUNNING); + if (become_nonbusy || comedi_is_subdevice_idle(s)) { + struct comedi_subdevice *new_s; + + /* + * To avoid deadlock, cannot acquire dev->mutex + * while dev->attach_lock is held. + */ + up_read(&dev->attach_lock); + attach_locked = false; mutex_lock(&dev->mutex); - if (async->buf_read_count - async->buf_write_count == 0) - do_become_nonbusy(dev, s); + /* + * Check device hasn't become detached behind our back. + * Checking dev->detach_count is unchanged ought to be + * sufficient (unless there have been 2**32 detaches in the + * meantime!), but check the subdevice pointer as well just in + * case. + */ + new_s = comedi_read_subdevice(dev, minor); + if (dev->attached && old_detach_count == dev->detach_count && + s == new_s && new_s->async == async) { + if (become_nonbusy || + async->buf_read_count - async->buf_write_count == 0) + do_become_nonbusy(dev, s); + } mutex_unlock(&dev->mutex); } - set_current_state(TASK_RUNNING); - remove_wait_queue(&async->wait_head, &wait); +out: + if (attach_locked) + up_read(&dev->attach_lock); return count ? count : retval; } From 5b13ed94a7d24fdc8abbac81e7e4d30ab22c6540 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:32 +0000 Subject: [PATCH 145/238] staging: comedi: add a kref to comedi device Add a `struct kref refcount` member to `struct comedi_device` to allow safe destruction of the comedi device. Only free the comedi device via the 'release' callback `kref_put()`. Currently, nothing calls `kref_put()`, so the safe destruction is ineffective, but this will be addressed by later patches. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 22 +++++++++++++++++++--- drivers/staging/comedi/comedidev.h | 2 ++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index fa8da20df753..403324c895b1 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -89,12 +89,29 @@ static struct cdev comedi_cdev; static void comedi_device_init(struct comedi_device *dev) { + kref_init(&dev->refcount); spin_lock_init(&dev->spinlock); mutex_init(&dev->mutex); init_rwsem(&dev->attach_lock); dev->minor = -1; } +static void comedi_dev_kref_release(struct kref *kref) +{ + struct comedi_device *dev = + container_of(kref, struct comedi_device, refcount); + + mutex_destroy(&dev->mutex); + kfree(dev); +} + +int comedi_dev_put(struct comedi_device *dev) +{ + if (dev) + return kref_put(&dev->refcount, comedi_dev_kref_release); + return 1; +} + static void comedi_device_cleanup(struct comedi_device *dev) { struct module *driver_module = NULL; @@ -112,7 +129,6 @@ static void comedi_device_cleanup(struct comedi_device *dev) dev->use_count--; } mutex_unlock(&dev->mutex); - mutex_destroy(&dev->mutex); } static bool comedi_clear_board_dev(struct comedi_device *dev) @@ -148,7 +164,7 @@ static void comedi_free_board_dev(struct comedi_device *dev) MKDEV(COMEDI_MAJOR, dev->minor)); } comedi_device_cleanup(dev); - kfree(dev); + comedi_dev_put(dev); } } @@ -2494,7 +2510,7 @@ struct comedi_device *comedi_alloc_board_minor(struct device *hardware_device) if (i == COMEDI_NUM_BOARD_MINORS) { mutex_unlock(&dev->mutex); comedi_device_cleanup(dev); - kfree(dev); + comedi_dev_put(dev); pr_err("comedi: error: ran out of minor numbers for board device files.\n"); return ERR_PTR(-EBUSY); } diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 05cc8dbcd515..08652dfa8c03 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -23,6 +23,7 @@ #include #include #include +#include #include "comedi.h" @@ -187,6 +188,7 @@ struct comedi_device { spinlock_t spinlock; struct mutex mutex; struct rw_semaphore attach_lock; + struct kref refcount; int n_subdevices; struct comedi_subdevice *subdevices; From b449c1cad7e3acf80834d4bdb1b6241d5d8dd249 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:33 +0000 Subject: [PATCH 146/238] staging: comedi: add comedi_dev_get_from_minor() Add function `struct comedi_device *comedi_dev_get_from_minor(unsigned minor)`. This behaves like the existing `comedi_dev_from_minor()` except that it also increments the `struct kref refcount` member (via new helper function `comedi_dev_get()`) to prevent it being freed. If it returns a valid pointer, the caller is responsible for calling `comedi_dev_put()` to decrement the reference count. Export `comedi_dev_get_from_minor()` and `comedi_dev_put()` as they will be used by the "kcomedilib" module in addition to the "comedi" module itself. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 42 ++++++++++++++++++++++++++++ drivers/staging/comedi/comedidev.h | 2 ++ 2 files changed, 44 insertions(+) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 403324c895b1..5e5ddbdbad0b 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -111,6 +111,14 @@ int comedi_dev_put(struct comedi_device *dev) return kref_put(&dev->refcount, comedi_dev_kref_release); return 1; } +EXPORT_SYMBOL_GPL(comedi_dev_put); + +static struct comedi_device *comedi_dev_get(struct comedi_device *dev) +{ + if (dev) + kref_get(&dev->refcount); + return dev; +} static void comedi_device_cleanup(struct comedi_device *dev) { @@ -209,6 +217,40 @@ struct comedi_device *comedi_dev_from_minor(unsigned minor) } EXPORT_SYMBOL_GPL(comedi_dev_from_minor); +static struct comedi_device *comedi_dev_get_from_board_minor(unsigned minor) +{ + struct comedi_device *dev; + + BUG_ON(minor >= COMEDI_NUM_BOARD_MINORS); + mutex_lock(&comedi_board_minor_table_lock); + dev = comedi_dev_get(comedi_board_minor_table[minor]); + mutex_unlock(&comedi_board_minor_table_lock); + return dev; +} + +static struct comedi_device *comedi_dev_get_from_subdevice_minor(unsigned minor) +{ + struct comedi_device *dev; + struct comedi_subdevice *s; + unsigned int i = minor - COMEDI_NUM_BOARD_MINORS; + + BUG_ON(i >= COMEDI_NUM_SUBDEVICE_MINORS); + mutex_lock(&comedi_subdevice_minor_table_lock); + s = comedi_subdevice_minor_table[i]; + dev = comedi_dev_get(s ? s->device : NULL); + mutex_unlock(&comedi_subdevice_minor_table_lock); + return dev; +} + +struct comedi_device *comedi_dev_get_from_minor(unsigned minor) +{ + if (minor < COMEDI_NUM_BOARD_MINORS) + return comedi_dev_get_from_board_minor(minor); + else + return comedi_dev_get_from_subdevice_minor(minor); +} +EXPORT_SYMBOL_GPL(comedi_dev_get_from_minor); + static struct comedi_subdevice * comedi_read_subdevice(const struct comedi_device *dev, unsigned int minor) { diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 08652dfa8c03..a9b1468aa17c 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -236,6 +236,8 @@ static const unsigned COMEDI_SUBDEVICE_MINOR_SHIFT = 4; static const unsigned COMEDI_SUBDEVICE_MINOR_OFFSET = 1; struct comedi_device *comedi_dev_from_minor(unsigned minor); +struct comedi_device *comedi_dev_get_from_minor(unsigned minor); +int comedi_dev_put(struct comedi_device *dev); void init_polling(void); void cleanup_polling(void); From fc406986d4115dfbd5e2ea8a0e96920e97162689 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:34 +0000 Subject: [PATCH 147/238] staging: comedi: increment reference while file open In the 'open' file operation handler `comedi_open()` in "comedi_fops.c", call `comedi_dev_get_from_minor()` instead of `comedi_dev_from_minor()` to get the pointer to the `struct comedi_device`. This increments the reference to prevent it being freed. Call `comedi_dev_put()` to decrement the reference on failure, and also call it from the 'release' file operation handler `comedi_close()`. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 5e5ddbdbad0b..0ff69133c212 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2348,7 +2348,8 @@ out: static int comedi_open(struct inode *inode, struct file *file) { const unsigned minor = iminor(inode); - struct comedi_device *dev = comedi_dev_from_minor(minor); + struct comedi_device *dev = comedi_dev_get_from_minor(minor); + int rc; if (!dev) { DPRINTK("invalid minor number\n"); @@ -2373,8 +2374,8 @@ static int comedi_open(struct inode *inode, struct file *file) goto ok; if (!capable(CAP_NET_ADMIN) && dev->in_request_module) { DPRINTK("in request module\n"); - mutex_unlock(&dev->mutex); - return -ENODEV; + rc = -ENODEV; + goto out; } if (capable(CAP_NET_ADMIN) && dev->in_request_module) goto ok; @@ -2391,8 +2392,8 @@ static int comedi_open(struct inode *inode, struct file *file) if (!dev->attached && !capable(CAP_NET_ADMIN)) { DPRINTK("not attached and not CAP_NET_ADMIN\n"); - mutex_unlock(&dev->mutex); - return -ENODEV; + rc = -ENODEV; + goto out; } ok: __module_get(THIS_MODULE); @@ -2400,26 +2401,28 @@ ok: if (dev->attached) { if (!try_module_get(dev->driver->module)) { module_put(THIS_MODULE); - mutex_unlock(&dev->mutex); - return -ENOSYS; + rc = -ENOSYS; + goto out; } } if (dev->attached && dev->use_count == 0 && dev->open) { - int rc = dev->open(dev); + rc = dev->open(dev); if (rc < 0) { module_put(dev->driver->module); module_put(THIS_MODULE); - mutex_unlock(&dev->mutex); - return rc; + goto out; } } dev->use_count++; + rc = 0; +out: mutex_unlock(&dev->mutex); - - return 0; + if (rc) + comedi_dev_put(dev); + return rc; } static int comedi_fasync(int fd, struct file *file, int on) @@ -2465,6 +2468,7 @@ static int comedi_close(struct inode *inode, struct file *file) dev->use_count--; mutex_unlock(&dev->mutex); + comedi_dev_put(dev); return 0; } From a200fadca97abb337dcc28e737c1a2e11f56b714 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:35 +0000 Subject: [PATCH 148/238] staging: comedi: use refcount in comedi_driver_unregister() Change `comedi_driver_unregister()` to call `comedi_dev_get_from_minor()` instead of `comedi_dev_from_minor()` when finding devices using the driver. This increments the reference count to prevent the device being removed while it is being checked to see if it is attached to the driver. Call `comedi_dev_put()` to decrement the reference afterwards. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 15b1ab885e77..a5d03b9c3717 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -662,7 +662,7 @@ void comedi_driver_unregister(struct comedi_driver *driver) /* check for devices using this driver */ for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) { - struct comedi_device *dev = comedi_dev_from_minor(i); + struct comedi_device *dev = comedi_dev_get_from_minor(i); if (!dev) continue; @@ -676,6 +676,7 @@ void comedi_driver_unregister(struct comedi_driver *driver) comedi_device_detach(dev); } mutex_unlock(&dev->mutex); + comedi_dev_put(dev); } } EXPORT_SYMBOL_GPL(comedi_driver_unregister); From 616a3548e816553c31d57cc211a86d327a192e12 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:36 +0000 Subject: [PATCH 149/238] staging: comedi: use refcount while reading /proc/comedi In the seq_file 'show' handler for "/proc/comedi" - `comedi_read()` in "comedi/proc.c", call `comedi_dev_get_from_minor()` instead of `comedi_dev_from_minor()` to increment the reference counter for the `struct comedi_device` while it is being examined. Call `comedi_dev_put()` to decrement the reference afterwards. Also acquire the `attach_lock` rwsem while checking whether the device is attached. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/proc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/proc.c b/drivers/staging/comedi/proc.c index ade00035d3bb..da6bc5855ebc 100644 --- a/drivers/staging/comedi/proc.c +++ b/drivers/staging/comedi/proc.c @@ -41,16 +41,20 @@ static int comedi_read(struct seq_file *m, void *v) "driver_name, board_name, n_subdevices"); for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) { - struct comedi_device *dev = comedi_dev_from_minor(i); + struct comedi_device *dev = comedi_dev_get_from_minor(i); + if (!dev) continue; + down_read(&dev->attach_lock); if (dev->attached) { devices_q = 1; seq_printf(m, "%2d: %-20s %-20s %4d\n", i, dev->driver->driver_name, dev->board_name, dev->n_subdevices); } + up_read(&dev->attach_lock); + comedi_dev_put(dev); } if (!devices_q) seq_puts(m, "no devices\n"); From be535c9a058b73600666d5431cfb442f39989a33 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:37 +0000 Subject: [PATCH 150/238] staging: comedi: use refcount in sysfs attribute handlers Call `comedi_dev_get_from_minor()` instead of `comedi_dev_from_minor()` in the sysfs attribute handler functions to increment the reference of the `struct comedi_device` during the operation. Call `comedi_dev_put()` to decrement the reference afterwards. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 0ff69133c212..37400e85c417 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -328,7 +328,7 @@ static ssize_t max_read_buffer_kb_show(struct device *csdev, struct comedi_subdevice *s; unsigned int size = 0; - dev = comedi_dev_from_minor(minor); + dev = comedi_dev_get_from_minor(minor); if (!dev) return -ENODEV; @@ -338,6 +338,7 @@ static ssize_t max_read_buffer_kb_show(struct device *csdev, size = s->async->max_bufsize / 1024; mutex_unlock(&dev->mutex); + comedi_dev_put(dev); return snprintf(buf, PAGE_SIZE, "%i\n", size); } @@ -358,7 +359,7 @@ static ssize_t max_read_buffer_kb_store(struct device *csdev, return -EINVAL; size *= 1024; - dev = comedi_dev_from_minor(minor); + dev = comedi_dev_get_from_minor(minor); if (!dev) return -ENODEV; @@ -370,6 +371,7 @@ static ssize_t max_read_buffer_kb_store(struct device *csdev, err = -EINVAL; mutex_unlock(&dev->mutex); + comedi_dev_put(dev); return err ? err : count; } static DEVICE_ATTR_RW(max_read_buffer_kb); @@ -382,7 +384,7 @@ static ssize_t read_buffer_kb_show(struct device *csdev, struct comedi_subdevice *s; unsigned int size = 0; - dev = comedi_dev_from_minor(minor); + dev = comedi_dev_get_from_minor(minor); if (!dev) return -ENODEV; @@ -392,6 +394,7 @@ static ssize_t read_buffer_kb_show(struct device *csdev, size = s->async->prealloc_bufsz / 1024; mutex_unlock(&dev->mutex); + comedi_dev_put(dev); return snprintf(buf, PAGE_SIZE, "%i\n", size); } @@ -412,7 +415,7 @@ static ssize_t read_buffer_kb_store(struct device *csdev, return -EINVAL; size *= 1024; - dev = comedi_dev_from_minor(minor); + dev = comedi_dev_get_from_minor(minor); if (!dev) return -ENODEV; @@ -424,6 +427,7 @@ static ssize_t read_buffer_kb_store(struct device *csdev, err = -EINVAL; mutex_unlock(&dev->mutex); + comedi_dev_put(dev); return err ? err : count; } static DEVICE_ATTR_RW(read_buffer_kb); @@ -437,7 +441,7 @@ static ssize_t max_write_buffer_kb_show(struct device *csdev, struct comedi_subdevice *s; unsigned int size = 0; - dev = comedi_dev_from_minor(minor); + dev = comedi_dev_get_from_minor(minor); if (!dev) return -ENODEV; @@ -447,6 +451,7 @@ static ssize_t max_write_buffer_kb_show(struct device *csdev, size = s->async->max_bufsize / 1024; mutex_unlock(&dev->mutex); + comedi_dev_put(dev); return snprintf(buf, PAGE_SIZE, "%i\n", size); } @@ -467,7 +472,7 @@ static ssize_t max_write_buffer_kb_store(struct device *csdev, return -EINVAL; size *= 1024; - dev = comedi_dev_from_minor(minor); + dev = comedi_dev_get_from_minor(minor); if (!dev) return -ENODEV; @@ -479,6 +484,7 @@ static ssize_t max_write_buffer_kb_store(struct device *csdev, err = -EINVAL; mutex_unlock(&dev->mutex); + comedi_dev_put(dev); return err ? err : count; } static DEVICE_ATTR_RW(max_write_buffer_kb); @@ -491,7 +497,7 @@ static ssize_t write_buffer_kb_show(struct device *csdev, struct comedi_subdevice *s; unsigned int size = 0; - dev = comedi_dev_from_minor(minor); + dev = comedi_dev_get_from_minor(minor); if (!dev) return -ENODEV; @@ -501,6 +507,7 @@ static ssize_t write_buffer_kb_show(struct device *csdev, size = s->async->prealloc_bufsz / 1024; mutex_unlock(&dev->mutex); + comedi_dev_put(dev); return snprintf(buf, PAGE_SIZE, "%i\n", size); } @@ -521,7 +528,7 @@ static ssize_t write_buffer_kb_store(struct device *csdev, return -EINVAL; size *= 1024; - dev = comedi_dev_from_minor(minor); + dev = comedi_dev_get_from_minor(minor); if (!dev) return -ENODEV; @@ -533,6 +540,7 @@ static ssize_t write_buffer_kb_store(struct device *csdev, err = -EINVAL; mutex_unlock(&dev->mutex); + comedi_dev_put(dev); return err ? err : count; } static DEVICE_ATTR_RW(write_buffer_kb); From 799a66ba36cb51330c53c024dffc6ddb68545c9c Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:38 +0000 Subject: [PATCH 151/238] staging: comedi: kcomedilib: increment reference while device in use Low-level comedi drivers that use the "kcomedilib" module (currently only the "comedi_bond" driver) call `comedi_open()` to "open" another comedi device (not as a file) and `comedi_close()` to "close" it. (Note: these are the functions exported by the "kcomedilib" module, not the identically named, statically linked functions in the core "comedi" module.) In `comedi_open()`, call `comedi_dev_get_from_minor()` instead of `comedi_dev_from_minor()` to get the pointer to the `struct comedi_device` being "opened". This increments its reference count to prevent it being freed. Call `comedi_dev_put()` if `comedi_open()` returns `NULL`, and also call it from `comedi_close()`. This decrements the reference count. Note that although we now protect against the `struct comedi_device` being freed, we do not yet protect against it being "detached" while it is being used. This will be addressed by a later patch. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../comedi/kcomedilib/kcomedilib_main.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/kcomedilib/kcomedilib_main.c b/drivers/staging/comedi/kcomedilib/kcomedilib_main.c index cd60677a3ed2..b3a06f2dbad6 100644 --- a/drivers/staging/comedi/kcomedilib/kcomedilib_main.c +++ b/drivers/staging/comedi/kcomedilib/kcomedilib_main.c @@ -35,7 +35,7 @@ MODULE_LICENSE("GPL"); struct comedi_device *comedi_open(const char *filename) { - struct comedi_device *dev; + struct comedi_device *dev, *retval = NULL; unsigned int minor; if (strncmp(filename, "/dev/comedi", 11) != 0) @@ -46,15 +46,19 @@ struct comedi_device *comedi_open(const char *filename) if (minor >= COMEDI_NUM_BOARD_MINORS) return NULL; - dev = comedi_dev_from_minor(minor); - - if (!dev || !dev->attached) + dev = comedi_dev_get_from_minor(minor); + if (!dev) return NULL; - if (!try_module_get(dev->driver->module)) - return NULL; + if (dev->attached && try_module_get(dev->driver->module)) + retval = dev; + else + retval = NULL; - return dev; + if (retval == NULL) + comedi_dev_put(dev); + + return retval; } EXPORT_SYMBOL_GPL(comedi_open); @@ -63,6 +67,7 @@ int comedi_close(struct comedi_device *d) struct comedi_device *dev = (struct comedi_device *)d; module_put(dev->driver->module); + comedi_dev_put(dev); return 0; } From 69e2387f3bfd408c7fb6c0d14b83d792f67ed638 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:39 +0000 Subject: [PATCH 152/238] staging: comedi: kcomedilib: protect against device detachment The functions in "kcomedilib" need to prevent the comedi device being detached during their operation. This can be done by acquiring either the main mutex or the "attach lock" semaphore in the `struct comedi_device`. Use the attach lock when merely checking whether the device is attached. Use the mutex when processing a comedi instruction. Also, don't bother trying to manipulate the module use count of low-level comedi driver in `comedi_open()` and `comedi_close()`. If the device gets detached while it is "open", we wouldn't be able to decrement the module use count anyway. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../comedi/kcomedilib/kcomedilib_main.c | 55 ++++++++++++------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/drivers/staging/comedi/kcomedilib/kcomedilib_main.c b/drivers/staging/comedi/kcomedilib/kcomedilib_main.c index b3a06f2dbad6..7dc5a18e69d4 100644 --- a/drivers/staging/comedi/kcomedilib/kcomedilib_main.c +++ b/drivers/staging/comedi/kcomedilib/kcomedilib_main.c @@ -50,10 +50,12 @@ struct comedi_device *comedi_open(const char *filename) if (!dev) return NULL; - if (dev->attached && try_module_get(dev->driver->module)) + down_read(&dev->attach_lock); + if (dev->attached) retval = dev; else retval = NULL; + up_read(&dev->attach_lock); if (retval == NULL) comedi_dev_put(dev); @@ -62,13 +64,9 @@ struct comedi_device *comedi_open(const char *filename) } EXPORT_SYMBOL_GPL(comedi_open); -int comedi_close(struct comedi_device *d) +int comedi_close(struct comedi_device *dev) { - struct comedi_device *dev = (struct comedi_device *)d; - - module_put(dev->driver->module); comedi_dev_put(dev); - return 0; } EXPORT_SYMBOL_GPL(comedi_close); @@ -78,7 +76,14 @@ static int comedi_do_insn(struct comedi_device *dev, unsigned int *data) { struct comedi_subdevice *s; - int ret = 0; + int ret; + + mutex_lock(&dev->mutex); + + if (!dev->attached) { + ret = -EINVAL; + goto error; + } /* a subdevice instruction */ if (insn->subdev >= dev->n_subdevices) { @@ -125,6 +130,7 @@ static int comedi_do_insn(struct comedi_device *dev, s->busy = NULL; error: + mutex_unlock(&dev->mutex); return ret; } @@ -174,9 +180,6 @@ int comedi_dio_bitfield2(struct comedi_device *dev, unsigned int subdev, unsigned int shift; int ret; - if (subdev >= dev->n_subdevices) - return -EINVAL; - base_channel = CR_CHAN(base_channel); n_chan = comedi_get_n_channels(dev, subdev); if (base_channel >= n_chan) @@ -216,23 +219,33 @@ int comedi_find_subdevice_by_type(struct comedi_device *dev, int type, unsigned int subd) { struct comedi_subdevice *s; + int ret = -ENODEV; - if (subd > dev->n_subdevices) - return -ENODEV; - - for (; subd < dev->n_subdevices; subd++) { - s = &dev->subdevices[subd]; - if (s->type == type) - return subd; - } - return -1; + down_read(&dev->attach_lock); + if (dev->attached) + for (; subd < dev->n_subdevices; subd++) { + s = &dev->subdevices[subd]; + if (s->type == type) { + ret = subd; + break; + } + } + up_read(&dev->attach_lock); + return ret; } EXPORT_SYMBOL_GPL(comedi_find_subdevice_by_type); int comedi_get_n_channels(struct comedi_device *dev, unsigned int subdevice) { - struct comedi_subdevice *s = &dev->subdevices[subdevice]; + int n; - return s->n_chan; + down_read(&dev->attach_lock); + if (!dev->attached || subdevice >= dev->n_subdevices) + n = 0; + else + n = dev->subdevices[subdevice].n_chan; + up_read(&dev->attach_lock); + + return n; } EXPORT_SYMBOL_GPL(comedi_get_n_channels); From e5d670dcb7b336fb0c2fcff29ce87892e492e6b3 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:40 +0000 Subject: [PATCH 153/238] staging: comedi: use file->private_data in file operations Since the `struct comedi_device` should now be protected from being freed while an open file object is using it, use the `private_data` member of the `struct file` to point to it. Set it in `comedi_open()` and use it in the other file operation handlers instead of calling `comedi_dev_from_minor()` and checking the result. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 38 ++++++---------------------- 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 37400e85c417..08aa93a1c87c 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -1828,12 +1828,9 @@ static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { const unsigned minor = iminor(file_inode(file)); - struct comedi_device *dev = comedi_dev_from_minor(minor); + struct comedi_device *dev = file->private_data; int rc; - if (!dev) - return -ENODEV; - mutex_lock(&dev->mutex); /* Device config is special, because it must work on @@ -1964,7 +1961,7 @@ static struct vm_operations_struct comedi_vm_ops = { static int comedi_mmap(struct file *file, struct vm_area_struct *vma) { const unsigned minor = iminor(file_inode(file)); - struct comedi_device *dev = comedi_dev_from_minor(minor); + struct comedi_device *dev = file->private_data; struct comedi_subdevice *s; struct comedi_async *async; unsigned long start = vma->vm_start; @@ -1973,9 +1970,6 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma) int i; int retval; - if (!dev) - return -ENODEV; - mutex_lock(&dev->mutex); if (!dev->attached) { @@ -2043,12 +2037,9 @@ static unsigned int comedi_poll(struct file *file, poll_table *wait) { unsigned int mask = 0; const unsigned minor = iminor(file_inode(file)); - struct comedi_device *dev = comedi_dev_from_minor(minor); + struct comedi_device *dev = file->private_data; struct comedi_subdevice *s; - if (!dev) - return -ENODEV; - mutex_lock(&dev->mutex); if (!dev->attached) { @@ -2088,14 +2079,11 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, int n, m, count = 0, retval = 0; DECLARE_WAITQUEUE(wait, current); const unsigned minor = iminor(file_inode(file)); - struct comedi_device *dev = comedi_dev_from_minor(minor); + struct comedi_device *dev = file->private_data; bool on_wait_queue = false; bool attach_locked; unsigned int old_detach_count; - if (!dev) - return -ENODEV; - /* Protect against device detachment during operation. */ down_read(&dev->attach_lock); attach_locked = true; @@ -2227,14 +2215,11 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, int n, m, count = 0, retval = 0; DECLARE_WAITQUEUE(wait, current); const unsigned minor = iminor(file_inode(file)); - struct comedi_device *dev = comedi_dev_from_minor(minor); + struct comedi_device *dev = file->private_data; unsigned int old_detach_count; bool become_nonbusy = false; bool attach_locked; - if (!dev) - return -ENODEV; - /* Protect against device detachment during operation. */ down_read(&dev->attach_lock); attach_locked = true; @@ -2424,6 +2409,7 @@ ok: } dev->use_count++; + file->private_data = dev; rc = 0; out: @@ -2435,25 +2421,17 @@ out: static int comedi_fasync(int fd, struct file *file, int on) { - const unsigned minor = iminor(file_inode(file)); - struct comedi_device *dev = comedi_dev_from_minor(minor); - - if (!dev) - return -ENODEV; + struct comedi_device *dev = file->private_data; return fasync_helper(fd, file, on, &dev->async_queue); } static int comedi_close(struct inode *inode, struct file *file) { - const unsigned minor = iminor(inode); - struct comedi_device *dev = comedi_dev_from_minor(minor); + struct comedi_device *dev = file->private_data; struct comedi_subdevice *s = NULL; int i; - if (!dev) - return -ENODEV; - mutex_lock(&dev->mutex); if (dev->subdevices) { From 49445b9117a6e9ca9a741251784432a1da2f9919 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:41 +0000 Subject: [PATCH 154/238] staging: comedi: remove comedi_dev_from_minor() The `comedi_dev_from_minor()` function is no longer used, so remove it. Calls to it have either been replaced by calls to `comedi_dev_get_from_minor()` or by using the `private_data` member of the open file object. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 28 ---------------------------- drivers/staging/comedi/comedidev.h | 1 - 2 files changed, 29 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 08aa93a1c87c..d569484f315b 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -189,34 +189,6 @@ static struct comedi_subdevice return s; } -static struct comedi_device *comedi_dev_from_board_minor(unsigned minor) -{ - struct comedi_device *dev; - - BUG_ON(minor >= COMEDI_NUM_BOARD_MINORS); - mutex_lock(&comedi_board_minor_table_lock); - dev = comedi_board_minor_table[minor]; - mutex_unlock(&comedi_board_minor_table_lock); - return dev; -} - -static struct comedi_device *comedi_dev_from_subdevice_minor(unsigned minor) -{ - struct comedi_subdevice *s; - - s = comedi_subdevice_from_minor(minor); - return s ? s->device : NULL; -} - -struct comedi_device *comedi_dev_from_minor(unsigned minor) -{ - if (minor < COMEDI_NUM_BOARD_MINORS) - return comedi_dev_from_board_minor(minor); - else - return comedi_dev_from_subdevice_minor(minor); -} -EXPORT_SYMBOL_GPL(comedi_dev_from_minor); - static struct comedi_device *comedi_dev_get_from_board_minor(unsigned minor) { struct comedi_device *dev; diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index a9b1468aa17c..4e7cd1443be6 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -235,7 +235,6 @@ enum comedi_minor_bits { static const unsigned COMEDI_SUBDEVICE_MINOR_SHIFT = 4; static const unsigned COMEDI_SUBDEVICE_MINOR_OFFSET = 1; -struct comedi_device *comedi_dev_from_minor(unsigned minor); struct comedi_device *comedi_dev_get_from_minor(unsigned minor); int comedi_dev_put(struct comedi_device *dev); From 63ab039511509739f881acfb99aef76b772e35a2 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:42 +0000 Subject: [PATCH 155/238] staging: comedi: make determination of read or write subdevice safer `comedi_read_subdevice()` and `comedi_write_subdevice()` respectively determine the read and write subdevice to use for a comedi device, depending on a minor device number passed in. The comedi device has a main "board" minor device number and may also have dynamically assigned, subdevice-specific minor device numbers, in a range of numbers shared by all comedi devices. If the minor device number is within the range of subdevice-specific minor device numbers, both functions call `comedi_subdevice_from_minor()` to determine what subdevice is associated with the minor device number (if any) and then check the subdevice belongs to the comedi device. Since the subdevice might belong to a different comedi device, the check is not protected against the subdevice being freed. Perform the check in `comedi_subdevice_from_minor()` instead, where it is protected against the subdevice being freed. Make it return `NULL` if the subdevice does not belong to the device. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index d569484f315b..8cb9d956e8f2 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -177,7 +177,7 @@ static void comedi_free_board_dev(struct comedi_device *dev) } static struct comedi_subdevice -*comedi_subdevice_from_minor(unsigned minor) +*comedi_subdevice_from_minor(const struct comedi_device *dev, unsigned minor) { struct comedi_subdevice *s; unsigned int i = minor - COMEDI_NUM_BOARD_MINORS; @@ -185,6 +185,8 @@ static struct comedi_subdevice BUG_ON(i >= COMEDI_NUM_SUBDEVICE_MINORS); mutex_lock(&comedi_subdevice_minor_table_lock); s = comedi_subdevice_minor_table[i]; + if (s && s->device != dev) + s = NULL; mutex_unlock(&comedi_subdevice_minor_table_lock); return s; } @@ -229,10 +231,8 @@ comedi_read_subdevice(const struct comedi_device *dev, unsigned int minor) struct comedi_subdevice *s; if (minor >= COMEDI_NUM_BOARD_MINORS) { - s = comedi_subdevice_from_minor(minor); - if (!s || s->device != dev) - return NULL; - if (s->subdev_flags & SDF_CMD_READ) + s = comedi_subdevice_from_minor(dev, minor); + if (s == NULL || (s->subdev_flags & SDF_CMD_READ)) return s; } return dev->read_subdev; @@ -244,10 +244,8 @@ comedi_write_subdevice(const struct comedi_device *dev, unsigned int minor) struct comedi_subdevice *s; if (minor >= COMEDI_NUM_BOARD_MINORS) { - s = comedi_subdevice_from_minor(minor); - if (!s || s->device != dev) - return NULL; - if (s->subdev_flags & SDF_CMD_WRITE) + s = comedi_subdevice_from_minor(dev, minor); + if (s == NULL || (s->subdev_flags & SDF_CMD_WRITE)) return s; } return dev->write_subdev; From af93da31634d6d55c9d313b5c49af8b272f7cb79 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 8 Nov 2013 15:03:43 +0000 Subject: [PATCH 156/238] staging: comedi: protect buffer from being freed while mmapped If a comedi device is automatically detached by `comedi_auto_unconfig()` any data buffers associated with subdevices that support asynchronous commands will be freed. If the buffer is mmapped at the time, bad things are likely to happen! Prevent this by moving some of the buffer details from `struct comedi_async` into a new, dynamically allocated, and kref-counted `struct comedi_buf_map`. This holds a list of pages, a reference count, and enough information to free the pages. The new member `buf_map` of `struct comedi_async` points to a `struct comedi_buf_map` when the buffer size is non-zero. Provide a new helper function `comedi_buf_is_mapped()` to check whether an a buffer is mmapped. If it is mmapped, the buffer is not allowed to be resized and the device is not allowed to be manually detached by the `COMEDI_DEVCONFIG` ioctl. Provide helper functions `comedi_buf_map_get()` and `comedi_buf_map_put()` to manipulate the reference count of the `struct comedi_buf_map`, which will be freed along with its contents via the 'release' callback of the `kref_put()` call. The reference count is manipulated by the vma operations and the mmap file operation. Now, when the comedi device is automatically detached, the buffer will be effectively freed by calling `comedi_buf_alloc()` with a new buffer size of 0. That calls local function `__comedi_buf_free()` which calls `comedi_buf_map_put()` on the `buf_map` member to free it. It won't actually be freed until the final 'put'. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_buf.c | 99 +++++++++++++++++------- drivers/staging/comedi/comedi_fops.c | 38 ++++----- drivers/staging/comedi/comedi_internal.h | 3 + drivers/staging/comedi/comedidev.h | 14 ++-- drivers/staging/comedi/drivers/mite.c | 2 +- 5 files changed, 99 insertions(+), 57 deletions(-) diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index 4e26bd7fc84f..924fce977985 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c @@ -16,6 +16,7 @@ */ #include +#include #include "comedidev.h" #include "comedi_internal.h" @@ -26,31 +27,21 @@ #define COMEDI_PAGE_PROTECTION PAGE_KERNEL #endif -static void __comedi_buf_free(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned n_pages) +static void comedi_buf_map_kref_release(struct kref *kref) { - struct comedi_async *async = s->async; + struct comedi_buf_map *bm = + container_of(kref, struct comedi_buf_map, refcount); struct comedi_buf_page *buf; - unsigned i; + unsigned int i; - if (async->prealloc_buf) { - vunmap(async->prealloc_buf); - async->prealloc_buf = NULL; - async->prealloc_bufsz = 0; - } - - if (!async->buf_page_list) - return; - - for (i = 0; i < n_pages; ++i) { - buf = &async->buf_page_list[i]; - if (buf->virt_addr) { + if (bm->page_list) { + for (i = 0; i < bm->n_pages; i++) { + buf = &bm->page_list[i]; clear_bit(PG_reserved, &(virt_to_page(buf->virt_addr)->flags)); - if (s->async_dma_dir != DMA_NONE) { + if (bm->dma_dir != DMA_NONE) { #ifdef CONFIG_HAS_DMA - dma_free_coherent(dev->hw_dev, + dma_free_coherent(bm->dma_hw_dev, PAGE_SIZE, buf->virt_addr, buf->dma_addr); @@ -59,10 +50,26 @@ static void __comedi_buf_free(struct comedi_device *dev, free_page((unsigned long)buf->virt_addr); } } + vfree(bm->page_list); } - vfree(async->buf_page_list); - async->buf_page_list = NULL; - async->n_buf_pages = 0; + if (bm->dma_dir != DMA_NONE) + put_device(bm->dma_hw_dev); + kfree(bm); +} + +static void __comedi_buf_free(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + struct comedi_async *async = s->async; + + if (async->prealloc_buf) { + vunmap(async->prealloc_buf); + async->prealloc_buf = NULL; + async->prealloc_bufsz = 0; + } + + comedi_buf_map_put(async->buf_map); + async->buf_map = NULL; } static void __comedi_buf_alloc(struct comedi_device *dev, @@ -71,6 +78,7 @@ static void __comedi_buf_alloc(struct comedi_device *dev, { struct comedi_async *async = s->async; struct page **pages = NULL; + struct comedi_buf_map *bm; struct comedi_buf_page *buf; unsigned i; @@ -80,18 +88,29 @@ static void __comedi_buf_alloc(struct comedi_device *dev, return; } - async->buf_page_list = vzalloc(sizeof(*buf) * n_pages); - if (async->buf_page_list) + bm = kzalloc(sizeof(*async->buf_map), GFP_KERNEL); + if (!bm) + return; + + async->buf_map = bm; + kref_init(&bm->refcount); + bm->dma_dir = s->async_dma_dir; + if (bm->dma_dir != DMA_NONE) + /* Need ref to hardware device to free buffer later. */ + bm->dma_hw_dev = get_device(dev->hw_dev); + + bm->page_list = vzalloc(sizeof(*buf) * n_pages); + if (bm->page_list) pages = vmalloc(sizeof(struct page *) * n_pages); if (!pages) return; for (i = 0; i < n_pages; i++) { - buf = &async->buf_page_list[i]; - if (s->async_dma_dir != DMA_NONE) + buf = &bm->page_list[i]; + if (bm->dma_dir != DMA_NONE) #ifdef CONFIG_HAS_DMA - buf->virt_addr = dma_alloc_coherent(dev->hw_dev, + buf->virt_addr = dma_alloc_coherent(bm->dma_hw_dev, PAGE_SIZE, &buf->dma_addr, GFP_KERNEL | @@ -108,6 +127,7 @@ static void __comedi_buf_alloc(struct comedi_device *dev, pages[i] = virt_to_page(buf->virt_addr); } + bm->n_pages = i; /* vmap the prealloc_buf if all the pages were allocated */ if (i == n_pages) @@ -117,6 +137,26 @@ static void __comedi_buf_alloc(struct comedi_device *dev, vfree(pages); } +void comedi_buf_map_get(struct comedi_buf_map *bm) +{ + if (bm) + kref_get(&bm->refcount); +} + +int comedi_buf_map_put(struct comedi_buf_map *bm) +{ + if (bm) + return kref_put(&bm->refcount, comedi_buf_map_kref_release); + return 1; +} + +bool comedi_buf_is_mmapped(struct comedi_async *async) +{ + struct comedi_buf_map *bm = async->buf_map; + + return bm && (atomic_read(&bm->refcount.refcount) > 1); +} + int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, unsigned long new_size) { @@ -130,7 +170,7 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, return 0; /* deallocate old buffer */ - __comedi_buf_free(dev, s, async->n_buf_pages); + __comedi_buf_free(dev, s); /* allocate new buffer */ if (new_size) { @@ -140,10 +180,9 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, if (!async->prealloc_buf) { /* allocation failed */ - __comedi_buf_free(dev, s, n_pages); + __comedi_buf_free(dev, s); return -ENOMEM; } - async->n_buf_pages = n_pages; } async->prealloc_bufsz = new_size; diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 8cb9d956e8f2..58f2b27144ca 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -264,7 +264,7 @@ static int resize_async_buffer(struct comedi_device *dev, DPRINTK("subdevice is busy, cannot resize buffer\n"); return -EBUSY; } - if (async->mmap_count) { + if (comedi_buf_is_mmapped(async)) { DPRINTK("subdevice is mmapped, cannot resize buffer\n"); return -EBUSY; } @@ -647,7 +647,7 @@ static int is_device_busy(struct comedi_device *dev) s = &dev->subdevices[i]; if (s->busy) return 1; - if (s->async && s->async->mmap_count) + if (s->async && comedi_buf_is_mmapped(s->async)) return 1; } @@ -1899,28 +1899,18 @@ done: static void comedi_vm_open(struct vm_area_struct *area) { - struct comedi_async *async; - struct comedi_device *dev; + struct comedi_buf_map *bm; - async = area->vm_private_data; - dev = async->subdevice->device; - - mutex_lock(&dev->mutex); - async->mmap_count++; - mutex_unlock(&dev->mutex); + bm = area->vm_private_data; + comedi_buf_map_get(bm); } static void comedi_vm_close(struct vm_area_struct *area) { - struct comedi_async *async; - struct comedi_device *dev; + struct comedi_buf_map *bm; - async = area->vm_private_data; - dev = async->subdevice->device; - - mutex_lock(&dev->mutex); - async->mmap_count--; - mutex_unlock(&dev->mutex); + bm = area->vm_private_data; + comedi_buf_map_put(bm); } static struct vm_operations_struct comedi_vm_ops = { @@ -1934,6 +1924,7 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma) struct comedi_device *dev = file->private_data; struct comedi_subdevice *s; struct comedi_async *async; + struct comedi_buf_map *bm; unsigned long start = vma->vm_start; unsigned long size; int n_pages; @@ -1980,8 +1971,13 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma) } n_pages = size >> PAGE_SHIFT; + bm = async->buf_map; + if (!bm || n_pages > bm->n_pages) { + retval = -EINVAL; + goto done; + } for (i = 0; i < n_pages; ++i) { - struct comedi_buf_page *buf = &async->buf_page_list[i]; + struct comedi_buf_page *buf = &bm->page_list[i]; if (remap_pfn_range(vma, start, page_to_pfn(virt_to_page(buf->virt_addr)), @@ -1993,9 +1989,9 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma) } vma->vm_ops = &comedi_vm_ops; - vma->vm_private_data = async; + vma->vm_private_data = bm; - async->mmap_count++; + vma->vm_ops->open(vma); retval = 0; done: diff --git a/drivers/staging/comedi/comedi_internal.h b/drivers/staging/comedi/comedi_internal.h index 151693b11383..9a746570f161 100644 --- a/drivers/staging/comedi/comedi_internal.h +++ b/drivers/staging/comedi/comedi_internal.h @@ -16,6 +16,9 @@ void comedi_free_subdevice_minor(struct comedi_subdevice *s); int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, unsigned long new_size); void comedi_buf_reset(struct comedi_async *async); +bool comedi_buf_is_mmapped(struct comedi_async *async); +void comedi_buf_map_get(struct comedi_buf_map *bm); +int comedi_buf_map_put(struct comedi_buf_map *bm); unsigned int comedi_buf_write_n_allocated(struct comedi_async *async); void comedi_device_cancel_all(struct comedi_device *dev); diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 4e7cd1443be6..a7b8937aa4a3 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -104,18 +104,22 @@ struct comedi_buf_page { dma_addr_t dma_addr; }; +struct comedi_buf_map { + struct device *dma_hw_dev; + struct comedi_buf_page *page_list; + unsigned int n_pages; + enum dma_data_direction dma_dir; + struct kref refcount; +}; + struct comedi_async { struct comedi_subdevice *subdevice; void *prealloc_buf; /* pre-allocated buffer */ unsigned int prealloc_bufsz; /* buffer size, in bytes */ - /* virtual and dma address of each page */ - struct comedi_buf_page *buf_page_list; - unsigned n_buf_pages; /* num elements in buf_page_list */ + struct comedi_buf_map *buf_map; /* map of buffer pages */ unsigned int max_bufsize; /* maximum buffer size, bytes */ - /* current number of mmaps of prealloc_buf */ - unsigned int mmap_count; /* byte count for writer (write completed) */ unsigned int buf_write_count; diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c index 35cb4ace7970..1a2191699351 100644 --- a/drivers/staging/comedi/drivers/mite.c +++ b/drivers/staging/comedi/drivers/mite.c @@ -345,7 +345,7 @@ int mite_buf_change(struct mite_dma_descriptor_ring *ring, for (i = 0; i < n_links; i++) { ring->descriptors[i].count = cpu_to_le32(PAGE_SIZE); ring->descriptors[i].addr = - cpu_to_le32(async->buf_page_list[i].dma_addr); + cpu_to_le32(async->buf_map->page_list[i].dma_addr); ring->descriptors[i].next = cpu_to_le32(ring->descriptors_dma_addr + (i + 1) * From 95bcc666e9437ac33f639e6d971b0b6e9dc86607 Mon Sep 17 00:00:00 2001 From: Duan Jiong Date: Wed, 6 Nov 2013 15:55:31 +0800 Subject: [PATCH 157/238] lustre/fld: replace IS_ERR and PTR_ERR with PTR_ERR_OR_ZERO This patch fixes coccinelle error regarding usage of IS_ERR and PTR_ERR instead of PTR_ERR_OR_ZERO. Signed-off-by: Duan Jiong Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/fld/fld_request.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c index e47fd50b2a2e..3191a398675d 100644 --- a/drivers/staging/lustre/lustre/fld/fld_request.c +++ b/drivers/staging/lustre/lustre/fld/fld_request.c @@ -504,10 +504,7 @@ static int __init fld_mod_init(void) fld_type_proc_dir = lprocfs_register(LUSTRE_FLD_NAME, proc_lustre_root, NULL, NULL); - if (IS_ERR(fld_type_proc_dir)) - return PTR_ERR(fld_type_proc_dir); - - return 0; + return PTR_ERR_OR_ZERO(fld_type_proc_dir); } static void __exit fld_mod_exit(void) From 5e6dc548e453c68d79bd44a1a4a6fca43898009d Mon Sep 17 00:00:00 2001 From: Chen Gang Date: Thu, 31 Oct 2013 15:27:37 +0800 Subject: [PATCH 158/238] drivers: staging: speakup: serialio: only use platform specific SERIAL_PORT_DFNS. If SERIAL_PORT_DFNS isn't present by platform, it need be defined to "nothing", like the 8250 serial driver does it. All related macros also need be removed: IRQF_SHARED is defined in "linux/interrupt.h", others will be defined when related architecture has SERIAL_PORT_DFNS. Or it will cause issue (for arc, with allmodconfig): CC [M] drivers/staging/speakup/serialio.o drivers/staging/speakup/serialio.c:12:2: error: initializer element is not constant SERIAL_PORT_DFNS ^ drivers/staging/speakup/serialio.c:12:2: error: (near initialization for 'rs_table[0].baud_base') drivers/staging/speakup/serialio.c:12:2: error: initializer element is not constant drivers/staging/speakup/serialio.c:12:2: error: (near initialization for 'rs_table[1].baud_base') drivers/staging/speakup/serialio.c:12:2: error: initializer element is not constant drivers/staging/speakup/serialio.c:12:2: error: (near initialization for 'rs_table[2].baud_base') drivers/staging/speakup/serialio.c:12:2: error: initializer element is not constant drivers/staging/speakup/serialio.c:12:2: error: (near initialization for 'rs_table[3].baud_base') Signed-off-by: Chen Gang Acked-by: Samuel Thibault Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/serialio.c | 4 ++++ drivers/staging/speakup/serialio.h | 26 -------------------------- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/drivers/staging/speakup/serialio.c b/drivers/staging/speakup/serialio.c index 135428856d47..4e18fb405344 100644 --- a/drivers/staging/speakup/serialio.c +++ b/drivers/staging/speakup/serialio.c @@ -6,6 +6,10 @@ #include "spk_priv.h" #include "serialio.h" +#ifndef SERIAL_PORT_DFNS +#define SERIAL_PORT_DFNS +#endif + static void start_serial_interrupt(int irq); static const struct old_serial_port rs_table[] = { diff --git a/drivers/staging/speakup/serialio.h b/drivers/staging/speakup/serialio.h index 55d68b5ad165..0a937732a190 100644 --- a/drivers/staging/speakup/serialio.h +++ b/drivers/staging/speakup/serialio.h @@ -36,30 +36,4 @@ struct old_serial_port { #define spk_serial_tx_busy() ((inb(speakup_info.port_tts + UART_LSR) & BOTH_EMPTY) != BOTH_EMPTY) -/* 2.6.22 doesn't have them any more, hardcode it for now (these values should - * be fine for 99% cases) */ -#ifndef BASE_BAUD -#define BASE_BAUD (1843200 / 16) -#endif -#ifndef STD_COM_FLAGS -#ifdef CONFIG_SERIAL_DETECT_IRQ -#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ) -#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ) -#else -#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) -#define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF -#endif -#endif -#ifndef SERIAL_PORT_DFNS -#define SERIAL_PORT_DFNS \ - /* UART CLK PORT IRQ FLAGS */ \ - { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ - { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \ - { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ - { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ -#endif -#ifndef IRQF_SHARED -#define IRQF_SHARED SA_SHIRQ -#endif - #endif From 4e20effa23b1cbfc15fcdd6774937334775c5361 Mon Sep 17 00:00:00 2001 From: Masanari Iida Date: Thu, 31 Oct 2013 14:20:25 +0900 Subject: [PATCH 159/238] staging: android: Fix typo in android/sync.h Correct spelling typo in android/sync.h Signed-off-by: Masanari Iida Acked-by: Randy Dunlap Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/sync.h | 50 +++++++++++++++++----------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h index 38ea986dc70f..62e2255b1c1e 100644 --- a/drivers/staging/android/sync.h +++ b/drivers/staging/android/sync.h @@ -28,7 +28,7 @@ struct sync_fence; /** * struct sync_timeline_ops - sync object implementation ops - * @driver_name: name of the implentation + * @driver_name: name of the implementation * @dup: duplicate a sync_pt * @has_signaled: returns: * 1 if pt has signaled @@ -37,12 +37,12 @@ struct sync_fence; * @compare: returns: * 1 if b will signal before a * 0 if a and b will signal at the same time - * -1 if a will signabl before b + * -1 if a will signal before b * @free_pt: called before sync_pt is freed * @release_obj: called before sync_timeline is freed * @print_obj: deprecated * @print_pt: deprecated - * @fill_driver_data: write implmentation specific driver data to data. + * @fill_driver_data: write implementation specific driver data to data. * should return an error if there is not enough room * as specified by size. This information is returned * to userspace by SYNC_IOC_FENCE_INFO. @@ -88,9 +88,9 @@ struct sync_timeline_ops { /** * struct sync_timeline - sync object * @kref: reference count on fence. - * @ops: ops that define the implementaiton of the sync_timeline + * @ops: ops that define the implementation of the sync_timeline * @name: name of the sync_timeline. Useful for debugging - * @destoryed: set when sync_timeline is destroyed + * @destroyed: set when sync_timeline is destroyed * @child_list_head: list of children sync_pts for this sync_timeline * @child_list_lock: lock protecting @child_list_head, destroyed, and * sync_pt.status @@ -119,12 +119,12 @@ struct sync_timeline { * @parent: sync_timeline to which this sync_pt belongs * @child_list: membership in sync_timeline.child_list_head * @active_list: membership in sync_timeline.active_list_head - * @signaled_list: membership in temorary signaled_list on stack + * @signaled_list: membership in temporary signaled_list on stack * @fence: sync_fence to which the sync_pt belongs * @pt_list: membership in sync_fence.pt_list_head * @status: 1: signaled, 0:active, <0: error * @timestamp: time which sync_pt status transitioned from active to - * singaled or error. + * signaled or error. */ struct sync_pt { struct sync_timeline *parent; @@ -145,9 +145,9 @@ struct sync_pt { /** * struct sync_fence - sync fence * @file: file representing this fence - * @kref: referenace count on fence. + * @kref: reference count on fence. * @name: name of sync_fence. Useful for debugging - * @pt_list_head: list of sync_pts in ths fence. immutable once fence + * @pt_list_head: list of sync_pts in the fence. immutable once fence * is created * @waiter_list_head: list of asynchronous waiters on this fence * @waiter_list_lock: lock protecting @waiter_list_head and @status @@ -201,23 +201,23 @@ static inline void sync_fence_waiter_init(struct sync_fence_waiter *waiter, /** * sync_timeline_create() - creates a sync object - * @ops: specifies the implemention ops for the object + * @ops: specifies the implementation ops for the object * @size: size to allocate for this obj * @name: sync_timeline name * - * Creates a new sync_timeline which will use the implemetation specified by - * @ops. @size bytes will be allocated allowing for implemntation specific - * data to be kept after the generic sync_timeline stuct. + * Creates a new sync_timeline which will use the implementation specified by + * @ops. @size bytes will be allocated allowing for implementation specific + * data to be kept after the generic sync_timeline struct. */ struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops, int size, const char *name); /** - * sync_timeline_destory() - destorys a sync object + * sync_timeline_destroy() - destroys a sync object * @obj: sync_timeline to destroy * - * A sync implemntation should call this when the @obj is going away - * (i.e. module unload.) @obj won't actually be freed until all its childern + * A sync implementation should call this when the @obj is going away + * (i.e. module unload.) @obj won't actually be freed until all its children * sync_pts are freed. */ void sync_timeline_destroy(struct sync_timeline *obj); @@ -226,7 +226,7 @@ void sync_timeline_destroy(struct sync_timeline *obj); * sync_timeline_signal() - signal a status change on a sync_timeline * @obj: sync_timeline to signal * - * A sync implemntation should call this any time one of it's sync_pts + * A sync implementation should call this any time one of it's sync_pts * has signaled or has an error condition. */ void sync_timeline_signal(struct sync_timeline *obj); @@ -236,8 +236,8 @@ void sync_timeline_signal(struct sync_timeline *obj); * @parent: sync_pt's parent sync_timeline * @size: size to allocate for this pt * - * Creates a new sync_pt as a chiled of @parent. @size bytes will be - * allocated allowing for implemntation specific data to be kept after + * Creates a new sync_pt as a child of @parent. @size bytes will be + * allocated allowing for implementation specific data to be kept after * the generic sync_timeline struct. */ struct sync_pt *sync_pt_create(struct sync_timeline *parent, int size); @@ -287,7 +287,7 @@ struct sync_fence *sync_fence_merge(const char *name, struct sync_fence *sync_fence_fdget(int fd); /** - * sync_fence_put() - puts a refernnce of a sync fence + * sync_fence_put() - puts a reference of a sync fence * @fence: fence to put * * Puts a reference on @fence. If this is the last reference, the fence and @@ -297,7 +297,7 @@ void sync_fence_put(struct sync_fence *fence); /** * sync_fence_install() - installs a fence into a file descriptor - * @fence: fence to instal + * @fence: fence to install * @fd: file descriptor in which to install the fence * * Installs @fence into @fd. @fd's should be acquired through get_unused_fd(). @@ -359,10 +359,10 @@ struct sync_merge_data { * struct sync_pt_info - detailed sync_pt information * @len: length of sync_pt_info including any driver_data * @obj_name: name of parent sync_timeline - * @driver_name: name of driver implmenting the parent + * @driver_name: name of driver implementing the parent * @status: status of the sync_pt 0:active 1:signaled <0:error * @timestamp_ns: timestamp of status change in nanoseconds - * @driver_data: any driver dependant data + * @driver_data: any driver dependent data */ struct sync_pt_info { __u32 len; @@ -377,7 +377,7 @@ struct sync_pt_info { /** * struct sync_fence_info_data - data returned from fence info ioctl * @len: ioctl caller writes the size of the buffer its passing in. - * ioctl returns length of sync_fence_data reutnred to userspace + * ioctl returns length of sync_fence_data returned to userspace * including pt_info. * @name: name of fence * @status: status of fence. 1: signaled 0:active <0:error @@ -418,7 +418,7 @@ struct sync_fence_info_data { * pt_info. * * pt_info is a buffer containing sync_pt_infos for every sync_pt in the fence. - * To itterate over the sync_pt_infos, use the sync_pt_info.len field. + * To iterate over the sync_pt_infos, use the sync_pt_info.len field. */ #define SYNC_IOC_FENCE_INFO _IOWR(SYNC_IOC_MAGIC, 2,\ struct sync_fence_info_data) From c766d23b969d6915965893d718a3d56290777ff0 Mon Sep 17 00:00:00 2001 From: Aldo Iljazi Date: Mon, 4 Nov 2013 14:15:22 +0200 Subject: [PATCH 160/238] Staging: ft1000: boot.h: fixed a few styling issues Fixed the following styling issues: Line 30: Removed space before open square bracket '[' Lines 31 to 155: Moved the commas that were in the start of the lines, to the end of the lines. Inserted spaces after the commas. Inserted a one tab indentation to each line. Signed-off-by: Aldo Iljazi Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-pcmcia/boot.h | 252 ++++++++++---------- 1 file changed, 126 insertions(+), 126 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-pcmcia/boot.h b/drivers/staging/ft1000/ft1000-pcmcia/boot.h index 9dce54eae1cf..915165e38704 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/boot.h +++ b/drivers/staging/ft1000/ft1000-pcmcia/boot.h @@ -27,132 +27,132 @@ #define _BOOTH_ // Official bootloader -static unsigned char bootimage [] = { -0x00,0x00,0x01,0x5E,0x00,0x00 -,0x00,0x00,0x00,0x00,0x02,0xD7 -,0x00,0x00,0x01,0x5E,0x46,0xB3 -,0xE6,0x02,0x00,0x98,0xE6,0x8C -,0x00,0x98,0xFB,0x92,0xFF,0xFF -,0x98,0xFB,0x94,0xFF,0xFF,0x98 -,0xFB,0x06,0x08,0x00,0x98,0xFB -,0x96,0x84,0x00,0x98,0xFB,0x08 -,0x1C,0x00,0x98,0xFB,0x51,0x25 -,0x10,0x1C,0x00,0xE6,0x51,0x01 -,0x07,0xFD,0x4C,0xFF,0x20,0xF5 -,0x51,0x02,0x20,0x08,0x00,0x4C -,0xFF,0x20,0x3C,0x00,0xC0,0x64 -,0x98,0xC0,0x66,0x98,0xC0,0x68 -,0x98,0xC0,0x6A,0x98,0xC0,0x6C -,0x98,0x90,0x08,0x90,0x09,0x90 -,0x0A,0x90,0x0B,0x90,0x0C,0x90 -,0x0D,0x90,0x0E,0x90,0x0F,0x90 -,0x04,0x90,0x06,0xFB,0x51,0x22 -,0x16,0x08,0x03,0xFB,0x51,0x52 -,0x16,0x08,0x04,0xFB,0x51,0x24 -,0x2B,0x08,0x06,0xFB,0x51,0x54 -,0x2B,0x08,0x07,0xFB,0x51,0x24 -,0x2B,0x08,0x09,0xFB,0x51,0x54 -,0x2B,0x08,0x0A,0xFB,0x51,0x12 -,0x16,0x08,0x0C,0xFB,0x51,0x52 -,0x16,0x08,0x0D,0x78,0x00,0x00 -,0x00,0x16,0x00,0x00,0xEC,0x31 -,0xAE,0x00,0x00,0x81,0x4C,0x0F -,0xE6,0x43,0xFF,0xEC,0x31,0x4E -,0x00,0x00,0x91,0xEC,0x31,0xAE -,0x00,0x00,0x91,0x4C,0x0F,0xE6 -,0x43,0xFF,0xEC,0x31,0x5E,0x00 -,0x00,0xA1,0xEB,0x31,0x08,0x00 -,0x00,0xA6,0xEB,0x31,0x08,0x00 -,0x00,0xAC,0x3C,0x00,0xEB,0x31 -,0x08,0x00,0x00,0xA8,0x76,0xFE -,0xFE,0x08,0xEB,0x31,0x08,0x20 -,0x00,0x00,0x76,0xFF,0xFF,0x18 -,0xED,0x31,0x08,0x20,0x00,0x00 -,0x26,0x10,0x04,0x10,0xF5,0x3C -,0x01,0x3C,0x00,0x08,0x01,0x12 -,0x3C,0x11,0x3C,0x00,0x08,0x01 -,0x0B,0x08,0x00,0x6D,0xEC,0x31 -,0xAE,0x20,0x00,0x06,0xED,0x4D -,0x08,0x00,0x00,0x67,0x80,0x6F -,0x00,0x01,0x0B,0x6F,0x00,0x02 -,0x2E,0x76,0xEE,0x01,0x48,0x06 -,0x01,0x39,0xED,0x4D,0x18,0x00 -,0x02,0xED,0x4D,0x08,0x00,0x04 -,0x14,0x06,0xA4,0xED,0x31,0x22 -,0x00,0x00,0xAC,0x76,0xEE,0x07 -,0x48,0x6D,0x22,0x01,0x1E,0x08 -,0x01,0x58,0xEB,0x31,0x08,0x00 -,0x00,0xAC,0x06,0xFF,0xBA,0x3C -,0x00,0xEB,0x31,0x08,0x20,0x00 -,0x04,0x3C,0x30,0xEB,0x31,0x08 -,0x20,0x00,0x02,0x3C,0x10,0xEB -,0x31,0x08,0x20,0x00,0x00,0xED -,0x31,0x08,0x20,0x00,0x00,0x04 -,0x10,0xF7,0xED,0x31,0x08,0x00 -,0x00,0xA2,0x91,0x00,0x9C,0x3C -,0x80,0xEB,0x31,0x08,0x20,0x00 -,0x04,0x3C,0x20,0xEB,0x31,0x08 -,0x20,0x00,0x02,0x3C,0x10,0xEB -,0x31,0x08,0x20,0x00,0x00,0xED -,0x31,0x08,0x20,0x00,0x00,0x04 -,0x10,0xF7,0xED,0x31,0x08,0x20 -,0x00,0x04,0x42,0x10,0x90,0x08 -,0xEC,0x31,0xAE,0x20,0x00,0x06 -,0xA4,0x41,0x08,0x00,0xB6,0xED -,0x41,0x28,0x7D,0xFF,0xFF,0x22 -,0xB3,0x40,0x98,0x2A,0x32,0xEB -,0x41,0x28,0xB4,0x43,0xFC,0x05 -,0xFF,0xE6,0xA0,0x31,0x20,0x00 -,0x06,0xEB,0x31,0x08,0x20,0x00 -,0x04,0x3C,0x20,0xEB,0x31,0x08 -,0x20,0x00,0x02,0x3C,0x10,0xEB -,0x31,0x08,0x20,0x00,0x00,0xED -,0x31,0x08,0x20,0x00,0x00,0x04 -,0x10,0xF7,0xED,0x31,0x08,0x20 -,0x00,0x04,0x42,0x10,0x90,0x08 -,0xEC,0x31,0xAE,0x20,0x00,0x06 -,0xA4,0x41,0x08,0x00,0x68,0xED -,0x41,0x28,0x7D,0xFF,0xFF,0x22 -,0xB3,0x40,0x98,0x2A,0x32,0xEB -,0x41,0x28,0xB4,0x43,0xFC,0x05 -,0xFF,0xE6,0x48,0x04,0xEB,0x31 -,0x08,0x20,0x00,0x04,0xEB,0x31 -,0x18,0x20,0x00,0x02,0x3C,0x11 -,0xEB,0x31,0x18,0x20,0x00,0x00 -,0xED,0x31,0x08,0x20,0x00,0x00 -,0x04,0x10,0xF7,0xED,0x31,0x08 -,0x20,0x00,0x02,0x66,0x00,0x6F -,0x00,0x01,0x16,0x76,0xEE,0x06 -,0x48,0x4A,0x1E,0x48,0x04,0xED -,0x31,0x08,0x20,0x00,0x04,0xEB -,0x31,0x08,0x00,0x00,0xA4,0x48 -,0x04,0xED,0x31,0x08,0x20,0x00 -,0x04,0xEB,0x31,0x08,0x00,0x00 -,0xA2,0x48,0x04,0x20,0x20,0x4A -,0x7C,0x46,0x82,0x50,0x05,0x50 -,0x15,0xB5,0x1E,0x98,0xED,0x31 -,0x08,0x00,0x00,0xA8,0x10,0x47 -,0x3B,0x2C,0x01,0xDB,0x40,0x11 -,0x98,0xC1,0x1E,0x98,0x10,0x07 -,0x30,0xF9,0x40,0x07,0x18,0x98 -,0x2A,0x10,0xEB,0x31,0x08,0x00 -,0x00,0xA8,0xA4,0x1E,0x98,0xBB -,0x1E,0x98,0x50,0x14,0x50,0x04 -,0x46,0x83,0x48,0x04,0x02,0x01 -,0x00,0x50,0x05,0x50,0x15,0x10 -,0x87,0x3F,0x90,0x2B,0x18,0x01 -,0x00,0xC0,0x31,0x00,0x00,0xAE -,0xDF,0x41,0x00,0x08,0x00,0x1A -,0x42,0x11,0x67,0x01,0xDF,0x41 -,0x02,0x08,0x00,0x10,0x42,0x11 -,0x62,0x01,0xB4,0x43,0x4A,0x68 -,0x50,0x14,0x50,0x04,0x24,0x10 -,0x48,0x04,0xF2,0x31,0x00,0x01 -,0x00,0x00,0xAE,0xF6,0x31,0x00 -,0x01,0x00,0x00,0xAE,0x62,0xE4 -,0xE5,0x61,0x04,0x48,0x04,0xE5 -,0x63,0x05,0x48,0x04,0x20,0x20 -,0x00,0x00,0x00,0x00 +static unsigned char bootimage[] = { + 0x00, 0x00, 0x01, 0x5E, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0xD7, + 0x00, 0x00, 0x01, 0x5E, 0x46, 0xB3, + 0xE6, 0x02, 0x00, 0x98, 0xE6, 0x8C, + 0x00, 0x98, 0xFB, 0x92, 0xFF, 0xFF, + 0x98, 0xFB, 0x94, 0xFF, 0xFF, 0x98, + 0xFB, 0x06, 0x08, 0x00, 0x98, 0xFB, + 0x96, 0x84, 0x00, 0x98, 0xFB, 0x08, + 0x1C, 0x00, 0x98, 0xFB, 0x51, 0x25, + 0x10, 0x1C, 0x00, 0xE6, 0x51, 0x01, + 0x07, 0xFD, 0x4C, 0xFF, 0x20, 0xF5, + 0x51, 0x02, 0x20, 0x08, 0x00, 0x4C, + 0xFF, 0x20, 0x3C, 0x00, 0xC0, 0x64, + 0x98, 0xC0, 0x66, 0x98, 0xC0, 0x68, + 0x98, 0xC0, 0x6A, 0x98, 0xC0, 0x6C, + 0x98, 0x90, 0x08, 0x90, 0x09, 0x90, + 0x0A, 0x90, 0x0B, 0x90, 0x0C, 0x90, + 0x0D, 0x90, 0x0E, 0x90, 0x0F, 0x90, + 0x04, 0x90, 0x06, 0xFB, 0x51, 0x22, + 0x16, 0x08, 0x03, 0xFB, 0x51, 0x52, + 0x16, 0x08, 0x04, 0xFB, 0x51, 0x24, + 0x2B, 0x08, 0x06, 0xFB, 0x51, 0x54, + 0x2B, 0x08, 0x07, 0xFB, 0x51, 0x24, + 0x2B, 0x08, 0x09, 0xFB, 0x51, 0x54, + 0x2B, 0x08, 0x0A, 0xFB, 0x51, 0x12, + 0x16, 0x08, 0x0C, 0xFB, 0x51, 0x52, + 0x16, 0x08, 0x0D, 0x78, 0x00, 0x00, + 0x00, 0x16, 0x00, 0x00, 0xEC, 0x31, + 0xAE, 0x00, 0x00, 0x81, 0x4C, 0x0F, + 0xE6, 0x43, 0xFF, 0xEC, 0x31, 0x4E, + 0x00, 0x00, 0x91, 0xEC, 0x31, 0xAE, + 0x00, 0x00, 0x91, 0x4C, 0x0F, 0xE6, + 0x43, 0xFF, 0xEC, 0x31, 0x5E, 0x00, + 0x00, 0xA1, 0xEB, 0x31, 0x08, 0x00, + 0x00, 0xA6, 0xEB, 0x31, 0x08, 0x00, + 0x00, 0xAC, 0x3C, 0x00, 0xEB, 0x31, + 0x08, 0x00, 0x00, 0xA8, 0x76, 0xFE, + 0xFE, 0x08, 0xEB, 0x31, 0x08, 0x20, + 0x00, 0x00, 0x76, 0xFF, 0xFF, 0x18, + 0xED, 0x31, 0x08, 0x20, 0x00, 0x00, + 0x26, 0x10, 0x04, 0x10, 0xF5, 0x3C, + 0x01, 0x3C, 0x00, 0x08, 0x01, 0x12, + 0x3C, 0x11, 0x3C, 0x00, 0x08, 0x01, + 0x0B, 0x08, 0x00, 0x6D, 0xEC, 0x31, + 0xAE, 0x20, 0x00, 0x06, 0xED, 0x4D, + 0x08, 0x00, 0x00, 0x67, 0x80, 0x6F, + 0x00, 0x01, 0x0B, 0x6F, 0x00, 0x02, + 0x2E, 0x76, 0xEE, 0x01, 0x48, 0x06, + 0x01, 0x39, 0xED, 0x4D, 0x18, 0x00, + 0x02, 0xED, 0x4D, 0x08, 0x00, 0x04, + 0x14, 0x06, 0xA4, 0xED, 0x31, 0x22, + 0x00, 0x00, 0xAC, 0x76, 0xEE, 0x07, + 0x48, 0x6D, 0x22, 0x01, 0x1E, 0x08, + 0x01, 0x58, 0xEB, 0x31, 0x08, 0x00, + 0x00, 0xAC, 0x06, 0xFF, 0xBA, 0x3C, + 0x00, 0xEB, 0x31, 0x08, 0x20, 0x00, + 0x04, 0x3C, 0x30, 0xEB, 0x31, 0x08, + 0x20, 0x00, 0x02, 0x3C, 0x10, 0xEB, + 0x31, 0x08, 0x20, 0x00, 0x00, 0xED, + 0x31, 0x08, 0x20, 0x00, 0x00, 0x04, + 0x10, 0xF7, 0xED, 0x31, 0x08, 0x00, + 0x00, 0xA2, 0x91, 0x00, 0x9C, 0x3C, + 0x80, 0xEB, 0x31, 0x08, 0x20, 0x00, + 0x04, 0x3C, 0x20, 0xEB, 0x31, 0x08, + 0x20, 0x00, 0x02, 0x3C, 0x10, 0xEB, + 0x31, 0x08, 0x20, 0x00, 0x00, 0xED, + 0x31, 0x08, 0x20, 0x00, 0x00, 0x04, + 0x10, 0xF7, 0xED, 0x31, 0x08, 0x20, + 0x00, 0x04, 0x42, 0x10, 0x90, 0x08, + 0xEC, 0x31, 0xAE, 0x20, 0x00, 0x06, + 0xA4, 0x41, 0x08, 0x00, 0xB6, 0xED, + 0x41, 0x28, 0x7D, 0xFF, 0xFF, 0x22, + 0xB3, 0x40, 0x98, 0x2A, 0x32, 0xEB, + 0x41, 0x28, 0xB4, 0x43, 0xFC, 0x05, + 0xFF, 0xE6, 0xA0, 0x31, 0x20, 0x00, + 0x06, 0xEB, 0x31, 0x08, 0x20, 0x00, + 0x04, 0x3C, 0x20, 0xEB, 0x31, 0x08, + 0x20, 0x00, 0x02, 0x3C, 0x10, 0xEB, + 0x31, 0x08, 0x20, 0x00, 0x00, 0xED, + 0x31, 0x08, 0x20, 0x00, 0x00, 0x04, + 0x10, 0xF7, 0xED, 0x31, 0x08, 0x20, + 0x00, 0x04, 0x42, 0x10, 0x90, 0x08, + 0xEC, 0x31, 0xAE, 0x20, 0x00, 0x06, + 0xA4, 0x41, 0x08, 0x00, 0x68, 0xED, + 0x41, 0x28, 0x7D, 0xFF, 0xFF, 0x22, + 0xB3, 0x40, 0x98, 0x2A, 0x32, 0xEB, + 0x41, 0x28, 0xB4, 0x43, 0xFC, 0x05, + 0xFF, 0xE6, 0x48, 0x04, 0xEB, 0x31, + 0x08, 0x20, 0x00, 0x04, 0xEB, 0x31, + 0x18, 0x20, 0x00, 0x02, 0x3C, 0x11, + 0xEB, 0x31, 0x18, 0x20, 0x00, 0x00, + 0xED, 0x31, 0x08, 0x20, 0x00, 0x00, + 0x04, 0x10, 0xF7, 0xED, 0x31, 0x08, + 0x20, 0x00, 0x02, 0x66, 0x00, 0x6F, + 0x00, 0x01, 0x16, 0x76, 0xEE, 0x06, + 0x48, 0x4A, 0x1E, 0x48, 0x04, 0xED, + 0x31, 0x08, 0x20, 0x00, 0x04, 0xEB, + 0x31, 0x08, 0x00, 0x00, 0xA4, 0x48, + 0x04, 0xED, 0x31, 0x08, 0x20, 0x00, + 0x04, 0xEB, 0x31, 0x08, 0x00, 0x00, + 0xA2, 0x48, 0x04, 0x20, 0x20, 0x4A, + 0x7C, 0x46, 0x82, 0x50, 0x05, 0x50, + 0x15, 0xB5, 0x1E, 0x98, 0xED, 0x31, + 0x08, 0x00, 0x00, 0xA8, 0x10, 0x47, + 0x3B, 0x2C, 0x01, 0xDB, 0x40, 0x11, + 0x98, 0xC1, 0x1E, 0x98, 0x10, 0x07, + 0x30, 0xF9, 0x40, 0x07, 0x18, 0x98, + 0x2A, 0x10, 0xEB, 0x31, 0x08, 0x00, + 0x00, 0xA8, 0xA4, 0x1E, 0x98, 0xBB, + 0x1E, 0x98, 0x50, 0x14, 0x50, 0x04, + 0x46, 0x83, 0x48, 0x04, 0x02, 0x01, + 0x00, 0x50, 0x05, 0x50, 0x15, 0x10, + 0x87, 0x3F, 0x90, 0x2B, 0x18, 0x01, + 0x00, 0xC0, 0x31, 0x00, 0x00, 0xAE, + 0xDF, 0x41, 0x00, 0x08, 0x00, 0x1A, + 0x42, 0x11, 0x67, 0x01, 0xDF, 0x41, + 0x02, 0x08, 0x00, 0x10, 0x42, 0x11, + 0x62, 0x01, 0xB4, 0x43, 0x4A, 0x68, + 0x50, 0x14, 0x50, 0x04, 0x24, 0x10, + 0x48, 0x04, 0xF2, 0x31, 0x00, 0x01, + 0x00, 0x00, 0xAE, 0xF6, 0x31, 0x00, + 0x01, 0x00, 0x00, 0xAE, 0x62, 0xE4, + 0xE5, 0x61, 0x04, 0x48, 0x04, 0xE5, + 0x63, 0x05, 0x48, 0x04, 0x20, 0x20, + 0x00, 0x00, 0x00, 0x00 }; #endif From c4df2822cd54118ad8a7a672ea9dcaa2d77fc776 Mon Sep 17 00:00:00 2001 From: Aldo Iljazi Date: Sun, 10 Nov 2013 15:44:20 +0200 Subject: [PATCH 161/238] Staging: ft1000: ft1000_download: fixed coding style issues Fixed the following coding style issues: Lines 84-91,99-106,275,514: Replaced spaces at the start of the lines with tabs. Lines 205,271: Inserted spaces after the commas. Lines 275,1060,1065: Indented the code with tabs instead of spaces. Line 275: Inserted spaces around '=' and '<', also moved the trailing statement on the next line. Line 512: Removed space between function name and open parenthesis. Line 839: Removed space after '&'. Line 853: Removed space after '&'. Signed-off-by: Aldo Iljazi Signed-off-by: Greg Kroah-Hartman --- .../ft1000/ft1000-usb/ft1000_download.c | 57 ++++++++++--------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c index b2643b780971..3c2b085e7990 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c @@ -81,29 +81,29 @@ #define DWNLD_MAG1_PS_HDR_LOC 0x03 struct dsp_file_hdr { - long version_id; // Version ID of this image format. - long package_id; // Package ID of code release. - long build_date; // Date/time stamp when file was built. - long commands_offset; // Offset to attached commands in Pseudo Hdr format. - long loader_offset; // Offset to bootloader code. - long loader_code_address; // Start address of bootloader. - long loader_code_end; // Where bootloader code ends. - long loader_code_size; - long version_data_offset; // Offset were scrambled version data begins. - long version_data_size; // Size, in words, of scrambled version data. - long nDspImages; // Number of DSP images in file. + long version_id; // Version ID of this image format. + long package_id; // Package ID of code release. + long build_date; // Date/time stamp when file was built. + long commands_offset; // Offset to attached commands in Pseudo Hdr format. + long loader_offset; // Offset to bootloader code. + long loader_code_address; // Start address of bootloader. + long loader_code_end; // Where bootloader code ends. + long loader_code_size; + long version_data_offset; // Offset were scrambled version data begins. + long version_data_size; // Size, in words, of scrambled version data. + long nDspImages; // Number of DSP images in file. }; #pragma pack(1) struct dsp_image_info { - long coff_date; // Date/time when DSP Coff image was built. - long begin_offset; // Offset in file where image begins. - long end_offset; // Offset in file where image begins. - long run_address; // On chip Start address of DSP code. - long image_size; // Size of image. - long version; // Embedded version # of DSP code. - unsigned short checksum; // DSP File checksum - unsigned short pad1; + long coff_date; // Date/time when DSP Coff image was built. + long begin_offset; // Offset in file where image begins. + long end_offset; // Offset in file where image begins. + long run_address; // On chip Start address of DSP code. + long image_size; // Size of image. + long version; // Embedded version # of DSP code. + unsigned short checksum; // DSP File checksum + unsigned short pad1; }; @@ -201,7 +201,7 @@ static u16 get_handshake(struct ft1000_usb *ft1000dev, u16 expected_value) } /* write the handshake value to the handshake location */ -static void put_handshake(struct ft1000_usb *ft1000dev,u16 handshake_value) +static void put_handshake(struct ft1000_usb *ft1000dev, u16 handshake_value) { u32 tempx; u16 tempword; @@ -267,11 +267,12 @@ static u16 get_handshake_usb(struct ft1000_usb *ft1000dev, u16 expected_value) return HANDSHAKE_TIMEOUT_VALUE; } -static void put_handshake_usb(struct ft1000_usb *ft1000dev,u16 handshake_value) +static void put_handshake_usb(struct ft1000_usb *ft1000dev, u16 handshake_value) { int i; - for (i=0; i<1000; i++); + for (i = 0; i < 1000; i++) + ; } static u16 get_request_type(struct ft1000_usb *ft1000dev) @@ -508,9 +509,9 @@ static int write_blk(struct ft1000_usb *ft1000dev, u16 **pUsFile, u8 **pUcFile, return status; } -static void usb_dnld_complete (struct urb *urb) +static void usb_dnld_complete(struct urb *urb) { - //DEBUG("****** usb_dnld_complete\n"); + //DEBUG("****** usb_dnld_complete\n"); } /* writes a block of DSP image to DPRAM @@ -835,7 +836,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, * Position ASIC DPRAM auto-increment pointer. */ - data = (u16 *) & mailbox_data->data[0]; + data = (u16 *) &mailbox_data->data[0]; dpram = (u16) DWNLD_MAG1_PS_HDR_LOC; if (word_length & 0x1) word_length++; @@ -849,7 +850,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, status = fix_ft1000_write_dpram32 (ft1000dev, dpram++, - (u8 *) & templong); + (u8 *) &templong); } break; @@ -1056,12 +1057,12 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart, // Check if Card is present status = Harley_Read_Register(&temp, FT1000_REG_SUP_IMASK); if ( (status != NDIS_STATUS_SUCCESS) || (temp == 0x0000) ) { - break; + break; } status = Harley_Read_Register(&temp, FT1000_REG_ASIC_ID); if ( (status != NDIS_STATUS_SUCCESS) || (temp == 0xffff) ) { - break; + break; } ****/ From 9961d59d3fe7b8bd135f4a8506bd7e5f4d919dbe Mon Sep 17 00:00:00 2001 From: Jie Liu Date: Fri, 1 Nov 2013 22:22:08 +0800 Subject: [PATCH 162/238] staging: ozwpan: remove unneeded __GFP_ZERO to kzalloc() at oz_elt_stream_create() Get rid of the needless __GFP_ZERO flag for kzalloc() at oz_elt_stream_create(). Signed-off-by: Jie Liu Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ozwpan/ozeltbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ozwpan/ozeltbuf.c b/drivers/staging/ozwpan/ozeltbuf.c index 9b86486c6b11..02d541247819 100644 --- a/drivers/staging/ozwpan/ozeltbuf.c +++ b/drivers/staging/ozwpan/ozeltbuf.c @@ -138,7 +138,7 @@ int oz_elt_stream_create(struct oz_elt_buf *buf, u8 id, int max_buf_count) oz_dbg(ON, "%s: (0x%x)\n", __func__, id); - st = kzalloc(sizeof(struct oz_elt_stream), GFP_ATOMIC | __GFP_ZERO); + st = kzalloc(sizeof(struct oz_elt_stream), GFP_ATOMIC); if (st == NULL) return -ENOMEM; atomic_set(&st->ref_count, 1); From fc0524b0986f994693f06a00c8de1c0469fd7086 Mon Sep 17 00:00:00 2001 From: Gu Zheng Date: Thu, 31 Oct 2013 18:33:01 +0800 Subject: [PATCH 163/238] staging/olpc_docn: reorder the lock sequence to avoid potential dead lock The lock sequence of dcon_blank_fb(fb_info->lock ---> console_lock) is against with the one of console_callback(console_lock ---> fb_info->lock), it'll lead to a potential dead lock, so reorder the lock sequence of dcon_blank_fb to avoid the potential dead lock. Signed-off-by: Gu Zheng Signed-off-by: Greg Kroah-Hartman --- drivers/staging/olpc_dcon/olpc_dcon.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c index 92b02891704d..26b4ec56fd30 100644 --- a/drivers/staging/olpc_dcon/olpc_dcon.c +++ b/drivers/staging/olpc_dcon/olpc_dcon.c @@ -255,17 +255,19 @@ static bool dcon_blank_fb(struct dcon_priv *dcon, bool blank) { int err; + console_lock(); if (!lock_fb_info(dcon->fbinfo)) { + console_unlock(); dev_err(&dcon->client->dev, "unable to lock framebuffer\n"); return false; } - console_lock(); + dcon->ignore_fb_events = true; err = fb_blank(dcon->fbinfo, blank ? FB_BLANK_POWERDOWN : FB_BLANK_UNBLANK); dcon->ignore_fb_events = false; - console_unlock(); unlock_fb_info(dcon->fbinfo); + console_unlock(); if (err) { dev_err(&dcon->client->dev, "couldn't %sblank framebuffer\n", From a72f8beeedc97b776799a1a80c04eb5312980c9b Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Sun, 3 Nov 2013 14:31:09 +0100 Subject: [PATCH 164/238] drm/imx: directly call drm_put_dev in ->remove Again no apparent user of the driver data field. Signed-off-by: Daniel Vetter Acked-by: Sascha Hauer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/imx-drm/imx-drm-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c index 4483d47f7395..65396b2468e5 100644 --- a/drivers/staging/imx-drm/imx-drm-core.c +++ b/drivers/staging/imx-drm/imx-drm-core.c @@ -443,6 +443,8 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags) if (!imx_drm_device_get()) ret = -EINVAL; + platform_set_drvdata(drm->platformdev, drm); + ret = 0; err_init: @@ -822,7 +824,7 @@ static int imx_drm_platform_probe(struct platform_device *pdev) static int imx_drm_platform_remove(struct platform_device *pdev) { - drm_platform_exit(&imx_drm_driver, pdev); + drm_put_dev(platform_get_drvdata(pdev)); return 0; } From 302433daf47aeb7d21d66e55fb84d6a8fffd4aed Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Sun, 3 Nov 2013 17:40:51 +0000 Subject: [PATCH 165/238] staging: vt6656: device.h Remove typedef enum __device_init_type. Since typedef enum __device_init_type is only ever called in one state. Remove the typedef from main_usb.c:device_init_registers and replace with macro values. The other values may be needed later. Apply cold value to sInitCmd.byInitClass. Remove if braces and correct formatting within. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/device.h | 8 +- drivers/staging/vt6656/main_usb.c | 270 +++++++++++++++--------------- 2 files changed, 141 insertions(+), 137 deletions(-) diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index 62b7de19b371..ef2b9228180c 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -149,11 +149,9 @@ typedef enum __device_msg_level { MSG_LEVEL_DEBUG = 4 /* Only for debug purpose. */ } DEVICE_MSG_LEVEL, *PDEVICE_MSG_LEVEL; -typedef enum __device_init_type { - DEVICE_INIT_COLD = 0, /* cold init */ - DEVICE_INIT_RESET, /* reset init or Dx to D0 power remain */ - DEVICE_INIT_DXPL /* Dx to D0 power lost init */ -} DEVICE_INIT_TYPE, *PDEVICE_INIT_TYPE; +#define DEVICE_INIT_COLD 0x0 /* cold init */ +#define DEVICE_INIT_RESET 0x1 /* reset init or Dx to D0 power remain */ +#define DEVICE_INIT_DXPL 0x2 /* Dx to D0 power lost init */ /* USB */ diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index aae228c533ef..297dd109631c 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -215,8 +215,7 @@ static void device_set_multi(struct net_device *dev); static int device_close(struct net_device *dev); static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); -static int device_init_registers(struct vnt_private *pDevice, - DEVICE_INIT_TYPE InitType); +static int device_init_registers(struct vnt_private *pDevice); static bool device_init_defrag_cb(struct vnt_private *pDevice); static void device_init_diversity_timer(struct vnt_private *pDevice); static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev); @@ -297,8 +296,7 @@ static void device_init_diversity_timer(struct vnt_private *pDevice) * initialization of MAC & BBP registers */ -static int device_init_registers(struct vnt_private *pDevice, - DEVICE_INIT_TYPE InitType) +static int device_init_registers(struct vnt_private *pDevice) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; u8 abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; @@ -313,12 +311,14 @@ static int device_init_registers(struct vnt_private *pDevice, u8 byTmp; u8 byCalibTXIQ = 0, byCalibTXDC = 0, byCalibRXIQ = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---->INIbInitAdapter. [%d][%d]\n", InitType, pDevice->byPacketType); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---->INIbInitAdapter. [%d][%d]\n", + DEVICE_INIT_COLD, pDevice->byPacketType); + spin_lock_irq(&pDevice->lock); - if (InitType == DEVICE_INIT_COLD) { - memcpy(pDevice->abyBroadcastAddr, abyBroadcastAddr, ETH_ALEN); - memcpy(pDevice->abySNAP_RFC1042, abySNAP_RFC1042, ETH_ALEN); - memcpy(pDevice->abySNAP_Bridgetunnel, + + memcpy(pDevice->abyBroadcastAddr, abyBroadcastAddr, ETH_ALEN); + memcpy(pDevice->abySNAP_RFC1042, abySNAP_RFC1042, ETH_ALEN); + memcpy(pDevice->abySNAP_Bridgetunnel, abySNAP_Bridgetunnel, ETH_ALEN); @@ -342,9 +342,8 @@ static int device_init_registers(struct vnt_private *pDevice, spin_unlock_irq(&pDevice->lock); return false; } - } - sInitCmd.byInitClass = (u8)InitType; + sInitCmd.byInitClass = DEVICE_INIT_COLD; sInitCmd.bExistSWNetAddr = (u8) pDevice->bExistSWNetAddr; for (ii = 0; ii < 6; ii++) sInitCmd.bySWNetAddr[ii] = pDevice->abyCurrentNetAddr[ii]; @@ -364,138 +363,145 @@ static int device_init_registers(struct vnt_private *pDevice, spin_unlock_irq(&pDevice->lock); return false; } - if (InitType == DEVICE_INIT_COLD) { - ntStatus = CONTROLnsRequestIn(pDevice,MESSAGE_TYPE_INIT_RSP,0,0,sizeof(RSP_CARD_INIT), (u8 *) &(sInitRsp)); - - if (ntStatus != STATUS_SUCCESS) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Cardinit request in status fail!\n"); - spin_unlock_irq(&pDevice->lock); - return false; - } + ntStatus = CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_INIT_RSP, 0, 0, + sizeof(RSP_CARD_INIT), (u8 *) &(sInitRsp)); + if (ntStatus != STATUS_SUCCESS) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO + "Cardinit request in status fail!\n"); + spin_unlock_irq(&pDevice->lock); + return false; + } /* local ID for AES functions */ - ntStatus = CONTROLnsRequestIn(pDevice, - MESSAGE_TYPE_READ, - MAC_REG_LOCALID, - MESSAGE_REQUEST_MACREG, - 1, - &pDevice->byLocalID); - - if ( ntStatus != STATUS_SUCCESS ) { - spin_unlock_irq(&pDevice->lock); - return false; - } + ntStatus = CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ, + MAC_REG_LOCALID, MESSAGE_REQUEST_MACREG, 1, + &pDevice->byLocalID); + if (ntStatus != STATUS_SUCCESS) { + spin_unlock_irq(&pDevice->lock); + return false; + } /* do MACbSoftwareReset in MACvInitialize */ /* force CCK */ - pDevice->bCCK = true; + pDevice->bCCK = true; pDevice->bProtectMode = false; /* only used in 11g type, sync with ERP IE */ - pDevice->bNonERPPresent = false; - pDevice->bBarkerPreambleMd = false; - if ( pDevice->bFixRate ) { - pDevice->wCurrentRate = (u16) pDevice->uConnectionRate; - } else { - if ( pDevice->byBBType == BB_TYPE_11B ) - pDevice->wCurrentRate = RATE_11M; - else - pDevice->wCurrentRate = RATE_54M; - } + pDevice->bNonERPPresent = false; + pDevice->bBarkerPreambleMd = false; + if (pDevice->bFixRate) { + pDevice->wCurrentRate = (u16)pDevice->uConnectionRate; + } else { + if (pDevice->byBBType == BB_TYPE_11B) + pDevice->wCurrentRate = RATE_11M; + else + pDevice->wCurrentRate = RATE_54M; + } - CHvInitChannelTable(pDevice); + CHvInitChannelTable(pDevice); - pDevice->byTopOFDMBasicRate = RATE_24M; - pDevice->byTopCCKBasicRate = RATE_1M; + pDevice->byTopOFDMBasicRate = RATE_24M; + pDevice->byTopCCKBasicRate = RATE_1M; pDevice->byRevId = 0; /* target to IF pin while programming to RF chip */ - pDevice->byCurPwr = 0xFF; + pDevice->byCurPwr = 0xFF; - pDevice->byCCKPwr = pDevice->abyEEPROM[EEP_OFS_PWR_CCK]; - pDevice->byOFDMPwrG = pDevice->abyEEPROM[EEP_OFS_PWR_OFDMG]; + pDevice->byCCKPwr = pDevice->abyEEPROM[EEP_OFS_PWR_CCK]; + pDevice->byOFDMPwrG = pDevice->abyEEPROM[EEP_OFS_PWR_OFDMG]; /* load power table */ for (ii = 0; ii < 14; ii++) { - pDevice->abyCCKPwrTbl[ii] = pDevice->abyEEPROM[ii + EEP_OFS_CCK_PWR_TBL]; - if (pDevice->abyCCKPwrTbl[ii] == 0) - pDevice->abyCCKPwrTbl[ii] = pDevice->byCCKPwr; - pDevice->abyOFDMPwrTbl[ii] = pDevice->abyEEPROM[ii + EEP_OFS_OFDM_PWR_TBL]; - if (pDevice->abyOFDMPwrTbl[ii] == 0) - pDevice->abyOFDMPwrTbl[ii] = pDevice->byOFDMPwrG; - } + pDevice->abyCCKPwrTbl[ii] = + pDevice->abyEEPROM[ii + EEP_OFS_CCK_PWR_TBL]; + + if (pDevice->abyCCKPwrTbl[ii] == 0) + pDevice->abyCCKPwrTbl[ii] = pDevice->byCCKPwr; + pDevice->abyOFDMPwrTbl[ii] = + pDevice->abyEEPROM[ii + EEP_OFS_OFDM_PWR_TBL]; + if (pDevice->abyOFDMPwrTbl[ii] == 0) + pDevice->abyOFDMPwrTbl[ii] = pDevice->byOFDMPwrG; + } /* * original zonetype is USA, but custom zonetype is Europe, * then need to recover 12, 13, 14 channels with 11 channel */ - if(((pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Japan) || - (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Europe))&& - (pDevice->byOriginalZonetype == ZoneType_USA)) { + if (((pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Japan) || + (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Europe)) && + (pDevice->byOriginalZonetype == ZoneType_USA)) { for (ii = 11; ii < 14; ii++) { pDevice->abyCCKPwrTbl[ii] = pDevice->abyCCKPwrTbl[10]; pDevice->abyOFDMPwrTbl[ii] = pDevice->abyOFDMPwrTbl[10]; } - } + } - pDevice->byOFDMPwrA = 0x34; /* same as RFbMA2829SelectChannel */ + pDevice->byOFDMPwrA = 0x34; /* same as RFbMA2829SelectChannel */ - /* load OFDM A power table */ - for (ii = 0; ii < CB_MAX_CHANNEL_5G; ii++) { - pDevice->abyOFDMAPwrTbl[ii] = pDevice->abyEEPROM[ii + EEP_OFS_OFDMA_PWR_TBL]; - if (pDevice->abyOFDMAPwrTbl[ii] == 0) - pDevice->abyOFDMAPwrTbl[ii] = pDevice->byOFDMPwrA; - } + /* load OFDM A power table */ + for (ii = 0; ii < CB_MAX_CHANNEL_5G; ii++) { + pDevice->abyOFDMAPwrTbl[ii] = + pDevice->abyEEPROM[ii + EEP_OFS_OFDMA_PWR_TBL]; - byAntenna = pDevice->abyEEPROM[EEP_OFS_ANTENNA]; - if (byAntenna & EEP_ANTINV) - pDevice->bTxRxAntInv = true; - else - pDevice->bTxRxAntInv = false; + if (pDevice->abyOFDMAPwrTbl[ii] == 0) + pDevice->abyOFDMAPwrTbl[ii] = pDevice->byOFDMPwrA; + } - byAntenna &= (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN); + byAntenna = pDevice->abyEEPROM[EEP_OFS_ANTENNA]; + + if (byAntenna & EEP_ANTINV) + pDevice->bTxRxAntInv = true; + else + pDevice->bTxRxAntInv = false; + + byAntenna &= (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN); if (byAntenna == 0) /* if not set default is both */ - byAntenna = (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN); + byAntenna = (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN); - if (byAntenna == (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN)) { - pDevice->byAntennaCount = 2; - pDevice->byTxAntennaMode = ANT_B; - pDevice->dwTxAntennaSel = 1; - pDevice->dwRxAntennaSel = 1; - if (pDevice->bTxRxAntInv == true) - pDevice->byRxAntennaMode = ANT_A; - else - pDevice->byRxAntennaMode = ANT_B; + if (byAntenna == (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN)) { + pDevice->byAntennaCount = 2; + pDevice->byTxAntennaMode = ANT_B; + pDevice->dwTxAntennaSel = 1; + pDevice->dwRxAntennaSel = 1; - if (pDevice->bDiversityRegCtlON) - pDevice->bDiversityEnable = true; - else - pDevice->bDiversityEnable = false; - } else { - pDevice->bDiversityEnable = false; - pDevice->byAntennaCount = 1; - pDevice->dwTxAntennaSel = 0; - pDevice->dwRxAntennaSel = 0; - if (byAntenna & EEP_ANTENNA_AUX) { - pDevice->byTxAntennaMode = ANT_A; - if (pDevice->bTxRxAntInv == true) - pDevice->byRxAntennaMode = ANT_B; - else - pDevice->byRxAntennaMode = ANT_A; - } else { - pDevice->byTxAntennaMode = ANT_B; - if (pDevice->bTxRxAntInv == true) - pDevice->byRxAntennaMode = ANT_A; - else - pDevice->byRxAntennaMode = ANT_B; - } - } - pDevice->ulDiversityNValue = 100*255; - pDevice->ulDiversityMValue = 100*16; - pDevice->byTMax = 1; - pDevice->byTMax2 = 4; - pDevice->ulSQ3TH = 0; - pDevice->byTMax3 = 64; + if (pDevice->bTxRxAntInv == true) + pDevice->byRxAntennaMode = ANT_A; + else + pDevice->byRxAntennaMode = ANT_B; + + if (pDevice->bDiversityRegCtlON) + pDevice->bDiversityEnable = true; + else + pDevice->bDiversityEnable = false; + } else { + pDevice->bDiversityEnable = false; + pDevice->byAntennaCount = 1; + pDevice->dwTxAntennaSel = 0; + pDevice->dwRxAntennaSel = 0; + + if (byAntenna & EEP_ANTENNA_AUX) { + pDevice->byTxAntennaMode = ANT_A; + + if (pDevice->bTxRxAntInv == true) + pDevice->byRxAntennaMode = ANT_B; + else + pDevice->byRxAntennaMode = ANT_A; + } else { + pDevice->byTxAntennaMode = ANT_B; + + if (pDevice->bTxRxAntInv == true) + pDevice->byRxAntennaMode = ANT_A; + else + pDevice->byRxAntennaMode = ANT_B; + } + } + + pDevice->ulDiversityNValue = 100 * 255; + pDevice->ulDiversityMValue = 100 * 16; + pDevice->byTMax = 1; + pDevice->byTMax2 = 4; + pDevice->ulSQ3TH = 0; + pDevice->byTMax3 = 64; /* get Auto Fall Back type */ pDevice->byAutoFBCtrl = AUTO_FB_0; @@ -524,49 +530,50 @@ static int device_init_registers(struct vnt_private *pDevice, } /* load vt3266 calibration parameters in EEPROM */ - if (pDevice->byRFType == RF_VT3226D0) { - if((pDevice->abyEEPROM[EEP_OFS_MAJOR_VER] == 0x1) && - (pDevice->abyEEPROM[EEP_OFS_MINOR_VER] >= 0x4)) { - byCalibTXIQ = pDevice->abyEEPROM[EEP_OFS_CALIB_TX_IQ]; - byCalibTXDC = pDevice->abyEEPROM[EEP_OFS_CALIB_TX_DC]; - byCalibRXIQ = pDevice->abyEEPROM[EEP_OFS_CALIB_RX_IQ]; - if( (byCalibTXIQ || byCalibTXDC || byCalibRXIQ) ) { + if (pDevice->byRFType == RF_VT3226D0) { + if ((pDevice->abyEEPROM[EEP_OFS_MAJOR_VER] == 0x1) && + (pDevice->abyEEPROM[EEP_OFS_MINOR_VER] >= 0x4)) { + + byCalibTXIQ = pDevice->abyEEPROM[EEP_OFS_CALIB_TX_IQ]; + byCalibTXDC = pDevice->abyEEPROM[EEP_OFS_CALIB_TX_DC]; + byCalibRXIQ = pDevice->abyEEPROM[EEP_OFS_CALIB_RX_IQ]; + if (byCalibTXIQ || byCalibTXDC || byCalibRXIQ) { /* CR255, enable TX/RX IQ and DC compensation mode */ - ControlvWriteByte(pDevice, + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xFF, 0x03); /* CR251, TX I/Q Imbalance Calibration */ - ControlvWriteByte(pDevice, + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xFB, byCalibTXIQ); /* CR252, TX DC-Offset Calibration */ - ControlvWriteByte(pDevice, + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xFC, byCalibTXDC); /* CR253, RX I/Q Imbalance Calibration */ - ControlvWriteByte(pDevice, + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xFD, byCalibRXIQ); - } else { + } else { /* CR255, turn off BB Calibration compensation */ - ControlvWriteByte(pDevice, + ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xFF, 0x0); - } - } - } + } + } + } pMgmt->eScanType = WMAC_SCAN_PASSIVE; pMgmt->uCurrChannel = pDevice->uChannel; pMgmt->uIBSSChannel = pDevice->uChannel; CARDbSetMediaChannel(pDevice, pMgmt->uCurrChannel); /* get permanent network address */ - memcpy(pDevice->abyPermanentNetAddr,&(sInitRsp.byNetAddr[0]),6); + memcpy(pDevice->abyPermanentNetAddr, &sInitRsp.byNetAddr[0], 6); memcpy(pDevice->abyCurrentNetAddr, pDevice->abyPermanentNetAddr, ETH_ALEN); @@ -574,7 +581,6 @@ static int device_init_registers(struct vnt_private *pDevice, /* if exist SW network address, use it */ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Network address = %pM\n", pDevice->abyCurrentNetAddr); - } /* * set BB and packet type at the same time @@ -962,10 +968,10 @@ static int device_open(struct net_device *dev) /* read config file */ Read_config_file(pDevice); - if (device_init_registers(pDevice, DEVICE_INIT_COLD) == false) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " init register fail\n"); - goto free_all; - } + if (device_init_registers(pDevice) == false) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " init register fail\n"); + goto free_all; + } device_set_multi(pDevice->dev); From 3d47a6fb2bd842206924214f7ec820cdfb92cf02 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Sun, 3 Nov 2013 17:43:23 +0000 Subject: [PATCH 166/238] staging: vt6656: Replace typedef struct _CMD_CARD_INIT Replace with struct vnt_cmd_card_init init_cmd in device_init_registers. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/main_usb.c | 25 +++++++++++-------------- drivers/staging/vt6656/rndis.h | 14 +++++++------- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 297dd109631c..fd8dfe971054 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -299,13 +299,13 @@ static void device_init_diversity_timer(struct vnt_private *pDevice) static int device_init_registers(struct vnt_private *pDevice) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; + struct vnt_cmd_card_init init_cmd; u8 abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; u8 abySNAP_RFC1042[ETH_ALEN] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00}; u8 abySNAP_Bridgetunnel[ETH_ALEN] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8}; u8 byAntenna; int ii; - CMD_CARD_INIT sInitCmd; int ntStatus = STATUS_SUCCESS; RSP_CARD_INIT sInitRsp; u8 byTmp; @@ -343,20 +343,17 @@ static int device_init_registers(struct vnt_private *pDevice) return false; } - sInitCmd.byInitClass = DEVICE_INIT_COLD; - sInitCmd.bExistSWNetAddr = (u8) pDevice->bExistSWNetAddr; - for (ii = 0; ii < 6; ii++) - sInitCmd.bySWNetAddr[ii] = pDevice->abyCurrentNetAddr[ii]; - sInitCmd.byShortRetryLimit = pDevice->byShortRetryLimit; - sInitCmd.byLongRetryLimit = pDevice->byLongRetryLimit; + init_cmd.init_class = DEVICE_INIT_COLD; + init_cmd.exist_sw_net_addr = (u8) pDevice->bExistSWNetAddr; + for (ii = 0; ii < 6; ii++) + init_cmd.sw_net_addr[ii] = pDevice->abyCurrentNetAddr[ii]; + init_cmd.short_retry_limit = pDevice->byShortRetryLimit; + init_cmd.long_retry_limit = pDevice->byLongRetryLimit; - /* issue card_init command to device */ - ntStatus = CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_CARDINIT, - 0, - 0, - sizeof(CMD_CARD_INIT), - (u8 *) &(sInitCmd)); + /* issue card_init command to device */ + ntStatus = CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_CARDINIT, 0, 0, + sizeof(struct vnt_cmd_card_init), (u8 *)&init_cmd); if ( ntStatus != STATUS_SUCCESS ) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Issue Card init fail \n"); diff --git a/drivers/staging/vt6656/rndis.h b/drivers/staging/vt6656/rndis.h index 5e073062017a..5dcc4b4007a3 100644 --- a/drivers/staging/vt6656/rndis.h +++ b/drivers/staging/vt6656/rndis.h @@ -77,14 +77,14 @@ typedef struct _CMD_WRITE_MASK u8 byMask; } CMD_WRITE_MASK, *PCMD_WRITE_MASK; -typedef struct _CMD_CARD_INIT +struct vnt_cmd_card_init { - u8 byInitClass; - u8 bExistSWNetAddr; - u8 bySWNetAddr[6]; - u8 byShortRetryLimit; - u8 byLongRetryLimit; -} CMD_CARD_INIT, *PCMD_CARD_INIT; + u8 init_class; + u8 exist_sw_net_addr; + u8 sw_net_addr[6]; + u8 short_retry_limit; + u8 long_retry_limit; +}; typedef struct _RSP_CARD_INIT { From ae1e1fe6e57b1640a3bed1d90f63bb59e8a4a3dc Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Sun, 3 Nov 2013 17:45:06 +0000 Subject: [PATCH 167/238] staging: vt6656: Replace typedef struct _RSP_CARD_INIT. Replace with struct vnt_rsp_card_rsp init_rsp in device_init_registers. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/main_usb.c | 8 ++++---- drivers/staging/vt6656/rndis.h | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index fd8dfe971054..d1f923c047e8 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -300,6 +300,7 @@ static int device_init_registers(struct vnt_private *pDevice) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct vnt_cmd_card_init init_cmd; + struct vnt_rsp_card_init init_rsp; u8 abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; u8 abySNAP_RFC1042[ETH_ALEN] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00}; u8 abySNAP_Bridgetunnel[ETH_ALEN] @@ -307,7 +308,6 @@ static int device_init_registers(struct vnt_private *pDevice) u8 byAntenna; int ii; int ntStatus = STATUS_SUCCESS; - RSP_CARD_INIT sInitRsp; u8 byTmp; u8 byCalibTXIQ = 0, byCalibTXDC = 0, byCalibRXIQ = 0; @@ -362,7 +362,7 @@ static int device_init_registers(struct vnt_private *pDevice) } ntStatus = CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_INIT_RSP, 0, 0, - sizeof(RSP_CARD_INIT), (u8 *) &(sInitRsp)); + sizeof(struct vnt_rsp_card_init), (u8 *)&init_rsp); if (ntStatus != STATUS_SUCCESS) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Cardinit request in status fail!\n"); @@ -519,7 +519,7 @@ static int device_init_registers(struct vnt_private *pDevice) pDevice->byMaxChannel = CB_MAX_CHANNEL; /* get RFType */ - pDevice->byRFType = sInitRsp.byRFType; + pDevice->byRFType = init_rsp.rf_type; if ((pDevice->byRFType & RF_EMU) != 0) { /* force change RevID for VT3253 emu */ @@ -570,7 +570,7 @@ static int device_init_registers(struct vnt_private *pDevice) CARDbSetMediaChannel(pDevice, pMgmt->uCurrChannel); /* get permanent network address */ - memcpy(pDevice->abyPermanentNetAddr, &sInitRsp.byNetAddr[0], 6); + memcpy(pDevice->abyPermanentNetAddr, &init_rsp.net_addr[0], 6); memcpy(pDevice->abyCurrentNetAddr, pDevice->abyPermanentNetAddr, ETH_ALEN); diff --git a/drivers/staging/vt6656/rndis.h b/drivers/staging/vt6656/rndis.h index 5dcc4b4007a3..08321ad48920 100644 --- a/drivers/staging/vt6656/rndis.h +++ b/drivers/staging/vt6656/rndis.h @@ -86,14 +86,14 @@ struct vnt_cmd_card_init u8 long_retry_limit; }; -typedef struct _RSP_CARD_INIT +struct vnt_rsp_card_init { - u8 byStatus; - u8 byNetAddr[6]; - u8 byRFType; - u8 byMinChannel; - u8 byMaxChannel; -} RSP_CARD_INIT, *PRSP_CARD_INIT; + u8 status; + u8 net_addr[6]; + u8 rf_type; + u8 min_channel; + u8 max_channel; +}; typedef struct _CMD_SET_KEY { From 748bf69c155607b6413206fcbce4d90097bac723 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Sun, 3 Nov 2013 17:49:32 +0000 Subject: [PATCH 168/238] staging; vt6656: device_init_registers Change vnt_cmd_card_int and vnt_rsp_card_int to off stack Move structures to vnt_private and convert to pointers in device_init_registers. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/device.h | 3 +++ drivers/staging/vt6656/main_usb.c | 23 +++++++++++------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index ef2b9228180c..739cda41b5a7 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -75,6 +75,7 @@ #include "desc.h" #include "key.h" #include "card.h" +#include "rndis.h" #define VNT_USB_VENDOR_ID 0x160a #define VNT_USB_PRODUCT_ID 0x3184 @@ -465,6 +466,8 @@ struct vnt_private { u8 byOriginalZonetype; int bLinkPass; /* link status: OK or fail */ + struct vnt_cmd_card_init init_command; + struct vnt_rsp_card_init init_response; u8 abyCurrentNetAddr[ETH_ALEN]; u8 abyPermanentNetAddr[ETH_ALEN]; diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index d1f923c047e8..ba39aaa44220 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -67,7 +67,6 @@ #include "datarate.h" #include "rf.h" #include "firmware.h" -#include "rndis.h" #include "control.h" #include "channel.h" #include "int.h" @@ -299,8 +298,8 @@ static void device_init_diversity_timer(struct vnt_private *pDevice) static int device_init_registers(struct vnt_private *pDevice) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - struct vnt_cmd_card_init init_cmd; - struct vnt_rsp_card_init init_rsp; + struct vnt_cmd_card_init *init_cmd = &pDevice->init_command; + struct vnt_rsp_card_init *init_rsp = &pDevice->init_response; u8 abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; u8 abySNAP_RFC1042[ETH_ALEN] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00}; u8 abySNAP_Bridgetunnel[ETH_ALEN] @@ -343,17 +342,17 @@ static int device_init_registers(struct vnt_private *pDevice) return false; } - init_cmd.init_class = DEVICE_INIT_COLD; - init_cmd.exist_sw_net_addr = (u8) pDevice->bExistSWNetAddr; + init_cmd->init_class = DEVICE_INIT_COLD; + init_cmd->exist_sw_net_addr = (u8) pDevice->bExistSWNetAddr; for (ii = 0; ii < 6; ii++) - init_cmd.sw_net_addr[ii] = pDevice->abyCurrentNetAddr[ii]; - init_cmd.short_retry_limit = pDevice->byShortRetryLimit; - init_cmd.long_retry_limit = pDevice->byLongRetryLimit; + init_cmd->sw_net_addr[ii] = pDevice->abyCurrentNetAddr[ii]; + init_cmd->short_retry_limit = pDevice->byShortRetryLimit; + init_cmd->long_retry_limit = pDevice->byLongRetryLimit; /* issue card_init command to device */ ntStatus = CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_CARDINIT, 0, 0, - sizeof(struct vnt_cmd_card_init), (u8 *)&init_cmd); + sizeof(struct vnt_cmd_card_init), (u8 *)init_cmd); if ( ntStatus != STATUS_SUCCESS ) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Issue Card init fail \n"); @@ -362,7 +361,7 @@ static int device_init_registers(struct vnt_private *pDevice) } ntStatus = CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_INIT_RSP, 0, 0, - sizeof(struct vnt_rsp_card_init), (u8 *)&init_rsp); + sizeof(struct vnt_rsp_card_init), (u8 *)init_rsp); if (ntStatus != STATUS_SUCCESS) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Cardinit request in status fail!\n"); @@ -519,7 +518,7 @@ static int device_init_registers(struct vnt_private *pDevice) pDevice->byMaxChannel = CB_MAX_CHANNEL; /* get RFType */ - pDevice->byRFType = init_rsp.rf_type; + pDevice->byRFType = init_rsp->rf_type; if ((pDevice->byRFType & RF_EMU) != 0) { /* force change RevID for VT3253 emu */ @@ -570,7 +569,7 @@ static int device_init_registers(struct vnt_private *pDevice) CARDbSetMediaChannel(pDevice, pMgmt->uCurrChannel); /* get permanent network address */ - memcpy(pDevice->abyPermanentNetAddr, &init_rsp.net_addr[0], 6); + memcpy(pDevice->abyPermanentNetAddr, init_rsp->net_addr, 6); memcpy(pDevice->abyCurrentNetAddr, pDevice->abyPermanentNetAddr, ETH_ALEN); From cbc06fb10c7295855c28c3a4b84b96b48e1dd844 Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Sun, 3 Nov 2013 17:52:15 +0000 Subject: [PATCH 169/238] staging: vt6656: cleanup device_init_registers White space and formatting clean up. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/main_usb.c | 223 +++++++++++++++--------------- 1 file changed, 114 insertions(+), 109 deletions(-) diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index ba39aaa44220..21805c650319 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -294,7 +294,6 @@ static void device_init_diversity_timer(struct vnt_private *pDevice) /* * initialization of MAC & BBP registers */ - static int device_init_registers(struct vnt_private *pDevice) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; @@ -317,30 +316,29 @@ static int device_init_registers(struct vnt_private *pDevice) memcpy(pDevice->abyBroadcastAddr, abyBroadcastAddr, ETH_ALEN); memcpy(pDevice->abySNAP_RFC1042, abySNAP_RFC1042, ETH_ALEN); - memcpy(pDevice->abySNAP_Bridgetunnel, - abySNAP_Bridgetunnel, - ETH_ALEN); + memcpy(pDevice->abySNAP_Bridgetunnel, abySNAP_Bridgetunnel, ETH_ALEN); - if ( !FIRMWAREbCheckVersion(pDevice) ) { - if (FIRMWAREbDownload(pDevice) == true) { - if (FIRMWAREbBrach2Sram(pDevice) == false) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" FIRMWAREbBrach2Sram fail \n"); - spin_unlock_irq(&pDevice->lock); - return false; - } - } else { + if (!FIRMWAREbCheckVersion(pDevice)) { + if (FIRMWAREbDownload(pDevice) == true) { + if (FIRMWAREbBrach2Sram(pDevice) == false) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO + " FIRMWAREbBrach2Sram fail\n"); + spin_unlock_irq(&pDevice->lock); + return false; + } + } else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO + " FIRMWAREbDownload fail\n"); + spin_unlock_irq(&pDevice->lock); + return false; + } + } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" FIRMWAREbDownload fail \n"); - spin_unlock_irq(&pDevice->lock); - return false; - } - } - - if ( !BBbVT3184Init(pDevice) ) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" BBbVT3184Init fail \n"); - spin_unlock_irq(&pDevice->lock); - return false; - } + if (!BBbVT3184Init(pDevice)) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" BBbVT3184Init fail\n"); + spin_unlock_irq(&pDevice->lock); + return false; + } init_cmd->init_class = DEVICE_INIT_COLD; init_cmd->exist_sw_net_addr = (u8) pDevice->bExistSWNetAddr; @@ -353,12 +351,11 @@ static int device_init_registers(struct vnt_private *pDevice) ntStatus = CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_CARDINIT, 0, 0, sizeof(struct vnt_cmd_card_init), (u8 *)init_cmd); - - if ( ntStatus != STATUS_SUCCESS ) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Issue Card init fail \n"); - spin_unlock_irq(&pDevice->lock); - return false; - } + if (ntStatus != STATUS_SUCCESS) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Issue Card init fail\n"); + spin_unlock_irq(&pDevice->lock); + return false; + } ntStatus = CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_INIT_RSP, 0, 0, sizeof(struct vnt_rsp_card_init), (u8 *)init_rsp); @@ -500,30 +497,30 @@ static int device_init_registers(struct vnt_private *pDevice) pDevice->byTMax3 = 64; /* get Auto Fall Back type */ - pDevice->byAutoFBCtrl = AUTO_FB_0; + pDevice->byAutoFBCtrl = AUTO_FB_0; /* set SCAN Time */ - pDevice->uScanTime = WLAN_SCAN_MINITIME; + pDevice->uScanTime = WLAN_SCAN_MINITIME; /* default Auto Mode */ /* pDevice->NetworkType = Ndis802_11Automode; */ - pDevice->eConfigPHYMode = PHY_TYPE_AUTO; - pDevice->byBBType = BB_TYPE_11G; + pDevice->eConfigPHYMode = PHY_TYPE_AUTO; + pDevice->byBBType = BB_TYPE_11G; /* initialize BBP registers */ - pDevice->ulTxPower = 25; + pDevice->ulTxPower = 25; /* get channel range */ - pDevice->byMinChannel = 1; - pDevice->byMaxChannel = CB_MAX_CHANNEL; + pDevice->byMinChannel = 1; + pDevice->byMaxChannel = CB_MAX_CHANNEL; /* get RFType */ pDevice->byRFType = init_rsp->rf_type; - if ((pDevice->byRFType & RF_EMU) != 0) { + if ((pDevice->byRFType & RF_EMU) != 0) { /* force change RevID for VT3253 emu */ pDevice->byRevId = 0x80; - } + } /* load vt3266 calibration parameters in EEPROM */ if (pDevice->byRFType == RF_VT3226D0) { @@ -536,105 +533,113 @@ static int device_init_registers(struct vnt_private *pDevice) if (byCalibTXIQ || byCalibTXDC || byCalibRXIQ) { /* CR255, enable TX/RX IQ and DC compensation mode */ ControlvWriteByte(pDevice, - MESSAGE_REQUEST_BBREG, - 0xFF, - 0x03); + MESSAGE_REQUEST_BBREG, + 0xff, + 0x03); /* CR251, TX I/Q Imbalance Calibration */ ControlvWriteByte(pDevice, - MESSAGE_REQUEST_BBREG, - 0xFB, - byCalibTXIQ); + MESSAGE_REQUEST_BBREG, + 0xfb, + byCalibTXIQ); /* CR252, TX DC-Offset Calibration */ ControlvWriteByte(pDevice, - MESSAGE_REQUEST_BBREG, - 0xFC, - byCalibTXDC); + MESSAGE_REQUEST_BBREG, + 0xfC, + byCalibTXDC); /* CR253, RX I/Q Imbalance Calibration */ ControlvWriteByte(pDevice, - MESSAGE_REQUEST_BBREG, - 0xFD, - byCalibRXIQ); + MESSAGE_REQUEST_BBREG, + 0xfd, + byCalibRXIQ); } else { /* CR255, turn off BB Calibration compensation */ ControlvWriteByte(pDevice, - MESSAGE_REQUEST_BBREG, - 0xFF, - 0x0); + MESSAGE_REQUEST_BBREG, + 0xff, + 0x0); } } } - pMgmt->eScanType = WMAC_SCAN_PASSIVE; - pMgmt->uCurrChannel = pDevice->uChannel; - pMgmt->uIBSSChannel = pDevice->uChannel; - CARDbSetMediaChannel(pDevice, pMgmt->uCurrChannel); + + pMgmt->eScanType = WMAC_SCAN_PASSIVE; + pMgmt->uCurrChannel = pDevice->uChannel; + pMgmt->uIBSSChannel = pDevice->uChannel; + CARDbSetMediaChannel(pDevice, pMgmt->uCurrChannel); /* get permanent network address */ memcpy(pDevice->abyPermanentNetAddr, init_rsp->net_addr, 6); memcpy(pDevice->abyCurrentNetAddr, - pDevice->abyPermanentNetAddr, - ETH_ALEN); + pDevice->abyPermanentNetAddr, ETH_ALEN); /* if exist SW network address, use it */ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Network address = %pM\n", pDevice->abyCurrentNetAddr); - /* - * set BB and packet type at the same time - * set Short Slot Time, xIFS, and RSPINF - */ - if (pDevice->byBBType == BB_TYPE_11A) { - CARDbAddBasicRate(pDevice, RATE_6M); - pDevice->bShortSlotTime = true; - } else { - CARDbAddBasicRate(pDevice, RATE_1M); - pDevice->bShortSlotTime = false; - } - BBvSetShortSlotTime(pDevice); - CARDvSetBSSMode(pDevice); + /* + * set BB and packet type at the same time + * set Short Slot Time, xIFS, and RSPINF + */ + if (pDevice->byBBType == BB_TYPE_11A) { + CARDbAddBasicRate(pDevice, RATE_6M); + pDevice->bShortSlotTime = true; + } else { + CARDbAddBasicRate(pDevice, RATE_1M); + pDevice->bShortSlotTime = false; + } - if (pDevice->bUpdateBBVGA) { - pDevice->byBBVGACurrent = pDevice->abyBBVGA[0]; - pDevice->byBBVGANew = pDevice->byBBVGACurrent; - BBvSetVGAGainOffset(pDevice, pDevice->abyBBVGA[0]); - } + BBvSetShortSlotTime(pDevice); + CARDvSetBSSMode(pDevice); - pDevice->byRadioCtl = pDevice->abyEEPROM[EEP_OFS_RADIOCTL]; - pDevice->bHWRadioOff = false; - if ( (pDevice->byRadioCtl & EEP_RADIOCTL_ENABLE) != 0 ) { - ntStatus = CONTROLnsRequestIn(pDevice, - MESSAGE_TYPE_READ, - MAC_REG_GPIOCTL1, - MESSAGE_REQUEST_MACREG, - 1, - &byTmp); + if (pDevice->bUpdateBBVGA) { + pDevice->byBBVGACurrent = pDevice->abyBBVGA[0]; + pDevice->byBBVGANew = pDevice->byBBVGACurrent; - if ( ntStatus != STATUS_SUCCESS ) { - spin_unlock_irq(&pDevice->lock); - return false; - } - if ( (byTmp & GPIO3_DATA) == 0 ) { - pDevice->bHWRadioOff = true; - MACvRegBitsOn(pDevice,MAC_REG_GPIOCTL1,GPIO3_INTMD); - } else { - MACvRegBitsOff(pDevice,MAC_REG_GPIOCTL1,GPIO3_INTMD); - pDevice->bHWRadioOff = false; - } + BBvSetVGAGainOffset(pDevice, pDevice->abyBBVGA[0]); + } - } + pDevice->byRadioCtl = pDevice->abyEEPROM[EEP_OFS_RADIOCTL]; + pDevice->bHWRadioOff = false; - ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_TMLEN,0x38); - ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); - MACvRegBitsOn(pDevice,MAC_REG_GPIOCTL0,0x01); + if ((pDevice->byRadioCtl & EEP_RADIOCTL_ENABLE) != 0) { + ntStatus = CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ, + MAC_REG_GPIOCTL1, MESSAGE_REQUEST_MACREG, 1, &byTmp); - if ((pDevice->bHWRadioOff == true) || (pDevice->bRadioControlOff == true)) { - CARDbRadioPowerOff(pDevice); - } else { - CARDbRadioPowerOn(pDevice); - } + if (ntStatus != STATUS_SUCCESS) { + spin_unlock_irq(&pDevice->lock); + return false; + } - spin_unlock_irq(&pDevice->lock); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"<----INIbInitAdapter Exit\n"); - return true; + if ((byTmp & GPIO3_DATA) == 0) { + pDevice->bHWRadioOff = true; + MACvRegBitsOn(pDevice, MAC_REG_GPIOCTL1, GPIO3_INTMD); + } else { + MACvRegBitsOff(pDevice, MAC_REG_GPIOCTL1, GPIO3_INTMD); + pDevice->bHWRadioOff = false; + } + + } + + ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, + MAC_REG_PAPEDELAY, LEDSTS_TMLEN, 0x38); + + ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, + MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW); + + MACvRegBitsOn(pDevice, MAC_REG_GPIOCTL0, 0x01); + + if ((pDevice->bHWRadioOff == true) || + (pDevice->bRadioControlOff == true)) { + CARDbRadioPowerOff(pDevice); + } else { + CARDbRadioPowerOn(pDevice); + } + + + spin_unlock_irq(&pDevice->lock); + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"<----INIbInitAdapter Exit\n"); + + return true; } #ifdef CONFIG_PM /* Minimal support for suspend and resume */ From f0fde117c12692f76887e09944f4d923a5470bdd Mon Sep 17 00:00:00 2001 From: Malcolm Priestley Date: Sun, 3 Nov 2013 19:02:41 +0000 Subject: [PATCH 170/238] staging: vt6656: main_usb.c ether_crc use kernel code use ether_crc already in kernel and remove local version. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/device.h | 1 + drivers/staging/vt6656/main_usb.c | 16 ---------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index 739cda41b5a7..b7a6e14e4d9f 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -44,6 +44,7 @@ #include #include #include +#include #ifdef SIOCETHTOOL #define DEVICE_ETHTOOL_IOCTL_SUPPORT diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 21805c650319..4cb7aa737a99 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -1194,22 +1194,6 @@ out: return NETDEV_TX_OK; } -static unsigned const ethernet_polynomial = 0x04c11db7U; -static inline u32 ether_crc(int length, unsigned char *data) -{ - int crc = -1; - - while(--length >= 0) { - unsigned char current_octet = *data++; - int bit; - for (bit = 0; bit < 8; bit++, current_octet >>= 1) { - crc = (crc << 1) ^ - ((crc < 0) ^ (current_octet & 1) ? ethernet_polynomial : 0); - } - } - return crc; -} - /* find out the start position of str2 from str1 */ static unsigned char *kstrstr(const unsigned char *str1, const unsigned char *str2) { From a82c40cba28266186eff04bde6e368083eefa687 Mon Sep 17 00:00:00 2001 From: Rupert Muchembled Date: Fri, 8 Nov 2013 06:01:48 +0000 Subject: [PATCH 171/238] Staging: silicom: Remove unnecessary variable from do_cmd() Remove unnecessary variable ioctl from do_cmd(). As a consequence, this patch removes an assignment to ioctl in an if condition, reported by checkpatch.pl. Signed-off-by: Rupert Muchembled Signed-off-by: Greg Kroah-Hartman --- drivers/staging/silicom/bypasslib/bypass.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/silicom/bypasslib/bypass.c b/drivers/staging/silicom/bypasslib/bypass.c index ba0d23a1cfbe..7d2cb54ad6c0 100644 --- a/drivers/staging/silicom/bypasslib/bypass.c +++ b/drivers/staging/silicom/bypasslib/bypass.c @@ -47,13 +47,13 @@ static int do_cmd(struct net_device *dev, struct ifreq *ifr, int cmd, int *data) { int ret = -1; struct if_bypass *bypass_cb; - static int (*ioctl) (struct net_device *, struct ifreq *, int); bypass_cb = (struct if_bypass *)ifr; bypass_cb->cmd = cmd; bypass_cb->data = *data; - if ((dev->netdev_ops) && (ioctl = dev->netdev_ops->ndo_do_ioctl)) { - ret = ioctl(dev, ifr, SIOCGIFBYPASS); + + if (dev->netdev_ops && dev->netdev_ops->ndo_do_ioctl) { + ret = dev->netdev_ops->ndo_do_ioctl(dev, ifr, SIOCGIFBYPASS); *data = bypass_cb->data; } From 473b1716256d2b01bfd105e6af96ccc34b951fe3 Mon Sep 17 00:00:00 2001 From: Rupert Muchembled Date: Fri, 8 Nov 2013 06:01:49 +0000 Subject: [PATCH 172/238] Staging: silicom: Remove unnecessary variable from get_bypass_info() Remove unnecessary variable ioctl from get_bypass_info(). As a consequence, this patch removes an assignment to ioctl in an if condition, reported by checkpatch.pl. Signed-off-by: Rupert Muchembled Signed-off-by: Greg Kroah-Hartman --- drivers/staging/silicom/bypasslib/bypass.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/silicom/bypasslib/bypass.c b/drivers/staging/silicom/bypasslib/bypass.c index 7d2cb54ad6c0..dda1b2a6b84b 100644 --- a/drivers/staging/silicom/bypasslib/bypass.c +++ b/drivers/staging/silicom/bypasslib/bypass.c @@ -480,7 +480,6 @@ static int get_bypass_info(int if_index, struct bp_info *bp_info) SET_BPLIB_INT_FN2(get_bypass_info, int, if_index, struct bp_info *, bp_info, ret); } else { - static int (*ioctl) (struct net_device *, struct ifreq *, int); struct net_device *dev; struct net_device *n; @@ -493,9 +492,10 @@ static int get_bypass_info(int if_index, struct bp_info *bp_info) bypass_cb = (struct if_bypass_info *)𝔦 bypass_cb->cmd = GET_BYPASS_INFO; - if ((dev->netdev_ops) && - (ioctl = dev->netdev_ops->ndo_do_ioctl)) { - ret = ioctl(dev, &ifr, SIOCGIFBYPASS); + if (dev->netdev_ops && + dev->netdev_ops->ndo_do_ioctl) { + ret = dev->netdev_ops->ndo_do_ioctl(dev, + &ifr, SIOCGIFBYPASS); } else From 6c7b4ac9363488a5d19ea26f864f0a8866ea5b49 Mon Sep 17 00:00:00 2001 From: Grygorii Strashko Date: Fri, 8 Nov 2013 18:41:42 -0500 Subject: [PATCH 173/238] mm/staging: remove unnecessary inclusion of bootmem.h Clean-up to remove depedency with bootmem headers. Cc: Yinghai Lu Cc: Tejun Heo Cc: Andrew Morton Cc: William Hubbs Cc: Chris Brannon Cc: Kirk Reiser Cc: Greg Kroah-Hartman Signed-off-by: Grygorii Strashko Signed-off-by: Santosh Shilimkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c index 47502fa5f3f6..ef5933b93590 100644 --- a/drivers/staging/speakup/main.c +++ b/drivers/staging/speakup/main.c @@ -37,8 +37,6 @@ #include #include -#include /* for alloc_bootmem */ - /* speakup_*_selection */ #include #include From 91f9765d377385863950f31d43aba5a888faa413 Mon Sep 17 00:00:00 2001 From: Joachim Adi Schuetz Date: Sun, 10 Nov 2013 15:15:06 +0100 Subject: [PATCH 174/238] staging: ced401: ced_ioc: fix a blank/tab codingstyle issue. Fixed a coding style issue - removed a blank before a tab. Signed-off-by: Joachim Adolf Schuetz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ced1401/ced_ioc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ced1401/ced_ioc.c b/drivers/staging/ced1401/ced_ioc.c index 62efd74b8c04..043a93230e82 100644 --- a/drivers/staging/ced1401/ced_ioc.c +++ b/drivers/staging/ced1401/ced_ioc.c @@ -630,7 +630,7 @@ int ClearArea(DEVICE_EXTENSION *pdx, int nArea) } spin_unlock_irq(&pdx->stagedLock); - if (pPages) { /* if we decided to release the memory */ + if (pPages) { /* if we decided to release the memory */ /* Now we must undo the pinning down of the pages. We will assume the worst and mark */ /* all the pages as dirty. Don't be tempted to move this up above as you must not be */ /* holding a spin lock to do this stuff as it is not atomic. */ From 0d100bfc4bedbcd297afa77714b9dbea8e9452db Mon Sep 17 00:00:00 2001 From: Kristina Martsenko Date: Mon, 11 Nov 2013 21:34:57 +0200 Subject: [PATCH 175/238] staging: lustre: ptlrpc: pack_generic: clean up whitespace around parentheses Fix the following types of checkpatch errors and warnings in pack_generic.c to comply with coding style: ERROR: space required before the open parenthesis '(' ERROR: space prohibited before that close parenthesis ')' WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Kristina Martsenko Reviewed-by: Sarah Sharp Signed-off-by: Greg Kroah-Hartman --- .../lustre/lustre/ptlrpc/pack_generic.c | 362 +++++++++--------- 1 file changed, 181 insertions(+), 181 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c index cd2611a3b53d..94abb51cf642 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c @@ -274,8 +274,8 @@ do { \ spin_unlock(&ptlrpc_rs_debug_lock); \ } while (0) #else -# define PTLRPC_RS_DEBUG_LRU_ADD(rs) do {} while(0) -# define PTLRPC_RS_DEBUG_LRU_DEL(rs) do {} while(0) +# define PTLRPC_RS_DEBUG_LRU_ADD(rs) do {} while (0) +# define PTLRPC_RS_DEBUG_LRU_DEL(rs) do {} while (0) #endif struct ptlrpc_reply_state * @@ -507,14 +507,14 @@ void lustre_free_reply_state(struct ptlrpc_reply_state *rs) { PTLRPC_RS_DEBUG_LRU_DEL(rs); - LASSERT (atomic_read(&rs->rs_refcount) == 0); - LASSERT (!rs->rs_difficult || rs->rs_handled); - LASSERT (!rs->rs_on_net); - LASSERT (!rs->rs_scheduled); - LASSERT (rs->rs_export == NULL); - LASSERT (rs->rs_nlocks == 0); - LASSERT (list_empty(&rs->rs_exp_list)); - LASSERT (list_empty(&rs->rs_obd_list)); + LASSERT(atomic_read(&rs->rs_refcount) == 0); + LASSERT(!rs->rs_difficult || rs->rs_handled); + LASSERT(!rs->rs_on_net); + LASSERT(!rs->rs_scheduled); + LASSERT(rs->rs_export == NULL); + LASSERT(rs->rs_nlocks == 0); + LASSERT(list_empty(&rs->rs_exp_list)); + LASSERT(list_empty(&rs->rs_obd_list)); sptlrpc_svc_free_rs(rs); } @@ -548,8 +548,8 @@ static int lustre_unpack_msg_v2(struct lustre_msg_v2 *m, int len) required_len = lustre_msg_hdr_size_v2(m->lm_bufcount); if (len < required_len) { /* didn't receive all the buffer lengths */ - CERROR ("message length %d too small for %d buflens\n", - len, m->lm_bufcount); + CERROR("message length %d too small for %d buflens\n", + len, m->lm_bufcount); return -EINVAL; } @@ -749,7 +749,7 @@ char *lustre_msg_string(struct lustre_msg *m, int index, int max_len) } if (str == NULL) { - CERROR ("can't unpack string in msg %p buffer[%d]\n", m, index); + CERROR("can't unpack string in msg %p buffer[%d]\n", m, index); return NULL; } @@ -1653,25 +1653,25 @@ EXPORT_SYMBOL(do_set_info_async); */ void lustre_swab_ptlrpc_body(struct ptlrpc_body *b) { - __swab32s (&b->pb_type); - __swab32s (&b->pb_version); - __swab32s (&b->pb_opc); - __swab32s (&b->pb_status); - __swab64s (&b->pb_last_xid); - __swab64s (&b->pb_last_seen); - __swab64s (&b->pb_last_committed); - __swab64s (&b->pb_transno); - __swab32s (&b->pb_flags); - __swab32s (&b->pb_op_flags); - __swab32s (&b->pb_conn_cnt); - __swab32s (&b->pb_timeout); - __swab32s (&b->pb_service_time); - __swab32s (&b->pb_limit); - __swab64s (&b->pb_slv); - __swab64s (&b->pb_pre_versions[0]); - __swab64s (&b->pb_pre_versions[1]); - __swab64s (&b->pb_pre_versions[2]); - __swab64s (&b->pb_pre_versions[3]); + __swab32s(&b->pb_type); + __swab32s(&b->pb_version); + __swab32s(&b->pb_opc); + __swab32s(&b->pb_status); + __swab64s(&b->pb_last_xid); + __swab64s(&b->pb_last_seen); + __swab64s(&b->pb_last_committed); + __swab64s(&b->pb_transno); + __swab32s(&b->pb_flags); + __swab32s(&b->pb_op_flags); + __swab32s(&b->pb_conn_cnt); + __swab32s(&b->pb_timeout); + __swab32s(&b->pb_service_time); + __swab32s(&b->pb_limit); + __swab64s(&b->pb_slv); + __swab64s(&b->pb_pre_versions[0]); + __swab64s(&b->pb_pre_versions[1]); + __swab64s(&b->pb_pre_versions[2]); + __swab64s(&b->pb_pre_versions[3]); CLASSERT(offsetof(typeof(*b), pb_padding) != 0); /* While we need to maintain compatibility between * clients and servers without ptlrpc_body_v2 (< 2.3) @@ -1723,33 +1723,33 @@ void lustre_swab_connect(struct obd_connect_data *ocd) CLASSERT(offsetof(typeof(*ocd), paddingF) != 0); } -void lustre_swab_obdo (struct obdo *o) +void lustre_swab_obdo(struct obdo *o) { - __swab64s (&o->o_valid); + __swab64s(&o->o_valid); lustre_swab_ost_id(&o->o_oi); - __swab64s (&o->o_parent_seq); - __swab64s (&o->o_size); - __swab64s (&o->o_mtime); - __swab64s (&o->o_atime); - __swab64s (&o->o_ctime); - __swab64s (&o->o_blocks); - __swab64s (&o->o_grant); - __swab32s (&o->o_blksize); - __swab32s (&o->o_mode); - __swab32s (&o->o_uid); - __swab32s (&o->o_gid); - __swab32s (&o->o_flags); - __swab32s (&o->o_nlink); - __swab32s (&o->o_parent_oid); - __swab32s (&o->o_misc); - __swab64s (&o->o_ioepoch); - __swab32s (&o->o_stripe_idx); - __swab32s (&o->o_parent_ver); + __swab64s(&o->o_parent_seq); + __swab64s(&o->o_size); + __swab64s(&o->o_mtime); + __swab64s(&o->o_atime); + __swab64s(&o->o_ctime); + __swab64s(&o->o_blocks); + __swab64s(&o->o_grant); + __swab32s(&o->o_blksize); + __swab32s(&o->o_mode); + __swab32s(&o->o_uid); + __swab32s(&o->o_gid); + __swab32s(&o->o_flags); + __swab32s(&o->o_nlink); + __swab32s(&o->o_parent_oid); + __swab32s(&o->o_misc); + __swab64s(&o->o_ioepoch); + __swab32s(&o->o_stripe_idx); + __swab32s(&o->o_parent_ver); /* o_handle is opaque */ /* o_lcookie is swabbed elsewhere */ - __swab32s (&o->o_uid_h); - __swab32s (&o->o_gid_h); - __swab64s (&o->o_data_version); + __swab32s(&o->o_uid_h); + __swab32s(&o->o_gid_h); + __swab64s(&o->o_data_version); CLASSERT(offsetof(typeof(*o), o_padding_4) != 0); CLASSERT(offsetof(typeof(*o), o_padding_5) != 0); CLASSERT(offsetof(typeof(*o), o_padding_6) != 0); @@ -1757,19 +1757,19 @@ void lustre_swab_obdo (struct obdo *o) } EXPORT_SYMBOL(lustre_swab_obdo); -void lustre_swab_obd_statfs (struct obd_statfs *os) +void lustre_swab_obd_statfs(struct obd_statfs *os) { - __swab64s (&os->os_type); - __swab64s (&os->os_blocks); - __swab64s (&os->os_bfree); - __swab64s (&os->os_bavail); - __swab64s (&os->os_files); - __swab64s (&os->os_ffree); + __swab64s(&os->os_type); + __swab64s(&os->os_blocks); + __swab64s(&os->os_bfree); + __swab64s(&os->os_bavail); + __swab64s(&os->os_files); + __swab64s(&os->os_ffree); /* no need to swab os_fsid */ - __swab32s (&os->os_bsize); - __swab32s (&os->os_namelen); - __swab64s (&os->os_maxbytes); - __swab32s (&os->os_state); + __swab32s(&os->os_bsize); + __swab32s(&os->os_namelen); + __swab64s(&os->os_maxbytes); + __swab32s(&os->os_state); CLASSERT(offsetof(typeof(*os), os_fprecreated) != 0); CLASSERT(offsetof(typeof(*os), os_spare2) != 0); CLASSERT(offsetof(typeof(*os), os_spare3) != 0); @@ -1790,17 +1790,17 @@ void lustre_swab_obd_ioobj(struct obd_ioobj *ioo) } EXPORT_SYMBOL(lustre_swab_obd_ioobj); -void lustre_swab_niobuf_remote (struct niobuf_remote *nbr) +void lustre_swab_niobuf_remote(struct niobuf_remote *nbr) { - __swab64s (&nbr->offset); - __swab32s (&nbr->len); - __swab32s (&nbr->flags); + __swab64s(&nbr->offset); + __swab32s(&nbr->len); + __swab32s(&nbr->flags); } EXPORT_SYMBOL(lustre_swab_niobuf_remote); -void lustre_swab_ost_body (struct ost_body *b) +void lustre_swab_ost_body(struct ost_body *b) { - lustre_swab_obdo (&b->oa); + lustre_swab_obdo(&b->oa); } EXPORT_SYMBOL(lustre_swab_ost_body); @@ -1861,45 +1861,45 @@ void lustre_swab_lquota_lvb(struct lquota_lvb *lvb) } EXPORT_SYMBOL(lustre_swab_lquota_lvb); -void lustre_swab_mdt_body (struct mdt_body *b) +void lustre_swab_mdt_body(struct mdt_body *b) { - lustre_swab_lu_fid (&b->fid1); - lustre_swab_lu_fid (&b->fid2); + lustre_swab_lu_fid(&b->fid1); + lustre_swab_lu_fid(&b->fid2); /* handle is opaque */ - __swab64s (&b->valid); - __swab64s (&b->size); - __swab64s (&b->mtime); - __swab64s (&b->atime); - __swab64s (&b->ctime); - __swab64s (&b->blocks); - __swab64s (&b->ioepoch); + __swab64s(&b->valid); + __swab64s(&b->size); + __swab64s(&b->mtime); + __swab64s(&b->atime); + __swab64s(&b->ctime); + __swab64s(&b->blocks); + __swab64s(&b->ioepoch); CLASSERT(offsetof(typeof(*b), unused1) != 0); - __swab32s (&b->fsuid); - __swab32s (&b->fsgid); - __swab32s (&b->capability); - __swab32s (&b->mode); - __swab32s (&b->uid); - __swab32s (&b->gid); - __swab32s (&b->flags); - __swab32s (&b->rdev); - __swab32s (&b->nlink); + __swab32s(&b->fsuid); + __swab32s(&b->fsgid); + __swab32s(&b->capability); + __swab32s(&b->mode); + __swab32s(&b->uid); + __swab32s(&b->gid); + __swab32s(&b->flags); + __swab32s(&b->rdev); + __swab32s(&b->nlink); CLASSERT(offsetof(typeof(*b), unused2) != 0); - __swab32s (&b->suppgid); - __swab32s (&b->eadatasize); - __swab32s (&b->aclsize); - __swab32s (&b->max_mdsize); - __swab32s (&b->max_cookiesize); - __swab32s (&b->uid_h); - __swab32s (&b->gid_h); + __swab32s(&b->suppgid); + __swab32s(&b->eadatasize); + __swab32s(&b->aclsize); + __swab32s(&b->max_mdsize); + __swab32s(&b->max_cookiesize); + __swab32s(&b->uid_h); + __swab32s(&b->gid_h); CLASSERT(offsetof(typeof(*b), padding_5) != 0); } EXPORT_SYMBOL(lustre_swab_mdt_body); -void lustre_swab_mdt_ioepoch (struct mdt_ioepoch *b) +void lustre_swab_mdt_ioepoch(struct mdt_ioepoch *b) { /* handle is opaque */ - __swab64s (&b->ioepoch); - __swab32s (&b->flags); + __swab64s(&b->ioepoch); + __swab32s(&b->flags); CLASSERT(offsetof(typeof(*b), padding) != 0); } EXPORT_SYMBOL(lustre_swab_mdt_ioepoch); @@ -1957,49 +1957,49 @@ void lustre_swab_mgs_config_res(struct mgs_config_res *body) } EXPORT_SYMBOL(lustre_swab_mgs_config_res); -static void lustre_swab_obd_dqinfo (struct obd_dqinfo *i) +static void lustre_swab_obd_dqinfo(struct obd_dqinfo *i) { - __swab64s (&i->dqi_bgrace); - __swab64s (&i->dqi_igrace); - __swab32s (&i->dqi_flags); - __swab32s (&i->dqi_valid); + __swab64s(&i->dqi_bgrace); + __swab64s(&i->dqi_igrace); + __swab32s(&i->dqi_flags); + __swab32s(&i->dqi_valid); } -static void lustre_swab_obd_dqblk (struct obd_dqblk *b) +static void lustre_swab_obd_dqblk(struct obd_dqblk *b) { - __swab64s (&b->dqb_ihardlimit); - __swab64s (&b->dqb_isoftlimit); - __swab64s (&b->dqb_curinodes); - __swab64s (&b->dqb_bhardlimit); - __swab64s (&b->dqb_bsoftlimit); - __swab64s (&b->dqb_curspace); - __swab64s (&b->dqb_btime); - __swab64s (&b->dqb_itime); - __swab32s (&b->dqb_valid); + __swab64s(&b->dqb_ihardlimit); + __swab64s(&b->dqb_isoftlimit); + __swab64s(&b->dqb_curinodes); + __swab64s(&b->dqb_bhardlimit); + __swab64s(&b->dqb_bsoftlimit); + __swab64s(&b->dqb_curspace); + __swab64s(&b->dqb_btime); + __swab64s(&b->dqb_itime); + __swab32s(&b->dqb_valid); CLASSERT(offsetof(typeof(*b), dqb_padding) != 0); } -void lustre_swab_obd_quotactl (struct obd_quotactl *q) +void lustre_swab_obd_quotactl(struct obd_quotactl *q) { - __swab32s (&q->qc_cmd); - __swab32s (&q->qc_type); - __swab32s (&q->qc_id); - __swab32s (&q->qc_stat); - lustre_swab_obd_dqinfo (&q->qc_dqinfo); - lustre_swab_obd_dqblk (&q->qc_dqblk); + __swab32s(&q->qc_cmd); + __swab32s(&q->qc_type); + __swab32s(&q->qc_id); + __swab32s(&q->qc_stat); + lustre_swab_obd_dqinfo(&q->qc_dqinfo); + lustre_swab_obd_dqblk(&q->qc_dqblk); } EXPORT_SYMBOL(lustre_swab_obd_quotactl); -void lustre_swab_mdt_remote_perm (struct mdt_remote_perm *p) +void lustre_swab_mdt_remote_perm(struct mdt_remote_perm *p) { - __swab32s (&p->rp_uid); - __swab32s (&p->rp_gid); - __swab32s (&p->rp_fsuid); - __swab32s (&p->rp_fsuid_h); - __swab32s (&p->rp_fsgid); - __swab32s (&p->rp_fsgid_h); - __swab32s (&p->rp_access_perm); - __swab32s (&p->rp_padding); + __swab32s(&p->rp_uid); + __swab32s(&p->rp_gid); + __swab32s(&p->rp_fsuid); + __swab32s(&p->rp_fsuid_h); + __swab32s(&p->rp_fsgid); + __swab32s(&p->rp_fsgid_h); + __swab32s(&p->rp_access_perm); + __swab32s(&p->rp_padding); }; EXPORT_SYMBOL(lustre_swab_mdt_remote_perm); @@ -2089,31 +2089,31 @@ void lustre_swab_mdt_rec_reint (struct mdt_rec_reint *rr) }; EXPORT_SYMBOL(lustre_swab_mdt_rec_reint); -void lustre_swab_lov_desc (struct lov_desc *ld) +void lustre_swab_lov_desc(struct lov_desc *ld) { - __swab32s (&ld->ld_tgt_count); - __swab32s (&ld->ld_active_tgt_count); - __swab32s (&ld->ld_default_stripe_count); - __swab32s (&ld->ld_pattern); - __swab64s (&ld->ld_default_stripe_size); - __swab64s (&ld->ld_default_stripe_offset); - __swab32s (&ld->ld_qos_maxage); + __swab32s(&ld->ld_tgt_count); + __swab32s(&ld->ld_active_tgt_count); + __swab32s(&ld->ld_default_stripe_count); + __swab32s(&ld->ld_pattern); + __swab64s(&ld->ld_default_stripe_size); + __swab64s(&ld->ld_default_stripe_offset); + __swab32s(&ld->ld_qos_maxage); /* uuid endian insensitive */ } EXPORT_SYMBOL(lustre_swab_lov_desc); -void lustre_swab_lmv_desc (struct lmv_desc *ld) +void lustre_swab_lmv_desc(struct lmv_desc *ld) { - __swab32s (&ld->ld_tgt_count); - __swab32s (&ld->ld_active_tgt_count); - __swab32s (&ld->ld_default_stripe_count); - __swab32s (&ld->ld_pattern); - __swab64s (&ld->ld_default_hash_size); - __swab32s (&ld->ld_qos_maxage); + __swab32s(&ld->ld_tgt_count); + __swab32s(&ld->ld_active_tgt_count); + __swab32s(&ld->ld_default_stripe_count); + __swab32s(&ld->ld_pattern); + __swab64s(&ld->ld_default_hash_size); + __swab32s(&ld->ld_qos_maxage); /* uuid endian insensitive */ } -void lustre_swab_lmv_stripe_md (struct lmv_stripe_md *mea) +void lustre_swab_lmv_stripe_md(struct lmv_stripe_md *mea) { __swab32s(&mea->mea_magic); __swab32s(&mea->mea_count); @@ -2142,7 +2142,7 @@ void lustre_swab_lmv_user_md(struct lmv_user_md *lum) } EXPORT_SYMBOL(lustre_swab_lmv_user_md); -static void print_lum (struct lov_user_md *lum) +static void print_lum(struct lov_user_md *lum) { CDEBUG(D_OTHER, "lov_user_md %p:\n", lum); CDEBUG(D_OTHER, "\tlmm_magic: %#x\n", lum->lmm_magic); @@ -2212,16 +2212,16 @@ void lustre_swab_lov_user_md_objects(struct lov_user_ost_data *lod, } EXPORT_SYMBOL(lustre_swab_lov_user_md_objects); -void lustre_swab_ldlm_res_id (struct ldlm_res_id *id) +void lustre_swab_ldlm_res_id(struct ldlm_res_id *id) { int i; for (i = 0; i < RES_NAME_SIZE; i++) - __swab64s (&id->name[i]); + __swab64s(&id->name[i]); } EXPORT_SYMBOL(lustre_swab_ldlm_res_id); -void lustre_swab_ldlm_policy_data (ldlm_wire_policy_data_t *d) +void lustre_swab_ldlm_policy_data(ldlm_wire_policy_data_t *d) { /* the lock data is a union and the first two fields are always an * extent so it's ok to process an LDLM_EXTENT and LDLM_FLOCK lock @@ -2234,46 +2234,46 @@ void lustre_swab_ldlm_policy_data (ldlm_wire_policy_data_t *d) } EXPORT_SYMBOL(lustre_swab_ldlm_policy_data); -void lustre_swab_ldlm_intent (struct ldlm_intent *i) +void lustre_swab_ldlm_intent(struct ldlm_intent *i) { - __swab64s (&i->opc); + __swab64s(&i->opc); } EXPORT_SYMBOL(lustre_swab_ldlm_intent); -void lustre_swab_ldlm_resource_desc (struct ldlm_resource_desc *r) +void lustre_swab_ldlm_resource_desc(struct ldlm_resource_desc *r) { - __swab32s (&r->lr_type); + __swab32s(&r->lr_type); CLASSERT(offsetof(typeof(*r), lr_padding) != 0); - lustre_swab_ldlm_res_id (&r->lr_name); + lustre_swab_ldlm_res_id(&r->lr_name); } EXPORT_SYMBOL(lustre_swab_ldlm_resource_desc); -void lustre_swab_ldlm_lock_desc (struct ldlm_lock_desc *l) +void lustre_swab_ldlm_lock_desc(struct ldlm_lock_desc *l) { - lustre_swab_ldlm_resource_desc (&l->l_resource); - __swab32s (&l->l_req_mode); - __swab32s (&l->l_granted_mode); - lustre_swab_ldlm_policy_data (&l->l_policy_data); + lustre_swab_ldlm_resource_desc(&l->l_resource); + __swab32s(&l->l_req_mode); + __swab32s(&l->l_granted_mode); + lustre_swab_ldlm_policy_data(&l->l_policy_data); } EXPORT_SYMBOL(lustre_swab_ldlm_lock_desc); -void lustre_swab_ldlm_request (struct ldlm_request *rq) +void lustre_swab_ldlm_request(struct ldlm_request *rq) { - __swab32s (&rq->lock_flags); - lustre_swab_ldlm_lock_desc (&rq->lock_desc); - __swab32s (&rq->lock_count); + __swab32s(&rq->lock_flags); + lustre_swab_ldlm_lock_desc(&rq->lock_desc); + __swab32s(&rq->lock_count); /* lock_handle[] opaque */ } EXPORT_SYMBOL(lustre_swab_ldlm_request); -void lustre_swab_ldlm_reply (struct ldlm_reply *r) +void lustre_swab_ldlm_reply(struct ldlm_reply *r) { - __swab32s (&r->lock_flags); + __swab32s(&r->lock_flags); CLASSERT(offsetof(typeof(*r), lock_padding) != 0); - lustre_swab_ldlm_lock_desc (&r->lock_desc); + lustre_swab_ldlm_lock_desc(&r->lock_desc); /* lock_handle opaque */ - __swab64s (&r->lock_policy_res1); - __swab64s (&r->lock_policy_res2); + __swab64s(&r->lock_policy_res1); + __swab64s(&r->lock_policy_res2); } EXPORT_SYMBOL(lustre_swab_ldlm_reply); @@ -2409,7 +2409,7 @@ static inline int rep_ptlrpc_body_swabbed(struct ptlrpc_request *req) void _debug_req(struct ptlrpc_request *req, struct libcfs_debug_msg_data *msgdata, - const char *fmt, ... ) + const char *fmt, ...) { int req_ok = req->rq_reqmsg != NULL; int rep_ok = req->rq_repmsg != NULL; @@ -2457,20 +2457,20 @@ EXPORT_SYMBOL(_debug_req); void lustre_swab_lustre_capa(struct lustre_capa *c) { lustre_swab_lu_fid(&c->lc_fid); - __swab64s (&c->lc_opc); - __swab64s (&c->lc_uid); - __swab64s (&c->lc_gid); - __swab32s (&c->lc_flags); - __swab32s (&c->lc_keyid); - __swab32s (&c->lc_timeout); - __swab32s (&c->lc_expiry); + __swab64s(&c->lc_opc); + __swab64s(&c->lc_uid); + __swab64s(&c->lc_gid); + __swab32s(&c->lc_flags); + __swab32s(&c->lc_keyid); + __swab32s(&c->lc_timeout); + __swab32s(&c->lc_expiry); } EXPORT_SYMBOL(lustre_swab_lustre_capa); void lustre_swab_lustre_capa_key(struct lustre_capa_key *k) { - __swab64s (&k->lk_seq); - __swab32s (&k->lk_keyid); + __swab64s(&k->lk_seq); + __swab32s(&k->lk_keyid); CLASSERT(offsetof(typeof(*k), lk_padding) != 0); } EXPORT_SYMBOL(lustre_swab_lustre_capa_key); From 3949015e4dc169e738bb6f04ef5cbd26253b1cf9 Mon Sep 17 00:00:00 2001 From: Kristina Martsenko Date: Mon, 11 Nov 2013 21:34:58 +0200 Subject: [PATCH 176/238] staging: lustre: ptlrpc: clean up whitespace around parentheses Fix the following types of checkpatch errors and warnings to comply with coding style: ERROR: space required before the open parenthesis '(' ERROR: space prohibited after that open parenthesis '(' ERROR: space prohibited before that close parenthesis ')' WARNING: space prohibited between function name and open parenthesis '(' Signed-off-by: Kristina Martsenko Reviewed-by: Sarah Sharp Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/client.c | 16 ++-- drivers/staging/lustre/lustre/ptlrpc/events.c | 73 +++++++++---------- .../lustre/lustre/ptlrpc/gss/gss_keyring.c | 2 +- .../lustre/lustre/ptlrpc/gss/gss_krb5_mech.c | 2 +- .../lustre/lustre/ptlrpc/gss/sec_gss.c | 6 +- drivers/staging/lustre/lustre/ptlrpc/import.c | 12 +-- drivers/staging/lustre/lustre/ptlrpc/layout.c | 4 +- .../lustre/lustre/ptlrpc/llog_client.c | 6 +- .../lustre/lustre/ptlrpc/lproc_ptlrpc.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 70 +++++++++--------- .../lustre/lustre/ptlrpc/ptlrpc_internal.h | 10 +-- .../lustre/lustre/ptlrpc/ptlrpc_module.c | 2 +- .../staging/lustre/lustre/ptlrpc/service.c | 28 +++---- 13 files changed, 116 insertions(+), 117 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index c2ab0c8c4d42..07d34b4a074e 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -459,7 +459,7 @@ ptlrpc_init_rq_pool(int num_rq, int msgsize, { struct ptlrpc_request_pool *pool; - OBD_ALLOC(pool, sizeof (struct ptlrpc_request_pool)); + OBD_ALLOC(pool, sizeof(struct ptlrpc_request_pool)); if (!pool) return NULL; @@ -475,7 +475,7 @@ ptlrpc_init_rq_pool(int num_rq, int msgsize, if (list_empty(&pool->prp_req_list)) { /* have not allocated a single request for the pool */ - OBD_FREE(pool, sizeof (struct ptlrpc_request_pool)); + OBD_FREE(pool, sizeof(struct ptlrpc_request_pool)); pool = NULL; } return pool; @@ -881,7 +881,7 @@ void ptlrpc_set_destroy(struct ptlrpc_request_set *set) /* Requests on the set should either all be completed, or all be new */ expected_phase = (atomic_read(&set->set_remaining) == 0) ? RQ_PHASE_COMPLETE : RQ_PHASE_NEW; - list_for_each (tmp, &set->set_requests) { + list_for_each(tmp, &set->set_requests) { struct ptlrpc_request *req = list_entry(tmp, struct ptlrpc_request, rq_set_chain); @@ -912,7 +912,7 @@ void ptlrpc_set_destroy(struct ptlrpc_request_set *set) req->rq_invalid_rqset = 0; spin_unlock(&req->rq_lock); - ptlrpc_req_finished (req); + ptlrpc_req_finished(req); } LASSERT(atomic_read(&set->set_remaining) == 0); @@ -1020,7 +1020,7 @@ static int ptlrpc_import_delay_req(struct obd_import *imp, { int delay = 0; - LASSERT (status != NULL); + LASSERT(status != NULL); *status = 0; if (req->rq_ctx_init || req->rq_ctx_fini) { @@ -1907,7 +1907,7 @@ int ptlrpc_expired_set(void *data) /* * A timeout expired. See which reqs it applies to... */ - list_for_each (tmp, &set->set_requests) { + list_for_each(tmp, &set->set_requests) { struct ptlrpc_request *req = list_entry(tmp, struct ptlrpc_request, rq_set_chain); @@ -2688,7 +2688,7 @@ int ptlrpc_replay_req(struct ptlrpc_request *req) LASSERT(req->rq_import->imp_state == LUSTRE_IMP_REPLAY); - LASSERT (sizeof (*aa) <= sizeof (req->rq_async_args)); + LASSERT(sizeof(*aa) <= sizeof(req->rq_async_args)); aa = ptlrpc_req_async_args(req); memset(aa, 0, sizeof(*aa)); @@ -2962,7 +2962,7 @@ void *ptlrpcd_alloc_work(struct obd_import *imp, init_waitqueue_head(&req->rq_set_waitq); atomic_set(&req->rq_refcount, 1); - CLASSERT (sizeof(*args) <= sizeof(req->rq_async_args)); + CLASSERT(sizeof(*args) <= sizeof(req->rq_async_args)); args = ptlrpc_req_async_args(req); args->magic = PTLRPC_WORK_MAGIC; args->cb = cb; diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c b/drivers/staging/lustre/lustre/ptlrpc/events.c index 58d089c3fef4..f66cfea87acf 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/events.c +++ b/drivers/staging/lustre/lustre/ptlrpc/events.c @@ -56,9 +56,9 @@ void request_out_callback(lnet_event_t *ev) struct ptlrpc_cb_id *cbid = ev->md.user_ptr; struct ptlrpc_request *req = cbid->cbid_arg; - LASSERT (ev->type == LNET_EVENT_SEND || - ev->type == LNET_EVENT_UNLINK); - LASSERT (ev->unlinked); + LASSERT(ev->type == LNET_EVENT_SEND || + ev->type == LNET_EVENT_UNLINK); + LASSERT(ev->unlinked); DEBUG_REQ(D_NET, req, "type %d, status %d", ev->type, ev->status); @@ -90,9 +90,9 @@ void reply_in_callback(lnet_event_t *ev) DEBUG_REQ(D_NET, req, "type %d, status %d", ev->type, ev->status); - LASSERT (ev->type == LNET_EVENT_PUT || ev->type == LNET_EVENT_UNLINK); - LASSERT (ev->md.start == req->rq_repbuf); - LASSERT (ev->offset + ev->mlength <= req->rq_repbuf_len); + LASSERT(ev->type == LNET_EVENT_PUT || ev->type == LNET_EVENT_UNLINK); + LASSERT(ev->md.start == req->rq_repbuf); + LASSERT(ev->offset + ev->mlength <= req->rq_repbuf_len); /* We've set LNET_MD_MANAGE_REMOTE for all outgoing requests for adaptive timeouts' early reply. */ LASSERT((ev->md.options & LNET_MD_MANAGE_REMOTE) != 0); @@ -113,7 +113,7 @@ void reply_in_callback(lnet_event_t *ev) goto out_wake; } - if (ev->mlength < ev->rlength ) { + if (ev->mlength < ev->rlength) { CDEBUG(D_RPCTRACE, "truncate req %p rpc %d - %d+%d\n", req, req->rq_replen, ev->rlength, ev->offset); req->rq_reply_truncate = 1; @@ -167,18 +167,18 @@ out_wake: /* * Client's bulk has been written/read */ -void client_bulk_callback (lnet_event_t *ev) +void client_bulk_callback(lnet_event_t *ev) { struct ptlrpc_cb_id *cbid = ev->md.user_ptr; struct ptlrpc_bulk_desc *desc = cbid->cbid_arg; struct ptlrpc_request *req; - LASSERT ((desc->bd_type == BULK_PUT_SINK && - ev->type == LNET_EVENT_PUT) || - (desc->bd_type == BULK_GET_SOURCE && - ev->type == LNET_EVENT_GET) || - ev->type == LNET_EVENT_UNLINK); - LASSERT (ev->unlinked); + LASSERT((desc->bd_type == BULK_PUT_SINK && + ev->type == LNET_EVENT_PUT) || + (desc->bd_type == BULK_GET_SOURCE && + ev->type == LNET_EVENT_GET) || + ev->type == LNET_EVENT_UNLINK); + LASSERT(ev->unlinked); if (CFS_FAIL_CHECK_ORSET(OBD_FAIL_PTLRPC_CLIENT_BULK_CB, CFS_FAIL_ONCE)) ev->status = -EIO; @@ -283,11 +283,11 @@ void request_in_callback(lnet_event_t *ev) struct ptlrpc_service *service = svcpt->scp_service; struct ptlrpc_request *req; - LASSERT (ev->type == LNET_EVENT_PUT || - ev->type == LNET_EVENT_UNLINK); - LASSERT ((char *)ev->md.start >= rqbd->rqbd_buffer); - LASSERT ((char *)ev->md.start + ev->offset + ev->mlength <= - rqbd->rqbd_buffer + service->srv_buf_size); + LASSERT(ev->type == LNET_EVENT_PUT || + ev->type == LNET_EVENT_UNLINK); + LASSERT((char *)ev->md.start >= rqbd->rqbd_buffer); + LASSERT((char *)ev->md.start + ev->offset + ev->mlength <= + rqbd->rqbd_buffer + service->srv_buf_size); CDEBUG((ev->status == 0) ? D_NET : D_ERROR, "event type %d, status %d, service %s\n", @@ -300,9 +300,9 @@ void request_in_callback(lnet_event_t *ev) * we'd have to re-post the rqbd, which we can't do in this * context. */ req = &rqbd->rqbd_req; - memset(req, 0, sizeof (*req)); + memset(req, 0, sizeof(*req)); } else { - LASSERT (ev->type == LNET_EVENT_PUT); + LASSERT(ev->type == LNET_EVENT_PUT); if (ev->status != 0) { /* We moaned above already... */ return; @@ -381,19 +381,19 @@ void reply_out_callback(lnet_event_t *ev) struct ptlrpc_reply_state *rs = cbid->cbid_arg; struct ptlrpc_service_part *svcpt = rs->rs_svcpt; - LASSERT (ev->type == LNET_EVENT_SEND || - ev->type == LNET_EVENT_ACK || - ev->type == LNET_EVENT_UNLINK); + LASSERT(ev->type == LNET_EVENT_SEND || + ev->type == LNET_EVENT_ACK || + ev->type == LNET_EVENT_UNLINK); if (!rs->rs_difficult) { /* 'Easy' replies have no further processing so I drop the * net's ref on 'rs' */ - LASSERT (ev->unlinked); + LASSERT(ev->unlinked); ptlrpc_rs_decref(rs); return; } - LASSERT (rs->rs_on_net); + LASSERT(rs->rs_on_net); if (ev->unlinked) { /* Last network callback. The net's ref on 'rs' stays put @@ -419,18 +419,17 @@ static void ptlrpc_master_callback(lnet_event_t *ev) void (*callback)(lnet_event_t *ev) = cbid->cbid_fn; /* Honestly, it's best to find out early. */ - LASSERT (cbid->cbid_arg != LP_POISON); - LASSERT (callback == request_out_callback || - callback == reply_in_callback || - callback == client_bulk_callback || - callback == request_in_callback || - callback == reply_out_callback - ); + LASSERT(cbid->cbid_arg != LP_POISON); + LASSERT(callback == request_out_callback || + callback == reply_in_callback || + callback == client_bulk_callback || + callback == request_in_callback || + callback == reply_out_callback); - callback (ev); + callback(ev); } -int ptlrpc_uuid_to_peer (struct obd_uuid *uuid, +int ptlrpc_uuid_to_peer(struct obd_uuid *uuid, lnet_process_id_t *peer, lnet_nid_t *self) { int best_dist = 0; @@ -538,7 +537,7 @@ int ptlrpc_ni_init(void) /* We're not passing any limits yet... */ rc = LNetNIInit(pid); if (rc < 0) { - CDEBUG (D_NET, "Can't init network interface: %d\n", rc); + CDEBUG(D_NET, "Can't init network interface: %d\n", rc); return (-ENOENT); } @@ -552,7 +551,7 @@ int ptlrpc_ni_init(void) if (rc == 0) return 0; - CERROR ("Failed to allocate event queue: %d\n", rc); + CERROR("Failed to allocate event queue: %d\n", rc); LNetNIFini(); return (-ENOMEM); diff --git a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_keyring.c b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_keyring.c index 188dbbfbd2f4..d43a13c69669 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_keyring.c +++ b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_keyring.c @@ -165,7 +165,7 @@ void ctx_start_timer_kr(struct ptlrpc_cli_ctx *ctx, long timeout) init_timer(timer); timer->expires = timeout; - timer->data = (unsigned long ) ctx; + timer->data = (unsigned long) ctx; timer->function = ctx_upcall_timeout_kr; add_timer(timer); diff --git a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_krb5_mech.c b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_krb5_mech.c index c106a9e049a7..b9fa3b4a40db 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_krb5_mech.c +++ b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_krb5_mech.c @@ -1276,7 +1276,7 @@ arc4_out_tfm: arc4_out_key: rawobj_free(&arc4_keye); arc4_out: - do {} while(0); /* just to avoid compile warning */ + do {} while (0); /* just to avoid compile warning */ } else { rc = krb5_encrypt_rawobjs(kctx->kc_keye.kb_tfm, 0, 3, data_desc, &cipher, 1); diff --git a/drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c b/drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c index b42ddda9ee25..92543f81eacf 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c +++ b/drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c @@ -483,7 +483,7 @@ int gss_do_check_seq(unsigned long *window, __u32 win_size, __u32 *max_seq, memset(window, 0, win_size / 8); *max_seq = seq_num; } else { - while(*max_seq < seq_num) { + while (*max_seq < seq_num) { (*max_seq)++; __clear_bit((*max_seq) % win_size, window); } @@ -2369,7 +2369,7 @@ int gss_svc_accept(struct ptlrpc_sec_policy *policy, struct ptlrpc_request *req) if (swabbed) gss_header_swabber(ghdr); - switch(ghdr->gh_proc) { + switch (ghdr->gh_proc) { case PTLRPC_GSS_PROC_INIT: case PTLRPC_GSS_PROC_CONTINUE_INIT: rc = gss_svc_handle_init(req, gw); @@ -2388,7 +2388,7 @@ int gss_svc_accept(struct ptlrpc_sec_policy *policy, struct ptlrpc_request *req) switch (rc) { case SECSVC_OK: - LASSERT (grctx->src_ctx); + LASSERT(grctx->src_ctx); req->rq_auth_gss = 1; req->rq_auth_remote = grctx->src_ctx->gsc_remote; diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c index 7b96a0e88cdb..ac8813e4ce2d 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/import.c +++ b/drivers/staging/lustre/lustre/ptlrpc/import.c @@ -81,14 +81,14 @@ do { \ ptlrpc_import_state_name(state)); \ __import_set_state(imp, state); \ } \ -} while(0) +} while (0) #define IMPORT_SET_STATE(imp, state) \ do { \ spin_lock(&imp->imp_lock); \ IMPORT_SET_STATE_NOLOCK(imp, state); \ spin_unlock(&imp->imp_lock); \ -} while(0) +} while (0) static int ptlrpc_connect_interpret(const struct lu_env *env, @@ -680,7 +680,7 @@ int ptlrpc_connect_import(struct obd_import *imp) ptlrpc_request_set_replen(request); request->rq_interpret_reply = ptlrpc_connect_interpret; - CLASSERT(sizeof (*aa) <= sizeof (request->rq_async_args)); + CLASSERT(sizeof(*aa) <= sizeof(request->rq_async_args)); aa = ptlrpc_req_async_args(request); memset(aa, 0, sizeof(*aa)); @@ -859,7 +859,7 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, if (MSG_CONNECT_RECONNECT & msg_flags) { memset(&old_hdl, 0, sizeof(old_hdl)); if (!memcmp(&old_hdl, lustre_msg_get_handle(request->rq_repmsg), - sizeof (old_hdl))) { + sizeof(old_hdl))) { LCONSOLE_WARN("Reconnect to %s (at @%s) failed due " "bad handle "LPX64"\n", obd2cli_tgt(imp->imp_obd), @@ -1507,7 +1507,7 @@ int at_measured(struct adaptive_timeout *at, unsigned int val) at->at_worst_time = now; at->at_hist[0] = val; at->at_binstart = now; - } else if (now - at->at_binstart < binlimit ) { + } else if (now - at->at_binstart < binlimit) { /* in bin 0 */ at->at_hist[0] = max(val, at->at_hist[0]); at->at_current = max(val, at->at_current); @@ -1517,7 +1517,7 @@ int at_measured(struct adaptive_timeout *at, unsigned int val) /* move bins over */ shift = (now - at->at_binstart) / binlimit; LASSERT(shift > 0); - for(i = AT_BINS - 1; i >= 0; i--) { + for (i = AT_BINS - 1; i >= 0; i--) { if (i >= shift) { at->at_hist[i] = at->at_hist[i - shift]; maxv = max(maxv, at->at_hist[i]); diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c b/drivers/staging/lustre/lustre/ptlrpc/layout.c index d0a6e5689227..504682d2eefa 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/layout.c +++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c @@ -1808,7 +1808,7 @@ swabber_dumper_helper(struct req_capsule *pill, const struct req_msg_field *field, enum req_location loc, int offset, - void *value, int len, int dump, void (*swabber)( void *)) + void *value, int len, int dump, void (*swabber)(void *)) { void *p; int i; @@ -1883,7 +1883,7 @@ swabber_dumper_helper(struct req_capsule *pill, static void *__req_capsule_get(struct req_capsule *pill, const struct req_msg_field *field, enum req_location loc, - void (*swabber)( void *), + void (*swabber)(void *), int dump) { const struct req_format *fmt; diff --git a/drivers/staging/lustre/lustre/ptlrpc/llog_client.c b/drivers/staging/lustre/lustre/ptlrpc/llog_client.c index 379e59477ea2..ab084541fddb 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/llog_client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/llog_client.c @@ -63,7 +63,7 @@ return (-EINVAL); \ } \ mutex_unlock(&ctxt->loc_mutex); \ -} while(0) +} while (0) #define LLOG_CLIENT_EXIT(ctxt, imp) do { \ mutex_lock(&ctxt->loc_mutex); \ @@ -72,7 +72,7 @@ ctxt->loc_imp, imp); \ class_import_put(imp); \ mutex_unlock(&ctxt->loc_mutex); \ -} while(0) +} while (0) /* This is a callback from the llog_* functions. * Assumes caller has already pushed us into the kernel context. */ @@ -302,7 +302,7 @@ static int llog_client_read_header(const struct lu_env *env, if (hdr == NULL) GOTO(out, rc =-EFAULT); - memcpy(handle->lgh_hdr, hdr, sizeof (*hdr)); + memcpy(handle->lgh_hdr, hdr, sizeof(*hdr)); handle->lgh_last_idx = handle->lgh_hdr->llh_tail.lrt_index; /* sanity checks */ diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index bea44a3d4a2f..09d832b59f97 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -221,7 +221,7 @@ void ptlrpc_lprocfs_register(struct proc_dir_entry *root, char *dir, for (i = 0; i < EXTRA_LAST_OPC; i++) { char *units; - switch(i) { + switch (i) { case BRW_WRITE_BYTES: case BRW_READ_BYTES: units = "bytes"; diff --git a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c index a0e009717a5a..6eb06ed8b5ad 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c +++ b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c @@ -47,17 +47,17 @@ * over \a conn connection to portal \a portal. * Returns 0 on success or error code. */ -static int ptl_send_buf (lnet_handle_md_t *mdh, void *base, int len, - lnet_ack_req_t ack, struct ptlrpc_cb_id *cbid, - struct ptlrpc_connection *conn, int portal, __u64 xid, - unsigned int offset) +static int ptl_send_buf(lnet_handle_md_t *mdh, void *base, int len, + lnet_ack_req_t ack, struct ptlrpc_cb_id *cbid, + struct ptlrpc_connection *conn, int portal, __u64 xid, + unsigned int offset) { int rc; lnet_md_t md; - LASSERT (portal != 0); - LASSERT (conn != NULL); - CDEBUG (D_INFO, "conn=%p id %s\n", conn, libcfs_id2str(conn->c_peer)); + LASSERT(portal != 0); + LASSERT(conn != NULL); + CDEBUG(D_INFO, "conn=%p id %s\n", conn, libcfs_id2str(conn->c_peer)); md.start = base; md.length = len; md.threshold = (ack == LNET_ACK_REQ) ? 2 : 1; @@ -71,18 +71,18 @@ static int ptl_send_buf (lnet_handle_md_t *mdh, void *base, int len, ack = LNET_NOACK_REQ; } - rc = LNetMDBind (md, LNET_UNLINK, mdh); + rc = LNetMDBind(md, LNET_UNLINK, mdh); if (unlikely(rc != 0)) { - CERROR ("LNetMDBind failed: %d\n", rc); - LASSERT (rc == -ENOMEM); + CERROR("LNetMDBind failed: %d\n", rc); + LASSERT(rc == -ENOMEM); return -ENOMEM; } CDEBUG(D_NET, "Sending %d bytes to portal %d, xid "LPD64", offset %u\n", len, portal, xid, offset); - rc = LNetPut (conn->c_self, *mdh, ack, - conn->c_peer, portal, xid, offset, 0); + rc = LNetPut(conn->c_self, *mdh, ack, + conn->c_peer, portal, xid, offset, 0); if (unlikely(rc != 0)) { int rc2; /* We're going to get an UNLINK event when I unlink below, @@ -363,14 +363,14 @@ int ptlrpc_send_reply(struct ptlrpc_request *req, int flags) * request, or a saved copy if this is a req saved in * target_queue_final_reply(). */ - LASSERT (req->rq_no_reply == 0); - LASSERT (req->rq_reqbuf != NULL); - LASSERT (rs != NULL); - LASSERT ((flags & PTLRPC_REPLY_MAYBE_DIFFICULT) || !rs->rs_difficult); - LASSERT (req->rq_repmsg != NULL); - LASSERT (req->rq_repmsg == rs->rs_msg); - LASSERT (rs->rs_cb_id.cbid_fn == reply_out_callback); - LASSERT (rs->rs_cb_id.cbid_arg == rs); + LASSERT(req->rq_no_reply == 0); + LASSERT(req->rq_reqbuf != NULL); + LASSERT(rs != NULL); + LASSERT((flags & PTLRPC_REPLY_MAYBE_DIFFICULT) || !rs->rs_difficult); + LASSERT(req->rq_repmsg != NULL); + LASSERT(req->rq_repmsg == rs->rs_msg); + LASSERT(rs->rs_cb_id.cbid_fn == reply_out_callback); + LASSERT(rs->rs_cb_id.cbid_arg == rs); /* There may be no rq_export during failover */ @@ -423,12 +423,12 @@ int ptlrpc_send_reply(struct ptlrpc_request *req, int flags) req->rq_sent = cfs_time_current_sec(); - rc = ptl_send_buf (&rs->rs_md_h, rs->rs_repbuf, rs->rs_repdata_len, - (rs->rs_difficult && !rs->rs_no_ack) ? - LNET_ACK_REQ : LNET_NOACK_REQ, - &rs->rs_cb_id, conn, - ptlrpc_req2svc(req)->srv_rep_portal, - req->rq_xid, req->rq_reply_off); + rc = ptl_send_buf(&rs->rs_md_h, rs->rs_repbuf, rs->rs_repdata_len, + (rs->rs_difficult && !rs->rs_no_ack) ? + LNET_ACK_REQ : LNET_NOACK_REQ, + &rs->rs_cb_id, conn, + ptlrpc_req2svc(req)->srv_rep_portal, + req->rq_xid, req->rq_reply_off); out: if (unlikely(rc != 0)) ptlrpc_req_drop_rs(req); @@ -437,7 +437,7 @@ out: } EXPORT_SYMBOL(ptlrpc_send_reply); -int ptlrpc_reply (struct ptlrpc_request *req) +int ptlrpc_reply(struct ptlrpc_request *req) { if (req->rq_no_reply) return 0; @@ -537,13 +537,13 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) /* bulk register should be done after wrap_request() */ if (request->rq_bulk != NULL) { - rc = ptlrpc_register_bulk (request); + rc = ptlrpc_register_bulk(request); if (rc != 0) GOTO(out, rc); } if (!noreply) { - LASSERT (request->rq_replen != 0); + LASSERT(request->rq_replen != 0); if (request->rq_repbuf == NULL) { LASSERT(request->rq_repdata == NULL); LASSERT(request->rq_repmsg == NULL); @@ -566,7 +566,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) LNET_UNLINK, LNET_INS_AFTER, &reply_me_h); if (rc != 0) { CERROR("LNetMEAttach failed: %d\n", rc); - LASSERT (rc == -ENOMEM); + LASSERT(rc == -ENOMEM); GOTO(cleanup_bulk, rc = -ENOMEM); } } @@ -604,7 +604,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) &request->rq_reply_md_h); if (rc != 0) { CERROR("LNetMDAttach failed: %d\n", rc); - LASSERT (rc == -ENOMEM); + LASSERT(rc == -ENOMEM); spin_lock(&request->rq_lock); /* ...but the MD attach didn't succeed... */ request->rq_receiving_reply = 0; @@ -655,7 +655,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) * nobody apart from the PUT's target has the right nid+XID to * access the reply buffer. */ rc2 = LNetMEUnlink(reply_me_h); - LASSERT (rc2 == 0); + LASSERT(rc2 == 0); /* UNLINKED callback called synchronously */ LASSERT(!request->rq_receiving_reply); @@ -715,9 +715,9 @@ int ptlrpc_register_rqbd(struct ptlrpc_request_buffer_desc *rqbd) return (0); CERROR("LNetMDAttach failed: %d; \n", rc); - LASSERT (rc == -ENOMEM); - rc = LNetMEUnlink (me_h); - LASSERT (rc == 0); + LASSERT(rc == -ENOMEM); + rc = LNetMEUnlink(me_h); + LASSERT(rc == 0); rqbd->rqbd_refcount = 0; return (-ENOMEM); diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h index ab363477151d..9bd3f84b33b7 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h @@ -77,13 +77,13 @@ void ptlrpc_lprocfs_register_service(struct proc_dir_entry *proc_entry, struct ptlrpc_service *svc); void ptlrpc_lprocfs_unregister_service(struct ptlrpc_service *svc); void ptlrpc_lprocfs_rpc_sent(struct ptlrpc_request *req, long amount); -void ptlrpc_lprocfs_do_request_stat (struct ptlrpc_request *req, +void ptlrpc_lprocfs_do_request_stat(struct ptlrpc_request *req, long q_usec, long work_usec); #else -#define ptlrpc_lprocfs_register_service(params...) do{}while(0) -#define ptlrpc_lprocfs_unregister_service(params...) do{}while(0) -#define ptlrpc_lprocfs_rpc_sent(params...) do{}while(0) -#define ptlrpc_lprocfs_do_request_stat(params...) do{}while(0) +#define ptlrpc_lprocfs_register_service(params...) do{}while (0) +#define ptlrpc_lprocfs_unregister_service(params...) do{}while (0) +#define ptlrpc_lprocfs_rpc_sent(params...) do{}while (0) +#define ptlrpc_lprocfs_do_request_stat(params...) do{}while (0) #endif /* LPROCFS */ /* NRS */ diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c index 419e634854df..0efd35887a15 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c @@ -112,7 +112,7 @@ __init int ptlrpc_init(void) return 0; cleanup: - switch(cleanup_phase) { + switch (cleanup_phase) { case 8: ptlrpc_nrs_fini(); case 7: diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index 21de868da522..b21ea83e75cd 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -386,7 +386,7 @@ ptlrpc_schedule_difficult_reply(struct ptlrpc_reply_state *rs) { LASSERT(spin_is_locked(&rs->rs_svcpt->scp_rep_lock)); LASSERT(spin_is_locked(&rs->rs_lock)); - LASSERT (rs->rs_difficult); + LASSERT(rs->rs_difficult); rs->rs_scheduled_ever = 1; /* flag any notification attempt */ if (rs->rs_scheduled) { /* being set up or already notified */ @@ -412,7 +412,7 @@ void ptlrpc_commit_replies(struct obd_export *exp) spin_lock(&exp->exp_uncommitted_replies_lock); list_for_each_entry_safe(rs, nxt, &exp->exp_uncommitted_replies, rs_obd_list) { - LASSERT (rs->rs_difficult); + LASSERT(rs->rs_difficult); /* VBR: per-export last_committed */ LASSERT(rs->rs_export); if (rs->rs_transno <= exp->exp_last_committed) { @@ -796,7 +796,7 @@ ptlrpc_register_service(struct ptlrpc_service_conf *conf, LASSERT(rc == 0); mutex_lock(&ptlrpc_all_services_mutex); - list_add (&service->srv_list, &ptlrpc_all_services); + list_add(&service->srv_list, &ptlrpc_all_services); mutex_unlock(&ptlrpc_all_services_mutex); if (proc_entry != NULL) @@ -1777,9 +1777,9 @@ ptlrpc_server_handle_req_in(struct ptlrpc_service_part *svcpt, rc = lustre_unpack_req_ptlrpc_body(req, MSG_PTLRPC_BODY_OFF); if (rc) { - CERROR ("error unpacking ptlrpc body: ptl %d from %s x" - LPU64"\n", svc->srv_req_portal, - libcfs_id2str(req->rq_peer), req->rq_xid); + CERROR("error unpacking ptlrpc body: ptl %d from %s x" + LPU64"\n", svc->srv_req_portal, + libcfs_id2str(req->rq_peer), req->rq_xid); goto err_req; } @@ -1798,7 +1798,7 @@ ptlrpc_server_handle_req_in(struct ptlrpc_service_part *svcpt, goto err_req; } - switch(lustre_msg_get_opc(req->rq_reqmsg)) { + switch (lustre_msg_get_opc(req->rq_reqmsg)) { case MDS_WRITEPAGE: case OST_WRITE: req->rq_bulk_write = 1; @@ -1895,7 +1895,7 @@ ptlrpc_server_handle_request(struct ptlrpc_service_part *svcpt, ptlrpc_rqphase_move(request, RQ_PHASE_INTERPRET); - if(OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_DUMP_LOG)) + if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_DUMP_LOG)) libcfs_debug_dumplog(); do_gettimeofday(&work_start); @@ -2037,13 +2037,13 @@ ptlrpc_handle_rs(struct ptlrpc_reply_state *rs) exp = rs->rs_export; - LASSERT (rs->rs_difficult); - LASSERT (rs->rs_scheduled); - LASSERT (list_empty(&rs->rs_list)); + LASSERT(rs->rs_difficult); + LASSERT(rs->rs_scheduled); + LASSERT(list_empty(&rs->rs_list)); spin_lock(&exp->exp_lock); /* Noop if removed already */ - list_del_init (&rs->rs_exp_list); + list_del_init(&rs->rs_exp_list); spin_unlock(&exp->exp_lock); /* The disk commit callback holds exp_uncommitted_replies_lock while it @@ -2113,9 +2113,9 @@ ptlrpc_handle_rs(struct ptlrpc_reply_state *rs) /* Off the net */ spin_unlock(&rs->rs_lock); - class_export_put (exp); + class_export_put(exp); rs->rs_export = NULL; - ptlrpc_rs_decref (rs); + ptlrpc_rs_decref(rs); if (atomic_dec_and_test(&svcpt->scp_nreps_difficult) && svc->srv_is_stopping) wake_up_all(&svcpt->scp_waitq); From cb68dd2d0df552fe6c18da86eceda461ec0cc7c8 Mon Sep 17 00:00:00 2001 From: Kristina Martsenko Date: Mon, 11 Nov 2013 21:34:59 +0200 Subject: [PATCH 177/238] staging: lustre: ptlrpc: clean up whitespace around braces Fix the following types of checkpatch errors to comply with coding style: ERROR: space required after that close brace '}' ERROR: space required before the open brace '{' Also change "if (x == 0)" into "if (!x)" on one line, to avoid introducing new checkpatch issues. Signed-off-by: Kristina Martsenko Reviewed-by: Sarah Sharp Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/client.c | 3 ++- drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c | 8 +++++--- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 3 ++- drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 8 ++++---- drivers/staging/lustre/lustre/ptlrpc/service.c | 2 +- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index 07d34b4a074e..a5b5caabf2e8 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -1596,7 +1596,8 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) continue; spin_lock(&imp->imp_lock); - if (ptlrpc_import_delay_req(imp, req, &status)){ + if (ptlrpc_import_delay_req(imp, req, + &status)) { /* put on delay list - only if we wait * recovery finished - before send */ list_del_init(&req->rq_list); diff --git a/drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c b/drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c index 92543f81eacf..8ce6271a5daa 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c +++ b/drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c @@ -804,7 +804,8 @@ int gss_cli_ctx_verify(struct ptlrpc_cli_ctx *ctx, case PTLRPC_GSS_PROC_DATA: pack_bulk = ghdr->gh_flags & LUSTRE_GSS_PACK_BULK; - if (!req->rq_early && !equi(req->rq_pack_bulk == 1, pack_bulk)){ + if (!req->rq_early && + !equi(req->rq_pack_bulk == 1, pack_bulk)) { CERROR("%s bulk flag in reply\n", req->rq_pack_bulk ? "missing" : "unexpected"); return -EPROTO; @@ -1009,7 +1010,8 @@ int gss_cli_ctx_unseal(struct ptlrpc_cli_ctx *ctx, case PTLRPC_GSS_PROC_DATA: pack_bulk = ghdr->gh_flags & LUSTRE_GSS_PACK_BULK; - if (!req->rq_early && !equi(req->rq_pack_bulk == 1, pack_bulk)){ + if (!req->rq_early && + !equi(req->rq_pack_bulk == 1, pack_bulk)) { CERROR("%s bulk flag in reply\n", req->rq_pack_bulk ? "missing" : "unexpected"); return -EPROTO; @@ -1979,7 +1981,7 @@ int gss_svc_handle_init(struct ptlrpc_request *req, return SECSVC_DROP; } - if (reqbuf->lm_bufcount < 3 || reqbuf->lm_bufcount > 4){ + if (reqbuf->lm_bufcount < 3 || reqbuf->lm_bufcount > 4) { CERROR("Invalid bufcount %d\n", reqbuf->lm_bufcount); return SECSVC_DROP; } diff --git a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c index 6eb06ed8b5ad..9b18b68ba1fe 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c +++ b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c @@ -66,7 +66,8 @@ static int ptl_send_buf(lnet_handle_md_t *mdh, void *base, int len, md.eq_handle = ptlrpc_eq_h; if (unlikely(ack == LNET_ACK_REQ && - OBD_FAIL_CHECK_ORSET(OBD_FAIL_PTLRPC_ACK, OBD_FAIL_ONCE))){ + OBD_FAIL_CHECK_ORSET(OBD_FAIL_PTLRPC_ACK, + OBD_FAIL_ONCE))) { /* don't ask for the ack to simulate failing client */ ack = LNET_NOACK_REQ; } diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h index 9bd3f84b33b7..5d0749cc4b0f 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h @@ -80,10 +80,10 @@ void ptlrpc_lprocfs_rpc_sent(struct ptlrpc_request *req, long amount); void ptlrpc_lprocfs_do_request_stat(struct ptlrpc_request *req, long q_usec, long work_usec); #else -#define ptlrpc_lprocfs_register_service(params...) do{}while (0) -#define ptlrpc_lprocfs_unregister_service(params...) do{}while (0) -#define ptlrpc_lprocfs_rpc_sent(params...) do{}while (0) -#define ptlrpc_lprocfs_do_request_stat(params...) do{}while (0) +#define ptlrpc_lprocfs_register_service(params...) do {} while (0) +#define ptlrpc_lprocfs_unregister_service(params...) do {} while (0) +#define ptlrpc_lprocfs_rpc_sent(params...) do {} while (0) +#define ptlrpc_lprocfs_do_request_stat(params...) do {} while (0) #endif /* LPROCFS */ /* NRS */ diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index b21ea83e75cd..544a030a2a2e 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -1268,7 +1268,7 @@ static int ptlrpc_at_send_early_reply(struct ptlrpc_request *req) return -ETIMEDOUT; } - if ((lustre_msghdr_get_flags(req->rq_reqmsg) & MSGHDR_AT_SUPPORT) == 0){ + if (!(lustre_msghdr_get_flags(req->rq_reqmsg) & MSGHDR_AT_SUPPORT)) { DEBUG_REQ(D_INFO, req, "Wanted to ask client for more time, " "but no AT support"); return -ENOSYS; From 7b8633dea27a5b4197d17e01e37ec07ed7837dc8 Mon Sep 17 00:00:00 2001 From: Kristina Martsenko Date: Mon, 11 Nov 2013 21:35:00 +0200 Subject: [PATCH 178/238] staging: lustre: ptlrpc: remove an unnecessary semicolon Remove an unnecessary semicolon and remove a space before another one to comply with coding style. Fix the following type of checkpatch warning: WARNING: space prohibited before semicolon Signed-off-by: Kristina Martsenko Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index a5b5caabf2e8..777f9314d6c4 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -200,7 +200,7 @@ void __ptlrpc_free_bulk(struct ptlrpc_bulk_desc *desc, int unpin) class_import_put(desc->bd_import); if (unpin) { - for (i = 0; i < desc->bd_iov_count ; i++) + for (i = 0; i < desc->bd_iov_count; i++) page_cache_release(desc->bd_iov[i].kiov_page); } @@ -1039,7 +1039,7 @@ static int ptlrpc_import_delay_req(struct obd_import *imp, *status = -EIO; } else if (req->rq_send_state == LUSTRE_IMP_CONNECTING && imp->imp_state == LUSTRE_IMP_CONNECTING) { - /* allow CONNECT even if import is invalid */ ; + /* allow CONNECT even if import is invalid */ if (atomic_read(&imp->imp_inval_count) != 0) { DEBUG_REQ(D_ERROR, req, "invalidate in flight"); *status = -EIO; From 2a763282df786aa8470a1e52c653dc3dcc574ed7 Mon Sep 17 00:00:00 2001 From: Kristina Martsenko Date: Mon, 11 Nov 2013 21:35:01 +0200 Subject: [PATCH 179/238] staging: lustre: ptlrpc: convert spaces to tabs Fix the following type of checkpatch warning to comply with coding style: WARNING: please, no spaces at the start of a line Signed-off-by: Kristina Martsenko Reviewed-by: Sarah Sharp Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/gss/gss_asn1.h | 6 +++--- drivers/staging/lustre/lustre/ptlrpc/gss/gss_err.h | 10 +++++----- drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_asn1.h b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_asn1.h index c70eb00796f9..bdfd83880422 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_asn1.h +++ b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_asn1.h @@ -64,9 +64,9 @@ #define G_REFLECT (-2045022961L) #define G_WRONG_TOKID (-2045022960L) -#define g_OID_equal(o1,o2) \ - (((o1)->len == (o2)->len) && \ - (memcmp((o1)->data,(o2)->data,(int) (o1)->len) == 0)) +#define g_OID_equal(o1, o2) \ + (((o1)->len == (o2)->len) && \ + (memcmp((o1)->data, (o2)->data, (int) (o1)->len) == 0)) __u32 g_verify_token_header(rawobj_t *mech, int *body_size, diff --git a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_err.h b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_err.h index 13425796fa33..37ec101e14e5 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_err.h +++ b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_err.h @@ -106,14 +106,14 @@ typedef unsigned int OM_uint32; * evaluates its argument only once. */ #define GSS_CALLING_ERROR(x) \ - ((x) & (GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET)) + ((x) & (GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET)) #define GSS_ROUTINE_ERROR(x) \ - ((x) & (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET)) + ((x) & (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET)) #define GSS_SUPPLEMENTARY_INFO(x) \ - ((x) & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET)) + ((x) & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET)) #define GSS_ERROR(x) \ - ((x) & ((GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET) | \ - (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))) + ((x) & ((GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET) | \ + (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))) /* * Now the actual status code definitions diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index 09d832b59f97..65451f77e782 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -46,8 +46,8 @@ struct ll_rpc_opcode { - __u32 opcode; - const char *opname; + __u32 opcode; + const char *opname; } ll_rpc_opcode_table[LUSTRE_MAX_OPCODES] = { { OST_REPLY, "ost_reply" }, { OST_GETATTR, "ost_getattr" }, @@ -137,8 +137,8 @@ struct ll_rpc_opcode { }; struct ll_eopcode { - __u32 opcode; - const char *opname; + __u32 opcode; + const char *opname; } ll_eopcode_table[EXTRA_LAST_OPC] = { { LDLM_GLIMPSE_ENQUEUE, "ldlm_glimpse_enqueue" }, { LDLM_PLAIN_ENQUEUE, "ldlm_plain_enqueue" }, From 998d2766fe2027be201d1571524e235672157bc2 Mon Sep 17 00:00:00 2001 From: Kristina Martsenko Date: Mon, 11 Nov 2013 21:35:02 +0200 Subject: [PATCH 180/238] staging: lustre: ptlrpc: remove whitespace before a newline Fix the following type of checkpatch warning: WARNING: unnecessary whitespace before a quoted newline Signed-off-by: Kristina Martsenko Reviewed-by: Sarah Sharp Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/pinger.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c index 9b18b68ba1fe..5f2aa7aa17ea 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c +++ b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c @@ -715,7 +715,7 @@ int ptlrpc_register_rqbd(struct ptlrpc_request_buffer_desc *rqbd) if (rc == 0) return (0); - CERROR("LNetMDAttach failed: %d; \n", rc); + CERROR("LNetMDAttach failed: %d;\n", rc); LASSERT(rc == -ENOMEM); rc = LNetMEUnlink(me_h); LASSERT(rc == 0); diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c b/drivers/staging/lustre/lustre/ptlrpc/pinger.c index 5dec771d70ee..a084eb1b1aca 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c @@ -576,7 +576,7 @@ int ptlrpc_del_timeout_client(struct list_head *obd_list, break; } } - LASSERTF(ti != NULL, "ti is NULL ! \n"); + LASSERTF(ti != NULL, "ti is NULL !\n"); if (list_empty(&ti->ti_obd_list)) { list_del(&ti->ti_chain); OBD_FREE_PTR(ti); From 532118c080368bd15dcafd1e6054f4b5a343941d Mon Sep 17 00:00:00 2001 From: Kristina Martsenko Date: Mon, 11 Nov 2013 21:35:03 +0200 Subject: [PATCH 181/238] staging: lustre: ptlrpc: fix indentation Fix the following type of checkpatch warning to comply with coding style: WARNING: suspect code indent for conditional statements Also join a debug string split across lines, as it was on the same lines as the other changes anyway. And reformat some comments in the kernel coding style for the same reason. Signed-off-by: Kristina Martsenko Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/import.c | 26 ++++++++++--------- .../lustre/lustre/ptlrpc/pack_generic.c | 4 +-- .../staging/lustre/lustre/ptlrpc/service.c | 21 ++++++++------- 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c index ac8813e4ce2d..283173a2fe23 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/import.c +++ b/drivers/staging/lustre/lustre/ptlrpc/import.c @@ -72,15 +72,15 @@ static void __import_set_state(struct obd_import *imp, } /* A CLOSED import should remain so. */ -#define IMPORT_SET_STATE_NOLOCK(imp, state) \ -do { \ - if (imp->imp_state != LUSTRE_IMP_CLOSED) { \ - CDEBUG(D_HA, "%p %s: changing import state from %s to %s\n", \ - imp, obd2cli_tgt(imp->imp_obd), \ - ptlrpc_import_state_name(imp->imp_state), \ - ptlrpc_import_state_name(state)); \ - __import_set_state(imp, state); \ - } \ +#define IMPORT_SET_STATE_NOLOCK(imp, state) \ +do { \ + if (imp->imp_state != LUSTRE_IMP_CLOSED) { \ + CDEBUG(D_HA, "%p %s: changing import state from %s to %s\n", \ + imp, obd2cli_tgt(imp->imp_obd), \ + ptlrpc_import_state_name(imp->imp_state), \ + ptlrpc_import_state_name(state)); \ + __import_set_state(imp, state); \ + } \ } while (0) #define IMPORT_SET_STATE(imp, state) \ @@ -1135,9 +1135,11 @@ out: if (ocd && (ocd->ocd_connect_flags & OBD_CONNECT_VERSION) && (ocd->ocd_version != LUSTRE_VERSION_CODE)) { - /* Actually servers are only supposed to refuse - connection from liblustre clients, so we should - never see this from VFS context */ + /* + * Actually servers are only supposed to refuse + * connection from liblustre clients, so we + * should never see this from VFS context + */ LCONSOLE_ERROR_MSG(0x16a, "Server %s version " "(%d.%d.%d.%d)" " refused connection from this client " diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c index 94abb51cf642..4659314a1865 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c @@ -636,8 +636,8 @@ static inline int lustre_unpack_ptlrpc_body_v2(struct ptlrpc_request *req, } if ((pb->pb_version & ~LUSTRE_VERSION_MASK) != PTLRPC_MSG_VERSION) { - CERROR("wrong lustre_msg version %08x\n", pb->pb_version); - return -EINVAL; + CERROR("wrong lustre_msg version %08x\n", pb->pb_version); + return -EINVAL; } if (!inout) diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index 544a030a2a2e..2b10d6dea2d9 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -1115,8 +1115,10 @@ static int ptlrpc_check_req(struct ptlrpc_request *req) } if (unlikely(req->rq_export->exp_obd && req->rq_export->exp_obd->obd_fail)) { - /* Failing over, don't handle any more reqs, send - error response instead. */ + /* + * Failing over, don't handle any more reqs, send + * error response instead. + */ CDEBUG(D_RPCTRACE, "Dropping req %p for failed obd %s\n", req, req->rq_export->exp_obd->obd_name); rc = -ENODEV; @@ -1967,13 +1969,14 @@ put_conn: lu_context_fini(&request->rq_session); if (unlikely(cfs_time_current_sec() > request->rq_deadline)) { - DEBUG_REQ(D_WARNING, request, "Request took longer " - "than estimated ("CFS_DURATION_T":"CFS_DURATION_T"s);" - " client may timeout.", - cfs_time_sub(request->rq_deadline, - request->rq_arrival_time.tv_sec), - cfs_time_sub(cfs_time_current_sec(), - request->rq_deadline)); + DEBUG_REQ(D_WARNING, request, + "Request took longer than estimated (" + CFS_DURATION_T":"CFS_DURATION_T + "s); client may timeout.", + cfs_time_sub(request->rq_deadline, + request->rq_arrival_time.tv_sec), + cfs_time_sub(cfs_time_current_sec(), + request->rq_deadline)); } do_gettimeofday(&work_end); From 7f1d15a819f01c0abc5763c522d537b9e3ef40fe Mon Sep 17 00:00:00 2001 From: Kristina Martsenko Date: Mon, 11 Nov 2013 21:35:04 +0200 Subject: [PATCH 182/238] staging: lustre: ptlrpc: fix label indentation Fix the following type of checkpatch warning to comply with coding style: WARNING: labels should not be indented Signed-off-by: Kristina Martsenko Reviewed-by: Sarah Sharp Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index 777f9314d6c4..d90efe408414 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -1753,7 +1753,7 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) ptlrpc_rqphase_move(req, RQ_PHASE_INTERPRET); - interpret: +interpret: LASSERT(req->rq_phase == RQ_PHASE_INTERPRET); /* This moves to "unregistering" phase we need to wait for From e630a6bcf18079b2ab6b03d55c9757e8ef6656b6 Mon Sep 17 00:00:00 2001 From: Kristina Martsenko Date: Mon, 11 Nov 2013 22:42:32 +0200 Subject: [PATCH 183/238] staging: lustre: fix checkpatch issue regarding pointer coding style Fix the following checkpatch error: ERROR: "(foo*)" should be "(foo *)" Signed-off-by: Kristina Martsenko Reviewed-by: Peter P Waskiewicz Jr Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdecho/echo_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index 1fb0ac4e920d..9b2dea292363 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -1106,7 +1106,7 @@ static struct echo_object *cl_echo_object_find(struct echo_device *d, /* coverity[overrun-buffer-val] */ obj = cl_object_find(env, echo_dev2cl(d), fid, &conf->eoc_cl); if (IS_ERR(obj)) - GOTO(out, eco = (void*)obj); + GOTO(out, eco = (void *)obj); eco = cl2echo_obj(obj); if (eco->eo_deleted) { From 89580e3792ee74b4873efbfdd5e2df1c3ae01d67 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Fri, 15 Nov 2013 00:13:03 +0800 Subject: [PATCH 184/238] staging/lustre/llite: restore ll_fiemap It was removed by coan by mistake when first porting the code. Signed-off-by: Peng Tao Signed-off-by: Andreas Dilger Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/file.c | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index fb85a58db058..c5b721c9cffd 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -2628,6 +2628,38 @@ int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat) return ll_getattr_it(mnt, de, &it, stat); } +int ll_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, + __u64 start, __u64 len) +{ + int rc; + size_t num_bytes; + struct ll_user_fiemap *fiemap; + unsigned int extent_count = fieinfo->fi_extents_max; + + num_bytes = sizeof(*fiemap) + (extent_count * + sizeof(struct ll_fiemap_extent)); + OBD_ALLOC_LARGE(fiemap, num_bytes); + + if (fiemap == NULL) + return -ENOMEM; + + fiemap->fm_flags = fieinfo->fi_flags; + fiemap->fm_extent_count = fieinfo->fi_extents_max; + fiemap->fm_start = start; + fiemap->fm_length = len; + memcpy(&fiemap->fm_extents[0], fieinfo->fi_extents_start, + sizeof(struct ll_fiemap_extent)); + + rc = ll_do_fiemap(inode, fiemap, num_bytes); + + fieinfo->fi_flags = fiemap->fm_flags; + fieinfo->fi_extents_mapped = fiemap->fm_mapped_extents; + memcpy(fieinfo->fi_extents_start, &fiemap->fm_extents[0], + fiemap->fm_mapped_extents * sizeof(struct ll_fiemap_extent)); + + OBD_FREE_LARGE(fiemap, num_bytes); + return rc; +} struct posix_acl * ll_get_acl(struct inode *inode, int type) { @@ -2740,6 +2772,7 @@ struct inode_operations ll_file_inode_operations = { .getxattr = ll_getxattr, .listxattr = ll_listxattr, .removexattr = ll_removexattr, + .fiemap = ll_fiemap, .get_acl = ll_get_acl, }; From c8d6036ae972c7ccfa7cc24e0601f38ccef1bc0b Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Fri, 15 Nov 2013 00:13:04 +0800 Subject: [PATCH 185/238] staging/lustre: remove lu_target.h It is only needed by server code. Signed-off-by: Peng Tao Signed-off-by: Andreas Dilger Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/include/lu_target.h | 91 ------------------- 1 file changed, 91 deletions(-) delete mode 100644 drivers/staging/lustre/lustre/include/lu_target.h diff --git a/drivers/staging/lustre/lustre/include/lu_target.h b/drivers/staging/lustre/lustre/include/lu_target.h deleted file mode 100644 index 8d48cf4e27ee..000000000000 --- a/drivers/staging/lustre/lustre/include/lu_target.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - * - * Copyright (c) 2011, 2012, Intel Corporation. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ - -#ifndef _LUSTRE_LU_TARGET_H -#define _LUSTRE_LU_TARGET_H - -#include -#include - -struct lu_target { - struct obd_device *lut_obd; - struct dt_device *lut_bottom; - /** last_rcvd file */ - struct dt_object *lut_last_rcvd; - /* transaction callbacks */ - struct dt_txn_callback lut_txn_cb; - /** server data in last_rcvd file */ - struct lr_server_data lut_lsd; - /** Server last transaction number */ - __u64 lut_last_transno; - /** Lock protecting last transaction number */ - spinlock_t lut_translock; - /** Lock protecting client bitmap */ - spinlock_t lut_client_bitmap_lock; - /** Bitmap of known clients */ - unsigned long *lut_client_bitmap; -}; - -typedef void (*tgt_cb_t)(struct lu_target *lut, __u64 transno, - void *data, int err); -struct tgt_commit_cb { - tgt_cb_t tgt_cb_func; - void *tgt_cb_data; -}; - -void tgt_boot_epoch_update(struct lu_target *lut); -int tgt_last_commit_cb_add(struct thandle *th, struct lu_target *lut, - struct obd_export *exp, __u64 transno); -int tgt_new_client_cb_add(struct thandle *th, struct obd_export *exp); -int tgt_init(const struct lu_env *env, struct lu_target *lut, - struct obd_device *obd, struct dt_device *dt); -void tgt_fini(const struct lu_env *env, struct lu_target *lut); -int tgt_client_alloc(struct obd_export *exp); -void tgt_client_free(struct obd_export *exp); -int tgt_client_del(const struct lu_env *env, struct obd_export *exp); -int tgt_client_add(const struct lu_env *env, struct obd_export *exp, int); -int tgt_client_new(const struct lu_env *env, struct obd_export *exp); -int tgt_client_data_read(const struct lu_env *env, struct lu_target *tg, - struct lsd_client_data *lcd, loff_t *off, int index); -int tgt_client_data_write(const struct lu_env *env, struct lu_target *tg, - struct lsd_client_data *lcd, loff_t *off, struct thandle *th); -int tgt_server_data_read(const struct lu_env *env, struct lu_target *tg); -int tgt_server_data_write(const struct lu_env *env, struct lu_target *tg, - struct thandle *th); -int tgt_server_data_update(const struct lu_env *env, struct lu_target *tg, int sync); -int tgt_truncate_last_rcvd(const struct lu_env *env, struct lu_target *tg, loff_t off); - -#endif /* __LUSTRE_LU_TARGET_H */ From 28706a78d8fbbce3a2bb0c187063d6540a7e4a88 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Fri, 15 Nov 2013 00:13:05 +0800 Subject: [PATCH 186/238] staging/lustre: remove llog_server.c It is only used by server. Signed-off-by: Peng Tao Signed-off-by: Andreas Dilger Signed-off-by: Greg Kroah-Hartman --- .../lustre/lustre/include/lustre_net.h | 9 - .../staging/lustre/lustre/ldlm/ldlm_lockd.c | 39 -- drivers/staging/lustre/lustre/ptlrpc/Makefile | 2 +- .../lustre/lustre/ptlrpc/llog_server.c | 450 ------------------ 4 files changed, 1 insertion(+), 499 deletions(-) delete mode 100644 drivers/staging/lustre/lustre/ptlrpc/llog_server.c diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 72edf01b58a2..91f28e363be2 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -3470,15 +3470,6 @@ static inline void ptlrpc_lprocfs_brw(struct ptlrpc_request *req, int bytes) {} #endif /** @} */ -/* ptlrpc/llog_server.c */ -int llog_origin_handle_open(struct ptlrpc_request *req); -int llog_origin_handle_destroy(struct ptlrpc_request *req); -int llog_origin_handle_prev_block(struct ptlrpc_request *req); -int llog_origin_handle_next_block(struct ptlrpc_request *req); -int llog_origin_handle_read_header(struct ptlrpc_request *req); -int llog_origin_handle_close(struct ptlrpc_request *req); -int llog_origin_handle_cancel(struct ptlrpc_request *req); - /* ptlrpc/llog_client.c */ extern struct llog_operations llog_client_ops; diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c index fde9bcd1d48d..40c58b7ae2ff 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c @@ -597,45 +597,6 @@ static int ldlm_callback_handler(struct ptlrpc_request *req) rc = ldlm_handle_setinfo(req); ldlm_callback_reply(req, rc); return 0; - case OBD_LOG_CANCEL: /* remove this eventually - for 1.4.0 compat */ - CERROR("shouldn't be handling OBD_LOG_CANCEL on DLM thread\n"); - req_capsule_set(&req->rq_pill, &RQF_LOG_CANCEL); - if (OBD_FAIL_CHECK(OBD_FAIL_OBD_LOG_CANCEL_NET)) - return 0; - rc = llog_origin_handle_cancel(req); - if (OBD_FAIL_CHECK(OBD_FAIL_OBD_LOG_CANCEL_REP)) - return 0; - ldlm_callback_reply(req, rc); - return 0; - case LLOG_ORIGIN_HANDLE_CREATE: - req_capsule_set(&req->rq_pill, &RQF_LLOG_ORIGIN_HANDLE_CREATE); - if (OBD_FAIL_CHECK(OBD_FAIL_OBD_LOGD_NET)) - return 0; - rc = llog_origin_handle_open(req); - ldlm_callback_reply(req, rc); - return 0; - case LLOG_ORIGIN_HANDLE_NEXT_BLOCK: - req_capsule_set(&req->rq_pill, - &RQF_LLOG_ORIGIN_HANDLE_NEXT_BLOCK); - if (OBD_FAIL_CHECK(OBD_FAIL_OBD_LOGD_NET)) - return 0; - rc = llog_origin_handle_next_block(req); - ldlm_callback_reply(req, rc); - return 0; - case LLOG_ORIGIN_HANDLE_READ_HEADER: - req_capsule_set(&req->rq_pill, - &RQF_LLOG_ORIGIN_HANDLE_READ_HEADER); - if (OBD_FAIL_CHECK(OBD_FAIL_OBD_LOGD_NET)) - return 0; - rc = llog_origin_handle_read_header(req); - ldlm_callback_reply(req, rc); - return 0; - case LLOG_ORIGIN_HANDLE_CLOSE: - if (OBD_FAIL_CHECK(OBD_FAIL_OBD_LOGD_NET)) - return 0; - rc = llog_origin_handle_close(req); - ldlm_callback_reply(req, rc); - return 0; case OBD_QC_CALLBACK: req_capsule_set(&req->rq_pill, &RQF_QC_CALLBACK); if (OBD_FAIL_CHECK(OBD_FAIL_OBD_QC_CALLBACK_NET)) diff --git a/drivers/staging/lustre/lustre/ptlrpc/Makefile b/drivers/staging/lustre/lustre/ptlrpc/Makefile index 6d78b80487f2..2ec0c24ff38b 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/Makefile +++ b/drivers/staging/lustre/lustre/ptlrpc/Makefile @@ -10,7 +10,7 @@ ldlm_objs += $(LDLM)ldlm_pool.o ldlm_objs += $(LDLM)interval_tree.o ptlrpc_objs := client.o recover.o connection.o niobuf.o pack_generic.o ptlrpc_objs += events.o ptlrpc_module.o service.o pinger.o -ptlrpc_objs += llog_net.o llog_client.o llog_server.o import.o ptlrpcd.o +ptlrpc_objs += llog_net.o llog_client.o import.o ptlrpcd.o ptlrpc_objs += pers.o lproc_ptlrpc.o wiretest.o layout.o ptlrpc_objs += sec.o sec_bulk.o sec_gc.o sec_config.o sec_lproc.o ptlrpc_objs += sec_null.o sec_plain.o nrs.o nrs_fifo.o diff --git a/drivers/staging/lustre/lustre/ptlrpc/llog_server.c b/drivers/staging/lustre/lustre/ptlrpc/llog_server.c deleted file mode 100644 index af9d2ac391ef..000000000000 --- a/drivers/staging/lustre/lustre/ptlrpc/llog_server.c +++ /dev/null @@ -1,450 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - * - * Copyright (c) 2011, 2012, Intel Corporation. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - * - * lustre/ptlrpc/llog_server.c - * - * remote api for llog - server side - * - * Author: Andreas Dilger - */ - -#define DEBUG_SUBSYSTEM S_LOG - - -#include -#include -#include -#include - -#if defined(LUSTRE_LOG_SERVER) -static int llog_origin_close(const struct lu_env *env, struct llog_handle *lgh) -{ - if (lgh->lgh_hdr != NULL && lgh->lgh_hdr->llh_flags & LLOG_F_IS_CAT) - return llog_cat_close(env, lgh); - else - return llog_close(env, lgh); -} - -/* Only open is supported, no new llog can be created remotely */ -int llog_origin_handle_open(struct ptlrpc_request *req) -{ - struct obd_export *exp = req->rq_export; - struct obd_device *obd = exp->exp_obd; - struct obd_device *disk_obd; - struct lvfs_run_ctxt saved; - struct llog_handle *loghandle; - struct llogd_body *body; - struct llog_logid *logid = NULL; - struct llog_ctxt *ctxt; - char *name = NULL; - int rc; - - body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY); - if (body == NULL) - return -EFAULT; - - if (ostid_id(&body->lgd_logid.lgl_oi) > 0) - logid = &body->lgd_logid; - - if (req_capsule_field_present(&req->rq_pill, &RMF_NAME, RCL_CLIENT)) { - name = req_capsule_client_get(&req->rq_pill, &RMF_NAME); - if (name == NULL) - return -EFAULT; - CDEBUG(D_INFO, "%s: opening log %s\n", obd->obd_name, name); - } - - ctxt = llog_get_context(obd, body->lgd_ctxt_idx); - if (ctxt == NULL) { - CDEBUG(D_WARNING, "%s: no ctxt. group=%p idx=%d name=%s\n", - obd->obd_name, &obd->obd_olg, body->lgd_ctxt_idx, name); - return -ENODEV; - } - disk_obd = ctxt->loc_exp->exp_obd; - push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL); - - rc = llog_open(req->rq_svc_thread->t_env, ctxt, &loghandle, logid, - name, LLOG_OPEN_EXISTS); - if (rc) - GOTO(out_pop, rc); - - rc = req_capsule_server_pack(&req->rq_pill); - if (rc) - GOTO(out_close, rc = -ENOMEM); - - body = req_capsule_server_get(&req->rq_pill, &RMF_LLOGD_BODY); - body->lgd_logid = loghandle->lgh_id; - -out_close: - llog_origin_close(req->rq_svc_thread->t_env, loghandle); -out_pop: - pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL); - llog_ctxt_put(ctxt); - return rc; -} -EXPORT_SYMBOL(llog_origin_handle_open); - -int llog_origin_handle_destroy(struct ptlrpc_request *req) -{ - struct obd_device *disk_obd; - struct lvfs_run_ctxt saved; - struct llogd_body *body; - struct llog_logid *logid = NULL; - struct llog_ctxt *ctxt; - int rc; - - body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY); - if (body == NULL) - return -EFAULT; - - if (ostid_id(&body->lgd_logid.lgl_oi) > 0) - logid = &body->lgd_logid; - - if (!(body->lgd_llh_flags & LLOG_F_IS_PLAIN)) - CERROR("%s: wrong llog flags %x\n", - req->rq_export->exp_obd->obd_name, body->lgd_llh_flags); - - ctxt = llog_get_context(req->rq_export->exp_obd, body->lgd_ctxt_idx); - if (ctxt == NULL) - return -ENODEV; - - disk_obd = ctxt->loc_exp->exp_obd; - push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL); - - rc = req_capsule_server_pack(&req->rq_pill); - /* erase only if no error and logid is valid */ - if (rc == 0) - rc = llog_erase(req->rq_svc_thread->t_env, ctxt, logid, NULL); - pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL); - llog_ctxt_put(ctxt); - return rc; -} -EXPORT_SYMBOL(llog_origin_handle_destroy); - -int llog_origin_handle_next_block(struct ptlrpc_request *req) -{ - struct obd_device *disk_obd; - struct llog_handle *loghandle; - struct llogd_body *body; - struct llogd_body *repbody; - struct lvfs_run_ctxt saved; - struct llog_ctxt *ctxt; - __u32 flags; - void *ptr; - int rc; - - body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY); - if (body == NULL) - return -EFAULT; - - ctxt = llog_get_context(req->rq_export->exp_obd, body->lgd_ctxt_idx); - if (ctxt == NULL) - return -ENODEV; - - disk_obd = ctxt->loc_exp->exp_obd; - push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL); - - rc = llog_open(req->rq_svc_thread->t_env, ctxt, &loghandle, - &body->lgd_logid, NULL, LLOG_OPEN_EXISTS); - if (rc) - GOTO(out_pop, rc); - - flags = body->lgd_llh_flags; - rc = llog_init_handle(req->rq_svc_thread->t_env, loghandle, flags, - NULL); - if (rc) - GOTO(out_close, rc); - - req_capsule_set_size(&req->rq_pill, &RMF_EADATA, RCL_SERVER, - LLOG_CHUNK_SIZE); - rc = req_capsule_server_pack(&req->rq_pill); - if (rc) - GOTO(out_close, rc = -ENOMEM); - - repbody = req_capsule_server_get(&req->rq_pill, &RMF_LLOGD_BODY); - *repbody = *body; - - ptr = req_capsule_server_get(&req->rq_pill, &RMF_EADATA); - rc = llog_next_block(req->rq_svc_thread->t_env, loghandle, - &repbody->lgd_saved_index, repbody->lgd_index, - &repbody->lgd_cur_offset, ptr, LLOG_CHUNK_SIZE); - if (rc) - GOTO(out_close, rc); -out_close: - llog_origin_close(req->rq_svc_thread->t_env, loghandle); -out_pop: - pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL); - llog_ctxt_put(ctxt); - return rc; -} -EXPORT_SYMBOL(llog_origin_handle_next_block); - -int llog_origin_handle_prev_block(struct ptlrpc_request *req) -{ - struct llog_handle *loghandle; - struct llogd_body *body; - struct llogd_body *repbody; - struct obd_device *disk_obd; - struct lvfs_run_ctxt saved; - struct llog_ctxt *ctxt; - __u32 flags; - void *ptr; - int rc; - - body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY); - if (body == NULL) - return -EFAULT; - - ctxt = llog_get_context(req->rq_export->exp_obd, body->lgd_ctxt_idx); - if (ctxt == NULL) - return -ENODEV; - - disk_obd = ctxt->loc_exp->exp_obd; - push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL); - - rc = llog_open(req->rq_svc_thread->t_env, ctxt, &loghandle, - &body->lgd_logid, NULL, LLOG_OPEN_EXISTS); - if (rc) - GOTO(out_pop, rc); - - flags = body->lgd_llh_flags; - rc = llog_init_handle(req->rq_svc_thread->t_env, loghandle, flags, - NULL); - if (rc) - GOTO(out_close, rc); - - req_capsule_set_size(&req->rq_pill, &RMF_EADATA, RCL_SERVER, - LLOG_CHUNK_SIZE); - rc = req_capsule_server_pack(&req->rq_pill); - if (rc) - GOTO(out_close, rc = -ENOMEM); - - repbody = req_capsule_server_get(&req->rq_pill, &RMF_LLOGD_BODY); - *repbody = *body; - - ptr = req_capsule_server_get(&req->rq_pill, &RMF_EADATA); - rc = llog_prev_block(req->rq_svc_thread->t_env, loghandle, - body->lgd_index, ptr, LLOG_CHUNK_SIZE); - if (rc) - GOTO(out_close, rc); - -out_close: - llog_origin_close(req->rq_svc_thread->t_env, loghandle); -out_pop: - pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL); - llog_ctxt_put(ctxt); - return rc; -} -EXPORT_SYMBOL(llog_origin_handle_prev_block); - -int llog_origin_handle_read_header(struct ptlrpc_request *req) -{ - struct obd_device *disk_obd; - struct llog_handle *loghandle; - struct llogd_body *body; - struct llog_log_hdr *hdr; - struct lvfs_run_ctxt saved; - struct llog_ctxt *ctxt; - __u32 flags; - int rc; - - body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY); - if (body == NULL) - return -EFAULT; - - ctxt = llog_get_context(req->rq_export->exp_obd, body->lgd_ctxt_idx); - if (ctxt == NULL) - return -ENODEV; - - disk_obd = ctxt->loc_exp->exp_obd; - push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL); - - rc = llog_open(req->rq_svc_thread->t_env, ctxt, &loghandle, - &body->lgd_logid, NULL, LLOG_OPEN_EXISTS); - if (rc) - GOTO(out_pop, rc); - - /* - * llog_init_handle() reads the llog header - */ - flags = body->lgd_llh_flags; - rc = llog_init_handle(req->rq_svc_thread->t_env, loghandle, flags, - NULL); - if (rc) - GOTO(out_close, rc); - flags = loghandle->lgh_hdr->llh_flags; - - rc = req_capsule_server_pack(&req->rq_pill); - if (rc) - GOTO(out_close, rc = -ENOMEM); - - hdr = req_capsule_server_get(&req->rq_pill, &RMF_LLOG_LOG_HDR); - *hdr = *loghandle->lgh_hdr; -out_close: - llog_origin_close(req->rq_svc_thread->t_env, loghandle); -out_pop: - pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL); - llog_ctxt_put(ctxt); - return rc; -} -EXPORT_SYMBOL(llog_origin_handle_read_header); - -int llog_origin_handle_close(struct ptlrpc_request *req) -{ - /* Nothing to do */ - return 0; -} -EXPORT_SYMBOL(llog_origin_handle_close); - -int llog_origin_handle_cancel(struct ptlrpc_request *req) -{ - int num_cookies, rc = 0, err, i, failed = 0; - struct obd_device *disk_obd; - struct llog_cookie *logcookies; - struct llog_ctxt *ctxt = NULL; - struct lvfs_run_ctxt saved; - struct llog_handle *cathandle; - struct inode *inode; - void *handle; - - logcookies = req_capsule_client_get(&req->rq_pill, &RMF_LOGCOOKIES); - num_cookies = req_capsule_get_size(&req->rq_pill, &RMF_LOGCOOKIES, - RCL_CLIENT) / sizeof(*logcookies); - if (logcookies == NULL || num_cookies == 0) { - DEBUG_REQ(D_HA, req, "No llog cookies sent"); - return -EFAULT; - } - - ctxt = llog_get_context(req->rq_export->exp_obd, - logcookies->lgc_subsys); - if (ctxt == NULL) - return -ENODEV; - - disk_obd = ctxt->loc_exp->exp_obd; - push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL); - for (i = 0; i < num_cookies; i++, logcookies++) { - cathandle = ctxt->loc_handle; - LASSERT(cathandle != NULL); - inode = cathandle->lgh_file->f_dentry->d_inode; - - handle = fsfilt_start_log(disk_obd, inode, - FSFILT_OP_CANCEL_UNLINK, NULL, 1); - if (IS_ERR(handle)) { - CERROR("fsfilt_start_log() failed: %ld\n", - PTR_ERR(handle)); - GOTO(pop_ctxt, rc = PTR_ERR(handle)); - } - - rc = llog_cat_cancel_records(req->rq_svc_thread->t_env, - cathandle, 1, logcookies); - - /* - * Do not raise -ENOENT errors for resent rpcs. This rec already - * might be killed. - */ - if (rc == -ENOENT && - (lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT)) { - /* - * Do not change this message, reply-single.sh test_59b - * expects to find this in log. - */ - CDEBUG(D_RPCTRACE, "RESENT cancel req %p - ignored\n", - req); - rc = 0; - } else if (rc == 0) { - CDEBUG(D_RPCTRACE, "Canceled %d llog-records\n", - num_cookies); - } - - err = fsfilt_commit(disk_obd, inode, handle, 0); - if (err) { - CERROR("Error committing transaction: %d\n", err); - if (!rc) - rc = err; - failed++; - GOTO(pop_ctxt, rc); - } else if (rc) - failed++; - } - GOTO(pop_ctxt, rc); -pop_ctxt: - pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL); - if (rc) - CERROR("Cancel %d of %d llog-records failed: %d\n", - failed, num_cookies, rc); - - llog_ctxt_put(ctxt); - return rc; -} -EXPORT_SYMBOL(llog_origin_handle_cancel); - -#else /* !__KERNEL__ */ -int llog_origin_handle_open(struct ptlrpc_request *req) -{ - LBUG(); - return 0; -} - -int llog_origin_handle_destroy(struct ptlrpc_request *req) -{ - LBUG(); - return 0; -} - -int llog_origin_handle_next_block(struct ptlrpc_request *req) -{ - LBUG(); - return 0; -} -int llog_origin_handle_prev_block(struct ptlrpc_request *req) -{ - LBUG(); - return 0; -} -int llog_origin_handle_read_header(struct ptlrpc_request *req) -{ - LBUG(); - return 0; -} -int llog_origin_handle_close(struct ptlrpc_request *req) -{ - LBUG(); - return 0; -} -int llog_origin_handle_cancel(struct ptlrpc_request *req) -{ - LBUG(); - return 0; -} -#endif From ea1db0814cbcf5e68ec948723d519f6a04e5e3f3 Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Fri, 15 Nov 2013 00:13:08 +0800 Subject: [PATCH 187/238] staging/lustre/llite: use correct FID in ll_och_fill() When ll_intent_file_open() is called on a file with a stale dentry, ll_och_fill() may incorrectly use the FID from the struct ll_inode_info rather than the FID from the response body (which is the correct FID for the close). Fix this, remove the ll_inode_info parameter from ll_och_fill(), and move the call to ll_ioepoch_open() from ll_och_fill() to ll_local_open(). Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3233 Lustre-change: http://review.whamcloud.com/6695 Signed-off-by: John L. Hammond Reviewed-by: Fan Yong Reviewed-by: Mike Pershin Reviewed-by: Oleg Drokin Signed-off-by: Peng Tao Signed-off-by: Andreas Dilger Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/file.c | 25 +++++++--------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index c5b721c9cffd..bfa6b0e97fff 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -431,22 +431,17 @@ void ll_ioepoch_open(struct ll_inode_info *lli, __u64 ioepoch) } } -static int ll_och_fill(struct obd_export *md_exp, struct ll_inode_info *lli, - struct lookup_intent *it, struct obd_client_handle *och) +static int ll_och_fill(struct obd_export *md_exp, struct lookup_intent *it, + struct obd_client_handle *och) { struct ptlrpc_request *req = it->d.lustre.it_data; struct mdt_body *body; - LASSERT(och); - body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY); - LASSERT(body != NULL); /* reply already checked out */ - - memcpy(&och->och_fh, &body->handle, sizeof(body->handle)); + och->och_fh = body->handle; + och->och_fid = body->fid1; och->och_magic = OBD_CLIENT_HANDLE_MAGIC; - och->och_fid = lli->lli_fid; och->och_flags = it->it_flags; - ll_ioepoch_open(lli, body->ioepoch); return md_set_open_replay_data(md_exp, och, req); } @@ -466,15 +461,12 @@ int ll_local_open(struct file *file, struct lookup_intent *it, struct mdt_body *body; int rc; - rc = ll_och_fill(ll_i2sbi(inode)->ll_md_exp, lli, it, och); - if (rc) + rc = ll_och_fill(ll_i2sbi(inode)->ll_md_exp, it, och); + if (rc != 0) return rc; body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY); - if ((it->it_flags & FMODE_WRITE) && - (body->valid & OBD_MD_FLSIZE)) - CDEBUG(D_INODE, "Epoch "LPU64" opened on "DFID"\n", - lli->lli_ioepoch, PFID(&lli->lli_fid)); + ll_ioepoch_open(lli, body->ioepoch); } LUSTRE_FPRIVATE(file) = fd; @@ -1482,8 +1474,7 @@ int ll_release_openhandle(struct dentry *dentry, struct lookup_intent *it) if (!och) GOTO(out, rc = -ENOMEM); - ll_och_fill(ll_i2sbi(inode)->ll_md_exp, - ll_i2info(inode), it, och); + ll_och_fill(ll_i2sbi(inode)->ll_md_exp, it, och); rc = ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp, inode, och); From aa363d6a1c2c3e8260d9ec3f88bbecebcf276b2c Mon Sep 17 00:00:00 2001 From: James Simmons Date: Fri, 15 Nov 2013 00:13:15 +0800 Subject: [PATCH 188/238] staging/lustre/autoconf: remove vectored fops tests file_operations.readv/writev have been removed since v2.6.19 We can remove the test and the dead code. Lustre-change: http://review.whamcloud.com/5343 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2800 Signed-off-by: Jeff Mahoney Signed-off-by: James Simmons Reviewed-by: Bob Glossman Reviewed-by: Christopher J. Morrone Reviewed-by: Oleg Drokin Signed-off-by: Peng Tao Signed-off-by: Andreas Dilger Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/file.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index bfa6b0e97fff..17064b4f6176 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -2699,17 +2699,12 @@ int ll_inode_permission(struct inode *inode, int mask) return rc; } -#define READ_METHOD aio_read -#define READ_FUNCTION ll_file_aio_read -#define WRITE_METHOD aio_write -#define WRITE_FUNCTION ll_file_aio_write - /* -o localflock - only provides locally consistent flock locks */ struct file_operations ll_file_operations = { .read = ll_file_read, - .READ_METHOD = READ_FUNCTION, + .aio_read = ll_file_aio_read, .write = ll_file_write, - .WRITE_METHOD = WRITE_FUNCTION, + .aio_write = ll_file_aio_write, .unlocked_ioctl = ll_file_ioctl, .open = ll_file_open, .release = ll_file_release, @@ -2722,9 +2717,9 @@ struct file_operations ll_file_operations = { struct file_operations ll_file_operations_flock = { .read = ll_file_read, - .READ_METHOD = READ_FUNCTION, + .aio_read = ll_file_aio_read, .write = ll_file_write, - .WRITE_METHOD = WRITE_FUNCTION, + .aio_write = ll_file_aio_write, .unlocked_ioctl = ll_file_ioctl, .open = ll_file_open, .release = ll_file_release, @@ -2740,9 +2735,9 @@ struct file_operations ll_file_operations_flock = { /* These are for -o noflock - to return ENOSYS on flock calls */ struct file_operations ll_file_operations_noflock = { .read = ll_file_read, - .READ_METHOD = READ_FUNCTION, + .aio_read = ll_file_aio_read, .write = ll_file_write, - .WRITE_METHOD = WRITE_FUNCTION, + .aio_write = ll_file_aio_write, .unlocked_ioctl = ll_file_ioctl, .open = ll_file_open, .release = ll_file_release, From c7c99012dd68feaebd7f6e0df9251bb62e184e9a Mon Sep 17 00:00:00 2001 From: James Simmons Date: Fri, 15 Nov 2013 00:13:16 +0800 Subject: [PATCH 189/238] staging/lustre/autoconf: remove LIBCFS_HAVE_IS_COMPAT_TASK test is_compat_task has been defined on all arches since v2.6.29. We can remove the test and dead code. Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2800 Lustre-change: http://review.whamcloud.com/5393 Signed-off-by: Jeff Mahoney Signed-off-by: James Simmons Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin Signed-off-by: Peng Tao Signed-off-by: Andreas Dilger Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/include/linux/libcfs/curproc.h | 1 - .../lustre/lustre/libcfs/linux/linux-curproc.c | 13 ------------- .../staging/lustre/lustre/llite/llite_internal.h | 3 ++- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/curproc.h b/drivers/staging/lustre/include/linux/libcfs/curproc.h index de8e35b796ab..507d16b9213c 100644 --- a/drivers/staging/lustre/include/linux/libcfs/curproc.h +++ b/drivers/staging/lustre/include/linux/libcfs/curproc.h @@ -61,7 +61,6 @@ int cfs_curproc_groups_nr(void); */ /* check if task is running in compat mode.*/ -int current_is_32bit(void); #define current_pid() (current->pid) #define current_comm() (current->comm) int cfs_get_environ(const char *key, char *value, int *val_len); diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c index 0bf8e5d87f1a..a2ef64c3403d 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c @@ -140,18 +140,6 @@ int cfs_capable(cfs_cap_t cap) return capable(cfs_cap_unpack(cap)); } -/* Check if task is running in 32-bit API mode, for the purpose of - * userspace binary interfaces. On 32-bit Linux this is (unfortunately) - * always true, even if the application is using LARGEFILE64 and 64-bit - * APIs, because Linux provides no way for the filesystem to know if it - * is called via 32-bit or 64-bit APIs. Other clients may vary. On - * 64-bit systems, this will only be true if the binary is calling a - * 32-bit system call. */ -int current_is_32bit(void) -{ - return is_compat_task(); -} - static int cfs_access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write) { @@ -311,7 +299,6 @@ EXPORT_SYMBOL(cfs_cap_raised); EXPORT_SYMBOL(cfs_curproc_cap_pack); EXPORT_SYMBOL(cfs_curproc_cap_unpack); EXPORT_SYMBOL(cfs_capable); -EXPORT_SYMBOL(current_is_32bit); /* * Local variables: diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index fb7cbb5fa124..d37c183109ba 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -46,6 +46,7 @@ #include #include #include +#include #ifndef FMODE_EXEC #define FMODE_EXEC 0 @@ -643,7 +644,7 @@ static inline int ll_need_32bit_api(struct ll_sb_info *sbi) #if BITS_PER_LONG == 32 return 1; #else - return unlikely(current_is_32bit() || (sbi->ll_flags & LL_SBI_32BIT_API)); + return unlikely(is_compat_task() || (sbi->ll_flags & LL_SBI_32BIT_API)); #endif } From 2a0f0eacd7d75e8fa79d642aa85bcf7c681187a7 Mon Sep 17 00:00:00 2001 From: Li Xi Date: Fri, 15 Nov 2013 00:13:17 +0800 Subject: [PATCH 190/238] staging/lustre/llog: fix return value of llog_alloc_handle llog_open() calls llog_alloc_handle() taking NULL as the error return value. But llog_alloc_handle() returns ERR_PTR(-ENOMEM) instead when error. Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3470 Lustre-change: http://review.whamcloud.com/6644 Signed-off-by: Li Xi Reviewed-by: Mike Pershin Reviewed-by: Andreas Dilger Signed-off-by: Peng Tao Signed-off-by: Andreas Dilger Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/llog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdclass/llog.c b/drivers/staging/lustre/lustre/obdclass/llog.c index 0cb44287502b..b4dad344b72a 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog.c +++ b/drivers/staging/lustre/lustre/obdclass/llog.c @@ -62,7 +62,7 @@ struct llog_handle *llog_alloc_handle(void) OBD_ALLOC_PTR(loghandle); if (loghandle == NULL) - return ERR_PTR(-ENOMEM); + return NULL; init_rwsem(&loghandle->lgh_lock); spin_lock_init(&loghandle->lgh_hdr_lock); From f3b2734f4bcc0093f1e7b49d658ae8353c86d32d Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Fri, 15 Nov 2013 00:13:18 +0800 Subject: [PATCH 191/238] staging/lustre/lov: convert magic to host-endian in lov_dump_lmm() In lov_dump_lmm(), convert the lmm_magic from little-endian to host-endian byte order before the switch statement, as the other lov_dump_xxx() and lov_verify_xxx() functions already do. Remove the unused macro LMM_ASSERT(). Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3297 Lustre-change: http://review.whamcloud.com/6290 Signed-off-by: John L. Hammond Reviewed-by: Li Wei Reviewed-by: Andreas Dilger Signed-off-by: Peng Tao Signed-off-by: Andreas Dilger Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lov/lov_pack.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index ec6f6e0572ae..27ed27e6fa6a 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -105,24 +105,22 @@ void lov_dump_lmm(int level, void *lmm) { int magic; - magic = ((struct lov_mds_md_v1 *)(lmm))->lmm_magic; + magic = le32_to_cpu(((struct lov_mds_md *)lmm)->lmm_magic); switch (magic) { case LOV_MAGIC_V1: - return lov_dump_lmm_v1(level, (struct lov_mds_md_v1 *)(lmm)); + lov_dump_lmm_v1(level, (struct lov_mds_md_v1 *)lmm); + break; case LOV_MAGIC_V3: - return lov_dump_lmm_v3(level, (struct lov_mds_md_v3 *)(lmm)); + lov_dump_lmm_v3(level, (struct lov_mds_md_v3 *)lmm); + break; default: - CERROR("Cannot recognize lmm_magic %x", magic); + CDEBUG(level, "unrecognized lmm_magic %x, assuming %x\n", + magic, LOV_MAGIC_V1); + lov_dump_lmm_common(level, lmm); + break; } - return; } -#define LMM_ASSERT(test) \ -do { \ - if (!(test)) lov_dump_lmm(D_ERROR, lmm); \ - LASSERT(test); /* so we know what assertion failed */ \ -} while (0) - /* Pack LOV object metadata for disk storage. It is packed in LE byte * order and is opaque to the networking layer. * From 86c17c0b5eed0bb4e1e61d5889a80f56bf59c93f Mon Sep 17 00:00:00 2001 From: Himangi Saraogi Date: Sat, 2 Nov 2013 10:05:30 +0530 Subject: [PATCH 192/238] staging:dwc2:hcd_queue.c : cleanups to the microframe scheduler code This patch takes up the task mentioned in the TODO file of dwc2 to cleanup the microframe scheduler code. The while(!done) loops have been replaced with appropriate for loops and unnecessary variables like done and ret have been removed. Signed-off-by: Himangi Saraogi Acked-by: Paul Zimmerman Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dwc2/hcd_queue.c | 88 +++++++++++--------------------- 1 file changed, 29 insertions(+), 59 deletions(-) diff --git a/drivers/staging/dwc2/hcd_queue.c b/drivers/staging/dwc2/hcd_queue.c index f200f1f6e1c6..2f68fbc08827 100644 --- a/drivers/staging/dwc2/hcd_queue.c +++ b/drivers/staging/dwc2/hcd_queue.c @@ -344,25 +344,17 @@ void dwc2_hcd_init_usecs(struct dwc2_hsotg *hsotg) static int dwc2_find_single_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) { unsigned short utime = qh->usecs; - int done = 0; - int i = 0; - int ret = -1; + int i; - while (!done) { + for (i = 0; i < 8; i++) { /* At the start hsotg->frame_usecs[i] = max_uframe_usecs[i] */ if (utime <= hsotg->frame_usecs[i]) { hsotg->frame_usecs[i] -= utime; qh->frame_usecs[i] += utime; - ret = i; - done = 1; - } else { - i++; - if (i == 8) - done = 1; + return i; } } - - return ret; + return -1; } /* @@ -372,21 +364,14 @@ static int dwc2_find_multi_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) { unsigned short utime = qh->usecs; unsigned short xtime; - int t_left = utime; - int done = 0; - int i = 0; + int t_left; + int i; int j; - int ret = -1; + int k; - while (!done) { - if (hsotg->frame_usecs[i] <= 0) { - i++; - if (i == 8) { - ret = -1; - done = 1; - } + for (i = 0; i < 8; i++) { + if (hsotg->frame_usecs[i] <= 0) continue; - } /* * we need n consecutive slots so use j as a start slot @@ -400,50 +385,35 @@ static int dwc2_find_multi_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) */ if (xtime + hsotg->frame_usecs[j] < utime) { if (hsotg->frame_usecs[j] < - max_uframe_usecs[j]) { - ret = -1; - break; - } + max_uframe_usecs[j]) + continue; } if (xtime >= utime) { - ret = i; - break; + t_left = utime; + for (k = i; k < 8; k++) { + t_left -= hsotg->frame_usecs[k]; + if (t_left <= 0) { + qh->frame_usecs[k] += + hsotg->frame_usecs[k] + + t_left; + hsotg->frame_usecs[k] = -t_left; + return i; + } else { + qh->frame_usecs[k] += + hsotg->frame_usecs[k]; + hsotg->frame_usecs[k] = 0; + } + } } /* add the frame time to x time */ xtime += hsotg->frame_usecs[j]; /* we must have a fully available next frame or break */ if (xtime < utime && - hsotg->frame_usecs[j] == max_uframe_usecs[j]) { - ret = -1; - break; - } - } - if (ret >= 0) { - t_left = utime; - for (j = i; t_left > 0 && j < 8; j++) { - t_left -= hsotg->frame_usecs[j]; - if (t_left <= 0) { - qh->frame_usecs[j] += - hsotg->frame_usecs[j] + t_left; - hsotg->frame_usecs[j] = -t_left; - ret = i; - done = 1; - } else { - qh->frame_usecs[j] += - hsotg->frame_usecs[j]; - hsotg->frame_usecs[j] = 0; - } - } - } else { - i++; - if (i == 8) { - ret = -1; - done = 1; - } + hsotg->frame_usecs[j] == max_uframe_usecs[j]) + continue; } } - - return ret; + return -1; } static int dwc2_find_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) From d3a8a4e2d5e42e80625d734bb2bc5f71ecd9ffc1 Mon Sep 17 00:00:00 2001 From: Jinshan Xiong Date: Tue, 19 Nov 2013 21:23:41 +0800 Subject: [PATCH 193/238] staging/lustre/hsm: Implementation of exclusive open Proposed way to do exclusive open: 0. First of all, we have to perform most of the work in kernel space; 1. Client exclusively opens the file with IT_RELEASE_OPEN. 1.1 exclusive open means the open will fail if the file is being opened by somebody else; 2. the MDT will handle IT_RELEASE as follows: 2.1 Revoke OPEN_LOCK on this file, just request EX mode of MDS_INODELOCK_OPEN lock and release it; 2.2 Acquire a rwsem, say open_rwsem, with write mode before trying to the file; for the normal open, it should acquire read mode of open_rwsem; 2.3 Check if the file is already being opened by others, if not return with -EBUSY; 2.4 Check if the file can be released; 2.5 Set a special flag in struct mdt_file_data to mark this open is exclusive; 2.5 Release open rwsem. >From now on, if the file is opened by others, it will mark mdt_file_data that the exclusive open is broken. 3. Client: if IT_RELEASE_OPEN is finished successfully, and do followings: 3.1 Acquire full PW or EX extent lock to flush dirty cache; 3.2 Pack the handle of layout lock, data version and other attars; 3.3 Close the file with IT_RELEASE_CLOSE. 4. Back to MDT to handle IT_RELEASE CLOSE: 4.1 Grab the open_rwsem 4.2 Check if the exclusive open has ever been broken, in that case, the RELEASE process will fail; 4.3 Verify the data version matches archive; 4.4 Grab EX layout lock 4.5 Swap the layout 4.6 Release EX layout lock 4.7 Close the exclusive open Basically we avoid granting EX layout lock back to client and introduce exclusive open so that we know it if the file has ever being accessed. I hope this can simplify things a little bit. Also, exclusive open can be used to implement file lease. In this patch, a framework of lease is implemented. However, only exclusive lease is supported right now. To apply a lease, MDS_OPEN_LEASE must be set to open the file, EX mode open lock is returned to the client side to hold a lease. From that time on, if this file is opened again by other processes, the open lock will be revoked so the client who holds the lease will know the lease is already broken by checking that open lock. To release a lease, normal close is used. The client will revoke the open lock before sending CLOSE request. Lease can be applied in two ways. ll_lease_open()/close() can be called directly if the lease holder is in kernel space; or if the lease holder lives in user space, it has to open the file first and then use ioctl() with command LL_IOC_SET_LEASE to apply a lease. The lease holder has to poll the lease status itself. Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2919 Lustre-change: http://review.whamcloud.com/6730 Signed-off-by: Jinshan Xiong Signed-off-by: John L. Hammond Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: Peng Tao Signed-off-by: Andreas Dilger Signed-off-by: Greg Kroah-Hartman --- .../lustre/include/linux/lustre_intent.h | 2 +- .../lustre/lustre/include/lustre/lustre_idl.h | 5 + .../lustre/include/lustre/lustre_user.h | 3 + .../lustre/lustre/include/lustre_dlm_flags.h | 12 +- .../lustre/lustre/include/lustre_lib.h | 11 +- .../staging/lustre/lustre/ldlm/ldlm_lock.c | 5 + .../staging/lustre/lustre/ldlm/ldlm_request.c | 4 +- drivers/staging/lustre/lustre/llite/file.c | 297 +++++++++++++++++- .../lustre/lustre/llite/llite_internal.h | 11 +- .../staging/lustre/lustre/mdc/mdc_internal.h | 2 +- drivers/staging/lustre/lustre/mdc/mdc_lib.c | 7 +- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 40 ++- 12 files changed, 370 insertions(+), 29 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_intent.h b/drivers/staging/lustre/lustre/include/linux/lustre_intent.h index b10ddfa7df29..c491d52d86a2 100644 --- a/drivers/staging/lustre/lustre/include/linux/lustre_intent.h +++ b/drivers/staging/lustre/lustre/include/linux/lustre_intent.h @@ -52,8 +52,8 @@ struct lustre_intent_data { struct lookup_intent { int it_op; - int it_flags; int it_create_mode; + __u64 it_flags; union { struct lustre_intent_data lustre; } d; diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index 5ca18d016014..e592a0e0f794 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -2120,6 +2120,7 @@ extern void lustre_swab_generic_32s (__u32 *val); #define DISP_ENQ_OPEN_REF 0x00800000 #define DISP_ENQ_CREATE_REF 0x01000000 #define DISP_OPEN_LOCK 0x02000000 +#define DISP_OPEN_LEASE 0x04000000 /* INODE LOCK PARTS */ #define MDS_INODELOCK_LOOKUP 0x000001 /* dentry, mode, owner, group */ @@ -2373,6 +2374,10 @@ extern void lustre_swab_mdt_rec_setattr (struct mdt_rec_setattr *sa); * hsm restore) */ #define MDS_OPEN_VOLATILE 0400000000000ULL /* File is volatile = created unlinked */ +#define MDS_OPEN_LEASE 01000000000000ULL /* Open the file and grant lease + * delegation, succeed if it's not + * being opened with conflict mode. + */ /* permission for create non-directory file */ #define MAY_CREATE (1 << 7) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h index c7bd4473a1d0..9fd1d3ba2a63 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h @@ -245,6 +245,9 @@ struct ost_id { #define LL_IOC_LMV_GETSTRIPE _IOWR('f', 241, struct lmv_user_md) #define LL_IOC_REMOVE_ENTRY _IOWR('f', 242, __u64) +#define LL_IOC_SET_LEASE _IOWR('f', 243, long) +#define LL_IOC_GET_LEASE _IO('f', 244) + #define LL_STATFS_LMV 1 #define LL_STATFS_LOV 2 #define LL_STATFS_NODELAY 4 diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h b/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h index 8c34d9d4d258..f8b4ba749683 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h @@ -35,7 +35,7 @@ #ifndef LDLM_ALL_FLAGS_MASK /** l_flags bits marked as "all_flags" bits */ -#define LDLM_FL_ALL_FLAGS_MASK 0x007FFFFFC08F132FULL +#define LDLM_FL_ALL_FLAGS_MASK 0x00FFFFFFC08F132FULL /** l_flags bits marked as "ast" bits */ #define LDLM_FL_AST_MASK 0x0000000080000000ULL @@ -53,7 +53,7 @@ #define LDLM_FL_INHERIT_MASK 0x0000000000800000ULL /** l_flags bits marked as "local_only" bits */ -#define LDLM_FL_LOCAL_ONLY_MASK 0x007FFFFF00000000ULL +#define LDLM_FL_LOCAL_ONLY_MASK 0x00FFFFFF00000000ULL /** l_flags bits marked as "on_wire" bits */ #define LDLM_FL_ON_WIRE_MASK 0x00000000C08F132FULL @@ -358,6 +358,12 @@ #define ldlm_set_ns_srv(_l) LDLM_SET_FLAG(( _l), 1ULL << 54) #define ldlm_clear_ns_srv(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 54) +/** Flag whether this lock can be reused. Used by exclusive open. */ +#define LDLM_FL_EXCL 0x0080000000000000ULL /* bit 55 */ +#define ldlm_is_excl(_l) LDLM_TEST_FLAG((_l), 1ULL << 55) +#define ldlm_set_excl(_l) LDLM_SET_FLAG((_l), 1ULL << 55) +#define ldlm_clear_excl(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 55) + /** test for ldlm_lock flag bit set */ #define LDLM_TEST_FLAG(_l, _b) (((_l)->l_flags & (_b)) != 0) @@ -414,6 +420,7 @@ static int hf_lustre_ldlm_fl_server_lock = -1; static int hf_lustre_ldlm_fl_res_locked = -1; static int hf_lustre_ldlm_fl_waited = -1; static int hf_lustre_ldlm_fl_ns_srv = -1; +static int hf_lustre_ldlm_fl_excl = -1; const value_string lustre_ldlm_flags_vals[] = { {LDLM_FL_LOCK_CHANGED, "LDLM_FL_LOCK_CHANGED"}, @@ -454,6 +461,7 @@ const value_string lustre_ldlm_flags_vals[] = { {LDLM_FL_RES_LOCKED, "LDLM_FL_RES_LOCKED"}, {LDLM_FL_WAITED, "LDLM_FL_WAITED"}, {LDLM_FL_NS_SRV, "LDLM_FL_NS_SRV"}, + {LDLM_FL_EXCL, "LDLM_FL_EXCL"}, { 0, NULL } }; #endif /* WIRESHARK_COMPILE */ diff --git a/drivers/staging/lustre/lustre/include/lustre_lib.h b/drivers/staging/lustre/lustre/include/lustre_lib.h index b6fd03e45bb7..609a090484a6 100644 --- a/drivers/staging/lustre/lustre/include/lustre_lib.h +++ b/drivers/staging/lustre/lustre/include/lustre_lib.h @@ -81,11 +81,12 @@ struct client_obd *client_conn2cli(struct lustre_handle *conn); struct md_open_data; struct obd_client_handle { - struct lustre_handle och_fh; - struct lu_fid och_fid; - struct md_open_data *och_mod; - __u32 och_magic; - fmode_t och_flags; + struct lustre_handle och_fh; + struct lu_fid och_fid; + struct md_open_data *och_mod; + struct lustre_handle och_lease_handle; /* open lock for lease */ + __u32 och_magic; + fmode_t och_flags; }; #define OBD_CLIENT_HANDLE_MAGIC 0xd15ea5ed diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 3900a69742fc..ef826e90df03 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -1129,6 +1129,11 @@ static struct ldlm_lock *search_queue(struct list_head *queue, if (lock == old_lock) break; + /* Check if this lock can be matched. + * Used by LU-2919(exclusive open) for open lease lock */ + if (ldlm_is_excl(lock)) + continue; + /* llite sometimes wants to match locks that will be * canceled when their users drop, but we allow it to match * if it passes in CBPENDING and the lock still has users. diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index dcc278403136..1e2c0dd67569 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -910,7 +910,7 @@ int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp, lock->l_conn_export = exp; lock->l_export = NULL; lock->l_blocking_ast = einfo->ei_cb_bl; - lock->l_flags |= (*flags & LDLM_FL_NO_LRU); + lock->l_flags |= (*flags & (LDLM_FL_NO_LRU | LDLM_FL_EXCL)); /* lock not sent to server yet */ @@ -1333,7 +1333,7 @@ int ldlm_cli_cancel(struct lustre_handle *lockh, } rc = ldlm_cli_cancel_local(lock); - if (rc == LDLM_FL_LOCAL_ONLY) { + if (rc == LDLM_FL_LOCAL_ONLY || cancel_flags & LCF_LOCAL) { LDLM_LOCK_RELEASE(lock); return 0; } diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 17064b4f6176..971409ed52e7 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -241,6 +241,24 @@ int ll_md_close(struct obd_export *md_exp, struct inode *inode, if (unlikely(fd->fd_flags & LL_FILE_GROUP_LOCKED)) ll_put_grouplock(inode, file, fd->fd_grouplock.cg_gid); + if (fd->fd_lease_och != NULL) { + bool lease_broken; + + /* Usually the lease is not released when the + * application crashed, we need to release here. */ + rc = ll_lease_close(fd->fd_lease_och, inode, &lease_broken); + CDEBUG(rc ? D_ERROR : D_INODE, "Clean up lease "DFID" %d/%d\n", + PFID(&lli->lli_fid), rc, lease_broken); + + fd->fd_lease_och = NULL; + } + + if (fd->fd_och != NULL) { + rc = ll_close_inode_openhandle(md_exp, inode, fd->fd_och); + fd->fd_och = NULL; + GOTO(out, rc); + } + /* Let's see if we have good enough OPEN lock on the file and if we can skip talking to MDS */ if (file->f_dentry->d_inode) { /* Can this ever be false? */ @@ -277,6 +295,7 @@ int ll_md_close(struct obd_export *md_exp, struct inode *inode, file, file->f_dentry, file->f_dentry->d_name.name); } +out: LUSTRE_FPRIVATE(file) = NULL; ll_file_data_put(fd); ll_capa_close(inode); @@ -440,6 +459,7 @@ static int ll_och_fill(struct obd_export *md_exp, struct lookup_intent *it, body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY); och->och_fh = body->handle; och->och_fid = body->fid1; + och->och_lease_handle.cookie = it->d.lustre.it_lock_handle; och->och_magic = OBD_CLIENT_HANDLE_MAGIC; och->och_flags = it->it_flags; @@ -471,7 +491,7 @@ int ll_local_open(struct file *file, struct lookup_intent *it, LUSTRE_FPRIVATE(file) = fd; ll_readahead_init(inode, &fd->fd_ras); - fd->fd_omode = it->it_flags; + fd->fd_omode = it->it_flags & (FMODE_READ | FMODE_WRITE | FMODE_EXEC); return 0; } @@ -673,6 +693,196 @@ out_openerr: return rc; } +static int ll_md_blocking_lease_ast(struct ldlm_lock *lock, + struct ldlm_lock_desc *desc, void *data, int flag) +{ + int rc; + struct lustre_handle lockh; + + switch (flag) { + case LDLM_CB_BLOCKING: + ldlm_lock2handle(lock, &lockh); + rc = ldlm_cli_cancel(&lockh, LCF_ASYNC); + if (rc < 0) { + CDEBUG(D_INODE, "ldlm_cli_cancel: %d\n", rc); + return rc; + } + break; + case LDLM_CB_CANCELING: + /* do nothing */ + break; + } + return 0; +} + +/** + * Acquire a lease and open the file. + */ +struct obd_client_handle *ll_lease_open(struct inode *inode, struct file *file, + fmode_t fmode) +{ + struct lookup_intent it = { .it_op = IT_OPEN }; + struct ll_sb_info *sbi = ll_i2sbi(inode); + struct md_op_data *op_data; + struct ptlrpc_request *req; + struct lustre_handle old_handle = { 0 }; + struct obd_client_handle *och = NULL; + int rc; + int rc2; + + if (fmode != FMODE_WRITE && fmode != FMODE_READ) + return ERR_PTR(-EINVAL); + + if (file != NULL) { + struct ll_inode_info *lli = ll_i2info(inode); + struct ll_file_data *fd = LUSTRE_FPRIVATE(file); + struct obd_client_handle **och_p; + __u64 *och_usecount; + + if (!(fmode & file->f_mode) || (file->f_mode & FMODE_EXEC)) + return ERR_PTR(-EPERM); + + /* Get the openhandle of the file */ + rc = -EBUSY; + mutex_lock(&lli->lli_och_mutex); + if (fd->fd_lease_och != NULL) { + mutex_unlock(&lli->lli_och_mutex); + return ERR_PTR(rc); + } + + if (fd->fd_och == NULL) { + if (file->f_mode & FMODE_WRITE) { + LASSERT(lli->lli_mds_write_och != NULL); + och_p = &lli->lli_mds_write_och; + och_usecount = &lli->lli_open_fd_write_count; + } else { + LASSERT(lli->lli_mds_read_och != NULL); + och_p = &lli->lli_mds_read_och; + och_usecount = &lli->lli_open_fd_read_count; + } + if (*och_usecount == 1) { + fd->fd_och = *och_p; + *och_p = NULL; + *och_usecount = 0; + rc = 0; + } + } + mutex_unlock(&lli->lli_och_mutex); + if (rc < 0) /* more than 1 opener */ + return ERR_PTR(rc); + + LASSERT(fd->fd_och != NULL); + old_handle = fd->fd_och->och_fh; + } + + OBD_ALLOC_PTR(och); + if (och == NULL) + return ERR_PTR(-ENOMEM); + + op_data = ll_prep_md_op_data(NULL, inode, inode, NULL, 0, 0, + LUSTRE_OPC_ANY, NULL); + if (IS_ERR(op_data)) + GOTO(out, rc = PTR_ERR(op_data)); + + /* To tell the MDT this openhandle is from the same owner */ + op_data->op_handle = old_handle; + + it.it_flags = fmode | MDS_OPEN_LOCK | MDS_OPEN_BY_FID | MDS_OPEN_LEASE; + rc = md_intent_lock(sbi->ll_md_exp, op_data, NULL, 0, &it, 0, &req, + ll_md_blocking_lease_ast, + /* LDLM_FL_NO_LRU: To not put the lease lock into LRU list, otherwise + * it can be cancelled which may mislead applications that the lease is + * broken; + * LDLM_FL_EXCL: Set this flag so that it won't be matched by normal + * open in ll_md_blocking_ast(). Otherwise as ll_md_blocking_lease_ast + * doesn't deal with openhandle, so normal openhandle will be leaked. */ + LDLM_FL_NO_LRU | LDLM_FL_EXCL); + ll_finish_md_op_data(op_data); + if (req != NULL) { + ptlrpc_req_finished(req); + it_clear_disposition(&it, DISP_ENQ_COMPLETE); + } + if (rc < 0) + GOTO(out_release_it, rc); + + if (it_disposition(&it, DISP_LOOKUP_NEG)) + GOTO(out_release_it, rc = -ENOENT); + + rc = it_open_error(DISP_OPEN_OPEN, &it); + if (rc) + GOTO(out_release_it, rc); + + LASSERT(it_disposition(&it, DISP_ENQ_OPEN_REF)); + ll_och_fill(sbi->ll_md_exp, &it, och); + + if (!it_disposition(&it, DISP_OPEN_LEASE)) /* old server? */ + GOTO(out_close, rc = -EOPNOTSUPP); + + /* already get lease, handle lease lock */ + ll_set_lock_data(sbi->ll_md_exp, inode, &it, NULL); + if (it.d.lustre.it_lock_mode == 0 || + it.d.lustre.it_lock_bits != MDS_INODELOCK_OPEN) { + /* open lock must return for lease */ + CERROR(DFID "lease granted but no open lock, %d/%llu.\n", + PFID(ll_inode2fid(inode)), it.d.lustre.it_lock_mode, + it.d.lustre.it_lock_bits); + GOTO(out_close, rc = -EPROTO); + } + + ll_intent_release(&it); + return och; + +out_close: + rc2 = ll_close_inode_openhandle(sbi->ll_md_exp, inode, och); + if (rc2) + CERROR("Close openhandle returned %d\n", rc2); + + /* cancel open lock */ + if (it.d.lustre.it_lock_mode != 0) { + ldlm_lock_decref_and_cancel(&och->och_lease_handle, + it.d.lustre.it_lock_mode); + it.d.lustre.it_lock_mode = 0; + } +out_release_it: + ll_intent_release(&it); +out: + OBD_FREE_PTR(och); + return ERR_PTR(rc); +} +EXPORT_SYMBOL(ll_lease_open); + +/** + * Release lease and close the file. + * It will check if the lease has ever broken. + */ +int ll_lease_close(struct obd_client_handle *och, struct inode *inode, + bool *lease_broken) +{ + struct ldlm_lock *lock; + bool cancelled = true; + int rc; + + lock = ldlm_handle2lock(&och->och_lease_handle); + if (lock != NULL) { + lock_res_and_lock(lock); + cancelled = ldlm_is_cancel(lock); + unlock_res_and_lock(lock); + ldlm_lock_put(lock); + } + + CDEBUG(D_INODE, "lease for "DFID" broken? %d\n", + PFID(&ll_i2info(inode)->lli_fid), cancelled); + + if (!cancelled) + ldlm_cli_cancel(&och->och_lease_handle, 0); + if (lease_broken != NULL) + *lease_broken = cancelled; + + rc = ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp, inode, och); + return rc; +} +EXPORT_SYMBOL(ll_lease_close); + /* Fills the obdo with the attributes for the lsm */ static int ll_lsm_getattr(struct lov_stripe_md *lsm, struct obd_export *exp, struct obd_capa *capa, struct obdo *obdo, @@ -2066,6 +2276,91 @@ long ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) OBD_FREE_PTR(hca); return rc; } + case LL_IOC_SET_LEASE: { + struct ll_inode_info *lli = ll_i2info(inode); + struct obd_client_handle *och = NULL; + bool lease_broken; + fmode_t mode = 0; + + switch (arg) { + case F_WRLCK: + if (!(file->f_mode & FMODE_WRITE)) + return -EPERM; + mode = FMODE_WRITE; + break; + case F_RDLCK: + if (!(file->f_mode & FMODE_READ)) + return -EPERM; + mode = FMODE_READ; + break; + case F_UNLCK: + mutex_lock(&lli->lli_och_mutex); + if (fd->fd_lease_och != NULL) { + och = fd->fd_lease_och; + fd->fd_lease_och = NULL; + } + mutex_unlock(&lli->lli_och_mutex); + + if (och != NULL) { + mode = och->och_flags & + (FMODE_READ|FMODE_WRITE); + rc = ll_lease_close(och, inode, &lease_broken); + if (rc == 0 && lease_broken) + mode = 0; + } else { + rc = -ENOLCK; + } + + /* return the type of lease or error */ + return rc < 0 ? rc : (int)mode; + default: + return -EINVAL; + } + + CDEBUG(D_INODE, "Set lease with mode %d\n", mode); + + /* apply for lease */ + och = ll_lease_open(inode, file, mode); + if (IS_ERR(och)) + return PTR_ERR(och); + + rc = 0; + mutex_lock(&lli->lli_och_mutex); + if (fd->fd_lease_och == NULL) { + fd->fd_lease_och = och; + och = NULL; + } + mutex_unlock(&lli->lli_och_mutex); + if (och != NULL) { + /* impossible now that only excl is supported for now */ + ll_lease_close(och, inode, &lease_broken); + rc = -EBUSY; + } + return rc; + } + case LL_IOC_GET_LEASE: { + struct ll_inode_info *lli = ll_i2info(inode); + struct ldlm_lock *lock = NULL; + + rc = 0; + mutex_lock(&lli->lli_och_mutex); + if (fd->fd_lease_och != NULL) { + struct obd_client_handle *och = fd->fd_lease_och; + + lock = ldlm_handle2lock(&och->och_lease_handle); + if (lock != NULL) { + lock_res_and_lock(lock); + if (!ldlm_is_cancel(lock)) + rc = och->och_flags & + (FMODE_READ | FMODE_WRITE); + unlock_res_and_lock(lock); + ldlm_lock_put(lock); + } + } + mutex_unlock(&lli->lli_och_mutex); + + return rc; + } default: { int err; diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index d37c183109ba..1a13330ac966 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -608,10 +608,14 @@ extern struct kmem_cache *ll_file_data_slab; struct lustre_handle; struct ll_file_data { struct ll_readahead_state fd_ras; - int fd_omode; struct ccc_grouplock fd_grouplock; __u64 lfd_pos; __u32 fd_flags; + fmode_t fd_omode; + /* openhandle if lease exists for this file. + * Borrow lli->lli_och_mutex to protect assignment */ + struct obd_client_handle *fd_lease_och; + struct obd_client_handle *fd_och; struct file *fd_file; /* Indicate whether need to report failure when close. * true: failure is known, not report again. @@ -777,6 +781,11 @@ int ll_put_grouplock(struct inode *inode, struct file *file, unsigned long arg); int ll_fid2path(struct inode *inode, void *arg); int ll_data_version(struct inode *inode, __u64 *data_version, int extent_lock); +struct obd_client_handle *ll_lease_open(struct inode *inode, struct file *file, + fmode_t mode); +int ll_lease_close(struct obd_client_handle *och, struct inode *inode, + bool *lease_broken); + /* llite/dcache.c */ int ll_dops_init(struct dentry *de, int block, int init_sa); diff --git a/drivers/staging/lustre/lustre/mdc/mdc_internal.h b/drivers/staging/lustre/lustre/mdc/mdc_internal.h index 2aeff0ecec34..b995af6a2782 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_internal.h +++ b/drivers/staging/lustre/lustre/mdc/mdc_internal.h @@ -69,7 +69,7 @@ void mdc_create_pack(struct ptlrpc_request *req, struct md_op_data *op_data, const void *data, int datalen, __u32 mode, __u32 uid, __u32 gid, cfs_cap_t capability, __u64 rdev); void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data, - __u32 mode, __u64 rdev, __u32 flags, const void *data, + __u32 mode, __u64 rdev, __u64 flags, const void *data, int datalen); void mdc_unlink_pack(struct ptlrpc_request *req, struct md_op_data *op_data); void mdc_link_pack(struct ptlrpc_request *req, struct md_op_data *op_data); diff --git a/drivers/staging/lustre/lustre/mdc/mdc_lib.c b/drivers/staging/lustre/lustre/mdc/mdc_lib.c index b2de47803679..3e7702075bf9 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_lib.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_lib.c @@ -174,12 +174,12 @@ void mdc_create_pack(struct ptlrpc_request *req, struct md_op_data *op_data, } } -static __u64 mds_pack_open_flags(__u32 flags, __u32 mode) +static __u64 mds_pack_open_flags(__u64 flags, __u32 mode) { __u64 cr_flags = (flags & (FMODE_READ | FMODE_WRITE | MDS_OPEN_HAS_EA | MDS_OPEN_HAS_OBJS | MDS_OPEN_OWNEROVERRIDE | MDS_OPEN_LOCK | - MDS_OPEN_BY_FID)); + MDS_OPEN_BY_FID | MDS_OPEN_LEASE)); if (flags & O_CREAT) cr_flags |= MDS_OPEN_CREAT; if (flags & O_EXCL) @@ -207,7 +207,7 @@ static __u64 mds_pack_open_flags(__u32 flags, __u32 mode) /* packing of MDS records */ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data, - __u32 mode, __u64 rdev, __u32 flags, const void *lmm, + __u32 mode, __u64 rdev, __u64 flags, const void *lmm, int lmmlen) { struct mdt_rec_create *rec; @@ -234,6 +234,7 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data, rec->cr_suppgid2 = op_data->op_suppgids[1]; rec->cr_bias = op_data->op_bias; rec->cr_umask = current_umask(); + rec->cr_old_handle = op_data->op_handle; mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1); /* the next buffer is child capa, which is used for replay, diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index fb5a9959bf7a..eccbab7561fe 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -75,6 +75,12 @@ EXPORT_SYMBOL(it_clear_disposition); int it_open_error(int phase, struct lookup_intent *it) { + if (it_disposition(it, DISP_OPEN_LEASE)) { + if (phase >= DISP_OPEN_LEASE) + return it->d.lustre.it_status; + else + return 0; + } if (it_disposition(it, DISP_OPEN_OPEN)) { if (phase >= DISP_OPEN_OPEN) return it->d.lustre.it_status; @@ -281,14 +287,21 @@ static struct ptlrpc_request *mdc_intent_open_pack(struct obd_export *exp, /* XXX: openlock is not cancelled for cross-refs. */ /* If inode is known, cancel conflicting OPEN locks. */ if (fid_is_sane(&op_data->op_fid2)) { - if (it->it_flags & (FMODE_WRITE|MDS_OPEN_TRUNC)) - mode = LCK_CW; + if (it->it_flags & MDS_OPEN_LEASE) { /* try to get lease */ + if (it->it_flags & FMODE_WRITE) + mode = LCK_EX; + else + mode = LCK_PR; + } else { + if (it->it_flags & (FMODE_WRITE|MDS_OPEN_TRUNC)) + mode = LCK_CW; #ifdef FMODE_EXEC - else if (it->it_flags & FMODE_EXEC) - mode = LCK_PR; + else if (it->it_flags & FMODE_EXEC) + mode = LCK_PR; #endif - else - mode = LCK_CR; + else + mode = LCK_CR; + } count = mdc_resource_get_unused(exp, &op_data->op_fid2, &cancels, mode, MDS_INODELOCK_OPEN); @@ -1065,10 +1078,10 @@ int mdc_intent_lock(struct obd_export *exp, struct md_op_data *op_data, LASSERT(it); CDEBUG(D_DLMTRACE, "(name: %.*s,"DFID") in obj "DFID - ", intent: %s flags %#o\n", op_data->op_namelen, - op_data->op_name, PFID(&op_data->op_fid2), - PFID(&op_data->op_fid1), ldlm_it2str(it->it_op), - it->it_flags); + ", intent: %s flags %#Lo\n", op_data->op_namelen, + op_data->op_name, PFID(&op_data->op_fid2), + PFID(&op_data->op_fid1), ldlm_it2str(it->it_op), + it->it_flags); lockh.cookie = 0; if (fid_is_sane(&op_data->op_fid2) && @@ -1194,9 +1207,10 @@ int mdc_intent_getattr_async(struct obd_export *exp, int rc = 0; __u64 flags = LDLM_FL_HAS_INTENT; - CDEBUG(D_DLMTRACE,"name: %.*s in inode "DFID", intent: %s flags %#o\n", - op_data->op_namelen, op_data->op_name, PFID(&op_data->op_fid1), - ldlm_it2str(it->it_op), it->it_flags); + CDEBUG(D_DLMTRACE, + "name: %.*s in inode "DFID", intent: %s flags %#Lo\n", + op_data->op_namelen, op_data->op_name, PFID(&op_data->op_fid1), + ldlm_it2str(it->it_op), it->it_flags); fid_build_reg_res_name(&op_data->op_fid1, &res_id); req = mdc_intent_getattr_pack(exp, it, op_data); From d298b5377d415f001bcba914610417e3396d6d6c Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 19 Nov 2013 21:23:42 +0800 Subject: [PATCH 194/238] drivers/staging/lustre: indent lustre_ldlm_flags_vals To follow kernel's "no spaces at the start of a line" rule. Signed-off-by: Peng Tao Signed-off-by: Greg Kroah-Hartman --- .../lustre/lustre/include/lustre_dlm_flags.h | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h b/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h index f8b4ba749683..75716f17f64b 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h @@ -423,46 +423,46 @@ static int hf_lustre_ldlm_fl_ns_srv = -1; static int hf_lustre_ldlm_fl_excl = -1; const value_string lustre_ldlm_flags_vals[] = { - {LDLM_FL_LOCK_CHANGED, "LDLM_FL_LOCK_CHANGED"}, - {LDLM_FL_BLOCK_GRANTED, "LDLM_FL_BLOCK_GRANTED"}, - {LDLM_FL_BLOCK_CONV, "LDLM_FL_BLOCK_CONV"}, - {LDLM_FL_BLOCK_WAIT, "LDLM_FL_BLOCK_WAIT"}, - {LDLM_FL_AST_SENT, "LDLM_FL_AST_SENT"}, - {LDLM_FL_REPLAY, "LDLM_FL_REPLAY"}, - {LDLM_FL_INTENT_ONLY, "LDLM_FL_INTENT_ONLY"}, - {LDLM_FL_HAS_INTENT, "LDLM_FL_HAS_INTENT"}, - {LDLM_FL_DISCARD_DATA, "LDLM_FL_DISCARD_DATA"}, - {LDLM_FL_NO_TIMEOUT, "LDLM_FL_NO_TIMEOUT"}, - {LDLM_FL_BLOCK_NOWAIT, "LDLM_FL_BLOCK_NOWAIT"}, - {LDLM_FL_TEST_LOCK, "LDLM_FL_TEST_LOCK"}, - {LDLM_FL_CANCEL_ON_BLOCK, "LDLM_FL_CANCEL_ON_BLOCK"}, - {LDLM_FL_DENY_ON_CONTENTION, "LDLM_FL_DENY_ON_CONTENTION"}, - {LDLM_FL_AST_DISCARD_DATA, "LDLM_FL_AST_DISCARD_DATA"}, - {LDLM_FL_FAIL_LOC, "LDLM_FL_FAIL_LOC"}, - {LDLM_FL_SKIPPED, "LDLM_FL_SKIPPED"}, - {LDLM_FL_CBPENDING, "LDLM_FL_CBPENDING"}, - {LDLM_FL_WAIT_NOREPROC, "LDLM_FL_WAIT_NOREPROC"}, - {LDLM_FL_CANCEL, "LDLM_FL_CANCEL"}, - {LDLM_FL_LOCAL_ONLY, "LDLM_FL_LOCAL_ONLY"}, - {LDLM_FL_FAILED, "LDLM_FL_FAILED"}, - {LDLM_FL_CANCELING, "LDLM_FL_CANCELING"}, - {LDLM_FL_LOCAL, "LDLM_FL_LOCAL"}, - {LDLM_FL_LVB_READY, "LDLM_FL_LVB_READY"}, - {LDLM_FL_KMS_IGNORE, "LDLM_FL_KMS_IGNORE"}, - {LDLM_FL_CP_REQD, "LDLM_FL_CP_REQD"}, - {LDLM_FL_CLEANED, "LDLM_FL_CLEANED"}, - {LDLM_FL_ATOMIC_CB, "LDLM_FL_ATOMIC_CB"}, - {LDLM_FL_BL_AST, "LDLM_FL_BL_AST"}, - {LDLM_FL_BL_DONE, "LDLM_FL_BL_DONE"}, - {LDLM_FL_NO_LRU, "LDLM_FL_NO_LRU"}, - {LDLM_FL_FAIL_NOTIFIED, "LDLM_FL_FAIL_NOTIFIED"}, - {LDLM_FL_DESTROYED, "LDLM_FL_DESTROYED"}, - {LDLM_FL_SERVER_LOCK, "LDLM_FL_SERVER_LOCK"}, - {LDLM_FL_RES_LOCKED, "LDLM_FL_RES_LOCKED"}, - {LDLM_FL_WAITED, "LDLM_FL_WAITED"}, - {LDLM_FL_NS_SRV, "LDLM_FL_NS_SRV"}, - {LDLM_FL_EXCL, "LDLM_FL_EXCL"}, - { 0, NULL } + {LDLM_FL_LOCK_CHANGED, "LDLM_FL_LOCK_CHANGED"}, + {LDLM_FL_BLOCK_GRANTED, "LDLM_FL_BLOCK_GRANTED"}, + {LDLM_FL_BLOCK_CONV, "LDLM_FL_BLOCK_CONV"}, + {LDLM_FL_BLOCK_WAIT, "LDLM_FL_BLOCK_WAIT"}, + {LDLM_FL_AST_SENT, "LDLM_FL_AST_SENT"}, + {LDLM_FL_REPLAY, "LDLM_FL_REPLAY"}, + {LDLM_FL_INTENT_ONLY, "LDLM_FL_INTENT_ONLY"}, + {LDLM_FL_HAS_INTENT, "LDLM_FL_HAS_INTENT"}, + {LDLM_FL_DISCARD_DATA, "LDLM_FL_DISCARD_DATA"}, + {LDLM_FL_NO_TIMEOUT, "LDLM_FL_NO_TIMEOUT"}, + {LDLM_FL_BLOCK_NOWAIT, "LDLM_FL_BLOCK_NOWAIT"}, + {LDLM_FL_TEST_LOCK, "LDLM_FL_TEST_LOCK"}, + {LDLM_FL_CANCEL_ON_BLOCK, "LDLM_FL_CANCEL_ON_BLOCK"}, + {LDLM_FL_DENY_ON_CONTENTION, "LDLM_FL_DENY_ON_CONTENTION"}, + {LDLM_FL_AST_DISCARD_DATA, "LDLM_FL_AST_DISCARD_DATA"}, + {LDLM_FL_FAIL_LOC, "LDLM_FL_FAIL_LOC"}, + {LDLM_FL_SKIPPED, "LDLM_FL_SKIPPED"}, + {LDLM_FL_CBPENDING, "LDLM_FL_CBPENDING"}, + {LDLM_FL_WAIT_NOREPROC, "LDLM_FL_WAIT_NOREPROC"}, + {LDLM_FL_CANCEL, "LDLM_FL_CANCEL"}, + {LDLM_FL_LOCAL_ONLY, "LDLM_FL_LOCAL_ONLY"}, + {LDLM_FL_FAILED, "LDLM_FL_FAILED"}, + {LDLM_FL_CANCELING, "LDLM_FL_CANCELING"}, + {LDLM_FL_LOCAL, "LDLM_FL_LOCAL"}, + {LDLM_FL_LVB_READY, "LDLM_FL_LVB_READY"}, + {LDLM_FL_KMS_IGNORE, "LDLM_FL_KMS_IGNORE"}, + {LDLM_FL_CP_REQD, "LDLM_FL_CP_REQD"}, + {LDLM_FL_CLEANED, "LDLM_FL_CLEANED"}, + {LDLM_FL_ATOMIC_CB, "LDLM_FL_ATOMIC_CB"}, + {LDLM_FL_BL_AST, "LDLM_FL_BL_AST"}, + {LDLM_FL_BL_DONE, "LDLM_FL_BL_DONE"}, + {LDLM_FL_NO_LRU, "LDLM_FL_NO_LRU"}, + {LDLM_FL_FAIL_NOTIFIED, "LDLM_FL_FAIL_NOTIFIED"}, + {LDLM_FL_DESTROYED, "LDLM_FL_DESTROYED"}, + {LDLM_FL_SERVER_LOCK, "LDLM_FL_SERVER_LOCK"}, + {LDLM_FL_RES_LOCKED, "LDLM_FL_RES_LOCKED"}, + {LDLM_FL_WAITED, "LDLM_FL_WAITED"}, + {LDLM_FL_NS_SRV, "LDLM_FL_NS_SRV"}, + {LDLM_FL_EXCL, "LDLM_FL_EXCL"}, + { 0, NULL } }; #endif /* WIRESHARK_COMPILE */ #endif /* LDLM_ALL_FLAGS_MASK */ From d75e265bd87a34174198fe8ebf15030919e6ad5e Mon Sep 17 00:00:00 2001 From: Amir Shehata Date: Tue, 19 Nov 2013 21:23:44 +0800 Subject: [PATCH 195/238] staging/lustre/lnet: coding style fix for lst_test_add_ioctl To make the function a bit easier to read. This is coding style fix part of original Lustre commit in external tree. Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3093 Lustre-change: http://review.whamcloud.com/6092 Signed-off-by: Amir Shehata Reviewed-by: Isaac Huang Reviewed-by: Liang Zhen Reviewed-by: Oleg Drokin Signed-off-by: Peng Tao Signed-off-by: Andreas Dilger Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/selftest/conctl.c | 56 +++++++++---------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index bce3d3bde6b2..cbc416de7008 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -723,12 +723,12 @@ lst_stat_query_ioctl(lstio_stat_args_t *args) int lst_test_add_ioctl(lstio_test_args_t *args) { - char *name; - char *srcgrp = NULL; - char *dstgrp = NULL; - void *param = NULL; - int ret = 0; - int rc = -ENOMEM; + char *batch_name; + char *src_name = NULL; + char *dst_name = NULL; + void *param = NULL; + int ret = 0; + int rc = -ENOMEM; if (args->lstio_tes_resultp == NULL || args->lstio_tes_retp == NULL || @@ -755,16 +755,16 @@ int lst_test_add_ioctl(lstio_test_args_t *args) args->lstio_tes_param_len > PAGE_CACHE_SIZE - sizeof(lstcon_test_t))) return -EINVAL; - LIBCFS_ALLOC(name, args->lstio_tes_bat_nmlen + 1); - if (name == NULL) + LIBCFS_ALLOC(batch_name, args->lstio_tes_bat_nmlen + 1); + if (batch_name == NULL) return rc; - LIBCFS_ALLOC(srcgrp, args->lstio_tes_sgrp_nmlen + 1); - if (srcgrp == NULL) + LIBCFS_ALLOC(src_name, args->lstio_tes_sgrp_nmlen + 1); + if (src_name == NULL) goto out; - LIBCFS_ALLOC(dstgrp, args->lstio_tes_dgrp_nmlen + 1); - if (dstgrp == NULL) + LIBCFS_ALLOC(dst_name, args->lstio_tes_dgrp_nmlen + 1); + if (dst_name == NULL) goto out; if (args->lstio_tes_param != NULL) { @@ -774,39 +774,37 @@ int lst_test_add_ioctl(lstio_test_args_t *args) } rc = -EFAULT; - if (copy_from_user(name, - args->lstio_tes_bat_name, - args->lstio_tes_bat_nmlen) || - copy_from_user(srcgrp, - args->lstio_tes_sgrp_name, - args->lstio_tes_sgrp_nmlen) || - copy_from_user(dstgrp, - args->lstio_tes_dgrp_name, - args->lstio_tes_dgrp_nmlen) || + if (copy_from_user(batch_name, args->lstio_tes_bat_name, + args->lstio_tes_bat_nmlen) || + copy_from_user(src_name, args->lstio_tes_sgrp_name, + args->lstio_tes_sgrp_nmlen) || + copy_from_user(dst_name, args->lstio_tes_dgrp_name, + args->lstio_tes_dgrp_nmlen) || copy_from_user(param, args->lstio_tes_param, args->lstio_tes_param_len)) goto out; - rc = lstcon_test_add(name, + rc = lstcon_test_add(batch_name, args->lstio_tes_type, args->lstio_tes_loop, args->lstio_tes_concur, args->lstio_tes_dist, args->lstio_tes_span, - srcgrp, dstgrp, param, args->lstio_tes_param_len, + src_name, dst_name, param, + args->lstio_tes_param_len, &ret, args->lstio_tes_resultp); if (ret != 0) rc = (copy_to_user(args->lstio_tes_retp, &ret, sizeof(ret))) ? -EFAULT : 0; out: - if (name != NULL) - LIBCFS_FREE(name, args->lstio_tes_bat_nmlen + 1); + if (batch_name != NULL) + LIBCFS_FREE(batch_name, args->lstio_tes_bat_nmlen + 1); - if (srcgrp != NULL) - LIBCFS_FREE(srcgrp, args->lstio_tes_sgrp_nmlen + 1); + if (src_name != NULL) + LIBCFS_FREE(src_name, args->lstio_tes_sgrp_nmlen + 1); - if (dstgrp != NULL) - LIBCFS_FREE(dstgrp, args->lstio_tes_dgrp_nmlen + 1); + if (dst_name != NULL) + LIBCFS_FREE(dst_name, args->lstio_tes_dgrp_nmlen + 1); if (param != NULL) LIBCFS_FREE(param, args->lstio_tes_param_len); From f02e015688079350cb507c45cdf9790cfc772384 Mon Sep 17 00:00:00 2001 From: Amir Shehata Date: Tue, 19 Nov 2013 21:23:45 +0800 Subject: [PATCH 196/238] staging/lustre/lnet: remove extra space in lstcon_rpc_trans_abort This is coding style fix part of original Lustre commit in external tree. Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3093 Lustre-change: http://review.whamcloud.com/6092 Signed-off-by: Amir Shehata Reviewed-by: Isaac Huang Reviewed-by: Liang Zhen Reviewed-by: Oleg Drokin Signed-off-by: Peng Tao Signed-off-by: Andreas Dilger Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/selftest/conrpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index 9a52f25b72e9..53d58924737b 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -311,7 +311,7 @@ lstcon_rpc_trans_abort(lstcon_rpc_trans_t *trans, int error) sfw_abort_rpc(rpc); - if (error != ETIMEDOUT) + if (error != ETIMEDOUT) continue; nd = crpc->crp_node; From 75f1c090c2d01b2e91f30d3502967d6c14e22aea Mon Sep 17 00:00:00 2001 From: Amir Shehata Date: Tue, 19 Nov 2013 21:23:46 +0800 Subject: [PATCH 197/238] staging/lustre/lnet: constify name argument of lstcon_group_find/lstcon_batch_find This is part of original Lustre commit in external tree. Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3093 Lustre-change: http://review.whamcloud.com/6092 Signed-off-by: Amir Shehata Reviewed-by: Isaac Huang Reviewed-by: Liang Zhen Reviewed-by: Oleg Drokin Signed-off-by: Peng Tao Signed-off-by: Andreas Dilger Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/selftest/console.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index f1152e4fbcc4..e78281d86639 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -265,7 +265,7 @@ lstcon_group_decref(lstcon_group_t *grp) } static int -lstcon_group_find(char *name, lstcon_group_t **grpp) +lstcon_group_find(const char *name, lstcon_group_t **grpp) { lstcon_group_t *grp; @@ -831,7 +831,7 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p, } int -lstcon_batch_find(char *name, lstcon_batch_t **batpp) +lstcon_batch_find(const char *name, lstcon_batch_t **batpp) { lstcon_batch_t *bat; From 6a5b7a6dbfc70cd59ea7144d62fbec92b28d8a37 Mon Sep 17 00:00:00 2001 From: Amir Shehata Date: Tue, 19 Nov 2013 21:23:47 +0800 Subject: [PATCH 198/238] staging/lustre/lnet: coding style fix for lstcon_test_add To make the function a bit easier to read. This is coding style fix part of original Lustre commit in external tree. Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3093 Lustre-change: http://review.whamcloud.com/6092 Signed-off-by: Amir Shehata Reviewed-by: Isaac Huang Reviewed-by: Liang Zhen Reviewed-by: Oleg Drokin Signed-off-by: Peng Tao Signed-off-by: Andreas Dilger Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lnet/selftest/console.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index e78281d86639..067a8b535f7c 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -1284,18 +1284,18 @@ lstcon_test_add(char *name, int type, int loop, int concur, } memset(test, 0, offsetof(lstcon_test_t, tes_param[paramlen])); - test->tes_hdr.tsb_id = batch->bat_hdr.tsb_id; - test->tes_batch = batch; - test->tes_type = type; - test->tes_oneside = 0; /* TODO */ - test->tes_loop = loop; + test->tes_hdr.tsb_id = batch->bat_hdr.tsb_id; + test->tes_batch = batch; + test->tes_type = type; + test->tes_oneside = 0; /* TODO */ + test->tes_loop = loop; test->tes_concur = concur; - test->tes_stop_onerr = 1; /* TODO */ - test->tes_span = span; - test->tes_dist = dist; + test->tes_stop_onerr = 1; /* TODO */ + test->tes_span = span; + test->tes_dist = dist; test->tes_cliidx = 0; /* just used for creating RPC */ - test->tes_src_grp = src_grp; - test->tes_dst_grp = dst_grp; + test->tes_src_grp = src_grp; + test->tes_dst_grp = dst_grp; INIT_LIST_HEAD(&test->tes_trans_list); if (param != NULL) { From de55446b8e3e81ffcc1bfefb4b2d20209af45536 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 19 Nov 2013 22:38:35 +0800 Subject: [PATCH 199/238] staging/lustre/libcfs: remove HAVE_MM_INLINE Cc: Andreas Dilger Signed-off-by: Peng Tao Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/include/linux/libcfs/linux/kp30.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h b/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h index c204b677796f..9b30b4d92cc9 100644 --- a/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h +++ b/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h @@ -63,9 +63,7 @@ #include #include #include -#ifdef HAVE_MM_INLINE -# include -#endif +#include #include #include #include From 76766b46105b5b1d944bfc2fb12c98823de8e650 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 19 Nov 2013 22:38:36 +0800 Subject: [PATCH 200/238] staging/lustre: remove liblustreapi.h It is only used by user space. Cc: Andreas Dilger Signed-off-by: Peng Tao Signed-off-by: Greg Kroah-Hartman --- .../lustre/include/lustre/liblustreapi.h | 43 ------------------- 1 file changed, 43 deletions(-) delete mode 100644 drivers/staging/lustre/lustre/include/lustre/liblustreapi.h diff --git a/drivers/staging/lustre/lustre/include/lustre/liblustreapi.h b/drivers/staging/lustre/lustre/include/lustre/liblustreapi.h deleted file mode 100644 index 707eb74fdf68..000000000000 --- a/drivers/staging/lustre/lustre/include/lustre/liblustreapi.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ - -/* - * NOTE: This file is DEPRECATED! Please include lustreapi.h directly - * instead of this file. This file will be removed from a future version - * of lustre! - */ - -#ifndef _LIBLUSTREAPI_H_ -#define _LIBLUSTREAPI_H_ - -#include -#warning "Including liblustreapi.h is deprecated. Include lustreapi.h directly." - -#endif From e964cb969e493725a1c911b8d620117722bd2db6 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 19 Nov 2013 22:38:37 +0800 Subject: [PATCH 201/238] staging/lustre: remove lustreapi.h It is only used by user space. Cc: Andreas Dilger Signed-off-by: Peng Tao Signed-off-by: Greg Kroah-Hartman --- .../lustre/lustre/include/lustre/lustreapi.h | 310 ------------------ 1 file changed, 310 deletions(-) delete mode 100644 drivers/staging/lustre/lustre/include/lustre/lustreapi.h diff --git a/drivers/staging/lustre/lustre/include/lustre/lustreapi.h b/drivers/staging/lustre/lustre/include/lustre/lustreapi.h deleted file mode 100644 index 63da66506639..000000000000 --- a/drivers/staging/lustre/lustre/include/lustre/lustreapi.h +++ /dev/null @@ -1,310 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - * - * Copyright (c) 2011, 2012, Whamcloud, Inc. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ - -#ifndef _LUSTREAPI_H_ -#define _LUSTREAPI_H_ - -/** \defgroup llapi llapi - * - * @{ - */ - -#include - -typedef void (*llapi_cb_t)(char *obd_type_name, char *obd_name, char *obd_uuid, void *args); - -/* lustreapi message severity level */ -enum llapi_message_level { - LLAPI_MSG_OFF = 0, - LLAPI_MSG_FATAL = 1, - LLAPI_MSG_ERROR = 2, - LLAPI_MSG_WARN = 3, - LLAPI_MSG_NORMAL = 4, - LLAPI_MSG_INFO = 5, - LLAPI_MSG_DEBUG = 6, - LLAPI_MSG_MAX -}; - -/* the bottom three bits reserved for llapi_message_level */ -#define LLAPI_MSG_MASK 0x00000007 -#define LLAPI_MSG_NO_ERRNO 0x00000010 - -extern void llapi_msg_set_level(int level); -extern void llapi_error(int level, int rc, char *fmt, ...); -#define llapi_err_noerrno(level, fmt, a...) \ - llapi_error((level) | LLAPI_MSG_NO_ERRNO, 0, fmt, ## a) -extern void llapi_printf(int level, char *fmt, ...); -extern int llapi_file_create(const char *name, unsigned long long stripe_size, - int stripe_offset, int stripe_count, - int stripe_pattern); -extern int llapi_file_open(const char *name, int flags, int mode, - unsigned long long stripe_size, int stripe_offset, - int stripe_count, int stripe_pattern); -extern int llapi_file_create_pool(const char *name, - unsigned long long stripe_size, - int stripe_offset, int stripe_count, - int stripe_pattern, char *pool_name); -extern int llapi_file_open_pool(const char *name, int flags, int mode, - unsigned long long stripe_size, - int stripe_offset, int stripe_count, - int stripe_pattern, char *pool_name); -extern int llapi_poollist(const char *name); -extern int llapi_get_poollist(const char *name, char **poollist, int list_size, - char *buffer, int buffer_size); -extern int llapi_get_poolmembers(const char *poolname, char **members, - int list_size, char *buffer, int buffer_size); -extern int llapi_file_get_stripe(const char *path, struct lov_user_md *lum); -#define HAVE_LLAPI_FILE_LOOKUP -extern int llapi_file_lookup(int dirfd, const char *name); - -#define VERBOSE_COUNT 0x1 -#define VERBOSE_SIZE 0x2 -#define VERBOSE_OFFSET 0x4 -#define VERBOSE_POOL 0x8 -#define VERBOSE_DETAIL 0x10 -#define VERBOSE_OBJID 0x20 -#define VERBOSE_GENERATION 0x40 -#define VERBOSE_MDTINDEX 0x80 -#define VERBOSE_ALL (VERBOSE_COUNT | VERBOSE_SIZE | VERBOSE_OFFSET | \ - VERBOSE_POOL | VERBOSE_OBJID | VERBOSE_GENERATION) - -struct find_param { - unsigned int maxdepth; - time_t atime; - time_t mtime; - time_t ctime; - int asign; /* cannot be bitfields due to using pointers to */ - int csign; /* access them during argument parsing. */ - int msign; - int type; - int size_sign:2, /* these need to be signed values */ - stripesize_sign:2, - stripecount_sign:2; - unsigned long long size; - unsigned long long size_units; - uid_t uid; - gid_t gid; - - unsigned long zeroend:1, - recursive:1, - exclude_pattern:1, - exclude_type:1, - exclude_obd:1, - exclude_mdt:1, - exclude_gid:1, - exclude_uid:1, - check_gid:1, /* group ID */ - check_uid:1, /* user ID */ - check_pool:1, /* LOV pool name */ - check_size:1, /* file size */ - exclude_pool:1, - exclude_size:1, - exclude_atime:1, - exclude_mtime:1, - exclude_ctime:1, - get_lmv:1, /* get MDT list from LMV */ - raw:1, /* do not fill in defaults */ - check_stripesize:1, /* LOV stripe size */ - exclude_stripesize:1, - check_stripecount:1, /* LOV stripe count */ - exclude_stripecount:1; - - int verbose; - int quiet; - - /* regular expression */ - char *pattern; - - char *print_fmt; - - struct obd_uuid *obduuid; - int num_obds; - int num_alloc_obds; - int obdindex; - int *obdindexes; - - struct obd_uuid *mdtuuid; - int num_mdts; - int num_alloc_mdts; - int mdtindex; - int *mdtindexes; - int file_mdtindex; - - int lumlen; - struct lov_user_mds_data *lmd; - - char poolname[LOV_MAXPOOLNAME + 1]; - - int fp_lmv_count; - struct lmv_user_md *fp_lmv_md; - - unsigned long long stripesize; - unsigned long long stripesize_units; - unsigned long long stripecount; - - /* In-process parameters. */ - unsigned long got_uuids:1, - obds_printed:1, - have_fileinfo:1; /* file attrs and LOV xattr */ - unsigned int depth; - dev_t st_dev; -}; - -extern int llapi_ostlist(char *path, struct find_param *param); -extern int llapi_uuid_match(char *real_uuid, char *search_uuid); -extern int llapi_getstripe(char *path, struct find_param *param); -extern int llapi_find(char *path, struct find_param *param); - -extern int llapi_file_fget_mdtidx(int fd, int *mdtidx); -extern int llapi_dir_create_pool(const char *name, int flags, int stripe_offset, - int stripe_count, int stripe_pattern, - char *poolname); -int llapi_direntry_remove(char *dname); -extern int llapi_obd_statfs(char *path, __u32 type, __u32 index, - struct obd_statfs *stat_buf, - struct obd_uuid *uuid_buf); -extern int llapi_ping(char *obd_type, char *obd_name); -extern int llapi_target_check(int num_types, char **obd_types, char *dir); -extern int llapi_file_get_lov_uuid(const char *path, struct obd_uuid *lov_uuid); -extern int llapi_file_get_lmv_uuid(const char *path, struct obd_uuid *lmv_uuid); -extern int llapi_file_fget_lov_uuid(int fd, struct obd_uuid *lov_uuid); -extern int llapi_lov_get_uuids(int fd, struct obd_uuid *uuidp, int *ost_count); -extern int llapi_lmv_get_uuids(int fd, struct obd_uuid *uuidp, int *mdt_count); -extern int llapi_is_lustre_mnttype(const char *type); -extern int llapi_search_ost(char *fsname, char *poolname, char *ostname); -extern int llapi_get_obd_count(char *mnt, int *count, int is_mdt); -extern int parse_size(char *optarg, unsigned long long *size, - unsigned long long *size_units, int bytes_spec); -extern int llapi_search_mounts(const char *pathname, int index, - char *mntdir, char *fsname); -extern int llapi_search_fsname(const char *pathname, char *fsname); -extern int llapi_getname(const char *path, char *buf, size_t size); - -extern void llapi_ping_target(char *obd_type, char *obd_name, - char *obd_uuid, void *args); - -extern int llapi_search_rootpath(char *pathname, const char *fsname); - -struct mntent; -#define HAVE_LLAPI_IS_LUSTRE_MNT -extern int llapi_is_lustre_mnt(struct mntent *mnt); -extern int llapi_quotachown(char *path, int flag); -extern int llapi_quotacheck(char *mnt, int check_type); -extern int llapi_poll_quotacheck(char *mnt, struct if_quotacheck *qchk); -extern int llapi_quotactl(char *mnt, struct if_quotactl *qctl); -extern int llapi_target_iterate(int type_num, char **obd_type, void *args, - llapi_cb_t cb); -extern int llapi_get_connect_flags(const char *mnt, __u64 *flags); -extern int llapi_lsetfacl(int argc, char *argv[]); -extern int llapi_lgetfacl(int argc, char *argv[]); -extern int llapi_rsetfacl(int argc, char *argv[]); -extern int llapi_rgetfacl(int argc, char *argv[]); -extern int llapi_cp(int argc, char *argv[]); -extern int llapi_ls(int argc, char *argv[]); -extern int llapi_fid2path(const char *device, const char *fidstr, char *path, - int pathlen, long long *recno, int *linkno); -extern int llapi_path2fid(const char *path, lustre_fid *fid); -extern int llapi_fd2fid(const int fd, lustre_fid *fid); - -extern int llapi_get_version(char *buffer, int buffer_size, char **version); -extern int llapi_get_data_version(int fd, __u64 *data_version, __u64 flags); -extern int llapi_hsm_state_get(const char *path, struct hsm_user_state *hus); -extern int llapi_hsm_state_set(const char *path, __u64 setmask, __u64 clearmask, - __u32 archive_id); - -extern int llapi_create_volatile_idx(char *directory, int idx, int mode); -static inline int llapi_create_volatile(char *directory, int mode) -{ - return llapi_create_volatile_idx(directory, -1, mode); -} - - -extern int llapi_fswap_layouts(const int fd1, const int fd2, - __u64 dv1, __u64 dv2, __u64 flags); -extern int llapi_swap_layouts(const char *path1, const char *path2, - __u64 dv1, __u64 dv2, __u64 flags); - -/* Changelog interface. priv is private state, managed internally - by these functions */ -#define CHANGELOG_FLAG_FOLLOW 0x01 /* Not yet implemented */ -#define CHANGELOG_FLAG_BLOCK 0x02 /* Blocking IO makes sense in case of - slow user parsing of the records, but it also prevents us from cleaning - up if the records are not consumed. */ - -/* Records received are in extentded format now, though most of them are still - * written in disk in changelog_rec format (to save space and time), it's - * converted to extented format in the lustre api to ease changelog analysis. */ -#define HAVE_CHANGELOG_EXTEND_REC 1 - -extern int llapi_changelog_start(void **priv, int flags, const char *mdtname, - long long startrec); -extern int llapi_changelog_fini(void **priv); -extern int llapi_changelog_recv(void *priv, struct changelog_ext_rec **rech); -extern int llapi_changelog_free(struct changelog_ext_rec **rech); -/* Allow records up to endrec to be destroyed; requires registered id. */ -extern int llapi_changelog_clear(const char *mdtname, const char *idstr, - long long endrec); - -/* HSM copytool interface. - * priv is private state, managed internally by these functions - */ -struct hsm_copytool_private; -extern int llapi_hsm_copytool_start(struct hsm_copytool_private **priv, - char *fsname, int flags, - int archive_count, int *archives); -extern int llapi_hsm_copytool_fini(struct hsm_copytool_private **priv); -extern int llapi_hsm_copytool_recv(struct hsm_copytool_private *priv, - struct hsm_action_list **hal, int *msgsize); -extern int llapi_hsm_copytool_free(struct hsm_action_list **hal); -extern int llapi_hsm_copy_start(char *mnt, struct hsm_copy *copy, - const struct hsm_action_item *hai); -extern int llapi_hsm_copy_end(char *mnt, struct hsm_copy *copy, - const struct hsm_progress *hp); -extern int llapi_hsm_progress(char *mnt, struct hsm_progress *hp); -extern int llapi_hsm_import(const char *dst, int archive, struct stat *st, - unsigned long long stripe_size, int stripe_offset, - int stripe_count, int stripe_pattern, - char *pool_name, lustre_fid *newfid); - -/* HSM user interface */ -extern struct hsm_user_request *llapi_hsm_user_request_alloc(int itemcount, - int data_len); -extern int llapi_hsm_request(char *mnt, struct hsm_user_request *request); -extern int llapi_hsm_current_action(const char *path, - struct hsm_current_action *hca); -/** @} llapi */ - -#endif From bda211d5c166a836c14f8f76268228550d3baf67 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 19 Nov 2013 22:38:38 +0800 Subject: [PATCH 202/238] staging/lustre: remove fsfilt_ext3.c It is only used by server. Cc: Andreas Dilger Signed-off-by: Peng Tao Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/lvfs/fsfilt_ext3.c | 760 ------------------ 1 file changed, 760 deletions(-) delete mode 100644 drivers/staging/lustre/lustre/lvfs/fsfilt_ext3.c diff --git a/drivers/staging/lustre/lustre/lvfs/fsfilt_ext3.c b/drivers/staging/lustre/lustre/lvfs/fsfilt_ext3.c deleted file mode 100644 index ee75994003e1..000000000000 --- a/drivers/staging/lustre/lustre/lvfs/fsfilt_ext3.c +++ /dev/null @@ -1,760 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - * - * Copyright (c) 2011, 2012, Intel Corporation. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - * - * lustre/lvfs/fsfilt_ext3.c - * - * Author: Andreas Dilger - */ - -#define DEBUG_SUBSYSTEM S_FILTER - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -#ifdef HAVE_EXT_PBLOCK /* Name changed to ext4_ext_pblock for kernel 2.6.35 */ -#define ext3_ext_pblock(ex) ext_pblock((ex)) -#endif - -/* for kernels 2.6.18 and later */ -#define FSFILT_SINGLEDATA_TRANS_BLOCKS(sb) EXT3_SINGLEDATA_TRANS_BLOCKS(sb) - -#define fsfilt_ext3_ext_insert_extent(handle, inode, path, newext, flag) \ - ext3_ext_insert_extent(handle, inode, path, newext, flag) - -#define ext3_mb_discard_inode_preallocations(inode) \ - ext3_discard_preallocations(inode) - -#define fsfilt_log_start_commit(journal, tid) jbd2_log_start_commit(journal, tid) -#define fsfilt_log_wait_commit(journal, tid) jbd2_log_wait_commit(journal, tid) - -static struct kmem_cache *fcb_cache; - -struct fsfilt_cb_data { - struct ext4_journal_cb_entry cb_jcb; /* private data - MUST BE FIRST */ - fsfilt_cb_t cb_func; /* MDS/OBD completion function */ - struct obd_device *cb_obd; /* MDS/OBD completion device */ - __u64 cb_last_rcvd; /* MDS/OST last committed operation */ - void *cb_data; /* MDS/OST completion function data */ -}; - -static char *fsfilt_ext3_get_label(struct super_block *sb) -{ - return EXT3_SB(sb)->s_es->s_volume_name; -} - -/* kernel has ext4_blocks_for_truncate since linux-3.1.1 */ -# include - -/* - * We don't currently need any additional blocks for rmdir and - * unlink transactions because we are storing the OST oa_id inside - * the inode (which we will be changing anyways as part of this - * transaction). - */ -static void *fsfilt_ext3_start(struct inode *inode, int op, void *desc_private, - int logs) -{ - /* For updates to the last received file */ - int nblocks = FSFILT_SINGLEDATA_TRANS_BLOCKS(inode->i_sb); - journal_t *journal; - void *handle; - - if (current->journal_info) { - CDEBUG(D_INODE, "increasing refcount on %p\n", - current->journal_info); - goto journal_start; - } - - switch(op) { - case FSFILT_OP_UNLINK: - /* delete one file + create/update logs for each stripe */ - nblocks += EXT3_DELETE_TRANS_BLOCKS(inode->i_sb); - nblocks += (EXT3_INDEX_EXTRA_TRANS_BLOCKS + - FSFILT_SINGLEDATA_TRANS_BLOCKS(inode->i_sb)) * logs; - break; - case FSFILT_OP_CANCEL_UNLINK: - LASSERT(logs == 1); - - /* blocks for log header bitmap update OR - * blocks for catalog header bitmap update + unlink of logs + - * blocks for delete the inode (include blocks truncating). */ - nblocks = (LLOG_CHUNK_SIZE >> inode->i_blkbits) + - EXT3_DELETE_TRANS_BLOCKS(inode->i_sb) + - ext4_blocks_for_truncate(inode) + 3; - break; - default: CERROR("unknown transaction start op %d\n", op); - LBUG(); - } - - LASSERT(current->journal_info == desc_private); - journal = EXT3_SB(inode->i_sb)->s_journal; - if (nblocks > journal->j_max_transaction_buffers) { - CWARN("too many credits %d for op %ux%u using %d instead\n", - nblocks, op, logs, journal->j_max_transaction_buffers); - nblocks = journal->j_max_transaction_buffers; - } - - journal_start: - LASSERTF(nblocks > 0, "can't start %d credit transaction\n", nblocks); - handle = ext3_journal_start(inode, nblocks); - - if (!IS_ERR(handle)) - LASSERT(current->journal_info == handle); - else - CERROR("error starting handle for op %u (%u credits): rc %ld\n", - op, nblocks, PTR_ERR(handle)); - return handle; -} - -static int fsfilt_ext3_commit(struct inode *inode, void *h, int force_sync) -{ - int rc; - handle_t *handle = h; - - LASSERT(current->journal_info == handle); - if (force_sync) - handle->h_sync = 1; /* recovery likes this */ - - rc = ext3_journal_stop(handle); - - return rc; -} - -#ifndef EXT3_EXTENTS_FL -#define EXT3_EXTENTS_FL 0x00080000 /* Inode uses extents */ -#endif - -#ifndef EXT_ASSERT -#define EXT_ASSERT(cond) BUG_ON(!(cond)) -#endif - -#define EXT_GENERATION(inode) (EXT4_I(inode)->i_ext_generation) -#define ext3_ext_base inode -#define ext3_ext_base2inode(inode) (inode) -#define EXT_DEPTH(inode) ext_depth(inode) -#define fsfilt_ext3_ext_walk_space(inode, block, num, cb, cbdata) \ - ext3_ext_walk_space(inode, block, num, cb, cbdata); - -struct bpointers { - unsigned long *blocks; - unsigned long start; - int num; - int init_num; - int create; -}; - -static long ext3_ext_find_goal(struct inode *inode, struct ext3_ext_path *path, - unsigned long block, int *aflags) -{ - struct ext3_inode_info *ei = EXT3_I(inode); - unsigned long bg_start; - unsigned long colour; - int depth; - - if (path) { - struct ext3_extent *ex; - depth = path->p_depth; - - /* try to predict block placement */ - if ((ex = path[depth].p_ext)) - return ext4_ext_pblock(ex) + (block - le32_to_cpu(ex->ee_block)); - - /* it looks index is empty - * try to find starting from index itself */ - if (path[depth].p_bh) - return path[depth].p_bh->b_blocknr; - } - - /* OK. use inode's group */ - bg_start = (ei->i_block_group * EXT3_BLOCKS_PER_GROUP(inode->i_sb)) + - le32_to_cpu(EXT3_SB(inode->i_sb)->s_es->s_first_data_block); - colour = (current->pid % 16) * - (EXT3_BLOCKS_PER_GROUP(inode->i_sb) / 16); - return bg_start + colour + block; -} - -#define ll_unmap_underlying_metadata(sb, blocknr) \ - unmap_underlying_metadata((sb)->s_bdev, blocknr) - -#ifndef EXT3_MB_HINT_GROUP_ALLOC -static unsigned long new_blocks(handle_t *handle, struct ext3_ext_base *base, - struct ext3_ext_path *path, unsigned long block, - unsigned long *count, int *err) -{ - unsigned long pblock, goal; - int aflags = 0; - struct inode *inode = ext3_ext_base2inode(base); - - goal = ext3_ext_find_goal(inode, path, block, &aflags); - aflags |= 2; /* block have been already reserved */ - pblock = ext3_mb_new_blocks(handle, inode, goal, count, aflags, err); - return pblock; - -} -#else -static unsigned long new_blocks(handle_t *handle, struct ext3_ext_base *base, - struct ext3_ext_path *path, unsigned long block, - unsigned long *count, int *err) -{ - struct inode *inode = ext3_ext_base2inode(base); - struct ext3_allocation_request ar; - unsigned long pblock; - int aflags; - - /* find neighbour allocated blocks */ - ar.lleft = block; - *err = ext3_ext_search_left(base, path, &ar.lleft, &ar.pleft); - if (*err) - return 0; - ar.lright = block; - *err = ext3_ext_search_right(base, path, &ar.lright, &ar.pright); - if (*err) - return 0; - - /* allocate new block */ - ar.goal = ext3_ext_find_goal(inode, path, block, &aflags); - ar.inode = inode; - ar.logical = block; - ar.len = *count; - ar.flags = EXT3_MB_HINT_DATA; - pblock = ext3_mb_new_blocks(handle, &ar, err); - *count = ar.len; - return pblock; -} -#endif - -static int ext3_ext_new_extent_cb(struct ext3_ext_base *base, - struct ext3_ext_path *path, - struct ext3_ext_cache *cex, -#ifdef HAVE_EXT_PREPARE_CB_EXTENT - struct ext3_extent *ex, -#endif - void *cbdata) -{ - struct bpointers *bp = cbdata; - struct inode *inode = ext3_ext_base2inode(base); - struct ext3_extent nex; - unsigned long pblock; - unsigned long tgen; - int err, i; - unsigned long count; - handle_t *handle; - -#ifdef EXT3_EXT_CACHE_EXTENT - if (cex->ec_type == EXT3_EXT_CACHE_EXTENT) -#else - if ((cex->ec_len != 0) && (cex->ec_start != 0)) -#endif - { - err = EXT_CONTINUE; - goto map; - } - - if (bp->create == 0) { - i = 0; - if (cex->ec_block < bp->start) - i = bp->start - cex->ec_block; - if (i >= cex->ec_len) - CERROR("nothing to do?! i = %d, e_num = %u\n", - i, cex->ec_len); - for (; i < cex->ec_len && bp->num; i++) { - *(bp->blocks) = 0; - bp->blocks++; - bp->num--; - bp->start++; - } - - return EXT_CONTINUE; - } - - tgen = EXT_GENERATION(base); - count = ext3_ext_calc_credits_for_insert(base, path); - - handle = ext3_journal_start(inode, count+EXT3_ALLOC_NEEDED+1); - if (IS_ERR(handle)) { - return PTR_ERR(handle); - } - - if (tgen != EXT_GENERATION(base)) { - /* the tree has changed. so path can be invalid at moment */ - ext3_journal_stop(handle); - return EXT_REPEAT; - } - - /* In 2.6.32 kernel, ext4_ext_walk_space()'s callback func is not - * protected by i_data_sem as whole. so we patch it to store - * generation to path and now verify the tree hasn't changed */ - down_write((&EXT4_I(inode)->i_data_sem)); - - /* validate extent, make sure the extent tree does not changed */ - if (EXT_GENERATION(base) != path[0].p_generation) { - /* cex is invalid, try again */ - up_write(&EXT4_I(inode)->i_data_sem); - ext3_journal_stop(handle); - return EXT_REPEAT; - } - - count = cex->ec_len; - pblock = new_blocks(handle, base, path, cex->ec_block, &count, &err); - if (!pblock) - goto out; - EXT_ASSERT(count <= cex->ec_len); - - /* insert new extent */ - nex.ee_block = cpu_to_le32(cex->ec_block); - ext3_ext_store_pblock(&nex, pblock); - nex.ee_len = cpu_to_le16(count); - err = fsfilt_ext3_ext_insert_extent(handle, base, path, &nex, 0); - if (err) { - /* free data blocks we just allocated */ - /* not a good idea to call discard here directly, - * but otherwise we'd need to call it every free() */ -#ifdef EXT3_MB_HINT_GROUP_ALLOC - ext3_mb_discard_inode_preallocations(inode); -#endif -#ifdef HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD /* Introduced in 2.6.32-rc7 */ - ext3_free_blocks(handle, inode, NULL, ext4_ext_pblock(&nex), - cpu_to_le16(nex.ee_len), 0); -#else - ext3_free_blocks(handle, inode, ext4_ext_pblock(&nex), - cpu_to_le16(nex.ee_len), 0); -#endif - goto out; - } - - /* - * Putting len of the actual extent we just inserted, - * we are asking ext3_ext_walk_space() to continue - * scaning after that block - */ - cex->ec_len = le16_to_cpu(nex.ee_len); - cex->ec_start = ext4_ext_pblock(&nex); - BUG_ON(le16_to_cpu(nex.ee_len) == 0); - BUG_ON(le32_to_cpu(nex.ee_block) != cex->ec_block); - -out: - up_write((&EXT4_I(inode)->i_data_sem)); - ext3_journal_stop(handle); -map: - if (err >= 0) { - /* map blocks */ - if (bp->num == 0) { - CERROR("hmm. why do we find this extent?\n"); - CERROR("initial space: %lu:%u\n", - bp->start, bp->init_num); -#ifdef EXT3_EXT_CACHE_EXTENT - CERROR("current extent: %u/%u/%llu %d\n", - cex->ec_block, cex->ec_len, - (unsigned long long)cex->ec_start, - cex->ec_type); -#else - CERROR("current extent: %u/%u/%llu\n", - cex->ec_block, cex->ec_len, - (unsigned long long)cex->ec_start); -#endif - } - i = 0; - if (cex->ec_block < bp->start) - i = bp->start - cex->ec_block; - if (i >= cex->ec_len) - CERROR("nothing to do?! i = %d, e_num = %u\n", - i, cex->ec_len); - for (; i < cex->ec_len && bp->num; i++) { - *(bp->blocks) = cex->ec_start + i; -#ifdef EXT3_EXT_CACHE_EXTENT - if (cex->ec_type != EXT3_EXT_CACHE_EXTENT) -#else - if ((cex->ec_len == 0) || (cex->ec_start == 0)) -#endif - { - /* unmap any possible underlying metadata from - * the block device mapping. bug 6998. */ - ll_unmap_underlying_metadata(inode->i_sb, - *(bp->blocks)); - } - bp->blocks++; - bp->num--; - bp->start++; - } - } - return err; -} - -int fsfilt_map_nblocks(struct inode *inode, unsigned long block, - unsigned long num, unsigned long *blocks, - int create) -{ - struct ext3_ext_base *base = inode; - struct bpointers bp; - int err; - - CDEBUG(D_OTHER, "blocks %lu-%lu requested for inode %u\n", - block, block + num - 1, (unsigned) inode->i_ino); - - bp.blocks = blocks; - bp.start = block; - bp.init_num = bp.num = num; - bp.create = create; - - err = fsfilt_ext3_ext_walk_space(base, block, num, - ext3_ext_new_extent_cb, &bp); - ext3_ext_invalidate_cache(base); - - return err; -} - -int fsfilt_ext3_map_ext_inode_pages(struct inode *inode, struct page **page, - int pages, unsigned long *blocks, - int create) -{ - int blocks_per_page = PAGE_CACHE_SIZE >> inode->i_blkbits; - int rc = 0, i = 0; - struct page *fp = NULL; - int clen = 0; - - CDEBUG(D_OTHER, "inode %lu: map %d pages from %lu\n", - inode->i_ino, pages, (*page)->index); - - /* pages are sorted already. so, we just have to find - * contig. space and process them properly */ - while (i < pages) { - if (fp == NULL) { - /* start new extent */ - fp = *page++; - clen = 1; - i++; - continue; - } else if (fp->index + clen == (*page)->index) { - /* continue the extent */ - page++; - clen++; - i++; - continue; - } - - /* process found extent */ - rc = fsfilt_map_nblocks(inode, fp->index * blocks_per_page, - clen * blocks_per_page, blocks, - create); - if (rc) - GOTO(cleanup, rc); - - /* look for next extent */ - fp = NULL; - blocks += blocks_per_page * clen; - } - - if (fp) - rc = fsfilt_map_nblocks(inode, fp->index * blocks_per_page, - clen * blocks_per_page, blocks, - create); -cleanup: - return rc; -} - -int fsfilt_ext3_map_bm_inode_pages(struct inode *inode, struct page **page, - int pages, unsigned long *blocks, - int create) -{ - int blocks_per_page = PAGE_CACHE_SIZE >> inode->i_blkbits; - unsigned long *b; - int rc = 0, i; - - for (i = 0, b = blocks; i < pages; i++, page++) { - rc = ext3_map_inode_page(inode, *page, b, create); - if (rc) { - CERROR("ino %lu, blk %lu create %d: rc %d\n", - inode->i_ino, *b, create, rc); - break; - } - - b += blocks_per_page; - } - return rc; -} - -int fsfilt_ext3_map_inode_pages(struct inode *inode, struct page **page, - int pages, unsigned long *blocks, - int create, struct mutex *optional_mutex) -{ - int rc; - - if (EXT3_I(inode)->i_flags & EXT3_EXTENTS_FL) { - rc = fsfilt_ext3_map_ext_inode_pages(inode, page, pages, - blocks, create); - return rc; - } - if (optional_mutex != NULL) - mutex_lock(optional_mutex); - rc = fsfilt_ext3_map_bm_inode_pages(inode, page, pages, blocks, create); - if (optional_mutex != NULL) - mutex_unlock(optional_mutex); - - return rc; -} - -int fsfilt_ext3_read(struct inode *inode, void *buf, int size, loff_t *offs) -{ - unsigned long block; - struct buffer_head *bh; - int err, blocksize, csize, boffs, osize = size; - - /* prevent reading after eof */ - spin_lock(&inode->i_lock); - if (i_size_read(inode) < *offs + size) { - size = i_size_read(inode) - *offs; - spin_unlock(&inode->i_lock); - if (size < 0) { - CDEBUG(D_EXT2, "size %llu is too short for read @%llu\n", - i_size_read(inode), *offs); - return -EBADR; - } else if (size == 0) { - return 0; - } - } else { - spin_unlock(&inode->i_lock); - } - - blocksize = 1 << inode->i_blkbits; - - while (size > 0) { - block = *offs >> inode->i_blkbits; - boffs = *offs & (blocksize - 1); - csize = min(blocksize - boffs, size); - bh = ext3_bread(NULL, inode, block, 0, &err); - if (!bh) { - CERROR("can't read block: %d\n", err); - return err; - } - - memcpy(buf, bh->b_data + boffs, csize); - brelse(bh); - - *offs += csize; - buf += csize; - size -= csize; - } - return osize; -} -EXPORT_SYMBOL(fsfilt_ext3_read); - -static int fsfilt_ext3_read_record(struct file * file, void *buf, - int size, loff_t *offs) -{ - int rc; - rc = fsfilt_ext3_read(file->f_dentry->d_inode, buf, size, offs); - if (rc > 0) - rc = 0; - return rc; -} - -int fsfilt_ext3_write_handle(struct inode *inode, void *buf, int bufsize, - loff_t *offs, handle_t *handle) -{ - struct buffer_head *bh = NULL; - loff_t old_size = i_size_read(inode), offset = *offs; - loff_t new_size = i_size_read(inode); - unsigned long block; - int err = 0, blocksize = 1 << inode->i_blkbits, size, boffs; - - while (bufsize > 0) { - if (bh != NULL) - brelse(bh); - - block = offset >> inode->i_blkbits; - boffs = offset & (blocksize - 1); - size = min(blocksize - boffs, bufsize); - bh = ext3_bread(handle, inode, block, 1, &err); - if (!bh) { - CERROR("can't read/create block: %d\n", err); - break; - } - - err = ext3_journal_get_write_access(handle, bh); - if (err) { - CERROR("journal_get_write_access() returned error %d\n", - err); - break; - } - LASSERT(bh->b_data + boffs + size <= bh->b_data + bh->b_size); - memcpy(bh->b_data + boffs, buf, size); - err = ext3_journal_dirty_metadata(handle, bh); - if (err) { - CERROR("journal_dirty_metadata() returned error %d\n", - err); - break; - } - if (offset + size > new_size) - new_size = offset + size; - offset += size; - bufsize -= size; - buf += size; - } - if (bh) - brelse(bh); - - /* correct in-core and on-disk sizes */ - if (new_size > i_size_read(inode)) { - spin_lock(&inode->i_lock); - if (new_size > i_size_read(inode)) - i_size_write(inode, new_size); - if (i_size_read(inode) > EXT3_I(inode)->i_disksize) - EXT3_I(inode)->i_disksize = i_size_read(inode); - if (i_size_read(inode) > old_size) { - spin_unlock(&inode->i_lock); - mark_inode_dirty(inode); - } else { - spin_unlock(&inode->i_lock); - } - } - - if (err == 0) - *offs = offset; - return err; -} -EXPORT_SYMBOL(fsfilt_ext3_write_handle); - -static int fsfilt_ext3_write_record(struct file *file, void *buf, int bufsize, - loff_t *offs, int force_sync) -{ - struct inode *inode = file->f_dentry->d_inode; - handle_t *handle; - int err, block_count = 0, blocksize; - - /* Determine how many transaction credits are needed */ - blocksize = 1 << inode->i_blkbits; - block_count = (*offs & (blocksize - 1)) + bufsize; - block_count = (block_count + blocksize - 1) >> inode->i_blkbits; - - handle = ext3_journal_start(inode, - block_count * EXT3_DATA_TRANS_BLOCKS(inode->i_sb) + 2); - if (IS_ERR(handle)) { - CERROR("can't start transaction for %d blocks (%d bytes)\n", - block_count * EXT3_DATA_TRANS_BLOCKS(inode->i_sb) + 2, - bufsize); - return PTR_ERR(handle); - } - - err = fsfilt_ext3_write_handle(inode, buf, bufsize, offs, handle); - - if (!err && force_sync) - handle->h_sync = 1; /* recovery likes this */ - - ext3_journal_stop(handle); - - return err; -} - -static int fsfilt_ext3_setup(struct super_block *sb) -{ - if (!EXT3_HAS_COMPAT_FEATURE(sb, - EXT3_FEATURE_COMPAT_HAS_JOURNAL)) { - CERROR("ext3 mounted without journal\n"); - return -EINVAL; - } - -#ifdef S_PDIROPS - CWARN("Enabling PDIROPS\n"); - set_opt(EXT3_SB(sb)->s_mount_opt, PDIROPS); - sb->s_flags |= S_PDIROPS; -#endif - if (!EXT3_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_DIR_INDEX)) - CWARN("filesystem doesn't have dir_index feature enabled\n"); - return 0; -} -static struct fsfilt_operations fsfilt_ext3_ops = { - .fs_type = "ext3", - .fs_owner = THIS_MODULE, - .fs_getlabel = fsfilt_ext3_get_label, - .fs_start = fsfilt_ext3_start, - .fs_commit = fsfilt_ext3_commit, - .fs_map_inode_pages = fsfilt_ext3_map_inode_pages, - .fs_write_record = fsfilt_ext3_write_record, - .fs_read_record = fsfilt_ext3_read_record, - .fs_setup = fsfilt_ext3_setup, -}; - -static int __init fsfilt_ext3_init(void) -{ - int rc; - - fcb_cache = kmem_cache_create("fsfilt_ext3_fcb", - sizeof(struct fsfilt_cb_data), 0, 0); - if (!fcb_cache) { - CERROR("error allocating fsfilt journal callback cache\n"); - GOTO(out, rc = -ENOMEM); - } - - rc = fsfilt_register_ops(&fsfilt_ext3_ops); - - if (rc) { - int err = kmem_cache_destroy(fcb_cache); - LASSERTF(err == 0, "error destroying new cache: rc %d\n", err); - } -out: - return rc; -} - -static void __exit fsfilt_ext3_exit(void) -{ - int rc; - - fsfilt_unregister_ops(&fsfilt_ext3_ops); - rc = kmem_cache_destroy(fcb_cache); - LASSERTF(rc == 0, "couldn't destroy fcb_cache slab\n"); -} - -module_init(fsfilt_ext3_init); -module_exit(fsfilt_ext3_exit); - -MODULE_AUTHOR("Sun Microsystems, Inc. "); -MODULE_DESCRIPTION("Lustre ext3 Filesystem Helper v0.1"); -MODULE_LICENSE("GPL"); From 6f0737c9c817545af6774a23722a6bc99b9dbb44 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 19 Nov 2013 22:38:39 +0800 Subject: [PATCH 203/238] staging/lustre/o2iblnd: remove kib_sysctl we have #define CFS_SYSFS_MODULE_PARM 1 so it is indeed dead code. Cc: Andreas Dilger Signed-off-by: Peng Tao Signed-off-by: Greg Kroah-Hartman --- .../lustre/lnet/klnds/o2iblnd/o2iblnd.c | 1 - .../lustre/lnet/klnds/o2iblnd/o2iblnd.h | 3 - .../lnet/klnds/o2iblnd/o2iblnd_modparams.c | 262 ------------------ 3 files changed, 266 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 86397f96b033..644a0000130a 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -3230,7 +3230,6 @@ void __exit kiblnd_module_fini (void) { lnet_unregister_lnd(&the_o2iblnd); - kiblnd_tunables_fini(); } int __init diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h index 938df0cf8c64..3f83ce4871cf 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h @@ -106,9 +106,6 @@ typedef struct int *kib_fmr_pool_size; /* # FMRs in pool */ int *kib_fmr_flush_trigger; /* When to trigger FMR flush */ int *kib_fmr_cache; /* enable FMR pool cache? */ -#if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM - ctl_table_header_t *kib_sysctl; /* sysctl interface */ -#endif int *kib_require_priv_port;/* accept only privileged ports */ int *kib_use_priv_port; /* use privileged port for active connect */ /* # threads on each CPT */ diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c index 92dc5672e2dd..cc291d00dba0 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c @@ -176,261 +176,6 @@ kib_tunables_t kiblnd_tunables = { .kib_nscheds = &nscheds }; -#if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM - -static char ipif_basename_space[32]; - - -enum { - O2IBLND_SERVICE = 1, - O2IBLND_CKSUM, - O2IBLND_TIMEOUT, - O2IBLND_NTX, - O2IBLND_CREDITS, - O2IBLND_PEER_TXCREDITS, - O2IBLND_PEER_CREDITS_HIW, - O2IBLND_PEER_RTRCREDITS, - O2IBLND_PEER_TIMEOUT, - O2IBLND_IPIF_BASENAME, - O2IBLND_RETRY_COUNT, - O2IBLND_RNR_RETRY_COUNT, - O2IBLND_KEEPALIVE, - O2IBLND_CONCURRENT_SENDS, - O2IBLND_IB_MTU, - O2IBLND_MAP_ON_DEMAND, - O2IBLND_FMR_POOL_SIZE, - O2IBLND_FMR_FLUSH_TRIGGER, - O2IBLND_FMR_CACHE, - O2IBLND_PMR_POOL_SIZE, - O2IBLND_DEV_FAILOVER -}; - -static ctl_table_t kiblnd_ctl_table[] = { - { - .ctl_name = O2IBLND_SERVICE, - .procname = "service", - .data = &service, - .maxlen = sizeof(int), - .mode = 0444, - .proc_handler = &proc_dointvec - }, - { - .ctl_name = O2IBLND_CKSUM, - .procname = "cksum", - .data = &cksum, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec - }, - { - .ctl_name = O2IBLND_TIMEOUT, - .procname = "timeout", - .data = &timeout, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec - }, - { - .ctl_name = O2IBLND_NTX, - .procname = "ntx", - .data = &ntx, - .maxlen = sizeof(int), - .mode = 0444, - .proc_handler = &proc_dointvec - }, - { - .ctl_name = O2IBLND_CREDITS, - .procname = "credits", - .data = &credits, - .maxlen = sizeof(int), - .mode = 0444, - .proc_handler = &proc_dointvec - }, - { - .ctl_name = O2IBLND_PEER_TXCREDITS, - .procname = "peer_credits", - .data = &peer_credits, - .maxlen = sizeof(int), - .mode = 0444, - .proc_handler = &proc_dointvec - }, - { - .ctl_name = O2IBLND_PEER_CREDITS_HIW, - .procname = "peer_credits_hiw", - .data = &peer_credits_hiw, - .maxlen = sizeof(int), - .mode = 0444, - .proc_handler = &proc_dointvec - }, - { - .ctl_name = O2IBLND_PEER_RTRCREDITS, - .procname = "peer_buffer_credits", - .data = &peer_buffer_credits, - .maxlen = sizeof(int), - .mode = 0444, - .proc_handler = &proc_dointvec - }, - { - .ctl_name = O2IBLND_PEER_TIMEOUT, - .procname = "peer_timeout", - .data = &peer_timeout, - .maxlen = sizeof(int), - .mode = 0444, - .proc_handler = &proc_dointvec - }, - { - .ctl_name = O2IBLND_IPIF_BASENAME, - .procname = "ipif_name", - .data = ipif_basename_space, - .maxlen = sizeof(ipif_basename_space), - .mode = 0444, - .proc_handler = &proc_dostring - }, - { - .ctl_name = O2IBLND_RETRY_COUNT, - .procname = "retry_count", - .data = &retry_count, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec - }, - { - .ctl_name = O2IBLND_RNR_RETRY_COUNT, - .procname = "rnr_retry_count", - .data = &rnr_retry_count, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec - }, - { - .ctl_name = O2IBLND_KEEPALIVE, - .procname = "keepalive", - .data = &keepalive, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec - }, - { - .ctl_name = O2IBLND_CONCURRENT_SENDS, - .procname = "concurrent_sends", - .data = &concurrent_sends, - .maxlen = sizeof(int), - .mode = 0444, - .proc_handler = &proc_dointvec - }, - { - .ctl_name = O2IBLND_IB_MTU, - .procname = "ib_mtu", - .data = &ib_mtu, - .maxlen = sizeof(int), - .mode = 0444, - .proc_handler = &proc_dointvec - }, - { - .ctl_name = O2IBLND_MAP_ON_DEMAND, - .procname = "map_on_demand", - .data = &map_on_demand, - .maxlen = sizeof(int), - .mode = 0444, - .proc_handler = &proc_dointvec - }, - - { - .ctl_name = O2IBLND_FMR_POOL_SIZE, - .procname = "fmr_pool_size", - .data = &fmr_pool_size, - .maxlen = sizeof(int), - .mode = 0444, - .proc_handler = &proc_dointvec - }, - { - .ctl_name = O2IBLND_FMR_FLUSH_TRIGGER, - .procname = "fmr_flush_trigger", - .data = &fmr_flush_trigger, - .maxlen = sizeof(int), - .mode = 0444, - .proc_handler = &proc_dointvec - }, - { - .ctl_name = O2IBLND_FMR_CACHE, - .procname = "fmr_cache", - .data = &fmr_cache, - .maxlen = sizeof(int), - .mode = 0444, - .proc_handler = &proc_dointvec - }, - { - .ctl_name = O2IBLND_PMR_POOL_SIZE, - .procname = "pmr_pool_size", - .data = &pmr_pool_size, - .maxlen = sizeof(int), - .mode = 0444, - .proc_handler = &proc_dointvec - }, - { - .ctl_name = O2IBLND_DEV_FAILOVER, - .procname = "dev_failover", - .data = &dev_failover, - .maxlen = sizeof(int), - .mode = 0444, - .proc_handler = &proc_dointvec - }, - {0} -}; - -static ctl_table_t kiblnd_top_ctl_table[] = { - { - .ctl_name = CTL_O2IBLND, - .procname = "o2iblnd", - .data = NULL, - .maxlen = 0, - .mode = 0555, - .child = kiblnd_ctl_table - }, - {0} -}; - -void -kiblnd_initstrtunable(char *space, char *str, int size) -{ - strncpy(space, str, size); - space[size-1] = 0; -} - -void -kiblnd_sysctl_init (void) -{ - kiblnd_initstrtunable(ipif_basename_space, ipif_name, - sizeof(ipif_basename_space)); - - kiblnd_tunables.kib_sysctl = - register_sysctl_table(kiblnd_top_ctl_table); - - if (kiblnd_tunables.kib_sysctl == NULL) - CWARN("Can't setup /proc tunables\n"); -} - -void -kiblnd_sysctl_fini (void) -{ - if (kiblnd_tunables.kib_sysctl != NULL) - unregister_sysctl_table(kiblnd_tunables.kib_sysctl); -} - -#else - -void -kiblnd_sysctl_init (void) -{ -} - -void -kiblnd_sysctl_fini (void) -{ -} - -#endif - int kiblnd_tunables_init (void) { @@ -482,12 +227,5 @@ kiblnd_tunables_init (void) *kiblnd_tunables.kib_concurrent_sends, *kiblnd_tunables.kib_peertxcredits); } - kiblnd_sysctl_init(); return 0; } - -void -kiblnd_tunables_fini (void) -{ - kiblnd_sysctl_fini(); -} From a05a2e4d19ec3be7a8a70e831b5f5c8dcea2efe4 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 19 Nov 2013 22:38:40 +0800 Subject: [PATCH 204/238] staging/lustre/socklnd: remove ksnd_sysctl It is dead code because we defined CFS_SYSFS_MODULE_PARM. Cc: Andreas Dilger Signed-off-by: Peng Tao Signed-off-by: Greg Kroah-Hartman --- .../lustre/lnet/klnds/socklnd/socklnd.c | 1 - .../lustre/lnet/klnds/socklnd/socklnd.h | 6 - .../lnet/klnds/socklnd/socklnd_lib-linux.c | 307 ------------------ .../lnet/klnds/socklnd/socklnd_modparams.c | 12 +- 4 files changed, 1 insertion(+), 325 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index 2ddc3aadb8d6..8f74d0be32f1 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -2866,7 +2866,6 @@ void __exit ksocknal_module_fini (void) { lnet_unregister_lnd(&the_ksocklnd); - ksocknal_tunables_fini(); } int __init diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h index b483e0c3a69a..df2be7a7f46e 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h @@ -124,9 +124,6 @@ typedef struct unsigned int *ksnd_zc_min_payload; /* minimum zero copy payload size */ int *ksnd_zc_recv; /* enable ZC receive (for Chelsio TOE) */ int *ksnd_zc_recv_min_nfrags; /* minimum # of fragments to enable ZC receive */ -#if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM - ctl_table_header_t *ksnd_sysctl; /* sysctl interface */ -#endif } ksock_tunables_t; typedef struct @@ -592,9 +589,6 @@ extern int ksocknal_lib_get_conn_tunables (ksock_conn_t *conn, int *txmem, int *rxmem, int *nagle); extern int ksocknal_tunables_init(void); -extern void ksocknal_tunables_fini(void); -extern int ksocknal_lib_tunables_init(void); -extern void ksocknal_lib_tunables_fini(void); extern void ksocknal_lib_csum_tx(ksock_tx_t *tx); diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c index a1c6a519bf5b..80141aa32c21 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c @@ -36,313 +36,6 @@ #include "socklnd.h" -# if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM - - -enum { - SOCKLND_TIMEOUT = 1, - SOCKLND_CREDITS, - SOCKLND_PEER_TXCREDITS, - SOCKLND_PEER_RTRCREDITS, - SOCKLND_PEER_TIMEOUT, - SOCKLND_NCONNDS, - SOCKLND_RECONNECTS_MIN, - SOCKLND_RECONNECTS_MAX, - SOCKLND_EAGER_ACK, - SOCKLND_ZERO_COPY, - SOCKLND_TYPED, - SOCKLND_BULK_MIN, - SOCKLND_RX_BUFFER_SIZE, - SOCKLND_TX_BUFFER_SIZE, - SOCKLND_NAGLE, - SOCKLND_IRQ_AFFINITY, - SOCKLND_ROUND_ROBIN, - SOCKLND_KEEPALIVE, - SOCKLND_KEEPALIVE_IDLE, - SOCKLND_KEEPALIVE_COUNT, - SOCKLND_KEEPALIVE_INTVL, - SOCKLND_BACKOFF_INIT, - SOCKLND_BACKOFF_MAX, - SOCKLND_PROTOCOL, - SOCKLND_ZERO_COPY_RECV, - SOCKLND_ZERO_COPY_RECV_MIN_NFRAGS -}; - -static ctl_table_t ksocknal_ctl_table[] = { - { - .ctl_name = SOCKLND_TIMEOUT, - .procname = "timeout", - .data = &ksocknal_tunables.ksnd_timeout, - .maxlen = sizeof (int), - .mode = 0644, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, - { - .ctl_name = SOCKLND_CREDITS, - .procname = "credits", - .data = &ksocknal_tunables.ksnd_credits, - .maxlen = sizeof (int), - .mode = 0444, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, - { - .ctl_name = SOCKLND_PEER_TXCREDITS, - .procname = "peer_credits", - .data = &ksocknal_tunables.ksnd_peertxcredits, - .maxlen = sizeof (int), - .mode = 0444, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, - { - .ctl_name = SOCKLND_PEER_RTRCREDITS, - .procname = "peer_buffer_credits", - .data = &ksocknal_tunables.ksnd_peerrtrcredits, - .maxlen = sizeof (int), - .mode = 0444, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, - { - .ctl_name = SOCKLND_PEER_TIMEOUT, - .procname = "peer_timeout", - .data = &ksocknal_tunables.ksnd_peertimeout, - .maxlen = sizeof (int), - .mode = 0444, - .proc_handler = &proc_dointvec - .strategy = &sysctl_intvec, - }, - { - .ctl_name = SOCKLND_NCONNDS, - .procname = "nconnds", - .data = &ksocknal_tunables.ksnd_nconnds, - .maxlen = sizeof (int), - .mode = 0444, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, - { - .ctl_name = SOCKLND_RECONNECTS_MIN, - .procname = "min_reconnectms", - .data = &ksocknal_tunables.ksnd_min_reconnectms, - .maxlen = sizeof (int), - .mode = 0444, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, - { - .ctl_name = SOCKLND_RECONNECTS_MAX, - .procname = "max_reconnectms", - .data = &ksocknal_tunables.ksnd_max_reconnectms, - .maxlen = sizeof (int), - .mode = 0444, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, - { - .ctl_name = SOCKLND_EAGER_ACK, - .procname = "eager_ack", - .data = &ksocknal_tunables.ksnd_eager_ack, - .maxlen = sizeof (int), - .mode = 0644, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, - { - .ctl_name = SOCKLND_ZERO_COPY, - .procname = "zero_copy", - .data = &ksocknal_tunables.ksnd_zc_min_payload, - .maxlen = sizeof (int), - .mode = 0644, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, - { - .ctl_name = SOCKLND_ZERO_COPY_RECV, - .procname = "zero_copy_recv", - .data = &ksocknal_tunables.ksnd_zc_recv, - .maxlen = sizeof (int), - .mode = 0644, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, - - { - .ctl_name = SOCKLND_ZERO_COPY_RECV_MIN_NFRAGS, - .procname = "zero_copy_recv", - .data = &ksocknal_tunables.ksnd_zc_recv_min_nfrags, - .maxlen = sizeof (int), - .mode = 0644, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, - { - .ctl_name = SOCKLND_TYPED, - .procname = "typed", - .data = &ksocknal_tunables.ksnd_typed_conns, - .maxlen = sizeof (int), - .mode = 0444, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, - { - .ctl_name = SOCKLND_BULK_MIN, - .procname = "min_bulk", - .data = &ksocknal_tunables.ksnd_min_bulk, - .maxlen = sizeof (int), - .mode = 0644, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, - { - .ctl_name = SOCKLND_RX_BUFFER_SIZE, - .procname = "rx_buffer_size", - .data = &ksocknal_tunables.ksnd_rx_buffer_size, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, - { - .ctl_name = SOCKLND_TX_BUFFER_SIZE, - .procname = "tx_buffer_size", - .data = &ksocknal_tunables.ksnd_tx_buffer_size, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, - { - .ctl_name = SOCKLND_NAGLE, - .procname = "nagle", - .data = &ksocknal_tunables.ksnd_nagle, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, - { - .ctl_name = SOCKLND_ROUND_ROBIN, - .procname = "round_robin", - .data = &ksocknal_tunables.ksnd_round_robin, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, - { - .ctl_name = SOCKLND_KEEPALIVE, - .procname = "keepalive", - .data = &ksocknal_tunables.ksnd_keepalive, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, - { - .ctl_name = SOCKLND_KEEPALIVE_IDLE, - .procname = "keepalive_idle", - .data = &ksocknal_tunables.ksnd_keepalive_idle, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, - { - .ctl_name = SOCKLND_KEEPALIVE_COUNT, - .procname = "keepalive_count", - .data = &ksocknal_tunables.ksnd_keepalive_count, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, - { - .ctl_name = SOCKLND_KEEPALIVE_INTVL, - .procname = "keepalive_intvl", - .data = &ksocknal_tunables.ksnd_keepalive_intvl, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, -#if SOCKNAL_VERSION_DEBUG - { - .ctl_name = SOCKLND_PROTOCOL, - .procname = "protocol", - .data = &ksocknal_tunables.ksnd_protocol, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec, - .strategy = &sysctl_intvec, - }, -#endif - {0} -}; - - -ctl_table_t ksocknal_top_ctl_table[] = { - { - .ctl_name = CTL_SOCKLND, - .procname = "socknal", - .data = NULL, - .maxlen = 0, - .mode = 0555, - .child = ksocknal_ctl_table - }, - { 0 } -}; - -int -ksocknal_lib_tunables_init () -{ - if (!*ksocknal_tunables.ksnd_typed_conns) { - int rc = -EINVAL; -#if SOCKNAL_VERSION_DEBUG - if (*ksocknal_tunables.ksnd_protocol < 3) - rc = 0; -#endif - if (rc != 0) { - CERROR("Protocol V3.x MUST have typed connections\n"); - return rc; - } - } - - if (*ksocknal_tunables.ksnd_zc_recv_min_nfrags < 2) - *ksocknal_tunables.ksnd_zc_recv_min_nfrags = 2; - if (*ksocknal_tunables.ksnd_zc_recv_min_nfrags > LNET_MAX_IOV) - *ksocknal_tunables.ksnd_zc_recv_min_nfrags = LNET_MAX_IOV; - - ksocknal_tunables.ksnd_sysctl = - register_sysctl_table(ksocknal_top_ctl_table); - - if (ksocknal_tunables.ksnd_sysctl == NULL) - CWARN("Can't setup /proc tunables\n"); - - return 0; -} - -void -ksocknal_lib_tunables_fini(void) -{ - if (ksocknal_tunables.ksnd_sysctl != NULL) - unregister_sysctl_table(ksocknal_tunables.ksnd_sysctl); -} -#else -int -ksocknal_lib_tunables_init(void) -{ - return 0; -} - -void -ksocknal_lib_tunables_fini(void) -{ -} -#endif /* # if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM */ - int ksocknal_lib_get_conn_addrs (ksock_conn_t *conn) { diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c index 8a474f64abbe..9f4c64e51b0b 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c @@ -181,18 +181,8 @@ int ksocknal_tunables_init(void) ksocknal_tunables.ksnd_protocol = &protocol; #endif -#if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM - ksocknal_tunables.ksnd_sysctl = NULL; -#endif - if (*ksocknal_tunables.ksnd_zc_min_payload < (2 << 10)) *ksocknal_tunables.ksnd_zc_min_payload = (2 << 10); - /* initialize platform-sepcific tunables */ - return ksocknal_lib_tunables_init(); + return 0; }; - -void ksocknal_tunables_fini(void) -{ - ksocknal_lib_tunables_fini(); -} From 81ddefb0040f9bf4722d99b4a1938c771e036530 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 19 Nov 2013 22:38:41 +0800 Subject: [PATCH 205/238] staging/lustre: remove CFS_SYSFS_MODULE_PARM No more references to it. Cc: Andreas Dilger Signed-off-by: Peng Tao Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/include/linux/libcfs/linux/kp30.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h b/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h index 9b30b4d92cc9..d4c671651dea 100644 --- a/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h +++ b/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h @@ -77,8 +77,6 @@ module_param(name, type, perm);\ MODULE_PARM_DESC(name, desc) -#define CFS_SYSFS_MODULE_PARM 1 /* module parameters accessible via sysfs */ - /******************************************************************************/ /* Light-weight trace * Support for temporary event tracing with minimal Heisenberg effect. */ From 6be96847b3233ed7f659ca3c1cf70f5ac4cc0a6b Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 19 Nov 2013 22:38:42 +0800 Subject: [PATCH 206/238] staging/lustre/libcfs: remove IOCTL_LIBCFS_TYPE Cc: Andreas Dilger Signed-off-by: Peng Tao Signed-off-by: Greg Kroah-Hartman --- .../include/linux/libcfs/libcfs_ioctl.h | 66 +++++++++---------- .../lustre/include/linux/libcfs/linux/kp30.h | 2 - 2 files changed, 33 insertions(+), 35 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h index 5be367973508..315743ec92e3 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h @@ -110,41 +110,41 @@ struct libcfs_ioctl_handler { #define IOC_LIBCFS_TYPE 'e' #define IOC_LIBCFS_MIN_NR 30 /* libcfs ioctls */ -#define IOC_LIBCFS_PANIC _IOWR('e', 30, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_CLEAR_DEBUG _IOWR('e', 31, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_MARK_DEBUG _IOWR('e', 32, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_LWT_CONTROL _IOWR('e', 33, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_LWT_SNAPSHOT _IOWR('e', 34, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_LWT_LOOKUP_STRING _IOWR('e', 35, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_MEMHOG _IOWR('e', 36, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_PING_TEST _IOWR('e', 37, IOCTL_LIBCFS_TYPE) +#define IOC_LIBCFS_PANIC _IOWR('e', 30, long) +#define IOC_LIBCFS_CLEAR_DEBUG _IOWR('e', 31, long) +#define IOC_LIBCFS_MARK_DEBUG _IOWR('e', 32, long) +#define IOC_LIBCFS_LWT_CONTROL _IOWR('e', 33, long) +#define IOC_LIBCFS_LWT_SNAPSHOT _IOWR('e', 34, long) +#define IOC_LIBCFS_LWT_LOOKUP_STRING _IOWR('e', 35, long) +#define IOC_LIBCFS_MEMHOG _IOWR('e', 36, long) +#define IOC_LIBCFS_PING_TEST _IOWR('e', 37, long) /* lnet ioctls */ -#define IOC_LIBCFS_GET_NI _IOWR('e', 50, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_FAIL_NID _IOWR('e', 51, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_ADD_ROUTE _IOWR('e', 52, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_DEL_ROUTE _IOWR('e', 53, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_GET_ROUTE _IOWR('e', 54, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_NOTIFY_ROUTER _IOWR('e', 55, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_UNCONFIGURE _IOWR('e', 56, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_PORTALS_COMPATIBILITY _IOWR('e', 57, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_LNET_DIST _IOWR('e', 58, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_CONFIGURE _IOWR('e', 59, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_TESTPROTOCOMPAT _IOWR('e', 60, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_PING _IOWR('e', 61, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_DEBUG_PEER _IOWR('e', 62, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_LNETST _IOWR('e', 63, IOCTL_LIBCFS_TYPE) +#define IOC_LIBCFS_GET_NI _IOWR('e', 50, long) +#define IOC_LIBCFS_FAIL_NID _IOWR('e', 51, long) +#define IOC_LIBCFS_ADD_ROUTE _IOWR('e', 52, long) +#define IOC_LIBCFS_DEL_ROUTE _IOWR('e', 53, long) +#define IOC_LIBCFS_GET_ROUTE _IOWR('e', 54, long) +#define IOC_LIBCFS_NOTIFY_ROUTER _IOWR('e', 55, long) +#define IOC_LIBCFS_UNCONFIGURE _IOWR('e', 56, long) +#define IOC_LIBCFS_PORTALS_COMPATIBILITY _IOWR('e', 57, long) +#define IOC_LIBCFS_LNET_DIST _IOWR('e', 58, long) +#define IOC_LIBCFS_CONFIGURE _IOWR('e', 59, long) +#define IOC_LIBCFS_TESTPROTOCOMPAT _IOWR('e', 60, long) +#define IOC_LIBCFS_PING _IOWR('e', 61, long) +#define IOC_LIBCFS_DEBUG_PEER _IOWR('e', 62, long) +#define IOC_LIBCFS_LNETST _IOWR('e', 63, long) /* lnd ioctls */ -#define IOC_LIBCFS_REGISTER_MYNID _IOWR('e', 70, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_CLOSE_CONNECTION _IOWR('e', 71, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_PUSH_CONNECTION _IOWR('e', 72, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_GET_CONN _IOWR('e', 73, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_DEL_PEER _IOWR('e', 74, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_ADD_PEER _IOWR('e', 75, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_GET_PEER _IOWR('e', 76, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_GET_TXDESC _IOWR('e', 77, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_ADD_INTERFACE _IOWR('e', 78, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_DEL_INTERFACE _IOWR('e', 79, IOCTL_LIBCFS_TYPE) -#define IOC_LIBCFS_GET_INTERFACE _IOWR('e', 80, IOCTL_LIBCFS_TYPE) +#define IOC_LIBCFS_REGISTER_MYNID _IOWR('e', 70, long) +#define IOC_LIBCFS_CLOSE_CONNECTION _IOWR('e', 71, long) +#define IOC_LIBCFS_PUSH_CONNECTION _IOWR('e', 72, long) +#define IOC_LIBCFS_GET_CONN _IOWR('e', 73, long) +#define IOC_LIBCFS_DEL_PEER _IOWR('e', 74, long) +#define IOC_LIBCFS_ADD_PEER _IOWR('e', 75, long) +#define IOC_LIBCFS_GET_PEER _IOWR('e', 76, long) +#define IOC_LIBCFS_GET_TXDESC _IOWR('e', 77, long) +#define IOC_LIBCFS_ADD_INTERFACE _IOWR('e', 78, long) +#define IOC_LIBCFS_DEL_INTERFACE _IOWR('e', 79, long) +#define IOC_LIBCFS_GET_INTERFACE _IOWR('e', 80, long) #define IOC_LIBCFS_MAX_NR 80 diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h b/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h index d4c671651dea..69eefd5179bd 100644 --- a/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h +++ b/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h @@ -175,8 +175,6 @@ extern int lwt_snapshot (cfs_cycles_t *now, int *ncpu, int *total_size, /* ------------------------------------------------------------------ */ -#define IOCTL_LIBCFS_TYPE long - #ifdef __CYGWIN__ # ifndef BITS_PER_LONG # define BITS_PER_LONG 64 From 414b1419c5ef5962ba82d3b29bbe722568a82556 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 19 Nov 2013 22:38:43 +0800 Subject: [PATCH 207/238] staging/lustre: remove __CYGWIN__ Cc: Andreas Dilger Signed-off-by: Peng Tao Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/include/linux/libcfs/linux/kp30.h | 6 ------ drivers/staging/lustre/include/linux/lnet/types.h | 11 ----------- drivers/staging/lustre/lustre/osc/osc_request.c | 4 ---- 3 files changed, 21 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h b/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h index 69eefd5179bd..fedf086e7ccf 100644 --- a/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h +++ b/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h @@ -175,12 +175,6 @@ extern int lwt_snapshot (cfs_cycles_t *now, int *ncpu, int *total_size, /* ------------------------------------------------------------------ */ -#ifdef __CYGWIN__ -# ifndef BITS_PER_LONG -# define BITS_PER_LONG 64 -# endif -#endif - # define LI_POISON 0x5a5a5a5a #if BITS_PER_LONG > 32 # define LL_POISON 0x5a5a5a5a5a5a5a5aL diff --git a/drivers/staging/lustre/include/linux/lnet/types.h b/drivers/staging/lustre/include/linux/lnet/types.h index 4f63b7acb9d7..c833ce8544d3 100644 --- a/drivers/staging/lustre/include/linux/lnet/types.h +++ b/drivers/staging/lustre/include/linux/lnet/types.h @@ -383,14 +383,6 @@ typedef enum { typedef unsigned LNET_SEQ_BASETYPE lnet_seq_t; #define LNET_SEQ_GT(a,b) (((signed LNET_SEQ_BASETYPE)((a) - (b))) > 0) -/* XXX - * cygwin need the pragma line, not clear if it's needed in other places. - * checking!!! - */ -#ifdef __CYGWIN__ -#pragma pack(push, 4) -#endif - /** * Information about an event on a MD. */ @@ -462,9 +454,6 @@ typedef struct { */ volatile lnet_seq_t sequence; } lnet_event_t; -#ifdef __CYGWIN__ -#pragma pop -#endif /** * Event queue handler function type. diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index cb197782d9a3..c837a0d71e0f 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -46,10 +46,6 @@ #include #include -#ifdef __CYGWIN__ -# include -#endif - #include #include #include From bace1077ff38c5258c3c10f26e7e08db2abd32ed Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 19 Nov 2013 22:38:44 +0800 Subject: [PATCH 208/238] staging/lustre: remove _LWORDSIZE Cc: Andreas Dilger Signed-off-by: Peng Tao Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/include/linux/libcfs/linux/kp30.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h b/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h index fedf086e7ccf..44f490ca782e 100644 --- a/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h +++ b/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h @@ -185,8 +185,6 @@ extern int lwt_snapshot (cfs_cycles_t *now, int *ncpu, int *total_size, /* this is a bit chunky */ -#define _LWORDSIZE BITS_PER_LONG - # define LPU64 "%llu" # define LPD64 "%lld" # define LPX64 "%#llx" @@ -206,9 +204,6 @@ extern int lwt_snapshot (cfs_cycles_t *now, int *ncpu, int *total_size, */ # define LPPID "%d" - -#undef _LWORDSIZE - /* compat macroses */ From 9f773620f1c14e4b0e8e2e17792d559f2e39fb44 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 19 Nov 2013 22:38:45 +0800 Subject: [PATCH 209/238] staging/lustre: get_cpu is always defined Cc: Andreas Dilger Signed-off-by: Peng Tao Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/include/linux/libcfs/linux/kp30.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h b/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h index 44f490ca782e..e6f03c7ae006 100644 --- a/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h +++ b/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h @@ -206,18 +206,6 @@ extern int lwt_snapshot (cfs_cycles_t *now, int *ncpu, int *total_size, /* compat macroses */ - -#ifndef get_cpu -# ifdef CONFIG_PREEMPT -# define get_cpu() ({ preempt_disable(); smp_processor_id(); }) -# define put_cpu() preempt_enable() -# else -# define get_cpu() smp_processor_id() -# define put_cpu() -# endif -#else -#endif /* get_cpu & put_cpu */ - #define INIT_CTL_NAME(a) #define INIT_STRATEGY(a) From 7fb3d1c5276b1e31f5cc736730231cf72d2d5a05 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 19 Nov 2013 22:38:46 +0800 Subject: [PATCH 210/238] staging/lustre: remove INIT_CTL_NAME legacy code used to support kernel where struct ctl_table has ctl_name member. Cc: Andreas Dilger Signed-off-by: Peng Tao Signed-off-by: Greg Kroah-Hartman --- .../lustre/include/linux/libcfs/linux/kp30.h | 1 - .../staging/lustre/lnet/lnet/router_proc.c | 10 -------- .../lustre/lustre/libcfs/linux/linux-proc.c | 25 +------------------ .../lustre/obdclass/linux/linux-sysctl.c | 23 ++--------------- 4 files changed, 3 insertions(+), 56 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h b/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h index e6f03c7ae006..ba7854159d7d 100644 --- a/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h +++ b/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h @@ -206,7 +206,6 @@ extern int lwt_snapshot (cfs_cycles_t *now, int *ncpu, int *total_size, /* compat macroses */ -#define INIT_CTL_NAME(a) #define INIT_STRATEGY(a) #endif diff --git a/drivers/staging/lustre/lnet/lnet/router_proc.c b/drivers/staging/lustre/lnet/lnet/router_proc.c index 5e47de36c184..daaa043ad118 100644 --- a/drivers/staging/lustre/lnet/lnet/router_proc.c +++ b/drivers/staging/lustre/lnet/lnet/router_proc.c @@ -855,55 +855,46 @@ static ctl_table_t lnet_table[] = { * to go via /proc for portability. */ { - INIT_CTL_NAME(PSDEV_LNET_STATS) .procname = "stats", .mode = 0644, .proc_handler = &proc_lnet_stats, }, { - INIT_CTL_NAME(PSDEV_LNET_ROUTES) .procname = "routes", .mode = 0444, .proc_handler = &proc_lnet_routes, }, { - INIT_CTL_NAME(PSDEV_LNET_ROUTERS) .procname = "routers", .mode = 0444, .proc_handler = &proc_lnet_routers, }, { - INIT_CTL_NAME(PSDEV_LNET_PEERS) .procname = "peers", .mode = 0444, .proc_handler = &proc_lnet_peers, }, { - INIT_CTL_NAME(PSDEV_LNET_PEERS) .procname = "buffers", .mode = 0444, .proc_handler = &proc_lnet_buffers, }, { - INIT_CTL_NAME(PSDEV_LNET_NIS) .procname = "nis", .mode = 0444, .proc_handler = &proc_lnet_nis, }, { - INIT_CTL_NAME(PSDEV_LNET_PTL_ROTOR) .procname = "portal_rotor", .mode = 0644, .proc_handler = &proc_lnet_portal_rotor, }, { - INIT_CTL_NAME(0) } }; static ctl_table_t top_table[] = { { - INIT_CTL_NAME(CTL_LNET) .procname = "lnet", .mode = 0555, .data = NULL, @@ -911,7 +902,6 @@ static ctl_table_t top_table[] = { .child = lnet_table, }, { - INIT_CTL_NAME(0) } }; diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c index fc6c97749487..f2bb8672a4ff 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c @@ -371,7 +371,6 @@ static ctl_table_t lnet_table[] = { * to go via /proc for portability. */ { - INIT_CTL_NAME(PSDEV_DEBUG) .procname = "debug", .data = &libcfs_debug, .maxlen = sizeof(int), @@ -379,7 +378,6 @@ static ctl_table_t lnet_table[] = { .proc_handler = &proc_dobitmasks, }, { - INIT_CTL_NAME(PSDEV_SUBSYSTEM_DEBUG) .procname = "subsystem_debug", .data = &libcfs_subsystem_debug, .maxlen = sizeof(int), @@ -387,7 +385,6 @@ static ctl_table_t lnet_table[] = { .proc_handler = &proc_dobitmasks, }, { - INIT_CTL_NAME(PSDEV_PRINTK) .procname = "printk", .data = &libcfs_printk, .maxlen = sizeof(int), @@ -395,7 +392,6 @@ static ctl_table_t lnet_table[] = { .proc_handler = &proc_dobitmasks, }, { - INIT_CTL_NAME(PSDEV_CONSOLE_RATELIMIT) .procname = "console_ratelimit", .data = &libcfs_console_ratelimit, .maxlen = sizeof(int), @@ -403,21 +399,18 @@ static ctl_table_t lnet_table[] = { .proc_handler = &proc_dointvec }, { - INIT_CTL_NAME(PSDEV_CONSOLE_MAX_DELAY_CS) .procname = "console_max_delay_centisecs", .maxlen = sizeof(int), .mode = 0644, .proc_handler = &proc_console_max_delay_cs }, { - INIT_CTL_NAME(PSDEV_CONSOLE_MIN_DELAY_CS) .procname = "console_min_delay_centisecs", .maxlen = sizeof(int), .mode = 0644, .proc_handler = &proc_console_min_delay_cs }, { - INIT_CTL_NAME(PSDEV_CONSOLE_BACKOFF) .procname = "console_backoff", .maxlen = sizeof(int), .mode = 0644, @@ -425,7 +418,6 @@ static ctl_table_t lnet_table[] = { }, { - INIT_CTL_NAME(PSDEV_DEBUG_PATH) .procname = "debug_path", .data = libcfs_debug_file_path_arr, .maxlen = sizeof(libcfs_debug_file_path_arr), @@ -434,7 +426,6 @@ static ctl_table_t lnet_table[] = { }, { - INIT_CTL_NAME(PSDEV_CPT_TABLE) .procname = "cpu_partition_table", .maxlen = 128, .mode = 0444, @@ -442,7 +433,6 @@ static ctl_table_t lnet_table[] = { }, { - INIT_CTL_NAME(PSDEV_LNET_UPCALL) .procname = "upcall", .data = lnet_upcall, .maxlen = sizeof(lnet_upcall), @@ -450,7 +440,6 @@ static ctl_table_t lnet_table[] = { .proc_handler = &proc_dostring, }, { - INIT_CTL_NAME(PSDEV_LNET_DEBUG_LOG_UPCALL) .procname = "debug_log_upcall", .data = lnet_debug_log_upcall, .maxlen = sizeof(lnet_debug_log_upcall), @@ -458,7 +447,6 @@ static ctl_table_t lnet_table[] = { .proc_handler = &proc_dostring, }, { - INIT_CTL_NAME(PSDEV_LNET_MEMUSED) .procname = "lnet_memused", .data = (int *)&libcfs_kmemory.counter, .maxlen = sizeof(int), @@ -467,7 +455,6 @@ static ctl_table_t lnet_table[] = { INIT_STRATEGY(&sysctl_intvec) }, { - INIT_CTL_NAME(PSDEV_LNET_CATASTROPHE) .procname = "catastrophe", .data = &libcfs_catastrophe, .maxlen = sizeof(int), @@ -476,7 +463,6 @@ static ctl_table_t lnet_table[] = { INIT_STRATEGY(&sysctl_intvec) }, { - INIT_CTL_NAME(PSDEV_LNET_PANIC_ON_LBUG) .procname = "panic_on_lbug", .data = &libcfs_panic_on_lbug, .maxlen = sizeof(int), @@ -485,27 +471,23 @@ static ctl_table_t lnet_table[] = { INIT_STRATEGY(&sysctl_intvec) }, { - INIT_CTL_NAME(PSDEV_LNET_DUMP_KERNEL) .procname = "dump_kernel", .maxlen = 256, .mode = 0200, .proc_handler = &proc_dump_kernel, }, { - INIT_CTL_NAME(PSDEV_LNET_DAEMON_FILE) .procname = "daemon_file", .mode = 0644, .maxlen = 256, .proc_handler = &proc_daemon_file, }, { - INIT_CTL_NAME(PSDEV_LNET_DEBUG_MB) .procname = "debug_mb", .mode = 0644, .proc_handler = &proc_debug_mb, }, { - INIT_CTL_NAME(PSDEV_LNET_WATCHDOG_RATELIMIT) .procname = "watchdog_ratelimit", .data = &libcfs_watchdog_ratelimit, .maxlen = sizeof(int), @@ -514,7 +496,7 @@ static ctl_table_t lnet_table[] = { .extra1 = &min_watchdog_ratelimit, .extra2 = &max_watchdog_ratelimit, }, - { INIT_CTL_NAME(PSDEV_LNET_FORCE_LBUG) + { .procname = "force_lbug", .data = NULL, .maxlen = 0, @@ -522,7 +504,6 @@ static ctl_table_t lnet_table[] = { .proc_handler = &libcfs_force_lbug }, { - INIT_CTL_NAME(PSDEV_LNET_FAIL_LOC) .procname = "fail_loc", .data = &cfs_fail_loc, .maxlen = sizeof(cfs_fail_loc), @@ -530,7 +511,6 @@ static ctl_table_t lnet_table[] = { .proc_handler = &proc_fail_loc }, { - INIT_CTL_NAME(PSDEV_LNET_FAIL_VAL) .procname = "fail_val", .data = &cfs_fail_val, .maxlen = sizeof(int), @@ -538,14 +518,12 @@ static ctl_table_t lnet_table[] = { .proc_handler = &proc_dointvec }, { - INIT_CTL_NAME(0) } }; #ifdef CONFIG_SYSCTL static ctl_table_t top_table[] = { { - INIT_CTL_NAME(CTL_LNET) .procname = "lnet", .mode = 0555, .data = NULL, @@ -553,7 +531,6 @@ static ctl_table_t top_table[] = { .child = lnet_table, }, { - INIT_CTL_NAME(0) } }; #endif diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c index acd2619227df..d66be020983d 100644 --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c @@ -282,7 +282,6 @@ int LL_PROC_PROTO(proc_at_history) #ifdef CONFIG_SYSCTL static ctl_table_t obd_table[] = { { - INIT_CTL_NAME(OBD_TIMEOUT) .procname = "timeout", .data = &obd_timeout, .maxlen = sizeof(int), @@ -290,7 +289,6 @@ static ctl_table_t obd_table[] = { .proc_handler = &proc_set_timeout }, { - INIT_CTL_NAME(OBD_DEBUG_PEER_ON_TIMEOUT) .procname = "debug_peer_on_timeout", .data = &obd_debug_peer_on_timeout, .maxlen = sizeof(int), @@ -298,7 +296,6 @@ static ctl_table_t obd_table[] = { .proc_handler = &proc_dointvec }, { - INIT_CTL_NAME(OBD_DUMP_ON_TIMEOUT) .procname = "dump_on_timeout", .data = &obd_dump_on_timeout, .maxlen = sizeof(int), @@ -306,7 +303,6 @@ static ctl_table_t obd_table[] = { .proc_handler = &proc_dointvec }, { - INIT_CTL_NAME(OBD_DUMP_ON_EVICTION) .procname = "dump_on_eviction", .data = &obd_dump_on_eviction, .maxlen = sizeof(int), @@ -314,7 +310,6 @@ static ctl_table_t obd_table[] = { .proc_handler = &proc_dointvec }, { - INIT_CTL_NAME(OBD_MEMUSED) .procname = "memused", .data = NULL, .maxlen = 0, @@ -322,7 +317,6 @@ static ctl_table_t obd_table[] = { .proc_handler = &proc_memory_alloc }, { - INIT_CTL_NAME(OBD_PAGESUSED) .procname = "pagesused", .data = NULL, .maxlen = 0, @@ -330,7 +324,6 @@ static ctl_table_t obd_table[] = { .proc_handler = &proc_pages_alloc }, { - INIT_CTL_NAME(OBD_MAXMEMUSED) .procname = "memused_max", .data = NULL, .maxlen = 0, @@ -338,7 +331,6 @@ static ctl_table_t obd_table[] = { .proc_handler = &proc_mem_max }, { - INIT_CTL_NAME(OBD_MAXPAGESUSED) .procname = "pagesused_max", .data = NULL, .maxlen = 0, @@ -346,7 +338,6 @@ static ctl_table_t obd_table[] = { .proc_handler = &proc_pages_max }, { - INIT_CTL_NAME(OBD_LDLM_TIMEOUT) .procname = "ldlm_timeout", .data = &ldlm_timeout, .maxlen = sizeof(int), @@ -354,7 +345,6 @@ static ctl_table_t obd_table[] = { .proc_handler = &proc_set_timeout }, { - INIT_CTL_NAME(OBD_ALLOC_FAIL_RATE) .procname = "alloc_fail_rate", .data = &obd_alloc_fail_rate, .maxlen = sizeof(int), @@ -362,7 +352,6 @@ static ctl_table_t obd_table[] = { .proc_handler = &proc_alloc_fail_rate }, { - INIT_CTL_NAME(OBD_MAX_DIRTY_PAGES) .procname = "max_dirty_mb", .data = &obd_max_dirty_pages, .maxlen = sizeof(int), @@ -370,7 +359,6 @@ static ctl_table_t obd_table[] = { .proc_handler = &proc_max_dirty_pages_in_mb }, { - INIT_CTL_NAME(OBD_AT_MIN) .procname = "at_min", .data = &at_min, .maxlen = sizeof(int), @@ -378,7 +366,6 @@ static ctl_table_t obd_table[] = { .proc_handler = &proc_at_min }, { - INIT_CTL_NAME(OBD_AT_MAX) .procname = "at_max", .data = &at_max, .maxlen = sizeof(int), @@ -386,7 +373,6 @@ static ctl_table_t obd_table[] = { .proc_handler = &proc_at_max }, { - INIT_CTL_NAME(OBD_AT_EXTRA) .procname = "at_extra", .data = &at_extra, .maxlen = sizeof(int), @@ -394,7 +380,6 @@ static ctl_table_t obd_table[] = { .proc_handler = &proc_at_extra }, { - INIT_CTL_NAME(OBD_AT_EARLY_MARGIN) .procname = "at_early_margin", .data = &at_early_margin, .maxlen = sizeof(int), @@ -402,26 +387,22 @@ static ctl_table_t obd_table[] = { .proc_handler = &proc_at_early_margin }, { - INIT_CTL_NAME(OBD_AT_HISTORY) .procname = "at_history", .data = &at_history, .maxlen = sizeof(int), .mode = 0644, .proc_handler = &proc_at_history - }, - { INIT_CTL_NAME(0) } + } }; static ctl_table_t parent_table[] = { { - INIT_CTL_NAME(OBD_SYSCTL) .procname = "lustre", .data = NULL, .maxlen = 0, .mode = 0555, .child = obd_table - }, - { INIT_CTL_NAME(0) } + } }; #endif From 843cff5abd3d6668f5d4862e05eabc8c07bbe3f9 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 19 Nov 2013 22:38:47 +0800 Subject: [PATCH 211/238] staging/lustre: remove INIT_STRATEGY legacy code used to support kernel where struct ctl_table has strategy member. Cc: Andreas Dilger Signed-off-by: Peng Tao Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/include/linux/libcfs/linux/kp30.h | 4 ---- drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c | 3 --- 2 files changed, 7 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h b/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h index ba7854159d7d..3a883f82e64f 100644 --- a/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h +++ b/drivers/staging/lustre/include/linux/libcfs/linux/kp30.h @@ -204,8 +204,4 @@ extern int lwt_snapshot (cfs_cycles_t *now, int *ncpu, int *total_size, */ # define LPPID "%d" -/* compat macroses */ - -#define INIT_STRATEGY(a) - #endif diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c index f2bb8672a4ff..ef0ab106496f 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c @@ -452,7 +452,6 @@ static ctl_table_t lnet_table[] = { .maxlen = sizeof(int), .mode = 0444, .proc_handler = &proc_dointvec, - INIT_STRATEGY(&sysctl_intvec) }, { .procname = "catastrophe", @@ -460,7 +459,6 @@ static ctl_table_t lnet_table[] = { .maxlen = sizeof(int), .mode = 0444, .proc_handler = &proc_dointvec, - INIT_STRATEGY(&sysctl_intvec) }, { .procname = "panic_on_lbug", @@ -468,7 +466,6 @@ static ctl_table_t lnet_table[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = &proc_dointvec, - INIT_STRATEGY(&sysctl_intvec) }, { .procname = "dump_kernel", From 1c126bc6a248ee0ce2f1df09ac99eedc22bc4520 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 12 Nov 2013 20:07:19 +0100 Subject: [PATCH 212/238] staging: Remove superfluous name casts device_driver.name is "const char *" Signed-off-by: Geert Uytterhoeven Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dwc2/platform.c | 2 +- drivers/staging/usbip/vhci_hcd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/dwc2/platform.c b/drivers/staging/dwc2/platform.c index 76ae6e210f55..8f0489efdf40 100644 --- a/drivers/staging/dwc2/platform.c +++ b/drivers/staging/dwc2/platform.c @@ -134,7 +134,7 @@ MODULE_DEVICE_TABLE(of, dwc2_of_match_table); static struct platform_driver dwc2_platform_driver = { .driver = { - .name = (char *)dwc2_driver_name, + .name = dwc2_driver_name, .of_match_table = dwc2_of_match_table, }, .probe = dwc2_driver_probe, diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c index e37c6c1a9931..64cace681cee 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c @@ -1107,7 +1107,7 @@ static struct platform_driver vhci_driver = { .suspend = vhci_hcd_suspend, .resume = vhci_hcd_resume, .driver = { - .name = (char *) driver_name, + .name = driver_name, .owner = THIS_MODULE, }, }; From 782872bf7a86d17a1fade8353479151b3b2fcf15 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 12 Nov 2013 20:07:20 +0100 Subject: [PATCH 213/238] staging: r8188eu: Remove superfluous name cast usb_driver.name is "const char *" Signed-off-by: Geert Uytterhoeven Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index 7d14779310d3..b21b1566424b 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c @@ -71,7 +71,7 @@ struct rtw_usb_drv { }; static struct rtw_usb_drv rtl8188e_usb_drv = { - .usbdrv.name = (char *)"r8188eu", + .usbdrv.name = "r8188eu", .usbdrv.probe = rtw_drv_init, .usbdrv.disconnect = rtw_dev_remove, .usbdrv.id_table = rtw_usb_id_tbl, From 6fafecb90c9ed2cca8ed450fed693095c0160dc2 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 12 Nov 2013 20:07:21 +0100 Subject: [PATCH 214/238] staging: usbip: Remove superfluous name cast platform_device.name is "const char *" Signed-off-by: Geert Uytterhoeven Signed-off-by: Greg Kroah-Hartman --- drivers/staging/usbip/vhci_hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c index 64cace681cee..aa22c631191c 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c @@ -1124,7 +1124,7 @@ static void the_pdev_release(struct device *dev) static struct platform_device the_pdev = { /* should be the same name as driver_name */ - .name = (char *) driver_name, + .name = driver_name, .id = -1, .dev = { .release = the_pdev_release, From e8e8f87e24261916e8f11f82c11cbefe1c54df3b Mon Sep 17 00:00:00 2001 From: Eddie Kovsky Date: Mon, 18 Nov 2013 20:57:45 -0700 Subject: [PATCH 215/238] staging: Clean up whitespace warnings in staging/winbond Reduced checkpatch.pl warnings from 46 to 17 Long strings on lines over 80 characters remain untouched Signed-off-by: Eddie Kovsky Acked-by: Pavel Machek Signed-off-by: Greg Kroah-Hartman --- drivers/staging/winbond/mds.c | 101 ++++++++++++++++++++++------------ 1 file changed, 66 insertions(+), 35 deletions(-) diff --git a/drivers/staging/winbond/mds.c b/drivers/staging/winbond/mds.c index cac7720bef2b..aef0855f4c68 100644 --- a/drivers/staging/winbond/mds.c +++ b/drivers/staging/winbond/mds.c @@ -56,7 +56,8 @@ static void Mds_DurationSet(struct wbsoft_priv *adapter, RTS_on = true; /* Using RTS */ else { if (pT01->T01_modulation_type) { /* Is using OFDM */ - if (CURRENT_PROTECT_MECHANISM) /* Is using protect */ + /* Is using protect */ + if (CURRENT_PROTECT_MECHANISM) CTS_on = true; /* Using CTS */ } } @@ -69,9 +70,9 @@ static void Mds_DurationSet(struct wbsoft_priv *adapter, * ACK Rate : 24 Mega bps * ACK frame length = 14 bytes */ Duration = 2*DEFAULT_SIFSTIME + - 2*PREAMBLE_PLUS_SIGNAL_PLUS_SIGNALEXTENSION + - ((BodyLen*8 + 22 + Rate*4 - 1)/(Rate*4))*Tsym + - ((112 + 22 + 95)/96)*Tsym; + 2*PREAMBLE_PLUS_SIGNAL_PLUS_SIGNALEXTENSION + + ((BodyLen*8 + 22 + Rate*4 - 1)/(Rate*4))*Tsym + + ((112 + 22 + 95)/96)*Tsym; } else { /* DSSS */ /* CTS duration * 2 SIFS + DATA transmit time + 1 ACK @@ -92,13 +93,15 @@ static void Mds_DurationSet(struct wbsoft_priv *adapter, * CTS Rate : 24 Mega bps * CTS frame length = 14 bytes */ Duration += (DEFAULT_SIFSTIME + - PREAMBLE_PLUS_SIGNAL_PLUS_SIGNALEXTENSION + - ((112 + 22 + 95)/96)*Tsym); + PREAMBLE_PLUS_SIGNAL_PLUS_SIGNALEXTENSION + + ((112 + 22 + 95)/96)*Tsym); } else { /* CTS + 1 SIFS + CTS duration * CTS Rate : ?? Mega bps - * CTS frame length = 14 bytes */ - if (pT01->T01_plcp_header_length) /* long preamble */ + * CTS frame length = 14 bytes + */ + /* long preamble */ + if (pT01->T01_plcp_header_length) Duration += LONG_PREAMBLE_PLUS_PLCPHEADER_TIME; else Duration += SHORT_PREAMBLE_PLUS_PLCPHEADER_TIME; @@ -149,8 +152,8 @@ static void Mds_DurationSet(struct wbsoft_priv *adapter, + Rate-1) / Rate + DEFAULT_SIFSTIME*3); } - - ((u16 *)buffer)[5] = cpu_to_le16(Duration); /* 4 USHOR for skip 8B USB, 2USHORT=FC + Duration */ + /* 4 USHOR for skip 8B USB, 2USHORT=FC + Duration */ + ((u16 *)buffer)[5] = cpu_to_le16(Duration); /* ----20061009 add by anson's endian */ pNextT00->value = cpu_to_le32(pNextT00->value); @@ -159,7 +162,8 @@ static void Mds_DurationSet(struct wbsoft_priv *adapter, buffer += OffsetSize; pT01 = (struct T01_descriptor *)(buffer+4); - if (i != 1) /* The last fragment will not have the next fragment */ + /* The last fragment will not have the next fragment */ + if (i != 1) pNextT00 = (struct T00_descriptor *)(buffer+OffsetSize); } @@ -189,7 +193,8 @@ static void Mds_DurationSet(struct wbsoft_priv *adapter, } } - ((u16 *)buffer)[5] = cpu_to_le16(Duration); /* 4 USHOR for skip 8B USB, 2USHORT=FC + Duration */ + /* 4 USHOR for skip 8B USB, 2USHORT=FC + Duration */ + ((u16 *)buffer)[5] = cpu_to_le16(Duration); pT00->value = cpu_to_le32(pT00->value); pT01->value = cpu_to_le32(pT01->value); /* --end 20061009 add */ @@ -221,9 +226,10 @@ static u16 Mds_BodyCopy(struct wbsoft_priv *adapter, CopySize = SizeLeft; if (SizeLeft > pDes->FragmentThreshold) { CopySize = pDes->FragmentThreshold; - pT00->T00_frame_length = 24 + CopySize; /* Set USB length */ - } else - pT00->T00_frame_length = 24 + SizeLeft; /* Set USB length */ + /* Set USB length */ + pT00->T00_frame_length = 24 + CopySize; + } else /* Set USB length */ + pT00->T00_frame_length = 24 + SizeLeft; SizeLeft -= CopySize; @@ -267,21 +273,27 @@ static u16 Mds_BodyCopy(struct wbsoft_priv *adapter, /* 931130.5.n */ if (pMds->MicAdd) { if (!SizeLeft) { - pMds->MicWriteAddress[pMds->MicWriteIndex] = buffer - pMds->MicAdd; - pMds->MicWriteSize[pMds->MicWriteIndex] = pMds->MicAdd; + pMds->MicWriteAddress[pMds->MicWriteIndex] = + buffer - pMds->MicAdd; + pMds->MicWriteSize[pMds->MicWriteIndex] = + pMds->MicAdd; pMds->MicAdd = 0; } else if (SizeLeft < 8) { /* 931130.5.p */ pMds->MicAdd = SizeLeft; - pMds->MicWriteAddress[pMds->MicWriteIndex] = buffer - (8 - SizeLeft); - pMds->MicWriteSize[pMds->MicWriteIndex] = 8 - SizeLeft; + pMds->MicWriteAddress[pMds->MicWriteIndex] = + buffer - (8 - SizeLeft); + pMds->MicWriteSize[pMds->MicWriteIndex] = + 8 - SizeLeft; pMds->MicWriteIndex++; } } /* Does it need to generate the new header for next mpdu? */ if (SizeLeft) { - buffer = TargetBuffer + Size; /* Get the next 4n start address */ - memcpy(buffer, TargetBuffer, 32); /* Copy 8B USB +24B 802.11 */ + /* Get the next 4n start address */ + buffer = TargetBuffer + Size; + /* Copy 8B USB +24B 802.11 */ + memcpy(buffer, TargetBuffer, 32); pT00 = (struct T00_descriptor *)buffer; pT00->T00_first_mpdu = 0; } @@ -293,7 +305,8 @@ static u16 Mds_BodyCopy(struct wbsoft_priv *adapter, pT00->T00_IsLastMpdu = 1; buffer = (u8 *)pT00 + 8; /* +8 for USB hdr */ buffer[1] &= ~0x04; /* Clear more frag bit of 802.11 frame control */ - pDes->FragmentCount = FragmentCount; /* Update the correct fragment number */ + /* Update the correct fragment number */ + pDes->FragmentCount = FragmentCount; return Size; } @@ -330,7 +343,8 @@ static void Mds_HeaderCopy(struct wbsoft_priv *adapter, FragmentThreshold = DEFAULT_FRAGMENT_THRESHOLD; /* Do not fragment */ /* Copy full data, the 1'st buffer contain all the data 931130.5.j */ - memcpy(TargetBuffer, src_buffer, DOT_11_MAC_HEADER_SIZE); /* Copy header */ + /* Copy header */ + memcpy(TargetBuffer, src_buffer, DOT_11_MAC_HEADER_SIZE); pDes->buffer_address[0] = src_buffer + DOT_11_MAC_HEADER_SIZE; pDes->buffer_total_size -= DOT_11_MAC_HEADER_SIZE; pDes->buffer_size[0] = pDes->buffer_total_size; @@ -358,8 +372,8 @@ static void Mds_HeaderCopy(struct wbsoft_priv *adapter, for (i = 0; i < 2; i++) { if (i == 1) ctmp1 = ctmpf; - - pMds->TxRate[pDes->Descriptor_ID][i] = ctmp1; /* backup the ta rate and fall back rate */ + /* backup the ta rate and fall back rate */ + pMds->TxRate[pDes->Descriptor_ID][i] = ctmp1; if (ctmp1 == 108) ctmp2 = 7; @@ -395,7 +409,8 @@ static void Mds_HeaderCopy(struct wbsoft_priv *adapter, /* * Set preamble type */ - if ((pT01->T01_modulation_type == 0) && (pT01->T01_transmit_rate == 0)) /* RATE_1M */ + /* RATE_1M */ + if ((pT01->T01_modulation_type == 0) && (pT01->T01_transmit_rate == 0)) pDes->PreambleMode = WLAN_PREAMBLE_TYPE_LONG; else pDes->PreambleMode = CURRENT_PREAMBLE_MODE; @@ -468,12 +483,14 @@ Mds_Tx(struct wbsoft_priv *adapter) /* Start to fill the data */ do { FillIndex = pMds->TxFillIndex; - if (pMds->TxOwner[FillIndex]) { /* Is owned by software 0:Yes 1:No */ + /* Is owned by software 0:Yes 1:No */ + if (pMds->TxOwner[FillIndex]) { pr_debug("[Mds_Tx] Tx Owner is H/W.\n"); break; } - XmitBufAddress = pMds->pTxBuffer + (MAX_USB_TX_BUFFER * FillIndex); /* Get buffer */ + /* Get buffer */ + XmitBufAddress = pMds->pTxBuffer + (MAX_USB_TX_BUFFER * FillIndex); XmitBufSize = 0; FillCount = 0; do { @@ -485,7 +502,8 @@ Mds_Tx(struct wbsoft_priv *adapter) FragmentThreshold = CURRENT_FRAGMENT_THRESHOLD; /* 931130.5.b */ FragmentCount = PacketSize/FragmentThreshold + 1; - stmp = PacketSize + FragmentCount*32 + 8; /* 931130.5.c 8:MIC */ + /* 931130.5.c 8:MIC */ + stmp = PacketSize + FragmentCount*32 + 8; if ((XmitBufSize + stmp) >= MAX_USB_TX_BUFFER) break; /* buffer is not enough */ @@ -499,18 +517,23 @@ Mds_Tx(struct wbsoft_priv *adapter) TxDesIndex = pMds->TxDesIndex; /* Get the current ID */ pTxDes->Descriptor_ID = TxDesIndex; - pMds->TxDesFrom[TxDesIndex] = 2; /* Storing the information of source coming from */ + /* Storing the information of source coming from */ + pMds->TxDesFrom[TxDesIndex] = 2; pMds->TxDesIndex++; pMds->TxDesIndex %= MAX_USB_TX_DESCRIPTOR; MLME_GetNextPacket(adapter, pTxDes); - /* Copy header. 8byte USB + 24byte 802.11Hdr. Set TxRate, Preamble type */ + /* + * Copy header. 8byte USB + 24byte 802.11Hdr. + * Set TxRate, Preamble type + */ Mds_HeaderCopy(adapter, pTxDes, XmitBufAddress); /* For speed up Key setting */ if (pTxDes->EapFix) { - pr_debug("35: EPA 4th frame detected. Size = %d\n", PacketSize); + pr_debug("35: EPA 4th frame detected. Size = %d\n", + PacketSize); pHwData->IsKeyPreSet = 1; } @@ -524,7 +547,9 @@ Mds_Tx(struct wbsoft_priv *adapter) XmitBufSize += CurrentSize; XmitBufAddress += CurrentSize; - /* Get packet to transmit completed, 1:TESTSTA 2:MLME 3: Ndis data */ + /* Get packet to transmit completed, + * 1:TESTSTA 2:MLME 3: Ndis data + */ MLME_SendComplete(adapter, 0, true); /* Software TSC count 20060214 */ @@ -533,7 +558,12 @@ Mds_Tx(struct wbsoft_priv *adapter) pMds->TxTsc_2++; FillCount++; /* 20060928 */ - } while (HAL_USB_MODE_BURST(pHwData)); /* End of multiple MSDU copy loop. false = single true = multiple sending */ + /* + * End of multiple MSDU copy loop. + * false = single + * true = multiple sending + */ + } while (HAL_USB_MODE_BURST(pHwData)); /* Move to the next one, if necessary */ if (BufferFilled) { @@ -594,7 +624,8 @@ Mds_SendComplete(struct wbsoft_priv *adapter, struct T02_descriptor *pT02) pHwData->tx_retry_count[RetryCount] += RetryCount; else pHwData->tx_retry_count[7] += RetryCount; - pr_debug("dto_tx_retry_count =%d\n", pHwData->dto_tx_retry_count); + pr_debug("dto_tx_retry_count =%d\n", + pHwData->dto_tx_retry_count); MTO_SetTxCount(adapter, TxRate, RetryCount); } pHwData->dto_tx_frag_count += (RetryCount+1); From 6eaf842a24bae6c4d8159a26f428919d114fc667 Mon Sep 17 00:00:00 2001 From: SeongJae Park Date: Thu, 14 Nov 2013 21:15:10 +0900 Subject: [PATCH 216/238] staging: alarm-dev: Remove unnecessary parenthesis Signed-off-by: SeongJae Park Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/alarm-dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/android/alarm-dev.c b/drivers/staging/android/alarm-dev.c index 647694f43dcf..ccf74eef5364 100644 --- a/drivers/staging/android/alarm-dev.c +++ b/drivers/staging/android/alarm-dev.c @@ -68,8 +68,8 @@ static struct devalarm alarms[ANDROID_ALARM_TYPE_COUNT]; */ static int is_wakeup(enum android_alarm_type type) { - return (type == ANDROID_ALARM_RTC_WAKEUP || - type == ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP); + return type == ANDROID_ALARM_RTC_WAKEUP || + type == ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP; } From 027c440971f9b3dccc05da5bf626cb129f8daf58 Mon Sep 17 00:00:00 2001 From: SeongJae Park Date: Thu, 14 Nov 2013 21:15:11 +0900 Subject: [PATCH 217/238] staging: alarm-dev: Remove unnecessary blank lines Signed-off-by: SeongJae Park Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/alarm-dev.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/android/alarm-dev.c b/drivers/staging/android/alarm-dev.c index ccf74eef5364..a3b467be7f8f 100644 --- a/drivers/staging/android/alarm-dev.c +++ b/drivers/staging/android/alarm-dev.c @@ -72,7 +72,6 @@ static int is_wakeup(enum android_alarm_type type) type == ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP; } - static void devalarm_start(struct devalarm *alrm, ktime_t exp) { if (is_wakeup(alrm->type)) @@ -111,7 +110,6 @@ static void alarm_clear(enum android_alarm_type alarm_type) } alarm_enabled &= ~alarm_type_mask; spin_unlock_irqrestore(&alarm_slock, flags); - } static void alarm_set(enum android_alarm_type alarm_type, @@ -371,7 +369,6 @@ static void devalarm_triggered(struct devalarm *alarm) spin_unlock_irqrestore(&alarm_slock, flags); } - static enum hrtimer_restart devalarm_hrthandler(struct hrtimer *hrt) { struct devalarm *devalrm = container_of(hrt, struct devalarm, u.hrt); From 5230a5f585244b300586d1f4cd578d9e604b8771 Mon Sep 17 00:00:00 2001 From: SeongJae Park Date: Thu, 14 Nov 2013 21:15:12 +0900 Subject: [PATCH 218/238] staging: alarm-dev: Seperate functions with one blank line Signed-off-by: SeongJae Park Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/alarm-dev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/android/alarm-dev.c b/drivers/staging/android/alarm-dev.c index a3b467be7f8f..2fc7cdd4c4e3 100644 --- a/drivers/staging/android/alarm-dev.c +++ b/drivers/staging/android/alarm-dev.c @@ -278,6 +278,7 @@ static long alarm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return 0; } + #ifdef CONFIG_COMPAT static long alarm_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) From ffae31f625d881b162a7979229d12c047d3c21f1 Mon Sep 17 00:00:00 2001 From: Eric Skoglund Date: Tue, 12 Nov 2013 10:42:21 +0100 Subject: [PATCH 219/238] Drivers: Staging: cxt1e1: sbeid: Fixed coding style issue - space -> tabs This patch converts spaces to tabs to conform to the coding style standards. Signed-off-by: Eric Skoglund Signed-off-by: Greg Kroah-Hartman --- drivers/staging/cxt1e1/sbeid.c | 318 ++++++++++++++++----------------- 1 file changed, 159 insertions(+), 159 deletions(-) diff --git a/drivers/staging/cxt1e1/sbeid.c b/drivers/staging/cxt1e1/sbeid.c index 6ec51bccceb1..75efbc3a62ff 100644 --- a/drivers/staging/cxt1e1/sbeid.c +++ b/drivers/staging/cxt1e1/sbeid.c @@ -22,44 +22,44 @@ char * sbeid_get_bdname (ci_t *ci) { - char *np = NULL; + char *np = NULL; - switch (ci->brd_id) - { - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1): - np = "wanPTMC-256T3 "; - break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1): - np = "wanPTMC-256T3 "; - break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1): - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1_L): - np = "wanPMC-C4T1E1"; - break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1): - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1_L): - np = "wanPMC-C2T1E1"; - break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1): - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L): - np = "wanPMC-C1T1E1"; - break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1): - np = "wanPCI-C4T1E1"; - break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1): - np = "wanPCI-C2T1E1"; - break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1): - np = "wanPCI-C1T1E1"; - break; - default: - /*** np = ""; ***/ - np = "wanPCI-CxT1E1"; - break; - } + switch (ci->brd_id) + { + case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1): + np = "wanPTMC-256T3 "; + break; + case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1): + np = "wanPTMC-256T3 "; + break; + case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1): + case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1_L): + np = "wanPMC-C4T1E1"; + break; + case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1): + case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1_L): + np = "wanPMC-C2T1E1"; + break; + case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1): + case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L): + np = "wanPMC-C1T1E1"; + break; + case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1): + np = "wanPCI-C4T1E1"; + break; + case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1): + np = "wanPCI-C2T1E1"; + break; + case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1): + np = "wanPCI-C1T1E1"; + break; + default: + /*** np = ""; ***/ + np = "wanPCI-CxT1E1"; + break; + } - return np; + return np; } @@ -68,96 +68,96 @@ sbeid_get_bdname (ci_t *ci) void sbeid_set_hdwbid (ci_t *ci) { - /* - * set SBE's unique hardware identification (for legacy boards might not - * have this register implemented) - */ + /* + * set SBE's unique hardware identification (for legacy boards might not + * have this register implemented) + */ - switch (ci->brd_id) - { + switch (ci->brd_id) + { case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1): - ci->hdw_bid = SBE_BID_256T3_E1; /* 0x46 - SBE wanPTMC-256T3 (E1 - * Version) */ - break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1): - ci->hdw_bid = SBE_BID_256T3_T1; /* 0x42 - SBE wanPTMC-256T3 (T1 - * Version) */ - break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1): - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1_L): - /* - * This Board ID is a generic identification. Use the found number - * of ports to further define this hardware. - */ - switch (ci->max_port) - { - default: /* shouldn't need a default, but have one - * anyway */ - case 4: - ci->hdw_bid = SBE_BID_PMC_C4T1E1; /* 0xC4 - SBE wanPMC-C4T1E1 */ - break; - case 2: - ci->hdw_bid = SBE_BID_PMC_C2T1E1; /* 0xC2 - SBE wanPMC-C2T1E1 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1); - break; - case 1: - ci->hdw_bid = SBE_BID_PMC_C1T1E1; /* 0xC1 - SBE wanPMC-C1T1E1 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1); - break; - } - break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1): - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1_L): - ci->hdw_bid = SBE_BID_PMC_C2T1E1; /* 0xC2 - SBE wanPMC-C2T1E1 */ - break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1): - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L): - ci->hdw_bid = SBE_BID_PMC_C1T1E1; /* 0xC1 - SBE wanPMC-C1T1E1 */ - break; + ci->hdw_bid = SBE_BID_256T3_E1; /* 0x46 - SBE wanPTMC-256T3 (E1 + * Version) */ + break; + case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1): + ci->hdw_bid = SBE_BID_256T3_T1; /* 0x42 - SBE wanPTMC-256T3 (T1 + * Version) */ + break; + case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1): + case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1_L): + /* + * This Board ID is a generic identification. Use the found number + * of ports to further define this hardware. + */ + switch (ci->max_port) + { + default: /* shouldn't need a default, but have one + * anyway */ + case 4: + ci->hdw_bid = SBE_BID_PMC_C4T1E1; /* 0xC4 - SBE wanPMC-C4T1E1 */ + break; + case 2: + ci->hdw_bid = SBE_BID_PMC_C2T1E1; /* 0xC2 - SBE wanPMC-C2T1E1 */ + ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1); + break; + case 1: + ci->hdw_bid = SBE_BID_PMC_C1T1E1; /* 0xC1 - SBE wanPMC-C1T1E1 */ + ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1); + break; + } + break; + case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1): + case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1_L): + ci->hdw_bid = SBE_BID_PMC_C2T1E1; /* 0xC2 - SBE wanPMC-C2T1E1 */ + break; + case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1): + case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L): + ci->hdw_bid = SBE_BID_PMC_C1T1E1; /* 0xC1 - SBE wanPMC-C1T1E1 */ + break; #ifdef SBE_PMCC4_ENABLE - /* - * This case is entered as a result of the inability to obtain the - * from the board's EEPROM. Assume a PCI board and set - * according to the number ofr found ports. - */ - case 0: - /* start by assuming 4-port for ZERO casing */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1); - /* drop thru to set hdw_bid and alternate PCI CxT1E1 settings */ + /* + * This case is entered as a result of the inability to obtain the + * from the board's EEPROM. Assume a PCI board and set + * according to the number ofr found ports. + */ + case 0: + /* start by assuming 4-port for ZERO casing */ + ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1); + /* drop thru to set hdw_bid and alternate PCI CxT1E1 settings */ #endif - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1): - /* - * This Board ID is a generic identification. Use the number of - * found ports to further define this hardware. - */ - switch (ci->max_port) - { - default: /* shouldn't need a default, but have one - * anyway */ - case 4: - ci->hdw_bid = SBE_BID_PCI_C4T1E1; /* 0x04 - SBE wanPCI-C4T1E1 */ - break; - case 2: - ci->hdw_bid = SBE_BID_PCI_C2T1E1; /* 0x02 - SBE wanPCI-C2T1E1 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1); - break; - case 1: - ci->hdw_bid = SBE_BID_PCI_C1T1E1; /* 0x01 - SBE wanPCI-C1T1E1 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1); - break; - } - break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1): - ci->hdw_bid = SBE_BID_PCI_C2T1E1; /* 0x02 - SBE wanPCI-C2T1E1 */ - break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1): - ci->hdw_bid = SBE_BID_PCI_C1T1E1; /* 0x01 - SBE wanPCI-C1T1E1 */ - break; - default: - /*** bid = ""; ***/ - ci->hdw_bid = SBE_BID_PMC_C4T1E1; /* 0x41 - SBE wanPTMC-C4T1E1 */ - break; - } + case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1): + /* + * This Board ID is a generic identification. Use the number of + * found ports to further define this hardware. + */ + switch (ci->max_port) + { + default: /* shouldn't need a default, but have one + * anyway */ + case 4: + ci->hdw_bid = SBE_BID_PCI_C4T1E1; /* 0x04 - SBE wanPCI-C4T1E1 */ + break; + case 2: + ci->hdw_bid = SBE_BID_PCI_C2T1E1; /* 0x02 - SBE wanPCI-C2T1E1 */ + ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1); + break; + case 1: + ci->hdw_bid = SBE_BID_PCI_C1T1E1; /* 0x01 - SBE wanPCI-C1T1E1 */ + ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1); + break; + } + break; + case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1): + ci->hdw_bid = SBE_BID_PCI_C2T1E1; /* 0x02 - SBE wanPCI-C2T1E1 */ + break; + case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1): + ci->hdw_bid = SBE_BID_PCI_C1T1E1; /* 0x01 - SBE wanPCI-C1T1E1 */ + break; + default: + /*** bid = ""; ***/ + ci->hdw_bid = SBE_BID_PMC_C4T1E1; /* 0x41 - SBE wanPTMC-C4T1E1 */ + break; + } } /* given the presetting of hdw_bid, set the corresponding brd_id */ @@ -165,45 +165,45 @@ sbeid_set_hdwbid (ci_t *ci) void sbeid_set_bdtype (ci_t *ci) { - /* set SBE's unique PCI VENDOR/DEVID */ - switch (ci->hdw_bid) - { + /* set SBE's unique PCI VENDOR/DEVID */ + switch (ci->hdw_bid) + { case SBE_BID_C1T3: /* SBE wanPMC-C1T3 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T3); - break; - case SBE_BID_C24TE1: /* SBE wanPTMC-C24TE1 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_C24TE1); - break; - case SBE_BID_256T3_E1: /* SBE wanPTMC-256T3 E1 Version */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1); - break; - case SBE_BID_256T3_T1: /* SBE wanPTMC-256T3 T1 Version */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1); - break; - case SBE_BID_PMC_C4T1E1: /* 0xC4 - SBE wanPMC-C4T1E1 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1); - break; - case SBE_BID_PMC_C2T1E1: /* 0xC2 - SBE wanPMC-C2T1E1 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1); - break; - case SBE_BID_PMC_C1T1E1: /* 0xC1 - SBE wanPMC-C1T1E1 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1); - break; - case SBE_BID_PCI_C4T1E1: /* 0x04 - SBE wanPCI-C4T1E1 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1); - break; - case SBE_BID_PCI_C2T1E1: /* 0x02 - SBE wanPCI-C2T1E1 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1); - break; - case SBE_BID_PCI_C1T1E1: /* 0x01 - SBE wanPCI-C1T1E1 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1); - break; + ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T3); + break; + case SBE_BID_C24TE1: /* SBE wanPTMC-C24TE1 */ + ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_C24TE1); + break; + case SBE_BID_256T3_E1: /* SBE wanPTMC-256T3 E1 Version */ + ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1); + break; + case SBE_BID_256T3_T1: /* SBE wanPTMC-256T3 T1 Version */ + ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1); + break; + case SBE_BID_PMC_C4T1E1: /* 0xC4 - SBE wanPMC-C4T1E1 */ + ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1); + break; + case SBE_BID_PMC_C2T1E1: /* 0xC2 - SBE wanPMC-C2T1E1 */ + ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1); + break; + case SBE_BID_PMC_C1T1E1: /* 0xC1 - SBE wanPMC-C1T1E1 */ + ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1); + break; + case SBE_BID_PCI_C4T1E1: /* 0x04 - SBE wanPCI-C4T1E1 */ + ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1); + break; + case SBE_BID_PCI_C2T1E1: /* 0x02 - SBE wanPCI-C2T1E1 */ + ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1); + break; + case SBE_BID_PCI_C1T1E1: /* 0x01 - SBE wanPCI-C1T1E1 */ + ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1); + break; - default: - /*** hdw_bid = ""; ***/ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1); - break; - } + default: + /*** hdw_bid = ""; ***/ + ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1); + break; + } } From e585e3df37cc5db728a3945987c256e71c92c446 Mon Sep 17 00:00:00 2001 From: Eric Skoglund Date: Tue, 12 Nov 2013 10:42:22 +0100 Subject: [PATCH 220/238] Drivers: Staging: cxt1e1: sbeid: Fixed braces coding style issue This patch fixes a brace coding style issue. Signed-off-by: Eric Skoglund Signed-off-by: Greg Kroah-Hartman --- drivers/staging/cxt1e1/sbeid.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/staging/cxt1e1/sbeid.c b/drivers/staging/cxt1e1/sbeid.c index 75efbc3a62ff..bf6c94375205 100644 --- a/drivers/staging/cxt1e1/sbeid.c +++ b/drivers/staging/cxt1e1/sbeid.c @@ -24,8 +24,7 @@ sbeid_get_bdname (ci_t *ci) { char *np = NULL; - switch (ci->brd_id) - { + switch (ci->brd_id) { case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1): np = "wanPTMC-256T3 "; break; @@ -73,8 +72,7 @@ sbeid_set_hdwbid (ci_t *ci) * have this register implemented) */ - switch (ci->brd_id) - { + switch (ci->brd_id) { case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1): ci->hdw_bid = SBE_BID_256T3_E1; /* 0x46 - SBE wanPTMC-256T3 (E1 * Version) */ @@ -89,8 +87,7 @@ sbeid_set_hdwbid (ci_t *ci) * This Board ID is a generic identification. Use the found number * of ports to further define this hardware. */ - switch (ci->max_port) - { + switch (ci->max_port) { default: /* shouldn't need a default, but have one * anyway */ case 4: @@ -130,8 +127,7 @@ sbeid_set_hdwbid (ci_t *ci) * This Board ID is a generic identification. Use the number of * found ports to further define this hardware. */ - switch (ci->max_port) - { + switch (ci->max_port) { default: /* shouldn't need a default, but have one * anyway */ case 4: @@ -166,8 +162,7 @@ void sbeid_set_bdtype (ci_t *ci) { /* set SBE's unique PCI VENDOR/DEVID */ - switch (ci->hdw_bid) - { + switch (ci->hdw_bid) { case SBE_BID_C1T3: /* SBE wanPMC-C1T3 */ ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T3); break; From 5ee86a38058deb464afdbfbb487825b4278d85ca Mon Sep 17 00:00:00 2001 From: Eric Skoglund Date: Tue, 12 Nov 2013 10:42:23 +0100 Subject: [PATCH 221/238] Drivers: Staging: cxt1e1: stbeid: Fixed whitespace between function and parameters This patch fixes whitespace coding style errors: func () --> func() Signed-of-by: Eric Skoglund Signed-off-by: Greg Kroah-Hartman --- drivers/staging/cxt1e1/sbeid.c | 84 +++++++++++++++++----------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/drivers/staging/cxt1e1/sbeid.c b/drivers/staging/cxt1e1/sbeid.c index bf6c94375205..97c5c6e7e299 100644 --- a/drivers/staging/cxt1e1/sbeid.c +++ b/drivers/staging/cxt1e1/sbeid.c @@ -20,36 +20,36 @@ #include "sbe_bid.h" char * -sbeid_get_bdname (ci_t *ci) +sbeid_get_bdname(ci_t *ci) { char *np = NULL; switch (ci->brd_id) { - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1): + case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1): np = "wanPTMC-256T3 "; break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1): + case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1): np = "wanPTMC-256T3 "; break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1): - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1_L): + case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1): + case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1_L): np = "wanPMC-C4T1E1"; break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1): - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1_L): + case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1): + case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1_L): np = "wanPMC-C2T1E1"; break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1): - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L): + case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1): + case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L): np = "wanPMC-C1T1E1"; break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1): + case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1): np = "wanPCI-C4T1E1"; break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1): + case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1): np = "wanPCI-C2T1E1"; break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1): + case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1): np = "wanPCI-C1T1E1"; break; default: @@ -65,7 +65,7 @@ sbeid_get_bdname (ci_t *ci) /* given the presetting of brd_id, set the corresponding hdw_id */ void -sbeid_set_hdwbid (ci_t *ci) +sbeid_set_hdwbid(ci_t *ci) { /* * set SBE's unique hardware identification (for legacy boards might not @@ -73,16 +73,16 @@ sbeid_set_hdwbid (ci_t *ci) */ switch (ci->brd_id) { - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1): + case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1): ci->hdw_bid = SBE_BID_256T3_E1; /* 0x46 - SBE wanPTMC-256T3 (E1 * Version) */ break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1): + case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1): ci->hdw_bid = SBE_BID_256T3_T1; /* 0x42 - SBE wanPTMC-256T3 (T1 * Version) */ break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1): - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1_L): + case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1): + case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1_L): /* * This Board ID is a generic identification. Use the found number * of ports to further define this hardware. @@ -95,20 +95,20 @@ sbeid_set_hdwbid (ci_t *ci) break; case 2: ci->hdw_bid = SBE_BID_PMC_C2T1E1; /* 0xC2 - SBE wanPMC-C2T1E1 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1); + ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1); break; case 1: ci->hdw_bid = SBE_BID_PMC_C1T1E1; /* 0xC1 - SBE wanPMC-C1T1E1 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1); + ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1); break; } break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1): - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1_L): + case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1): + case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1_L): ci->hdw_bid = SBE_BID_PMC_C2T1E1; /* 0xC2 - SBE wanPMC-C2T1E1 */ break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1): - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L): + case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1): + case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L): ci->hdw_bid = SBE_BID_PMC_C1T1E1; /* 0xC1 - SBE wanPMC-C1T1E1 */ break; #ifdef SBE_PMCC4_ENABLE @@ -119,10 +119,10 @@ sbeid_set_hdwbid (ci_t *ci) */ case 0: /* start by assuming 4-port for ZERO casing */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1); + ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1); /* drop thru to set hdw_bid and alternate PCI CxT1E1 settings */ #endif - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1): + case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1): /* * This Board ID is a generic identification. Use the number of * found ports to further define this hardware. @@ -135,18 +135,18 @@ sbeid_set_hdwbid (ci_t *ci) break; case 2: ci->hdw_bid = SBE_BID_PCI_C2T1E1; /* 0x02 - SBE wanPCI-C2T1E1 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1); + ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1); break; case 1: ci->hdw_bid = SBE_BID_PCI_C1T1E1; /* 0x01 - SBE wanPCI-C1T1E1 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1); + ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1); break; } break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1): + case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1): ci->hdw_bid = SBE_BID_PCI_C2T1E1; /* 0x02 - SBE wanPCI-C2T1E1 */ break; - case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1): + case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1): ci->hdw_bid = SBE_BID_PCI_C1T1E1; /* 0x01 - SBE wanPCI-C1T1E1 */ break; default: @@ -159,44 +159,44 @@ sbeid_set_hdwbid (ci_t *ci) /* given the presetting of hdw_bid, set the corresponding brd_id */ void -sbeid_set_bdtype (ci_t *ci) +sbeid_set_bdtype(ci_t *ci) { /* set SBE's unique PCI VENDOR/DEVID */ switch (ci->hdw_bid) { - case SBE_BID_C1T3: /* SBE wanPMC-C1T3 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T3); + case SBE_BID_C1T3: /* SBE wanPMC-C1T3 */ + ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T3); break; case SBE_BID_C24TE1: /* SBE wanPTMC-C24TE1 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_C24TE1); + ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_C24TE1); break; case SBE_BID_256T3_E1: /* SBE wanPTMC-256T3 E1 Version */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1); + ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1); break; case SBE_BID_256T3_T1: /* SBE wanPTMC-256T3 T1 Version */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1); + ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1); break; case SBE_BID_PMC_C4T1E1: /* 0xC4 - SBE wanPMC-C4T1E1 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1); + ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1); break; case SBE_BID_PMC_C2T1E1: /* 0xC2 - SBE wanPMC-C2T1E1 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1); + ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1); break; case SBE_BID_PMC_C1T1E1: /* 0xC1 - SBE wanPMC-C1T1E1 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1); + ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1); break; case SBE_BID_PCI_C4T1E1: /* 0x04 - SBE wanPCI-C4T1E1 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1); + ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1); break; case SBE_BID_PCI_C2T1E1: /* 0x02 - SBE wanPCI-C2T1E1 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1); + ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1); break; case SBE_BID_PCI_C1T1E1: /* 0x01 - SBE wanPCI-C1T1E1 */ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1); + ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1); break; default: /*** hdw_bid = ""; ***/ - ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1); + ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1); break; } } From 5cfa1b2598f3b0610ac597082aa997f7a94a7b3d Mon Sep 17 00:00:00 2001 From: Ana Rey Date: Tue, 12 Nov 2013 15:22:50 +0100 Subject: [PATCH 222/238] staging: rtl8187se: fix coding style in function declarations Removed innecessary spaces and indentation errors in function definition (including some curly braces wrongly placed and broke up at 80-chars per line). I still see some errors if I run the checkpatch.pl script, but those are not my fault. I'll address them in follow up patches. Signed-off-by: Ana Rey Acked-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8187se/ieee80211/dot11d.c | 36 ++---- drivers/staging/rtl8187se/ieee80211/dot11d.h | 46 ++----- .../staging/rtl8187se/ieee80211/ieee80211.h | 120 ++++++++++-------- .../rtl8187se/ieee80211/ieee80211_crypt.c | 3 +- .../ieee80211/ieee80211_crypt_ccmp.c | 2 +- .../ieee80211/ieee80211_crypt_tkip.c | 9 +- .../rtl8187se/ieee80211/ieee80211_rx.c | 39 +++--- .../rtl8187se/ieee80211/ieee80211_softmac.c | 91 +++++++------ .../ieee80211/ieee80211_softmac_wx.c | 64 +++++----- .../rtl8187se/ieee80211/ieee80211_tx.c | 13 +- .../rtl8187se/ieee80211/ieee80211_wx.c | 8 +- drivers/staging/rtl8187se/r8180.h | 22 ++-- drivers/staging/rtl8187se/r8180_core.c | 17 ++- drivers/staging/rtl8187se/r8180_dm.h | 2 +- drivers/staging/rtl8187se/r8180_rtl8225.h | 3 +- drivers/staging/rtl8187se/r8180_wx.c | 102 +++++++-------- drivers/staging/rtl8187se/r8185b_init.c | 13 +- 17 files changed, 280 insertions(+), 310 deletions(-) diff --git a/drivers/staging/rtl8187se/ieee80211/dot11d.c b/drivers/staging/rtl8187se/ieee80211/dot11d.c index d1395a683d5b..4483c2c0307c 100644 --- a/drivers/staging/rtl8187se/ieee80211/dot11d.c +++ b/drivers/staging/rtl8187se/ieee80211/dot11d.c @@ -1,7 +1,6 @@ #include "dot11d.h" -void -Dot11d_Init(struct ieee80211_device *ieee) +void Dot11d_Init(struct ieee80211_device *ieee) { PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(ieee); @@ -17,8 +16,7 @@ Dot11d_Init(struct ieee80211_device *ieee) } /* Reset to the state as we are just entering a regulatory domain. */ -void -Dot11d_Reset(struct ieee80211_device *ieee) +void Dot11d_Reset(struct ieee80211_device *ieee) { u32 i; PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(ieee); @@ -50,13 +48,8 @@ Dot11d_Reset(struct ieee80211_device *ieee) * 1. IS_DOT11D_ENABLE() is TRUE. * 2. Input IE is an valid one. */ -void -Dot11d_UpdateCountryIe( - struct ieee80211_device *dev, - u8 *pTaddr, - u16 CoutryIeLen, - u8 *pCoutryIe - ) +void Dot11d_UpdateCountryIe(struct ieee80211_device *dev, u8 *pTaddr, + u16 CoutryIeLen, u8 *pCoutryIe) { PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); u8 i, j, NumTriples, MaxChnlNum; @@ -122,11 +115,7 @@ Dot11d_UpdateCountryIe( pDot11dInfo->State = DOT11D_STATE_LEARNED; } -u8 -DOT11D_GetMaxTxPwrInDbm( - struct ieee80211_device *dev, - u8 Channel - ) +u8 DOT11D_GetMaxTxPwrInDbm(struct ieee80211_device *dev, u8 Channel) { PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); u8 MaxTxPwrInDbm = 255; @@ -142,10 +131,7 @@ DOT11D_GetMaxTxPwrInDbm( } -void -DOT11D_ScanComplete( - struct ieee80211_device *dev - ) +void DOT11D_ScanComplete(struct ieee80211_device *dev) { PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); @@ -165,10 +151,7 @@ DOT11D_ScanComplete( } } -int IsLegalChannel( - struct ieee80211_device *dev, - u8 channel -) +int IsLegalChannel(struct ieee80211_device *dev, u8 channel) { PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); @@ -181,10 +164,7 @@ int IsLegalChannel( return 0; } -int ToLegalChannel( - struct ieee80211_device *dev, - u8 channel -) +int ToLegalChannel(struct ieee80211_device *dev, u8 channel) { PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); u8 default_chn = 0; diff --git a/drivers/staging/rtl8187se/ieee80211/dot11d.h b/drivers/staging/rtl8187se/ieee80211/dot11d.h index 9c016fee0107..63f4f3c72f10 100644 --- a/drivers/staging/rtl8187se/ieee80211/dot11d.h +++ b/drivers/staging/rtl8187se/ieee80211/dot11d.h @@ -58,43 +58,13 @@ typedef struct _RT_DOT11D_INFO { #define IS_DOT11D_STATE_DONE(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->State == DOT11D_STATE_DONE) +void Dot11d_Init(struct ieee80211_device *dev); +void Dot11d_Reset(struct ieee80211_device *dev); +void Dot11d_UpdateCountryIe(struct ieee80211_device *dev, u8 *pTaddr, + u16 CoutryIeLen, u8 *pCoutryIe); +u8 DOT11D_GetMaxTxPwrInDbm(struct ieee80211_device *dev, u8 Channel); +void DOT11D_ScanComplete(struct ieee80211_device *dev); +int IsLegalChannel(struct ieee80211_device *dev, u8 channel); +int ToLegalChannel(struct ieee80211_device *dev, u8 channel); -void -Dot11d_Init( - struct ieee80211_device *dev - ); - -void -Dot11d_Reset( - struct ieee80211_device *dev - ); - -void -Dot11d_UpdateCountryIe( - struct ieee80211_device *dev, - u8 * pTaddr, - u16 CoutryIeLen, - u8 * pCoutryIe - ); - -u8 -DOT11D_GetMaxTxPwrInDbm( - struct ieee80211_device *dev, - u8 Channel - ); - -void -DOT11D_ScanComplete( - struct ieee80211_device * dev - ); - -int IsLegalChannel( - struct ieee80211_device * dev, - u8 channel -); - -int ToLegalChannel( - struct ieee80211_device * dev, - u8 channel -); #endif /* #ifndef __INC_DOT11D_H */ diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211.h b/drivers/staging/rtl8187se/ieee80211/ieee80211.h index ce8dcf79185c..09ffd9bc8991 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211.h @@ -1240,7 +1240,8 @@ static inline int ieee80211_is_empty_essid(const char *essid, int essid_len) return 1; } -static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) +static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, + int mode) { /* * It is possible for both access points and our device to support @@ -1303,19 +1304,16 @@ extern int ieee80211_set_encryption(struct ieee80211_device *ieee); /* ieee80211_tx.c */ -extern int ieee80211_encrypt_fragment( - struct ieee80211_device *ieee, - struct sk_buff *frag, - int hdr_len); +extern int ieee80211_encrypt_fragment(struct ieee80211_device *ieee, + struct sk_buff *frag, int hdr_len); -extern int ieee80211_rtl_xmit(struct sk_buff *skb, - struct net_device *dev); +extern int ieee80211_rtl_xmit(struct sk_buff *skb, struct net_device *dev); extern void ieee80211_txb_free(struct ieee80211_txb *); /* ieee80211_rx.c */ extern int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb, - struct ieee80211_rx_stats *rx_stats); + struct ieee80211_rx_stats *rx_stats); extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, struct ieee80211_hdr_4addr *header, struct ieee80211_rx_stats *stats); @@ -1331,25 +1329,28 @@ extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee, struct iw_request_info *info, union iwreq_data *wrqu, char *key); extern int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data* wrqu, char *extra); + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); int ieee80211_wx_set_auth(struct ieee80211_device *ieee, - struct iw_request_info *info, - struct iw_param *data, char *extra); + struct iw_request_info *info, + struct iw_param *data, char *extra); int ieee80211_wx_set_mlme(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len); /* ieee80211_softmac.c */ extern short ieee80211_is_54g(const struct ieee80211_network *net); extern short ieee80211_is_shortslot(const struct ieee80211_network *net); -extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, - struct ieee80211_rx_stats *rx_stats, u16 type, - u16 stype); -extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net); +extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, + struct sk_buff *skb, + struct ieee80211_rx_stats *rx_stats, + u16 type, u16 stype); +extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, + struct ieee80211_network *net); -extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee); +extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, + struct ieee80211_device *ieee); extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee); extern void ieee80211_start_bss(struct ieee80211_device *ieee); extern void ieee80211_start_master_bss(struct ieee80211_device *ieee); @@ -1371,16 +1372,17 @@ extern void ieee80211_rtl_stop_queue(struct ieee80211_device *ieee); extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee); extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee); extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee); -extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p); +extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, + struct iw_point *p); extern void notify_wx_assoc_event(struct ieee80211_device *ieee); extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success); -extern void SendDisassociation(struct ieee80211_device *ieee,u8* asSta,u8 asRsn); +extern void SendDisassociation(struct ieee80211_device *ieee, u8 *asSta, + u8 asRsn); extern void ieee80211_rtl_start_scan(struct ieee80211_device *ieee); //Add for RF power on power off by lizhaoming 080512 -extern void SendDisassociation(struct ieee80211_device *ieee, - u8* asSta, - u8 asRsn); +extern void SendDisassociation(struct ieee80211_device *ieee, u8 *asSta, + u8 asRsn); /* ieee80211_crypt_ccmp&tkip&wep.c */ extern void ieee80211_tkip_null(void); @@ -1389,64 +1391,72 @@ extern void ieee80211_ccmp_null(void); /* ieee80211_softmac_wx.c */ extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *ext); + struct iw_request_info *info, + union iwreq_data *wrqu, char *ext); extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *awrq, - char *extra); + struct iw_request_info *info, + union iwreq_data *awrq, + char *extra); -extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b); +extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *b); extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a, - union iwreq_data *wrqu, char *b); +extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *b); -extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a, - union iwreq_data *wrqu, char *b); +extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *b); extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee, - struct iw_request_info *a, - union iwreq_data *wrqu, char *extra); + struct iw_request_info *a, + union iwreq_data *wrqu, char *extra); -extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a, - union iwreq_data *wrqu, char *b); +extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *b); -extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a, - union iwreq_data *wrqu, char *b); +extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *b); -extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a, - union iwreq_data *wrqu, char *b); +extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, + struct iw_request_info *a, + union iwreq_data *wrqu, char *b); extern void ieee80211_wx_sync_scan_wq(struct work_struct *work); extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); extern int ieee80211_wx_get_name(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); extern int ieee80211_wx_set_power(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); extern int ieee80211_wx_get_power(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra); extern void ieee80211_softmac_ips_scan_syncro(struct ieee80211_device *ieee); -extern void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr); +extern void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, + short pwr); extern const long ieee80211_wlan_frequencies[]; diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c index 694eae3d4fda..a0340ee9d8b7 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c @@ -39,8 +39,7 @@ struct ieee80211_crypto { static struct ieee80211_crypto *hcrypt; -void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, - int force) +void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, int force) { struct list_head *ptr, *n; struct ieee80211_crypt_data *entry; diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c index 05d34e5453c9..0e8392acdeac 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c @@ -60,7 +60,7 @@ struct ieee80211_ccmp_data { }; void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm, - const u8 pt[16], u8 ct[16]) + const u8 pt[16], u8 ct[16]) { crypto_cipher_encrypt_one((void *)tfm, ct, pt); } diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c index 9c25ffb1697c..34a10d1868b4 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c @@ -520,7 +520,8 @@ static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr) } -static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv) +static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, + void *priv) { struct ieee80211_tkip_data *tkey = priv; u8 *pos; @@ -550,8 +551,8 @@ static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *pri } static void ieee80211_michael_mic_failure(struct net_device *dev, - struct ieee80211_hdr_4addr *hdr, - int keyidx) + struct ieee80211_hdr_4addr *hdr, + int keyidx) { union iwreq_data wrqu; struct iw_michaelmicfailure ev; @@ -571,7 +572,7 @@ static void ieee80211_michael_mic_failure(struct net_device *dev, } static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, - int hdr_len, void *priv) + int hdr_len, void *priv) { struct ieee80211_tkip_data *tkey = priv; u8 mic[8]; diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c index 304579096562..b522b57a2691 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c @@ -337,8 +337,9 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb, /* Called only as a tasklet (software IRQ), by ieee80211_rx */ static inline int -ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, struct sk_buff *skb, - int keyidx, struct ieee80211_crypt_data *crypt) +ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, + struct sk_buff *skb, int keyidx, + struct ieee80211_crypt_data *crypt) { struct ieee80211_hdr_4addr *hdr; int res, hdrlen; @@ -366,7 +367,7 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, struct sk_buff *s /* this function is stolen from ipw2200 driver*/ #define IEEE_PACKET_RETRY_TIME (5*HZ) static int is_duplicate_packet(struct ieee80211_device *ieee, - struct ieee80211_hdr_4addr *header) + struct ieee80211_hdr_4addr *header) { u16 fc = le16_to_cpu(header->frame_ctl); u16 sc = le16_to_cpu(header->seq_ctl); @@ -467,7 +468,7 @@ drop: * IEEE 802.11 format, i.e., in the format it was sent over air. * This function is called only as a tasklet (software IRQ). */ int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb, - struct ieee80211_rx_stats *rx_stats) + struct ieee80211_rx_stats *rx_stats) { struct net_device *dev = ieee->dev; //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); @@ -794,9 +795,7 @@ static inline int ieee80211_is_ofdm_rate(u8 rate) return 0; } -static inline int ieee80211_SignalStrengthTranslate( - int CurrSS - ) +static inline int ieee80211_SignalStrengthTranslate(int CurrSS) { int RetSS; @@ -831,12 +830,10 @@ static inline int ieee80211_SignalStrengthTranslate( return RetSS; } -static inline void ieee80211_extract_country_ie( - struct ieee80211_device *ieee, - struct ieee80211_info_element *info_element, - struct ieee80211_network *network, - u8 *addr2 -) +static inline void +ieee80211_extract_country_ie(struct ieee80211_device *ieee, + struct ieee80211_info_element *info_element, + struct ieee80211_network *network, u8 *addr2) { if (IS_DOT11D_ENABLE(ieee)) { if (info_element->len != 0) { @@ -858,10 +855,8 @@ static inline void ieee80211_extract_country_ie( } -static int -ieee80211_TranslateToDbm( - unsigned char SignalStrengthIndex // 0-100 index. - ) +/* SignalStrengthIndex is 0-100 */ +static int ieee80211_TranslateToDbm(unsigned char SignalStrengthIndex) { unsigned char SignalPower; // in dBm. @@ -1197,7 +1192,7 @@ static inline int is_same_network(struct ieee80211_network *src, } inline void update_network(struct ieee80211_network *dst, - struct ieee80211_network *src) + struct ieee80211_network *src) { unsigned char quality = src->stats.signalstrength; unsigned char signal = 0; @@ -1281,10 +1276,10 @@ inline void update_network(struct ieee80211_network *dst, } -inline void ieee80211_process_probe_response( - struct ieee80211_device *ieee, - struct ieee80211_probe_response *beacon, - struct ieee80211_rx_stats *stats) +inline void +ieee80211_process_probe_response(struct ieee80211_device *ieee, + struct ieee80211_probe_response *beacon, + struct ieee80211_rx_stats *stats) { struct ieee80211_network network; struct ieee80211_network *target; diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c index 7e16ccb7a645..3af1bf965981 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c @@ -186,7 +186,8 @@ void init_mgmt_queue(struct ieee80211_device *ieee) void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl); -inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee) +inline void softmac_mgmt_xmit(struct sk_buff *skb, + struct ieee80211_device *ieee) { unsigned long flags; short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE; @@ -237,7 +238,8 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee } -inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee) +inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, + struct ieee80211_device *ieee) { short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE; @@ -275,10 +277,9 @@ inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *i // dev_kfree_skb_any(skb);//edit by thomas } //by amy for power save -inline struct sk_buff *ieee80211_disassociate_skb( - struct ieee80211_network *beacon, - struct ieee80211_device *ieee, - u8 asRsn) +inline struct sk_buff * +ieee80211_disassociate_skb(struct ieee80211_network *beacon, + struct ieee80211_device *ieee, u8 asRsn) { struct sk_buff *skb; struct ieee80211_disassoc_frame *disass; @@ -298,12 +299,7 @@ inline struct sk_buff *ieee80211_disassociate_skb( disass->reasoncode = asRsn; return skb; } -void -SendDisassociation( - struct ieee80211_device *ieee, - u8* asSta, - u8 asRsn -) +void SendDisassociation(struct ieee80211_device *ieee, u8 *asSta, u8 asRsn) { struct ieee80211_network *beacon = &ieee->current_network; struct sk_buff *skb; @@ -734,8 +730,9 @@ void ieee80211_start_scan_syncro(struct ieee80211_device *ieee) } -inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon, - struct ieee80211_device *ieee, int challengelen) +inline struct sk_buff * +ieee80211_authentication_req(struct ieee80211_network *beacon, + struct ieee80211_device *ieee, int challengelen) { struct sk_buff *skb; struct ieee80211_authentication *auth; @@ -767,7 +764,8 @@ inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *be } -static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest) +static struct sk_buff *ieee80211_probe_resp(struct ieee80211_device *ieee, + u8 *dest) { u8 *tag; int beacon_size; @@ -968,7 +966,7 @@ static struct sk_buff *ieee80211_auth_resp(struct ieee80211_device *ieee, } -struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr) +struct sk_buff *ieee80211_null_func(struct ieee80211_device *ieee, short pwr) { struct sk_buff *skb; struct ieee80211_hdr_3addr* hdr; @@ -994,7 +992,7 @@ struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr) } -void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest) +void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8 *dest) { struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest); @@ -1005,7 +1003,7 @@ void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest) } -void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest) +void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8 *dest) { struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest); @@ -1028,7 +1026,9 @@ void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest) } -inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee) +inline struct sk_buff * +ieee80211_association_req(struct ieee80211_network *beacon, + struct ieee80211_device *ieee) { struct sk_buff *skb; //unsigned long flags; @@ -1199,7 +1199,8 @@ void ieee80211_associate_step1(struct ieee80211_device *ieee) } } -void ieee80211_rtl_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen) +void ieee80211_rtl_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, + int chlen) { u8 *c; struct sk_buff *skb; @@ -1309,7 +1310,8 @@ void ieee80211_associate_procedure_wq(struct work_struct *work) up(&ieee->wx_sem); } -inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net) +inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, + struct ieee80211_network *net) { u8 tmp_ssid[IW_ESSID_MAX_SIZE+1]; int tmp_ssid_len = 0; @@ -1422,7 +1424,7 @@ void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee) } -static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen) +static inline u16 auth_parse(struct sk_buff *skb, u8 **challenge, int *chlen) { struct ieee80211_authentication *a; u8 *t; @@ -1448,7 +1450,7 @@ static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen) } -int auth_rq_parse(struct sk_buff *skb,u8* dest) +int auth_rq_parse(struct sk_buff *skb, u8 *dest) { struct ieee80211_authentication *a; @@ -1466,7 +1468,8 @@ int auth_rq_parse(struct sk_buff *skb,u8* dest) return WLAN_STATUS_SUCCESS; } -static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src) +static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, + u8 *src) { u8 *tag; u8 *skbend; @@ -1504,7 +1507,7 @@ static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, } -int assoc_rq_parse(struct sk_buff *skb,u8* dest) +int assoc_rq_parse(struct sk_buff *skb, u8 *dest) { struct ieee80211_assoc_request_frame *a; @@ -1535,8 +1538,8 @@ static inline u16 assoc_parse(struct sk_buff *skb, int *aid) return le16_to_cpu(a->status); } -static inline void -ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb) +static inline void ieee80211_rx_probe_rq(struct ieee80211_device *ieee, + struct sk_buff *skb) { u8 dest[ETH_ALEN]; @@ -1550,8 +1553,8 @@ ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb) } } -inline void -ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb) +inline void ieee80211_rx_auth_rq(struct ieee80211_device *ieee, + struct sk_buff *skb) { u8 dest[ETH_ALEN]; int status; @@ -1594,7 +1597,8 @@ void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr) } -short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l) +short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, + u32 *time_l) { int timeout = 0; @@ -1769,10 +1773,10 @@ void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success) spin_unlock_irqrestore(&ieee->lock, flags); } -inline int -ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, - struct ieee80211_rx_stats *rx_stats, u16 type, - u16 stype) +inline int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, + struct sk_buff *skb, + struct ieee80211_rx_stats *rx_stats, + u16 type, u16 stype) { struct ieee80211_hdr_3addr *header = (struct ieee80211_hdr_3addr *) skb->data; u16 errcode; @@ -1975,7 +1979,8 @@ associate_complete: * to the driver later, when it wakes the queue. */ -void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee) +void ieee80211_softmac_xmit(struct ieee80211_txb *txb, + struct ieee80211_device *ieee) { @@ -2618,7 +2623,8 @@ static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value) } -void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len) +void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, + int wpa_ie_len) { /* make sure WPA is enabled */ ieee80211_wpa_enable(ieee, 1); @@ -2627,7 +2633,8 @@ void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int } -static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason) +static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, + int reason) { int ret = 0; @@ -2651,7 +2658,7 @@ static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int re static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee, - struct ieee_param *param, int plen) + struct ieee_param *param, int plen) { u8 *buf; @@ -2705,7 +2712,8 @@ static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value) return ret; } -static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value) +static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, + u32 value) { int ret=0; unsigned long flags; @@ -2783,7 +2791,7 @@ static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 v /* implementation borrowed from hostap driver */ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee, - struct ieee_param *param, int param_len) + struct ieee_param *param, int param_len) { int ret = 0; @@ -2930,7 +2938,8 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee, return ret; } -int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p) +int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, + struct iw_point *p) { struct ieee_param *param; int ret=0; diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c index e5282068e3de..46f35644126c 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c @@ -28,8 +28,9 @@ const long ieee80211_wlan_frequencies[] = { }; -int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a, - union iwreq_data *wrqu, char *b) +int ieee80211_wx_set_freq(struct ieee80211_device *ieee, + struct iw_request_info *a, union iwreq_data *wrqu, + char *b) { int ret; struct iw_freq *fwrq = &wrqu->freq; @@ -82,8 +83,8 @@ out: int ieee80211_wx_get_freq(struct ieee80211_device *ieee, - struct iw_request_info *a, - union iwreq_data *wrqu, char *b) + struct iw_request_info *a, union iwreq_data *wrqu, + char *b) { struct iw_freq *fwrq = &wrqu->freq; @@ -97,8 +98,8 @@ int ieee80211_wx_get_freq(struct ieee80211_device *ieee, } int ieee80211_wx_get_wap(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, union iwreq_data *wrqu, + char *extra) { unsigned long flags; @@ -126,8 +127,7 @@ int ieee80211_wx_get_wap(struct ieee80211_device *ieee, int ieee80211_wx_set_wap(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *awrq, + struct iw_request_info *info, union iwreq_data *awrq, char *extra) { @@ -174,8 +174,9 @@ out: return ret; } -int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a, - union iwreq_data *wrqu, char *b) +int ieee80211_wx_get_essid(struct ieee80211_device *ieee, + struct iw_request_info *a, union iwreq_data *wrqu, + char *b) { int len, ret = 0; unsigned long flags; @@ -211,8 +212,8 @@ out: } int ieee80211_wx_set_rate(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, union iwreq_data *wrqu, + char *extra) { u32 target_rate = wrqu->bitrate.value; @@ -230,8 +231,8 @@ int ieee80211_wx_set_rate(struct ieee80211_device *ieee, int ieee80211_wx_get_rate(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, union iwreq_data *wrqu, + char *extra) { wrqu->bitrate.value = ieee->rate * 100000; @@ -239,8 +240,9 @@ int ieee80211_wx_get_rate(struct ieee80211_device *ieee, return 0; } -int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a, - union iwreq_data *wrqu, char *b) +int ieee80211_wx_set_mode(struct ieee80211_device *ieee, + struct iw_request_info *a, union iwreq_data *wrqu, + char *b) { ieee->sync_scan_hurryup = 1; @@ -305,8 +307,9 @@ void ieee80211_wx_sync_scan_wq(struct work_struct *work) } -int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a, - union iwreq_data *wrqu, char *b) +int ieee80211_wx_set_scan(struct ieee80211_device *ieee, + struct iw_request_info *a, union iwreq_data *wrqu, + char *b) { int ret = 0; @@ -333,8 +336,8 @@ out: } int ieee80211_wx_set_essid(struct ieee80211_device *ieee, - struct iw_request_info *a, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *a, union iwreq_data *wrqu, + char *extra) { int ret = 0, len; @@ -395,8 +398,9 @@ out: return ret; } -int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a, - union iwreq_data *wrqu, char *b) +int ieee80211_wx_get_mode(struct ieee80211_device *ieee, + struct iw_request_info *a, union iwreq_data *wrqu, + char *b) { wrqu->mode = ieee->iw_mode; @@ -404,8 +408,8 @@ int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info } int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, union iwreq_data *wrqu, + char *extra) { int *parms = (int *)extra; @@ -440,8 +444,8 @@ int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, } int ieee80211_wx_get_name(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, union iwreq_data *wrqu, + char *extra) { strlcpy(wrqu->name, "802.11", IFNAMSIZ); if (ieee->modulation & IEEE80211_CCK_MODULATION) { @@ -464,8 +468,8 @@ int ieee80211_wx_get_name(struct ieee80211_device *ieee, /* this is mostly stolen from hostap */ int ieee80211_wx_set_power(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, union iwreq_data *wrqu, + char *extra) { int ret = 0; @@ -525,8 +529,8 @@ exit: /* this is stolen from hostap */ int ieee80211_wx_get_power(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, union iwreq_data *wrqu, + char *extra) { int ret = 0; diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c index f5a5219fe14d..0dc5ae414270 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c @@ -177,10 +177,8 @@ static inline int ieee80211_put_snap(u8 *data, u16 h_proto) return SNAP_SIZE + sizeof(u16); } -int ieee80211_encrypt_fragment( - struct ieee80211_device *ieee, - struct sk_buff *frag, - int hdr_len) +int ieee80211_encrypt_fragment(struct ieee80211_device *ieee, + struct sk_buff *frag, int hdr_len) { struct ieee80211_crypt_data* crypt = ieee->crypt[ieee->tx_keyidx]; int res; @@ -279,8 +277,8 @@ static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, * Classify the to-be send data packet * Need to acquire the sent queue index. */ -static int -ieee80211_classify(struct sk_buff *skb, struct ieee80211_network *network) +static int ieee80211_classify(struct sk_buff *skb, + struct ieee80211_network *network) { struct ether_header *eh = (struct ether_header *)skb->data; unsigned int wme_UP = 0; @@ -310,8 +308,7 @@ ieee80211_classify(struct sk_buff *skb, struct ieee80211_network *network) } /* SKBs are added to the ieee->tx_queue. */ -int ieee80211_rtl_xmit(struct sk_buff *skb, - struct net_device *dev) +int ieee80211_rtl_xmit(struct sk_buff *skb, struct net_device *dev) { struct ieee80211_device *ieee = netdev_priv(dev); struct ieee80211_txb *txb = NULL; diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c index 24d39ccc1337..3b7955f0ff98 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c @@ -633,8 +633,8 @@ done: return ret; } int ieee80211_wx_set_mlme(struct ieee80211_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct iw_mlme *mlme = (struct iw_mlme *) extra; // printk("\ndkgadfslkdjgalskdf===============>%s(), cmd:%x\n", __func__, mlme->cmd); @@ -653,8 +653,8 @@ int ieee80211_wx_set_mlme(struct ieee80211_device *ieee, } int ieee80211_wx_set_auth(struct ieee80211_device *ieee, - struct iw_request_info *info, - struct iw_param *data, char *extra) + struct iw_request_info *info, + struct iw_param *data, char *extra) { /* struct ieee80211_security sec = { diff --git a/drivers/staging/rtl8187se/r8180.h b/drivers/staging/rtl8187se/r8180.h index 84957be01b4f..e9602f67cac8 100644 --- a/drivers/staging/rtl8187se/r8180.h +++ b/drivers/staging/rtl8187se/r8180.h @@ -639,20 +639,20 @@ typedef struct r8180_priv ((_ac) == WME_AC_BK) ? BK_PRIORITY : \ BE_PRIORITY) -short rtl8180_tx(struct net_device *dev,u8* skbuf, int len,int priority, - short morefrag,short fragdesc,int rate); +short rtl8180_tx(struct net_device *dev, u8 *skbuf, int len, int priority, + short morefrag, short fragdesc, int rate); u8 read_nic_byte(struct net_device *dev, int x); u32 read_nic_dword(struct net_device *dev, int x); u16 read_nic_word(struct net_device *dev, int x) ; -void write_nic_byte(struct net_device *dev, int x,u8 y); -void write_nic_word(struct net_device *dev, int x,u16 y); -void write_nic_dword(struct net_device *dev, int x,u32 y); +void write_nic_byte(struct net_device *dev, int x, u8 y); +void write_nic_word(struct net_device *dev, int x, u16 y); +void write_nic_dword(struct net_device *dev, int x, u32 y); void force_pci_posting(struct net_device *dev); void rtl8180_rtx_disable(struct net_device *); -void rtl8180_set_anaparam(struct net_device *dev,u32 a); -void rtl8185_set_anaparam2(struct net_device *dev,u32 a); +void rtl8180_set_anaparam(struct net_device *dev, u32 a); +void rtl8185_set_anaparam2(struct net_device *dev, u32 a); void rtl8180_set_hw_wep(struct net_device *dev); void rtl8180_no_hw_wep(struct net_device *dev); void rtl8180_update_msr(struct net_device *dev); @@ -661,7 +661,7 @@ void rtl8180_beacon_rx_disable(struct net_device *dev); int rtl8180_down(struct net_device *dev); int rtl8180_up(struct net_device *dev); void rtl8180_commit(struct net_device *dev); -void rtl8180_set_chan(struct net_device *dev,short ch); +void rtl8180_set_chan(struct net_device *dev, short ch); void write_phy(struct net_device *dev, u8 adr, u8 data); void write_phy_cck(struct net_device *dev, u8 adr, u32 data); void write_phy_ofdm(struct net_device *dev, u8 adr, u32 data); @@ -671,7 +671,8 @@ void IPSEnter(struct net_device *dev); void IPSLeave(struct net_device *dev); int get_curr_tx_free_desc(struct net_device *dev, int priority); void UpdateInitialGain(struct net_device *dev); -bool SetAntennaConfig87SE(struct net_device *dev, u8 DefaultAnt, bool bAntDiversity); +bool SetAntennaConfig87SE(struct net_device *dev, u8 DefaultAnt, + bool bAntDiversity); //#ifdef CONFIG_RTL8185B void rtl8185b_adapter_start(struct net_device *dev); @@ -684,7 +685,8 @@ void fix_tx_fifo(struct net_device *dev); void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch); void rtl8180_rate_adapter(struct work_struct * work); //#endif -bool MgntActSet_RF_State(struct net_device *dev, RT_RF_POWER_STATE StateToSet, u32 ChangeSource); +bool MgntActSet_RF_State(struct net_device *dev, RT_RF_POWER_STATE StateToSet, + u32 ChangeSource); #endif diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c index d4ba717ff0df..297136b3c57d 100644 --- a/drivers/staging/rtl8187se/r8180_core.c +++ b/drivers/staging/rtl8187se/r8180_core.c @@ -79,7 +79,7 @@ module_param(hwwep, int, S_IRUGO|S_IWUSR); MODULE_PARM_DESC(hwwep, " Try to use hardware WEP support. Still broken and not available on all cards"); static int rtl8180_pci_probe(struct pci_dev *pdev, - const struct pci_device_id *id); + const struct pci_device_id *id); static void rtl8180_pci_remove(struct pci_dev *pdev); @@ -387,7 +387,8 @@ static short buffer_add(struct buffer **buffer, u32 *buf, dma_addr_t dma, return 0; } -void buffer_free(struct net_device *dev, struct buffer **buffer, int len, short consistent) +void buffer_free(struct net_device *dev, struct buffer **buffer, int len, + short consistent) { struct buffer *tmp, *next; @@ -2238,7 +2239,8 @@ static CHANNEL_LIST ChannelPlan[] = { {{1,2,3,4,5,6,7,8,9,10,11,12,13},13} /* world wide 13: ch1~ch11 active scan, ch12~13 passive //lzm add 080826 */ }; -static void rtl8180_set_channel_map(u8 channel_plan, struct ieee80211_device *ieee) +static void rtl8180_set_channel_map(u8 channel_plan, + struct ieee80211_device *ieee) { int i; @@ -2830,11 +2832,8 @@ static struct net_device_stats *rtl8180_stats(struct net_device *dev) /* * Change current and default preamble mode. */ -bool -MgntActSet_802_11_PowerSaveMode( - struct r8180_priv *priv, - RT_PS_MODE rtPsMode -) +bool MgntActSet_802_11_PowerSaveMode(struct r8180_priv *priv, + RT_PS_MODE rtPsMode) { /* Currently, we do not change power save mode on IBSS mode. */ if (priv->ieee80211->iw_mode == IW_MODE_ADHOC) @@ -3161,7 +3160,7 @@ static const struct net_device_ops rtl8180_netdev_ops = { }; static int rtl8180_pci_probe(struct pci_dev *pdev, - const struct pci_device_id *id) + const struct pci_device_id *id) { unsigned long ioaddr = 0; struct net_device *dev = NULL; diff --git a/drivers/staging/rtl8187se/r8180_dm.h b/drivers/staging/rtl8187se/r8180_dm.h index 732c06ac1026..cb4046f346ef 100644 --- a/drivers/staging/rtl8187se/r8180_dm.h +++ b/drivers/staging/rtl8187se/r8180_dm.h @@ -5,7 +5,7 @@ /* #include "r8180_hw.h" */ /* #include "r8180_93cx6.h" */ void SwAntennaDiversityRxOk8185(struct net_device *dev, u8 SignalStrength); -bool SetAntenna8185(struct net_device *dev, u8 u1bAntennaIndex); +bool SetAntenna8185(struct net_device *dev, u8 u1bAntennaIndex); bool SwitchAntenna(struct net_device *dev); void SwAntennaDiversity(struct net_device *dev); void SwAntennaDiversityTimerCallback(struct net_device *dev); diff --git a/drivers/staging/rtl8187se/r8180_rtl8225.h b/drivers/staging/rtl8187se/r8180_rtl8225.h index c94ca0794a5d..de084f07a071 100644 --- a/drivers/staging/rtl8187se/r8180_rtl8225.h +++ b/drivers/staging/rtl8187se/r8180_rtl8225.h @@ -28,7 +28,8 @@ u16 RF_ReadReg(struct net_device *dev, u8 offset); void rtl8180_set_mode(struct net_device *dev, int mode); void rtl8180_set_mode(struct net_device *dev, int mode); -bool SetZebraRFPowerState8185(struct net_device *dev, RT_RF_POWER_STATE eRFPowerState); +bool SetZebraRFPowerState8185(struct net_device *dev, + RT_RF_POWER_STATE eRFPowerState); void rtl8225z4_rf_sleep(struct net_device *dev); void rtl8225z4_rf_wakeup(struct net_device *dev); diff --git a/drivers/staging/rtl8187se/r8180_wx.c b/drivers/staging/rtl8187se/r8180_wx.c index 92b76f4cca47..bae68759bd6a 100644 --- a/drivers/staging/rtl8187se/r8180_wx.c +++ b/drivers/staging/rtl8187se/r8180_wx.c @@ -75,8 +75,9 @@ static int r8180_wx_set_key(struct net_device *dev, } -static int r8180_wx_set_beaconinterval(struct net_device *dev, struct iw_request_info *aa, - union iwreq_data *wrqu, char *b) +static int r8180_wx_set_beaconinterval(struct net_device *dev, + struct iw_request_info *aa, + union iwreq_data *wrqu, char *b) { int *parms = (int *)b; int bi = parms[0]; @@ -474,9 +475,8 @@ static int r8180_wx_get_frag(struct net_device *dev, static int r8180_wx_set_wap(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *awrq, - char *extra) + struct iw_request_info *info, + union iwreq_data *awrq, char *extra) { int ret; struct r8180_priv *priv = ieee80211_priv(dev); @@ -538,8 +538,10 @@ static int r8180_wx_get_enc(struct net_device *dev, } -static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union - iwreq_data *wrqu, char *p) { +static int r8180_wx_set_scan_type(struct net_device *dev, + struct iw_request_info *aa, + union iwreq_data *wrqu, char *p) +{ struct r8180_priv *priv = ieee80211_priv(dev); int *parms = (int*)p; @@ -554,8 +556,8 @@ static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info } static int r8180_wx_set_retry(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8180_priv *priv = ieee80211_priv(dev); int err = 0; @@ -602,8 +604,8 @@ exit: } static int r8180_wx_get_retry(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8180_priv *priv = ieee80211_priv(dev); @@ -626,8 +628,8 @@ static int r8180_wx_get_retry(struct net_device *dev, } static int r8180_wx_get_sens(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8180_priv *priv = ieee80211_priv(dev); if (priv->rf_set_sens == NULL) @@ -638,8 +640,8 @@ static int r8180_wx_get_sens(struct net_device *dev, static int r8180_wx_set_sens(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8180_priv *priv = ieee80211_priv(dev); @@ -667,8 +669,8 @@ exit: static int r8180_wx_set_rawtx(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8180_priv *priv = ieee80211_priv(dev); int ret; @@ -687,8 +689,8 @@ static int r8180_wx_set_rawtx(struct net_device *dev, } static int r8180_wx_get_power(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { int ret; struct r8180_priv *priv = ieee80211_priv(dev); @@ -703,8 +705,8 @@ static int r8180_wx_get_power(struct net_device *dev, } static int r8180_wx_set_power(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { int ret; struct r8180_priv *priv = ieee80211_priv(dev); @@ -729,8 +731,8 @@ static int r8180_wx_set_power(struct net_device *dev, } static int r8180_wx_set_rts(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8180_priv *priv = ieee80211_priv(dev); @@ -751,8 +753,8 @@ static int r8180_wx_set_rts(struct net_device *dev, return 0; } static int r8180_wx_get_rts(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8180_priv *priv = ieee80211_priv(dev); @@ -842,8 +844,8 @@ static int r8180_wx_set_iwmode(struct net_device *dev, return ret; } static int r8180_wx_get_preamble(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8180_priv *priv = ieee80211_priv(dev); @@ -859,8 +861,8 @@ static int r8180_wx_get_preamble(struct net_device *dev, return 0; } static int r8180_wx_set_preamble(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8180_priv *priv = ieee80211_priv(dev); int ret = 0; @@ -882,8 +884,8 @@ static int r8180_wx_set_preamble(struct net_device *dev, return ret; } static int r8180_wx_get_siglevel(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8180_priv *priv = ieee80211_priv(dev); int ret = 0; @@ -901,8 +903,8 @@ static int r8180_wx_get_siglevel(struct net_device *dev, return ret; } static int r8180_wx_get_sigqual(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8180_priv *priv = ieee80211_priv(dev); int ret = 0; @@ -960,8 +962,8 @@ static int r8180_wx_reset_stats(struct net_device *dev, } static int r8180_wx_radio_on(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8180_priv *priv = ieee80211_priv(dev); @@ -979,8 +981,8 @@ static int r8180_wx_radio_on(struct net_device *dev, } static int r8180_wx_radio_off(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8180_priv *priv = ieee80211_priv(dev); @@ -997,8 +999,8 @@ static int r8180_wx_radio_off(struct net_device *dev, } static int r8180_wx_get_channelplan(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8180_priv *priv = ieee80211_priv(dev); @@ -1014,8 +1016,8 @@ static int r8180_wx_get_channelplan(struct net_device *dev, return 0; } static int r8180_wx_set_channelplan(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8180_priv *priv = ieee80211_priv(dev); int *val = (int *)extra; @@ -1044,8 +1046,8 @@ static int r8180_wx_set_channelplan(struct net_device *dev, } static int r8180_wx_get_version(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8180_priv *priv = ieee80211_priv(dev); /* struct ieee80211_device *ieee; */ @@ -1060,8 +1062,8 @@ static int r8180_wx_get_version(struct net_device *dev, /* added by amy 080818 */ /*receive datarate from user typing valid rate is from 2 to 108 (1 - 54M), if input 0, return to normal rate adaptive. */ static int r8180_wx_set_forcerate(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8180_priv *priv = ieee80211_priv(dev); u8 forcerate = *extra; @@ -1085,8 +1087,8 @@ static int r8180_wx_set_forcerate(struct net_device *dev, } static int r8180_wx_set_enc_ext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { struct r8180_priv *priv = ieee80211_priv(dev); @@ -1119,8 +1121,8 @@ static int r8180_wx_set_auth(struct net_device *dev, } static int r8180_wx_set_mlme(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) { int ret = 0; struct r8180_priv *priv = ieee80211_priv(dev); @@ -1334,7 +1336,7 @@ static iw_handler r8180_private_handler[] = { }; static inline int is_same_network(struct ieee80211_network *src, - struct ieee80211_network *dst, + struct ieee80211_network *dst, struct ieee80211_device *ieee) { /* A network is only a duplicate if the channel, BSSID, ESSID diff --git a/drivers/staging/rtl8187se/r8185b_init.c b/drivers/staging/rtl8187se/r8185b_init.c index f2f0dc7d4e9a..c8b9baff1dbc 100644 --- a/drivers/staging/rtl8187se/r8185b_init.c +++ b/drivers/staging/rtl8187se/r8185b_init.c @@ -870,9 +870,10 @@ static u8 GetSupportedWirelessMode8185(struct net_device *dev) return WIRELESS_MODE_B | WIRELESS_MODE_G; } -static void ActUpdateChannelAccessSetting(struct net_device *dev, - WIRELESS_MODE WirelessMode, - PCHANNEL_ACCESS_SETTING ChnlAccessSetting) +static void +ActUpdateChannelAccessSetting(struct net_device *dev, + WIRELESS_MODE WirelessMode, + PCHANNEL_ACCESS_SETTING ChnlAccessSetting) { AC_CODING eACI; @@ -1084,7 +1085,7 @@ static bool MgntDisconnect(struct net_device *dev, u8 asRsn) * PASSIVE LEVEL. */ static bool SetRFPowerState(struct net_device *dev, - RT_RF_POWER_STATE eRFPowerState) + RT_RF_POWER_STATE eRFPowerState) { struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); bool bResult = false; @@ -1097,8 +1098,8 @@ static bool SetRFPowerState(struct net_device *dev, return bResult; } -bool MgntActSet_RF_State(struct net_device *dev, - RT_RF_POWER_STATE StateToSet, u32 ChangeSource) +bool MgntActSet_RF_State(struct net_device *dev, RT_RF_POWER_STATE StateToSet, + u32 ChangeSource) { struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); bool bActionAllowed = false; From 566597a37647c34600d971e5898d5816dddd7afd Mon Sep 17 00:00:00 2001 From: Nandini Hanumanthagowda Date: Tue, 12 Nov 2013 23:05:30 +0530 Subject: [PATCH 223/238] staging: vt6656: removed unnecessary braces around if-else statements removed unnecessary braces around if-else statement whenever the if-else construct was followed by just single line of code to comply with linux coding style Signed-off-by: Nandini Hanumanthagowda Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/wcmd.c | 53 +++++++++++++---------------------- 1 file changed, 20 insertions(+), 33 deletions(-) diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index ca57fc37d609..5f0a00295ef4 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -108,9 +108,7 @@ static void vAdHocBeaconStop(struct vnt_private *pDevice) bStop = true; } if (pMgmt->uIBSSChannel > CB_MAX_CHANNEL_24G) - { bStop = true; - } } if (bStop) @@ -182,13 +180,13 @@ static void s_vProbeChannel(struct vnt_private *pDevice) u8 *pbyRate; int ii; - if (pDevice->byBBType == BB_TYPE_11A) { - pbyRate = &abyCurrSuppRatesA[0]; - } else if (pDevice->byBBType == BB_TYPE_11B) { - pbyRate = &abyCurrSuppRatesB[0]; - } else { - pbyRate = &abyCurrSuppRatesG[0]; - } + if (pDevice->byBBType == BB_TYPE_11A) + pbyRate = &abyCurrSuppRatesA[0]; + else if (pDevice->byBBType == BB_TYPE_11B) + pbyRate = &abyCurrSuppRatesB[0]; + else + pbyRate = &abyCurrSuppRatesG[0]; + // build an assocreq frame and send it pTxPacket = s_MgrMakeProbeRequest ( @@ -204,10 +202,9 @@ static void s_vProbeChannel(struct vnt_private *pDevice) for (ii = 0; ii < 1; ii++) { if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request sending fail.. \n"); - } - else { + } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request is sending.. \n"); - } + } } } @@ -316,9 +313,8 @@ void vRunCommand(struct work_struct *work) pItemSSID = (PWLAN_IE_SSID)pMgmt->abyScanSSID; - if (pMgmt->uScanChannel == 0) { + if (pMgmt->uScanChannel == 0) pMgmt->uScanChannel = pDevice->byMinChannel; - } if (pMgmt->uScanChannel > pDevice->byMaxChannel) { pDevice->eCommandState = WLAN_CMD_SCAN_END; s_bCommandComplete(pDevice); @@ -546,9 +542,8 @@ void vRunCommand(struct work_struct *work) // if Adhoc mode else if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { if (pMgmt->eCurrState == WMAC_STATE_JOINTED) { - if (netif_queue_stopped(pDevice->dev)) { + if (netif_queue_stopped(pDevice->dev)) netif_wake_queue(pDevice->dev); - } pDevice->bLinkPass = true; ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_INTER); pMgmt->sNodeDBTable[0].bActive = true; @@ -654,9 +649,8 @@ void vRunCommand(struct work_struct *work) ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_INTER); s_bClearBSSID_SCAN(pDevice); - if (netif_queue_stopped(pDevice->dev)) { + if (netif_queue_stopped(pDevice->dev)) netif_wake_queue(pDevice->dev); - } } else if (pMgmt->eCurrState < WMAC_STATE_ASSOCPENDING) { @@ -700,9 +694,8 @@ void vRunCommand(struct work_struct *work) pDevice->byRxMode &= ~RCR_UNICAST; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wcmd: rx_mode = %x\n", pDevice->byRxMode); BSSvAddMulticastNode(pDevice); - if (netif_queue_stopped(pDevice->dev)) { + if (netif_queue_stopped(pDevice->dev)) netif_wake_queue(pDevice->dev); - } pDevice->bLinkPass = true; ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_INTER); schedule_delayed_work(&pDevice->second_callback_work, HZ); @@ -722,9 +715,8 @@ void vRunCommand(struct work_struct *work) pDevice->bMoreData = true; } - if (nsDMA_tx_packet(pDevice, TYPE_AC0DMA, skb) != 0) { + if (nsDMA_tx_packet(pDevice, TYPE_AC0DMA, skb) != 0) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Multicast ps tx fail \n"); - } pMgmt->sNodeDBTable[0].wEnQueueCnt--; } @@ -747,9 +739,8 @@ void vRunCommand(struct work_struct *work) pDevice->bMoreData = true; } - if (nsDMA_tx_packet(pDevice, TYPE_AC0DMA, skb) != 0) { + if (nsDMA_tx_packet(pDevice, TYPE_AC0DMA, skb) != 0) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "sta ps tx fail \n"); - } pMgmt->sNodeDBTable[ii].wEnQueueCnt--; // check if sta ps enable, wait next pspoll @@ -973,11 +964,10 @@ static int s_bCommandComplete(struct vnt_private *pDevice) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_BSSID_SCAN\n"); pDevice->eCommandState = WLAN_CMD_SCAN_START; pMgmt->uScanChannel = 0; - if (pSSID->len != 0) { + if (pSSID->len != 0) memcpy(pMgmt->abyScanSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - } else { + else memset(pMgmt->abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - } /* if ((bForceSCAN == false) && (pDevice->bLinkPass == true)) { if ((pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) && @@ -1054,9 +1044,8 @@ int bScheduleCommand(struct vnt_private *pDevice, CMD_CODE eCommand, u8 *pbyItem0) { - if (pDevice->cbFreeCmdQueue == 0) { + if (pDevice->cbFreeCmdQueue == 0) return (false); - } pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].eCmd = eCommand; pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = true; memset(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, 0 , WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); @@ -1094,11 +1083,9 @@ int bScheduleCommand(struct vnt_private *pDevice, ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdEnqueueIdx, CMD_Q_SIZE); pDevice->cbFreeCmdQueue--; - if (pDevice->bCmdRunning == false) { + if (pDevice->bCmdRunning == false) s_bCommandComplete(pDevice); - } - else { - } + return (true); } From c3f007f5b6bcaeaf554014e3ec471c2308843c6e Mon Sep 17 00:00:00 2001 From: Nandini Hanumanthagowda Date: Tue, 12 Nov 2013 23:05:31 +0530 Subject: [PATCH 224/238] staging: vt6656: fixed open brace placement related error fixed the following checkpatch error: ERROR: that open brace { should be on the previous line Signed-off-by: Nandini Hanumanthagowda Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/wcmd.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index 5f0a00295ef4..cf234829806b 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -100,19 +100,16 @@ static void vAdHocBeaconStop(struct vnt_private *pDevice) */ bStop = false; if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && - (pMgmt->eCurrState >= WMAC_STATE_STARTED)) - { + (pMgmt->eCurrState >= WMAC_STATE_STARTED)) { if ((pMgmt->uIBSSChannel <= CB_MAX_CHANNEL_24G) && - (pMgmt->uScanChannel > CB_MAX_CHANNEL_24G)) - { + (pMgmt->uScanChannel > CB_MAX_CHANNEL_24G)) { bStop = true; } if (pMgmt->uIBSSChannel > CB_MAX_CHANNEL_24G) bStop = true; } - if (bStop) - { + if (bStop) { //PMESG(("STOP_BEACON: IBSSChannel = %u, ScanChannel = %u\n", // pMgmt->uIBSSChannel, pMgmt->uScanChannel)); MACvRegBitsOff(pDevice, MAC_REG_TCR, TCR_AUTOBCNTX); @@ -144,8 +141,7 @@ static void vAdHocBeaconRestart(struct vnt_private *pDevice) * (2) VT3253 is programmed as automatic Beacon Transmitting */ if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && - (pMgmt->eCurrState >= WMAC_STATE_STARTED)) - { + (pMgmt->eCurrState >= WMAC_STATE_STARTED)) { //PMESG(("RESTART_BEACON\n")); MACvRegBitsOn(pDevice, MAC_REG_TCR, TCR_AUTOBCNTX); } From bfce700fb107bb0d3dcb29726629535892267dd2 Mon Sep 17 00:00:00 2001 From: Nandini Hanumanthagowda Date: Tue, 12 Nov 2013 23:05:32 +0530 Subject: [PATCH 225/238] staging: vt6656: fixed checkpatch errors related to close brace fixed following checkpatch error: ERROR: else should follow close brace '}' Signed-off-by: Nandini Hanumanthagowda Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/wcmd.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index cf234829806b..a6681a2f7146 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -350,8 +350,7 @@ void vRunCommand(struct work_struct *work) if ((pDevice->byBBType != BB_TYPE_11A) && (pMgmt->uScanChannel > CB_MAX_CHANNEL_24G)) { pDevice->byBBType = BB_TYPE_11A; CARDvSetBSSMode(pDevice); - } - else if ((pDevice->byBBType == BB_TYPE_11A) && (pMgmt->uScanChannel <= CB_MAX_CHANNEL_24G)) { + } else if ((pDevice->byBBType == BB_TYPE_11A) && (pMgmt->uScanChannel <= CB_MAX_CHANNEL_24G)) { pDevice->byBBType = BB_TYPE_11G; CARDvSetBSSMode(pDevice); } @@ -544,8 +543,7 @@ void vRunCommand(struct work_struct *work) ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_INTER); pMgmt->sNodeDBTable[0].bActive = true; pMgmt->sNodeDBTable[0].uInActiveCount = 0; - } - else { + } else { // start own IBSS DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CreateOwn IBSS by CurrMode = IBSS_STA\n"); @@ -580,8 +578,7 @@ void vRunCommand(struct work_struct *work) } s_bClearBSSID_SCAN(pDevice); */ - } - else { + } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disconnect SSID none\n"); // if(pDevice->bWPASuppWextEnabled == true) { @@ -611,11 +608,9 @@ void vRunCommand(struct work_struct *work) spin_unlock_irq(&pDevice->lock); return; } - } - else if (pMgmt->eCurrState < WMAC_STATE_AUTHPENDING) { + } else if (pMgmt->eCurrState < WMAC_STATE_AUTHPENDING) { printk("WLAN_AUTHENTICATE_WAIT:Authen Fail???\n"); - } - else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if authenticated_frame delay! + } else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if authenticated_frame delay! pDevice->byLinkWaitCount++; printk("WLAN_AUTHENTICATE_WAIT:wait %d times!!\n", pDevice->byLinkWaitCount); spin_unlock_irq(&pDevice->lock); @@ -648,11 +643,9 @@ void vRunCommand(struct work_struct *work) if (netif_queue_stopped(pDevice->dev)) netif_wake_queue(pDevice->dev); - } - else if (pMgmt->eCurrState < WMAC_STATE_ASSOCPENDING) { + } else if (pMgmt->eCurrState < WMAC_STATE_ASSOCPENDING) { printk("WLAN_ASSOCIATE_WAIT:Association Fail???\n"); - } - else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if associated_frame delay! + } else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if associated_frame delay! pDevice->byLinkWaitCount++; printk("WLAN_ASSOCIATE_WAIT:wait %d times!!\n", pDevice->byLinkWaitCount); spin_unlock_irq(&pDevice->lock); @@ -706,8 +699,7 @@ void vRunCommand(struct work_struct *work) if (skb_queue_empty(&pMgmt->sNodeDBTable[0].sTxPSQueue)) { pMgmt->abyPSTxMap[0] &= ~byMask[0]; pDevice->bMoreData = false; - } - else { + } else { pDevice->bMoreData = true; } @@ -730,8 +722,7 @@ void vRunCommand(struct work_struct *work) pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[ii].wAID >> 3] &= ~byMask[pMgmt->sNodeDBTable[ii].wAID & 7]; pDevice->bMoreData = false; - } - else { + } else { pDevice->bMoreData = true; } @@ -946,8 +937,7 @@ static int s_bCommandComplete(struct vnt_private *pDevice) //Command Queue Empty pDevice->bCmdRunning = false; return true; - } - else { + } else { pDevice->eCommand = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].eCmd; pSSID = (PWLAN_IE_SSID)pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].abyCmdDesireSSID; bRadioCmd = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].bRadioCmd; From 015bdc262bfe21042af4d554459647c8d1f9b571 Mon Sep 17 00:00:00 2001 From: Nandini Hanumanthagowda Date: Tue, 12 Nov 2013 23:05:33 +0530 Subject: [PATCH 226/238] staging: vt6656: fixed unnecessary whitespace warning removed the "unnecessary whitespace before quoted new line" warning reported by checkpatch script Signed-off-by: Nandini Hanumanthagowda Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/wcmd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index a6681a2f7146..5f8175368c4f 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -197,9 +197,9 @@ static void s_vProbeChannel(struct vnt_private *pDevice) if (pTxPacket != NULL) { for (ii = 0; ii < 1; ii++) { if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request sending fail.. \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request sending fail..\n"); } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request is sending.. \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request is sending..\n"); } } } @@ -319,7 +319,7 @@ void vRunCommand(struct work_struct *work) } else { if (!ChannelValid(pDevice->byZoneType, pMgmt->uScanChannel)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Invalid channel pMgmt->uScanChannel = %d \n", pMgmt->uScanChannel); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Invalid channel pMgmt->uScanChannel = %d\n", pMgmt->uScanChannel); pMgmt->uScanChannel++; s_bCommandComplete(pDevice); spin_unlock_irq(&pDevice->lock); @@ -704,7 +704,7 @@ void vRunCommand(struct work_struct *work) } if (nsDMA_tx_packet(pDevice, TYPE_AC0DMA, skb) != 0) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Multicast ps tx fail \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Multicast ps tx fail\n"); pMgmt->sNodeDBTable[0].wEnQueueCnt--; } @@ -727,7 +727,7 @@ void vRunCommand(struct work_struct *work) } if (nsDMA_tx_packet(pDevice, TYPE_AC0DMA, skb) != 0) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "sta ps tx fail \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "sta ps tx fail\n"); pMgmt->sNodeDBTable[ii].wEnQueueCnt--; // check if sta ps enable, wait next pspoll @@ -739,7 +739,7 @@ void vRunCommand(struct work_struct *work) // clear tx map pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[ii].wAID >> 3] &= ~byMask[pMgmt->sNodeDBTable[ii].wAID & 7]; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d PS queue clear \n", ii); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d PS queue clear\n", ii); } pMgmt->sNodeDBTable[ii].bRxPSPoll = false; } From faaf9c195e162ec6c0d8c2247e06da4277dad80b Mon Sep 17 00:00:00 2001 From: Nandini Hanumanthagowda Date: Tue, 12 Nov 2013 23:05:34 +0530 Subject: [PATCH 227/238] staging: vt6656: fixed the switch case indentation level error aligned the case statements of 'switch' so that the switch and case are on same indentation level to fix the following error. ERROR: switch and case should be at the same indent Signed-off-by: Nandini Hanumanthagowda Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/wcmd.c | 78 +++++++++++++++++------------------ 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index 5f8175368c4f..c07737769e3b 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -292,7 +292,7 @@ void vRunCommand(struct work_struct *work) switch (pDevice->eCommandState) { - case WLAN_CMD_SCAN_START: + case WLAN_CMD_SCAN_START: pDevice->byReAssocCount = 0; if (pDevice->bRadioOff == true) { @@ -392,7 +392,7 @@ void vRunCommand(struct work_struct *work) break; - case WLAN_CMD_SCAN_END: + case WLAN_CMD_SCAN_END: // Set Baseband's sensitivity back. if (pDevice->byBBType != pDevice->byScanBBType) { @@ -428,7 +428,7 @@ void vRunCommand(struct work_struct *work) s_bCommandComplete(pDevice); break; - case WLAN_CMD_DISASSOCIATE_START: + case WLAN_CMD_DISASSOCIATE_START: pDevice->byReAssocCount = 0; if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState != WMAC_STATE_ASSOC)) { @@ -467,7 +467,7 @@ void vRunCommand(struct work_struct *work) s_bCommandComplete(pDevice); break; - case WLAN_CMD_SSID_START: + case WLAN_CMD_SSID_START: pDevice->byReAssocCount = 0; if (pDevice->bRadioOff == true) { @@ -593,7 +593,7 @@ void vRunCommand(struct work_struct *work) s_bCommandComplete(pDevice); break; - case WLAN_AUTHENTICATE_WAIT: + case WLAN_AUTHENTICATE_WAIT: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_AUTHENTICATE_WAIT\n"); if (pMgmt->eCurrState == WMAC_STATE_AUTH) { pDevice->byLinkWaitCount = 0; @@ -622,7 +622,7 @@ void vRunCommand(struct work_struct *work) s_bCommandComplete(pDevice); break; - case WLAN_ASSOCIATE_WAIT: + case WLAN_ASSOCIATE_WAIT: if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCurrState == WMAC_STATE_ASSOC\n"); if (pDevice->ePSMode != WMAC_POWER_CAM) { @@ -656,7 +656,7 @@ void vRunCommand(struct work_struct *work) s_bCommandComplete(pDevice); break; - case WLAN_CMD_AP_MODE_START: + case WLAN_CMD_AP_MODE_START: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_AP_MODE_START\n"); if (pMgmt->eConfigMode == WMAC_CONFIG_AP) { @@ -692,7 +692,7 @@ void vRunCommand(struct work_struct *work) s_bCommandComplete(pDevice); break; - case WLAN_CMD_TX_PSPACKET_START: + case WLAN_CMD_TX_PSPACKET_START: // DTIM Multicast tx if (pMgmt->sNodeDBTable[0].bRxPSPoll) { while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[0].sTxPSQueue)) != NULL) { @@ -748,7 +748,7 @@ void vRunCommand(struct work_struct *work) s_bCommandComplete(pDevice); break; - case WLAN_CMD_RADIO_START: + case WLAN_CMD_RADIO_START: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_RADIO_START\n"); // if (pDevice->bRadioCmd == true) @@ -843,7 +843,7 @@ void vRunCommand(struct work_struct *work) s_bCommandComplete(pDevice); break; - case WLAN_CMD_CHANGE_BBSENSITIVITY_START: + case WLAN_CMD_CHANGE_BBSENSITIVITY_START: pDevice->bStopDataPkt = true; pDevice->byBBVGACurrent = pDevice->byBBVGANew; @@ -853,24 +853,24 @@ void vRunCommand(struct work_struct *work) s_bCommandComplete(pDevice); break; - case WLAN_CMD_TBTT_WAKEUP_START: + case WLAN_CMD_TBTT_WAKEUP_START: PSbIsNextTBTTWakeUp(pDevice); s_bCommandComplete(pDevice); break; - case WLAN_CMD_BECON_SEND_START: + case WLAN_CMD_BECON_SEND_START: bMgrPrepareBeaconToSend(pDevice, pMgmt); s_bCommandComplete(pDevice); break; - case WLAN_CMD_SETPOWER_START: + case WLAN_CMD_SETPOWER_START: RFbSetPower(pDevice, pDevice->wCurrentRate, pMgmt->uCurrChannel); s_bCommandComplete(pDevice); break; - case WLAN_CMD_CHANGE_ANTENNA_START: + case WLAN_CMD_CHANGE_ANTENNA_START: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Change from Antenna%d to", (int)pDevice->dwRxAntennaSel); if (pDevice->dwRxAntennaSel == 0) { pDevice->dwRxAntennaSel = 1; @@ -888,12 +888,12 @@ void vRunCommand(struct work_struct *work) s_bCommandComplete(pDevice); break; - case WLAN_CMD_REMOVE_ALLKEY_START: + case WLAN_CMD_REMOVE_ALLKEY_START: KeybRemoveAllKey(pDevice, &(pDevice->sKey), pDevice->abyBSSID); s_bCommandComplete(pDevice); break; - case WLAN_CMD_MAC_DISPOWERSAVING_START: + case WLAN_CMD_MAC_DISPOWERSAVING_START: ControlvReadByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PSCTL, &byData); if ((byData & PSCTL_PS) != 0) { // disable power saving hw function @@ -908,7 +908,7 @@ void vRunCommand(struct work_struct *work) s_bCommandComplete(pDevice); break; - case WLAN_CMD_11H_CHSW_START: + case WLAN_CMD_11H_CHSW_START: CARDbSetMediaChannel(pDevice, pDevice->byNewChannel); pDevice->bChannelSwitch = false; pMgmt->uCurrChannel = pDevice->byNewChannel; @@ -916,7 +916,7 @@ void vRunCommand(struct work_struct *work) s_bCommandComplete(pDevice); break; - default: + default: s_bCommandComplete(pDevice); break; } //switch @@ -946,7 +946,7 @@ static int s_bCommandComplete(struct vnt_private *pDevice) pDevice->cbFreeCmdQueue++; pDevice->bCmdRunning = true; switch (pDevice->eCommand) { - case WLAN_CMD_BSSID_SCAN: + case WLAN_CMD_BSSID_SCAN: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_BSSID_SCAN\n"); pDevice->eCommandState = WLAN_CMD_SCAN_START; pMgmt->uScanChannel = 0; @@ -963,7 +963,7 @@ static int s_bCommandComplete(struct vnt_private *pDevice) } */ break; - case WLAN_CMD_SSID: + case WLAN_CMD_SSID: pDevice->eCommandState = WLAN_CMD_SSID_START; if (pSSID->len > WLAN_SSID_MAXLEN) pSSID->len = WLAN_SSID_MAXLEN; @@ -971,52 +971,52 @@ static int s_bCommandComplete(struct vnt_private *pDevice) memcpy(pMgmt->abyDesireSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_SSID_START\n"); break; - case WLAN_CMD_DISASSOCIATE: + case WLAN_CMD_DISASSOCIATE: pDevice->eCommandState = WLAN_CMD_DISASSOCIATE_START; break; - case WLAN_CMD_RX_PSPOLL: + case WLAN_CMD_RX_PSPOLL: pDevice->eCommandState = WLAN_CMD_TX_PSPACKET_START; break; - case WLAN_CMD_RUN_AP: + case WLAN_CMD_RUN_AP: pDevice->eCommandState = WLAN_CMD_AP_MODE_START; break; - case WLAN_CMD_RADIO: + case WLAN_CMD_RADIO: pDevice->eCommandState = WLAN_CMD_RADIO_START; pDevice->bRadioCmd = bRadioCmd; break; - case WLAN_CMD_CHANGE_BBSENSITIVITY: + case WLAN_CMD_CHANGE_BBSENSITIVITY: pDevice->eCommandState = WLAN_CMD_CHANGE_BBSENSITIVITY_START; break; - case WLAN_CMD_TBTT_WAKEUP: + case WLAN_CMD_TBTT_WAKEUP: pDevice->eCommandState = WLAN_CMD_TBTT_WAKEUP_START; break; - case WLAN_CMD_BECON_SEND: + case WLAN_CMD_BECON_SEND: pDevice->eCommandState = WLAN_CMD_BECON_SEND_START; break; - case WLAN_CMD_SETPOWER: + case WLAN_CMD_SETPOWER: pDevice->eCommandState = WLAN_CMD_SETPOWER_START; break; - case WLAN_CMD_CHANGE_ANTENNA: + case WLAN_CMD_CHANGE_ANTENNA: pDevice->eCommandState = WLAN_CMD_CHANGE_ANTENNA_START; break; - case WLAN_CMD_REMOVE_ALLKEY: + case WLAN_CMD_REMOVE_ALLKEY: pDevice->eCommandState = WLAN_CMD_REMOVE_ALLKEY_START; break; - case WLAN_CMD_MAC_DISPOWERSAVING: + case WLAN_CMD_MAC_DISPOWERSAVING: pDevice->eCommandState = WLAN_CMD_MAC_DISPOWERSAVING_START; break; - case WLAN_CMD_11H_CHSW: + case WLAN_CMD_11H_CHSW: pDevice->eCommandState = WLAN_CMD_11H_CHSW_START; break; - default: + default: break; } @@ -1037,31 +1037,31 @@ int bScheduleCommand(struct vnt_private *pDevice, memset(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, 0 , WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); if (pbyItem0 != NULL) { switch (eCommand) { - case WLAN_CMD_BSSID_SCAN: + case WLAN_CMD_BSSID_SCAN: pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = false; memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); break; - case WLAN_CMD_SSID: + case WLAN_CMD_SSID: memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); break; - case WLAN_CMD_DISASSOCIATE: + case WLAN_CMD_DISASSOCIATE: pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bNeedRadioOFF = *((int *)pbyItem0); break; /* - case WLAN_CMD_DEAUTH: + case WLAN_CMD_DEAUTH: pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].wDeAuthenReason = *((u16 *)pbyItem0); break; */ - case WLAN_CMD_RADIO: + case WLAN_CMD_RADIO: pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bRadioCmd = *((int *)pbyItem0); break; - default: + default: break; } } From cab086d37a8e024717fcd1d666999a05e0430588 Mon Sep 17 00:00:00 2001 From: Nandini Hanumanthagowda Date: Tue, 12 Nov 2013 23:05:35 +0530 Subject: [PATCH 228/238] staging: vt6656: indented all if-else statement blocks indented all if-else statement blocks to remove checkpatch warnings and errors like indent code wherever possible and no spaces at the start of line Signed-off-by: Nandini Hanumanthagowda Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/wcmd.c | 1216 ++++++++++++++++----------------- 1 file changed, 604 insertions(+), 612 deletions(-) diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index c07737769e3b..a53a15a60b4e 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -99,21 +99,21 @@ static void vAdHocBeaconStop(struct vnt_private *pDevice) * (3.2) AdHoc channel is in A mode */ bStop = false; - if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && - (pMgmt->eCurrState >= WMAC_STATE_STARTED)) { - if ((pMgmt->uIBSSChannel <= CB_MAX_CHANNEL_24G) && - (pMgmt->uScanChannel > CB_MAX_CHANNEL_24G)) { - bStop = true; - } - if (pMgmt->uIBSSChannel > CB_MAX_CHANNEL_24G) - bStop = true; - } + if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && + (pMgmt->eCurrState >= WMAC_STATE_STARTED)) { + if ((pMgmt->uIBSSChannel <= CB_MAX_CHANNEL_24G) && + (pMgmt->uScanChannel > CB_MAX_CHANNEL_24G)) { + bStop = true; + } + if (pMgmt->uIBSSChannel > CB_MAX_CHANNEL_24G) + bStop = true; + } - if (bStop) { - //PMESG(("STOP_BEACON: IBSSChannel = %u, ScanChannel = %u\n", - // pMgmt->uIBSSChannel, pMgmt->uScanChannel)); - MACvRegBitsOff(pDevice, MAC_REG_TCR, TCR_AUTOBCNTX); - } + if (bStop) { + //PMESG(("STOP_BEACON: IBSSChannel = %u, ScanChannel = %u\n", + // pMgmt->uIBSSChannel, pMgmt->uScanChannel)); + MACvRegBitsOff(pDevice, MAC_REG_TCR, TCR_AUTOBCNTX); + } } /* vAdHocBeaconStop */ @@ -140,11 +140,11 @@ static void vAdHocBeaconRestart(struct vnt_private *pDevice) * (1) STA is in AdHoc mode * (2) VT3253 is programmed as automatic Beacon Transmitting */ - if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && - (pMgmt->eCurrState >= WMAC_STATE_STARTED)) { - //PMESG(("RESTART_BEACON\n")); - MACvRegBitsOn(pDevice, MAC_REG_TCR, TCR_AUTOBCNTX); - } + if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && + (pMgmt->eCurrState >= WMAC_STATE_STARTED)) { + //PMESG(("RESTART_BEACON\n")); + MACvRegBitsOn(pDevice, MAC_REG_TCR, TCR_AUTOBCNTX); + } } @@ -194,15 +194,15 @@ static void s_vProbeChannel(struct vnt_private *pDevice) (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRatesG ); - if (pTxPacket != NULL) { - for (ii = 0; ii < 1; ii++) { - if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request sending fail..\n"); - } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request is sending..\n"); - } - } - } + if (pTxPacket != NULL) { + for (ii = 0; ii < 1; ii++) { + if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request sending fail..\n"); + } else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request is sending..\n"); + } + } + } } @@ -248,11 +248,11 @@ static struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *pDevice, sFrame.len += pCurrRates->len + WLAN_IEHDR_LEN; memcpy(sFrame.pSuppRates, pCurrRates, pCurrRates->len + WLAN_IEHDR_LEN); // Copy the extension rate set - if (pDevice->byBBType == BB_TYPE_11G) { - sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); - sFrame.len += pCurrExtSuppRates->len + WLAN_IEHDR_LEN; - memcpy(sFrame.pExtSuppRates, pCurrExtSuppRates, pCurrExtSuppRates->len + WLAN_IEHDR_LEN); - } + if (pDevice->byBBType == BB_TYPE_11G) { + sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); + sFrame.len += pCurrExtSuppRates->len + WLAN_IEHDR_LEN; + memcpy(sFrame.pExtSuppRates, pCurrExtSuppRates, pCurrExtSuppRates->len + WLAN_IEHDR_LEN); + } pTxPacket->cbMPDULen = sFrame.len; pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; @@ -283,10 +283,10 @@ void vRunCommand(struct work_struct *work) if (pDevice->Flags & fMP_DISCONNECTED) return; - if (pDevice->dwDiagRefCount != 0) - return; - if (pDevice->bCmdRunning != true) - return; + if (pDevice->dwDiagRefCount != 0) + return; + if (pDevice->bCmdRunning != true) + return; spin_lock_irq(&pDevice->lock); @@ -295,126 +295,123 @@ void vRunCommand(struct work_struct *work) case WLAN_CMD_SCAN_START: pDevice->byReAssocCount = 0; - if (pDevice->bRadioOff == true) { - s_bCommandComplete(pDevice); - spin_unlock_irq(&pDevice->lock); - return; - } + if (pDevice->bRadioOff == true) { + s_bCommandComplete(pDevice); + spin_unlock_irq(&pDevice->lock); + return; + } - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { - s_bCommandComplete(pDevice); - spin_unlock_irq(&pDevice->lock); - return; - } + if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { + s_bCommandComplete(pDevice); + spin_unlock_irq(&pDevice->lock); + return; + } pItemSSID = (PWLAN_IE_SSID)pMgmt->abyScanSSID; - if (pMgmt->uScanChannel == 0) - pMgmt->uScanChannel = pDevice->byMinChannel; - if (pMgmt->uScanChannel > pDevice->byMaxChannel) { - pDevice->eCommandState = WLAN_CMD_SCAN_END; - s_bCommandComplete(pDevice); - spin_unlock_irq(&pDevice->lock); - return; + if (pMgmt->uScanChannel == 0) + pMgmt->uScanChannel = pDevice->byMinChannel; + if (pMgmt->uScanChannel > pDevice->byMaxChannel) { + pDevice->eCommandState = WLAN_CMD_SCAN_END; + s_bCommandComplete(pDevice); + spin_unlock_irq(&pDevice->lock); + return; + } else { + if (!ChannelValid(pDevice->byZoneType, pMgmt->uScanChannel)) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Invalid channel pMgmt->uScanChannel = %d\n", pMgmt->uScanChannel); + pMgmt->uScanChannel++; + s_bCommandComplete(pDevice); + spin_unlock_irq(&pDevice->lock); + return; + } + if (pMgmt->uScanChannel == pDevice->byMinChannel) { + // pMgmt->eScanType = WMAC_SCAN_ACTIVE; //mike mark + pMgmt->abyScanBSSID[0] = 0xFF; + pMgmt->abyScanBSSID[1] = 0xFF; + pMgmt->abyScanBSSID[2] = 0xFF; + pMgmt->abyScanBSSID[3] = 0xFF; + pMgmt->abyScanBSSID[4] = 0xFF; + pMgmt->abyScanBSSID[5] = 0xFF; + pItemSSID->byElementID = WLAN_EID_SSID; + // clear bssid list + /* BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass); */ + pMgmt->eScanState = WMAC_IS_SCANNING; + pDevice->byScanBBType = pDevice->byBBType; //lucas + pDevice->bStopDataPkt = true; + // Turn off RCR_BSSID filter every time + MACvRegBitsOff(pDevice, MAC_REG_RCR, RCR_BSSID); + pDevice->byRxMode &= ~RCR_BSSID; + } + //lucas + vAdHocBeaconStop(pDevice); + if ((pDevice->byBBType != BB_TYPE_11A) && + (pMgmt->uScanChannel > CB_MAX_CHANNEL_24G)) { + pDevice->byBBType = BB_TYPE_11A; + CARDvSetBSSMode(pDevice); + } else if ((pDevice->byBBType == BB_TYPE_11A) && + (pMgmt->uScanChannel <= CB_MAX_CHANNEL_24G)) { + pDevice->byBBType = BB_TYPE_11G; + CARDvSetBSSMode(pDevice); + } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning.... channel: [%d]\n", pMgmt->uScanChannel); + // Set channel + CARDbSetMediaChannel(pDevice, pMgmt->uScanChannel); + // Set Baseband to be more sensitive. - } else { - if (!ChannelValid(pDevice->byZoneType, pMgmt->uScanChannel)) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Invalid channel pMgmt->uScanChannel = %d\n", pMgmt->uScanChannel); + if (pDevice->bUpdateBBVGA) { + BBvSetShortSlotTime(pDevice); + BBvSetVGAGainOffset(pDevice, pDevice->abyBBVGA[0]); + BBvUpdatePreEDThreshold(pDevice, true); + } pMgmt->uScanChannel++; - s_bCommandComplete(pDevice); - spin_unlock_irq(&pDevice->lock); - return; - } - if (pMgmt->uScanChannel == pDevice->byMinChannel) { - // pMgmt->eScanType = WMAC_SCAN_ACTIVE; //mike mark - pMgmt->abyScanBSSID[0] = 0xFF; - pMgmt->abyScanBSSID[1] = 0xFF; - pMgmt->abyScanBSSID[2] = 0xFF; - pMgmt->abyScanBSSID[3] = 0xFF; - pMgmt->abyScanBSSID[4] = 0xFF; - pMgmt->abyScanBSSID[5] = 0xFF; - pItemSSID->byElementID = WLAN_EID_SSID; - // clear bssid list - /* BSSvClearBSSList((void *) pDevice, - pDevice->bLinkPass); */ - pMgmt->eScanState = WMAC_IS_SCANNING; - pDevice->byScanBBType = pDevice->byBBType; //lucas - pDevice->bStopDataPkt = true; - // Turn off RCR_BSSID filter every time - MACvRegBitsOff(pDevice, MAC_REG_RCR, RCR_BSSID); - pDevice->byRxMode &= ~RCR_BSSID; - } - //lucas - vAdHocBeaconStop(pDevice); - if ((pDevice->byBBType != BB_TYPE_11A) && (pMgmt->uScanChannel > CB_MAX_CHANNEL_24G)) { - pDevice->byBBType = BB_TYPE_11A; - CARDvSetBSSMode(pDevice); - } else if ((pDevice->byBBType == BB_TYPE_11A) && (pMgmt->uScanChannel <= CB_MAX_CHANNEL_24G)) { - pDevice->byBBType = BB_TYPE_11G; - CARDvSetBSSMode(pDevice); - } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning.... channel: [%d]\n", pMgmt->uScanChannel); - // Set channel - CARDbSetMediaChannel(pDevice, pMgmt->uScanChannel); - // Set Baseband to be more sensitive. + while (!ChannelValid(pDevice->byZoneType, pMgmt->uScanChannel) && + pMgmt->uScanChannel <= pDevice->byMaxChannel){ + pMgmt->uScanChannel++; + } - if (pDevice->bUpdateBBVGA) { - BBvSetShortSlotTime(pDevice); - BBvSetVGAGainOffset(pDevice, pDevice->abyBBVGA[0]); - BBvUpdatePreEDThreshold(pDevice, true); - } - pMgmt->uScanChannel++; - - while (!ChannelValid(pDevice->byZoneType, pMgmt->uScanChannel) && - pMgmt->uScanChannel <= pDevice->byMaxChannel){ - pMgmt->uScanChannel++; - } - - if (pMgmt->uScanChannel > pDevice->byMaxChannel) { - // Set Baseband to be not sensitive and rescan - pDevice->eCommandState = WLAN_CMD_SCAN_END; - - } - if ((pMgmt->b11hEnable == false) || - (pMgmt->uScanChannel < CB_MAX_CHANNEL_24G)) { - s_vProbeChannel(pDevice); - spin_unlock_irq(&pDevice->lock); - vCommandTimerWait((void *) pDevice, 100); - return; - } else { - spin_unlock_irq(&pDevice->lock); - vCommandTimerWait((void *) pDevice, WCMD_PASSIVE_SCAN_TIME); - return; - } - - } + if (pMgmt->uScanChannel > pDevice->byMaxChannel) { + // Set Baseband to be not sensitive and rescan + pDevice->eCommandState = WLAN_CMD_SCAN_END; + } + if ((pMgmt->b11hEnable == false) || + (pMgmt->uScanChannel < CB_MAX_CHANNEL_24G)) { + s_vProbeChannel(pDevice); + spin_unlock_irq(&pDevice->lock); + vCommandTimerWait((void *) pDevice, 100); + return; + } else { + spin_unlock_irq(&pDevice->lock); + vCommandTimerWait((void *) pDevice, WCMD_PASSIVE_SCAN_TIME); + return; + } + } break; case WLAN_CMD_SCAN_END: // Set Baseband's sensitivity back. - if (pDevice->byBBType != pDevice->byScanBBType) { - pDevice->byBBType = pDevice->byScanBBType; - CARDvSetBSSMode(pDevice); - } + if (pDevice->byBBType != pDevice->byScanBBType) { + pDevice->byBBType = pDevice->byScanBBType; + CARDvSetBSSMode(pDevice); + } - if (pDevice->bUpdateBBVGA) { - BBvSetShortSlotTime(pDevice); - BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent); - BBvUpdatePreEDThreshold(pDevice, false); - } + if (pDevice->bUpdateBBVGA) { + BBvSetShortSlotTime(pDevice); + BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent); + BBvUpdatePreEDThreshold(pDevice, false); + } // Set channel back vAdHocBeaconRestart(pDevice); // Set channel back CARDbSetMediaChannel(pDevice, pMgmt->uCurrChannel); // Set Filter - if (pMgmt->bCurrBSSIDFilterOn) { - MACvRegBitsOn(pDevice, MAC_REG_RCR, RCR_BSSID); - pDevice->byRxMode |= RCR_BSSID; - } + if (pMgmt->bCurrBSSIDFilterOn) { + MACvRegBitsOn(pDevice, MAC_REG_RCR, RCR_BSSID); + pDevice->byRxMode |= RCR_BSSID; + } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel); pMgmt->uScanChannel = 0; pMgmt->eScanState = WMAC_NO_SCANNING; @@ -430,37 +427,36 @@ void vRunCommand(struct work_struct *work) case WLAN_CMD_DISASSOCIATE_START: pDevice->byReAssocCount = 0; - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && - (pMgmt->eCurrState != WMAC_STATE_ASSOC)) { - s_bCommandComplete(pDevice); - spin_unlock_irq(&pDevice->lock); - return; - } else { + if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && + (pMgmt->eCurrState != WMAC_STATE_ASSOC)) { + s_bCommandComplete(pDevice); + spin_unlock_irq(&pDevice->lock); + return; + } else { + pDevice->bwextstep0 = false; + pDevice->bwextstep1 = false; + pDevice->bwextstep2 = false; + pDevice->bwextstep3 = false; + pDevice->bWPASuppWextEnabled = false; + pDevice->fWPA_Authened = false; - pDevice->bwextstep0 = false; - pDevice->bwextstep1 = false; - pDevice->bwextstep2 = false; - pDevice->bwextstep3 = false; - pDevice->bWPASuppWextEnabled = false; - pDevice->fWPA_Authened = false; - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Send Disassociation Packet..\n"); - // reason = 8 : disassoc because sta has left - vMgrDisassocBeginSta((void *) pDevice, - pMgmt, - pMgmt->abyCurrBSSID, - (8), - &Status); - pDevice->bLinkPass = false; - ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW); - // unlock command busy - pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; - pItemSSID->len = 0; - memset(pItemSSID->abySSID, 0, WLAN_SSID_MAXLEN); - pMgmt->eCurrState = WMAC_STATE_IDLE; - pMgmt->sNodeDBTable[0].bActive = false; -// pDevice->bBeaconBufReady = false; - } + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Send Disassociation Packet..\n"); + // reason = 8 : disassoc because sta has left + vMgrDisassocBeginSta((void *) pDevice, + pMgmt, + pMgmt->abyCurrBSSID, + (8), + &Status); + pDevice->bLinkPass = false; + ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW); + // unlock command busy + pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; + pItemSSID->len = 0; + memset(pItemSSID->abySSID, 0, WLAN_SSID_MAXLEN); + pMgmt->eCurrState = WMAC_STATE_IDLE; + pMgmt->sNodeDBTable[0].bActive = false; +// pDevice->bBeaconBufReady = false; + } netif_stop_queue(pDevice->dev); if (pDevice->bNeedRadioOFF == true) CARDbRadioPowerOff(pDevice); @@ -470,11 +466,11 @@ void vRunCommand(struct work_struct *work) case WLAN_CMD_SSID_START: pDevice->byReAssocCount = 0; - if (pDevice->bRadioOff == true) { - s_bCommandComplete(pDevice); - spin_unlock_irq(&pDevice->lock); - return; - } + if (pDevice->bRadioOff == true) { + s_bCommandComplete(pDevice); + spin_unlock_irq(&pDevice->lock); + return; + } memcpy(pMgmt->abyAdHocSSID, pMgmt->abyDesireSSID, ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len + WLAN_IEHDR_LEN); @@ -484,28 +480,27 @@ void vRunCommand(struct work_struct *work) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" cmd: desire ssid = %s\n", pItemSSID->abySSID); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" cmd: curr ssid = %s\n", pItemSSIDCurr->abySSID); - if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Cmd pMgmt->eCurrState == WMAC_STATE_ASSOC\n"); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pItemSSID->len =%d\n", pItemSSID->len); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pItemSSIDCurr->len = %d\n", pItemSSIDCurr->len); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" desire ssid = %s\n", pItemSSID->abySSID); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" curr ssid = %s\n", pItemSSIDCurr->abySSID); - } + if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Cmd pMgmt->eCurrState == WMAC_STATE_ASSOC\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pItemSSID->len =%d\n", pItemSSID->len); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pItemSSIDCurr->len = %d\n", pItemSSIDCurr->len); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" desire ssid = %s\n", pItemSSID->abySSID); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" curr ssid = %s\n", pItemSSIDCurr->abySSID); + } - if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) || - ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) { - - if (pItemSSID->len == pItemSSIDCurr->len) { - if (memcmp(pItemSSID->abySSID, pItemSSIDCurr->abySSID, pItemSSID->len) == 0) { - s_bCommandComplete(pDevice); - spin_unlock_irq(&pDevice->lock); - return; - } - } - netif_stop_queue(pDevice->dev); - pDevice->bLinkPass = false; - ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW); - } + if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) || + ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) { + if (pItemSSID->len == pItemSSIDCurr->len) { + if (memcmp(pItemSSID->abySSID, pItemSSIDCurr->abySSID, pItemSSID->len) == 0) { + s_bCommandComplete(pDevice); + spin_unlock_irq(&pDevice->lock); + return; + } + } + netif_stop_queue(pDevice->dev); + pDevice->bLinkPass = false; + ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW); + } // set initial state pMgmt->eCurrState = WMAC_STATE_IDLE; pMgmt->eCurrMode = WMAC_MODE_STANDBY; @@ -513,145 +508,144 @@ void vRunCommand(struct work_struct *work) BSSvClearNodeDBTable(pDevice, 0); vMgrJoinBSSBegin((void *) pDevice, &Status); // if Infra mode - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED)) { - // Call mgr to begin the deauthentication - // reason = (3) because sta has left ESS - if (pMgmt->eCurrState >= WMAC_STATE_AUTH) { - vMgrDeAuthenBeginSta((void *)pDevice, - pMgmt, - pMgmt->abyCurrBSSID, - (3), - &Status); - } - // Call mgr to begin the authentication - vMgrAuthenBeginSta((void *) pDevice, pMgmt, &Status); - if (Status == CMD_STATUS_SUCCESS) { - pDevice->byLinkWaitCount = 0; - pDevice->eCommandState = WLAN_AUTHENTICATE_WAIT; - vCommandTimerWait((void *) pDevice, AUTHENTICATE_TIMEOUT); - spin_unlock_irq(&pDevice->lock); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Set eCommandState = WLAN_AUTHENTICATE_WAIT\n"); - return; - } - } - // if Adhoc mode - else if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { - if (pMgmt->eCurrState == WMAC_STATE_JOINTED) { - if (netif_queue_stopped(pDevice->dev)) - netif_wake_queue(pDevice->dev); - pDevice->bLinkPass = true; - ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_INTER); - pMgmt->sNodeDBTable[0].bActive = true; - pMgmt->sNodeDBTable[0].uInActiveCount = 0; - } else { - // start own IBSS - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "CreateOwn IBSS by CurrMode = IBSS_STA\n"); - vMgrCreateOwnIBSS((void *) pDevice, &Status); - if (Status != CMD_STATUS_SUCCESS) { - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "WLAN_CMD_IBSS_CREATE fail!\n"); - } - BSSvAddMulticastNode(pDevice); - } - s_bClearBSSID_SCAN(pDevice); - } - // if SSID not found - else if (pMgmt->eCurrMode == WMAC_MODE_STANDBY) { - if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA || - pMgmt->eConfigMode == WMAC_CONFIG_AUTO) { - // start own IBSS - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "CreateOwn IBSS by CurrMode = STANDBY\n"); - vMgrCreateOwnIBSS((void *) pDevice, &Status); - if (Status != CMD_STATUS_SUCCESS) { - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "WLAN_CMD_IBSS_CREATE fail!\n"); - } - BSSvAddMulticastNode(pDevice); - s_bClearBSSID_SCAN(pDevice); + if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED)) { + // Call mgr to begin the deauthentication + // reason = (3) because sta has left ESS + if (pMgmt->eCurrState >= WMAC_STATE_AUTH) { + vMgrDeAuthenBeginSta((void *)pDevice, + pMgmt, + pMgmt->abyCurrBSSID, + (3), + &Status); + } + // Call mgr to begin the authentication + vMgrAuthenBeginSta((void *) pDevice, pMgmt, &Status); + if (Status == CMD_STATUS_SUCCESS) { + pDevice->byLinkWaitCount = 0; + pDevice->eCommandState = WLAN_AUTHENTICATE_WAIT; + vCommandTimerWait((void *) pDevice, AUTHENTICATE_TIMEOUT); + spin_unlock_irq(&pDevice->lock); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Set eCommandState = WLAN_AUTHENTICATE_WAIT\n"); + return; + } + } + // if Adhoc mode + else if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { + if (pMgmt->eCurrState == WMAC_STATE_JOINTED) { + if (netif_queue_stopped(pDevice->dev)) + netif_wake_queue(pDevice->dev); + pDevice->bLinkPass = true; + ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_INTER); + pMgmt->sNodeDBTable[0].bActive = true; + pMgmt->sNodeDBTable[0].uInActiveCount = 0; + } else { + // start own IBSS + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CreateOwn IBSS by CurrMode = IBSS_STA\n"); + vMgrCreateOwnIBSS((void *) pDevice, &Status); + if (Status != CMD_STATUS_SUCCESS) { + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "WLAN_CMD_IBSS_CREATE fail!\n"); + } + BSSvAddMulticastNode(pDevice); + } + s_bClearBSSID_SCAN(pDevice); + } + // if SSID not found + else if (pMgmt->eCurrMode == WMAC_MODE_STANDBY) { + if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA || + pMgmt->eConfigMode == WMAC_CONFIG_AUTO) { + // start own IBSS + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "CreateOwn IBSS by CurrMode = STANDBY\n"); + vMgrCreateOwnIBSS((void *) pDevice, &Status); + if (Status != CMD_STATUS_SUCCESS) { + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "WLAN_CMD_IBSS_CREATE fail!\n"); + } + BSSvAddMulticastNode(pDevice); + s_bClearBSSID_SCAN(pDevice); /* - pDevice->bLinkPass = true; - ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); - if (netif_queue_stopped(pDevice->dev)){ - netif_wake_queue(pDevice->dev); - } - s_bClearBSSID_SCAN(pDevice); + pDevice->bLinkPass = true; + ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); + if (netif_queue_stopped(pDevice->dev)){ + netif_wake_queue(pDevice->dev); + } + s_bClearBSSID_SCAN(pDevice); */ - } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disconnect SSID none\n"); - // if(pDevice->bWPASuppWextEnabled == true) - { - union iwreq_data wrqu; - memset(&wrqu, 0, sizeof(wrqu)); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated:vMgrJoinBSSBegin Fail !!)\n"); - wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); - } - } - } + } else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disconnect SSID none\n"); + // if(pDevice->bWPASuppWextEnabled == true) + { + union iwreq_data wrqu; + memset(&wrqu, 0, sizeof(wrqu)); + wrqu.ap_addr.sa_family = ARPHRD_ETHER; + PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated:vMgrJoinBSSBegin Fail !!)\n"); + wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); + } + } + } s_bCommandComplete(pDevice); break; case WLAN_AUTHENTICATE_WAIT: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_AUTHENTICATE_WAIT\n"); - if (pMgmt->eCurrState == WMAC_STATE_AUTH) { - pDevice->byLinkWaitCount = 0; - // Call mgr to begin the association - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCurrState == WMAC_STATE_AUTH\n"); - vMgrAssocBeginSta((void *) pDevice, pMgmt, &Status); - if (Status == CMD_STATUS_SUCCESS) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState = WLAN_ASSOCIATE_WAIT\n"); - pDevice->byLinkWaitCount = 0; - pDevice->eCommandState = WLAN_ASSOCIATE_WAIT; - vCommandTimerWait((void *) pDevice, ASSOCIATE_TIMEOUT); - spin_unlock_irq(&pDevice->lock); - return; - } - } else if (pMgmt->eCurrState < WMAC_STATE_AUTHPENDING) { - printk("WLAN_AUTHENTICATE_WAIT:Authen Fail???\n"); - } else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if authenticated_frame delay! - pDevice->byLinkWaitCount++; - printk("WLAN_AUTHENTICATE_WAIT:wait %d times!!\n", pDevice->byLinkWaitCount); - spin_unlock_irq(&pDevice->lock); - vCommandTimerWait((void *) pDevice, AUTHENTICATE_TIMEOUT/2); - return; - } + if (pMgmt->eCurrState == WMAC_STATE_AUTH) { + pDevice->byLinkWaitCount = 0; + // Call mgr to begin the association + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCurrState == WMAC_STATE_AUTH\n"); + vMgrAssocBeginSta((void *) pDevice, pMgmt, &Status); + if (Status == CMD_STATUS_SUCCESS) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState = WLAN_ASSOCIATE_WAIT\n"); + pDevice->byLinkWaitCount = 0; + pDevice->eCommandState = WLAN_ASSOCIATE_WAIT; + vCommandTimerWait((void *) pDevice, ASSOCIATE_TIMEOUT); + spin_unlock_irq(&pDevice->lock); + return; + } + } else if (pMgmt->eCurrState < WMAC_STATE_AUTHPENDING) { + printk("WLAN_AUTHENTICATE_WAIT:Authen Fail???\n"); + } else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if authenticated_frame delay! + pDevice->byLinkWaitCount++; + printk("WLAN_AUTHENTICATE_WAIT:wait %d times!!\n", pDevice->byLinkWaitCount); + spin_unlock_irq(&pDevice->lock); + vCommandTimerWait((void *) pDevice, AUTHENTICATE_TIMEOUT/2); + return; + } pDevice->byLinkWaitCount = 0; s_bCommandComplete(pDevice); break; case WLAN_ASSOCIATE_WAIT: - if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCurrState == WMAC_STATE_ASSOC\n"); - if (pDevice->ePSMode != WMAC_POWER_CAM) { - PSvEnablePowerSaving((void *) pDevice, - pMgmt->wListenInterval); - } + if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCurrState == WMAC_STATE_ASSOC\n"); + if (pDevice->ePSMode != WMAC_POWER_CAM) { + PSvEnablePowerSaving((void *) pDevice, + pMgmt->wListenInterval); + } /* - if (pMgmt->eAuthenMode >= WMAC_AUTH_WPA) { - KeybRemoveAllKey(pDevice, &(pDevice->sKey), pDevice->abyBSSID); - } + if (pMgmt->eAuthenMode >= WMAC_AUTH_WPA) { + KeybRemoveAllKey(pDevice, &(pDevice->sKey), pDevice->abyBSSID); + } */ - pDevice->byLinkWaitCount = 0; - pDevice->byReAssocCount = 0; - pDevice->bLinkPass = true; - ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_INTER); - s_bClearBSSID_SCAN(pDevice); + pDevice->byLinkWaitCount = 0; + pDevice->byReAssocCount = 0; + pDevice->bLinkPass = true; + ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_INTER); + s_bClearBSSID_SCAN(pDevice); - if (netif_queue_stopped(pDevice->dev)) - netif_wake_queue(pDevice->dev); + if (netif_queue_stopped(pDevice->dev)) + netif_wake_queue(pDevice->dev); - } else if (pMgmt->eCurrState < WMAC_STATE_ASSOCPENDING) { - printk("WLAN_ASSOCIATE_WAIT:Association Fail???\n"); - } else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if associated_frame delay! - pDevice->byLinkWaitCount++; - printk("WLAN_ASSOCIATE_WAIT:wait %d times!!\n", pDevice->byLinkWaitCount); - spin_unlock_irq(&pDevice->lock); - vCommandTimerWait((void *) pDevice, ASSOCIATE_TIMEOUT/2); - return; - } + } else if (pMgmt->eCurrState < WMAC_STATE_ASSOCPENDING) { + printk("WLAN_ASSOCIATE_WAIT:Association Fail???\n"); + } else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if associated_frame delay! + pDevice->byLinkWaitCount++; + printk("WLAN_ASSOCIATE_WAIT:wait %d times!!\n", pDevice->byLinkWaitCount); + spin_unlock_irq(&pDevice->lock); + vCommandTimerWait((void *) pDevice, ASSOCIATE_TIMEOUT/2); + return; + } s_bCommandComplete(pDevice); break; @@ -659,91 +653,91 @@ void vRunCommand(struct work_struct *work) case WLAN_CMD_AP_MODE_START: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_AP_MODE_START\n"); - if (pMgmt->eConfigMode == WMAC_CONFIG_AP) { - cancel_delayed_work_sync(&pDevice->second_callback_work); - pMgmt->eCurrState = WMAC_STATE_IDLE; - pMgmt->eCurrMode = WMAC_MODE_STANDBY; - pDevice->bLinkPass = false; - ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW); - if (pDevice->bEnableHostWEP == true) - BSSvClearNodeDBTable(pDevice, 1); - else - BSSvClearNodeDBTable(pDevice, 0); - pDevice->uAssocCount = 0; - pMgmt->eCurrState = WMAC_STATE_IDLE; - pDevice->bFixRate = false; + if (pMgmt->eConfigMode == WMAC_CONFIG_AP) { + cancel_delayed_work_sync(&pDevice->second_callback_work); + pMgmt->eCurrState = WMAC_STATE_IDLE; + pMgmt->eCurrMode = WMAC_MODE_STANDBY; + pDevice->bLinkPass = false; + ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW); + if (pDevice->bEnableHostWEP == true) + BSSvClearNodeDBTable(pDevice, 1); + else + BSSvClearNodeDBTable(pDevice, 0); + pDevice->uAssocCount = 0; + pMgmt->eCurrState = WMAC_STATE_IDLE; + pDevice->bFixRate = false; - vMgrCreateOwnIBSS((void *) pDevice, &Status); - if (Status != CMD_STATUS_SUCCESS) { - DBG_PRT(MSG_LEVEL_DEBUG, - KERN_INFO "vMgrCreateOwnIBSS fail!\n"); - } - // always turn off unicast bit - MACvRegBitsOff(pDevice, MAC_REG_RCR, RCR_UNICAST); - pDevice->byRxMode &= ~RCR_UNICAST; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wcmd: rx_mode = %x\n", pDevice->byRxMode); - BSSvAddMulticastNode(pDevice); - if (netif_queue_stopped(pDevice->dev)) - netif_wake_queue(pDevice->dev); - pDevice->bLinkPass = true; - ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_INTER); - schedule_delayed_work(&pDevice->second_callback_work, HZ); - } + vMgrCreateOwnIBSS((void *) pDevice, &Status); + if (Status != CMD_STATUS_SUCCESS) { + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "vMgrCreateOwnIBSS fail!\n"); + } + // always turn off unicast bit + MACvRegBitsOff(pDevice, MAC_REG_RCR, RCR_UNICAST); + pDevice->byRxMode &= ~RCR_UNICAST; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wcmd: rx_mode = %x\n", pDevice->byRxMode); + BSSvAddMulticastNode(pDevice); + if (netif_queue_stopped(pDevice->dev)) + netif_wake_queue(pDevice->dev); + pDevice->bLinkPass = true; + ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_INTER); + schedule_delayed_work(&pDevice->second_callback_work, HZ); + } s_bCommandComplete(pDevice); break; case WLAN_CMD_TX_PSPACKET_START: // DTIM Multicast tx - if (pMgmt->sNodeDBTable[0].bRxPSPoll) { - while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[0].sTxPSQueue)) != NULL) { - if (skb_queue_empty(&pMgmt->sNodeDBTable[0].sTxPSQueue)) { - pMgmt->abyPSTxMap[0] &= ~byMask[0]; - pDevice->bMoreData = false; - } else { - pDevice->bMoreData = true; - } + if (pMgmt->sNodeDBTable[0].bRxPSPoll) { + while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[0].sTxPSQueue)) != NULL) { + if (skb_queue_empty(&pMgmt->sNodeDBTable[0].sTxPSQueue)) { + pMgmt->abyPSTxMap[0] &= ~byMask[0]; + pDevice->bMoreData = false; + } else { + pDevice->bMoreData = true; + } - if (nsDMA_tx_packet(pDevice, TYPE_AC0DMA, skb) != 0) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Multicast ps tx fail\n"); + if (nsDMA_tx_packet(pDevice, TYPE_AC0DMA, skb) != 0) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Multicast ps tx fail\n"); - pMgmt->sNodeDBTable[0].wEnQueueCnt--; - } - } + pMgmt->sNodeDBTable[0].wEnQueueCnt--; + } + } // PS nodes tx - for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) { - if (pMgmt->sNodeDBTable[ii].bActive && - pMgmt->sNodeDBTable[ii].bRxPSPoll) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d Enqueu Cnt= %d\n", - ii, pMgmt->sNodeDBTable[ii].wEnQueueCnt); - while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) != NULL) { - if (skb_queue_empty(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) { - // clear tx map - pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[ii].wAID >> 3] &= - ~byMask[pMgmt->sNodeDBTable[ii].wAID & 7]; - pDevice->bMoreData = false; - } else { - pDevice->bMoreData = true; - } + for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) { + if (pMgmt->sNodeDBTable[ii].bActive && + pMgmt->sNodeDBTable[ii].bRxPSPoll) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d Enqueu Cnt= %d\n", + ii, pMgmt->sNodeDBTable[ii].wEnQueueCnt); + while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) != NULL) { + if (skb_queue_empty(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) { + // clear tx map + pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[ii].wAID >> 3] &= + ~byMask[pMgmt->sNodeDBTable[ii].wAID & 7]; + pDevice->bMoreData = false; + } else { + pDevice->bMoreData = true; + } - if (nsDMA_tx_packet(pDevice, TYPE_AC0DMA, skb) != 0) - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "sta ps tx fail\n"); + if (nsDMA_tx_packet(pDevice, TYPE_AC0DMA, skb) != 0) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "sta ps tx fail\n"); - pMgmt->sNodeDBTable[ii].wEnQueueCnt--; - // check if sta ps enable, wait next pspoll - // if sta ps disable, send all pending buffers. - if (pMgmt->sNodeDBTable[ii].bPSEnable) - break; - } - if (skb_queue_empty(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) { - // clear tx map - pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[ii].wAID >> 3] &= - ~byMask[pMgmt->sNodeDBTable[ii].wAID & 7]; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d PS queue clear\n", ii); - } - pMgmt->sNodeDBTable[ii].bRxPSPoll = false; - } - } + pMgmt->sNodeDBTable[ii].wEnQueueCnt--; + // check if sta ps enable, wait next pspoll + // if sta ps disable, send all pending buffers. + if (pMgmt->sNodeDBTable[ii].bPSEnable) + break; + } + if (skb_queue_empty(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) { + // clear tx map + pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[ii].wAID >> 3] &= + ~byMask[pMgmt->sNodeDBTable[ii].wAID & 7]; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d PS queue clear\n", ii); + } + pMgmt->sNodeDBTable[ii].bRxPSPoll = false; + } + } s_bCommandComplete(pDevice); break; @@ -751,94 +745,93 @@ void vRunCommand(struct work_struct *work) case WLAN_CMD_RADIO_START: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_RADIO_START\n"); - // if (pDevice->bRadioCmd == true) - // CARDbRadioPowerOn(pDevice); - // else - // CARDbRadioPowerOff(pDevice); +// if (pDevice->bRadioCmd == true) +// CARDbRadioPowerOn(pDevice); +// else +// CARDbRadioPowerOff(pDevice); + { + int ntStatus = STATUS_SUCCESS; + u8 byTmp; - { - int ntStatus = STATUS_SUCCESS; - u8 byTmp; + ntStatus = CONTROLnsRequestIn(pDevice, + MESSAGE_TYPE_READ, + MAC_REG_GPIOCTL1, + MESSAGE_REQUEST_MACREG, + 1, + &byTmp); - ntStatus = CONTROLnsRequestIn(pDevice, - MESSAGE_TYPE_READ, - MAC_REG_GPIOCTL1, - MESSAGE_REQUEST_MACREG, - 1, - &byTmp); + if (ntStatus != STATUS_SUCCESS) { + s_bCommandComplete(pDevice); + spin_unlock_irq(&pDevice->lock); + return; + } + if ((byTmp & GPIO3_DATA) == 0) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" WLAN_CMD_RADIO_START_OFF........................\n"); + // Old commands are useless. + // empty command Q + pDevice->cbFreeCmdQueue = CMD_Q_SIZE; + pDevice->uCmdDequeueIdx = 0; + pDevice->uCmdEnqueueIdx = 0; + //0415pDevice->bCmdRunning = false; + pDevice->bCmdClear = true; + pDevice->bStopTx0Pkt = false; + pDevice->bStopDataPkt = true; - if (ntStatus != STATUS_SUCCESS) { - s_bCommandComplete(pDevice); - spin_unlock_irq(&pDevice->lock); - return; - } - if ((byTmp & GPIO3_DATA) == 0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" WLAN_CMD_RADIO_START_OFF........................\n"); - // Old commands are useless. - // empty command Q - pDevice->cbFreeCmdQueue = CMD_Q_SIZE; - pDevice->uCmdDequeueIdx = 0; - pDevice->uCmdEnqueueIdx = 0; - //0415pDevice->bCmdRunning = false; - pDevice->bCmdClear = true; - pDevice->bStopTx0Pkt = false; - pDevice->bStopDataPkt = true; + pDevice->byKeyIndex = 0; + pDevice->bTransmitKey = false; + spin_unlock_irq(&pDevice->lock); + KeyvInitTable(pDevice, &pDevice->sKey); + spin_lock_irq(&pDevice->lock); + pMgmt->byCSSPK = KEY_CTL_NONE; + pMgmt->byCSSGK = KEY_CTL_NONE; - pDevice->byKeyIndex = 0; - pDevice->bTransmitKey = false; - spin_unlock_irq(&pDevice->lock); - KeyvInitTable(pDevice, &pDevice->sKey); - spin_lock_irq(&pDevice->lock); - pMgmt->byCSSPK = KEY_CTL_NONE; - pMgmt->byCSSGK = KEY_CTL_NONE; + if (pDevice->bLinkPass == true) { + // reason = 8 : disassoc because sta has left + vMgrDisassocBeginSta((void *) pDevice, + pMgmt, + pMgmt->abyCurrBSSID, + (8), + &Status); + pDevice->bLinkPass = false; + // unlock command busy + pMgmt->eCurrState = WMAC_STATE_IDLE; + pMgmt->sNodeDBTable[0].bActive = false; + // if(pDevice->bWPASuppWextEnabled == true) + { + union iwreq_data wrqu; + memset(&wrqu, 0, sizeof(wrqu)); + wrqu.ap_addr.sa_family = ARPHRD_ETHER; + PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n"); + wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); + } + } + pDevice->bwextstep0 = false; + pDevice->bwextstep1 = false; + pDevice->bwextstep2 = false; + pDevice->bwextstep3 = false; + pDevice->bWPASuppWextEnabled = false; + //clear current SSID + pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; + pItemSSID->len = 0; + memset(pItemSSID->abySSID, 0, WLAN_SSID_MAXLEN); + //clear desired SSID + pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; + pItemSSID->len = 0; + memset(pItemSSID->abySSID, 0, WLAN_SSID_MAXLEN); - if (pDevice->bLinkPass == true) { - // reason = 8 : disassoc because sta has left - vMgrDisassocBeginSta((void *) pDevice, - pMgmt, - pMgmt->abyCurrBSSID, - (8), - &Status); - pDevice->bLinkPass = false; - // unlock command busy - pMgmt->eCurrState = WMAC_STATE_IDLE; - pMgmt->sNodeDBTable[0].bActive = false; - // if(pDevice->bWPASuppWextEnabled == true) - { - union iwreq_data wrqu; - memset(&wrqu, 0, sizeof(wrqu)); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n"); - wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); - } - } - pDevice->bwextstep0 = false; - pDevice->bwextstep1 = false; - pDevice->bwextstep2 = false; - pDevice->bwextstep3 = false; - pDevice->bWPASuppWextEnabled = false; - //clear current SSID - pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; - pItemSSID->len = 0; - memset(pItemSSID->abySSID, 0, WLAN_SSID_MAXLEN); - //clear desired SSID - pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; - pItemSSID->len = 0; - memset(pItemSSID->abySSID, 0, WLAN_SSID_MAXLEN); - - netif_stop_queue(pDevice->dev); - CARDbRadioPowerOff(pDevice); - MACvRegBitsOn(pDevice, MAC_REG_GPIOCTL1, GPIO3_INTMD); - ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_OFF); - pDevice->bHWRadioOff = true; - } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" WLAN_CMD_RADIO_START_ON........................\n"); - pDevice->bHWRadioOff = false; - CARDbRadioPowerOn(pDevice); - MACvRegBitsOff(pDevice, MAC_REG_GPIOCTL1, GPIO3_INTMD); - ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_ON); - } - } + netif_stop_queue(pDevice->dev); + CARDbRadioPowerOff(pDevice); + MACvRegBitsOn(pDevice, MAC_REG_GPIOCTL1, GPIO3_INTMD); + ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_OFF); + pDevice->bHWRadioOff = true; + } else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" WLAN_CMD_RADIO_START_ON........................\n"); + pDevice->bHWRadioOff = false; + CARDbRadioPowerOn(pDevice); + MACvRegBitsOff(pDevice, MAC_REG_GPIOCTL1, GPIO3_INTMD); + ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_ON); + } + } s_bCommandComplete(pDevice); break; @@ -872,19 +865,19 @@ void vRunCommand(struct work_struct *work) case WLAN_CMD_CHANGE_ANTENNA_START: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Change from Antenna%d to", (int)pDevice->dwRxAntennaSel); - if (pDevice->dwRxAntennaSel == 0) { - pDevice->dwRxAntennaSel = 1; - if (pDevice->bTxRxAntInv == true) - BBvSetAntennaMode(pDevice, ANT_RXA); - else - BBvSetAntennaMode(pDevice, ANT_RXB); - } else { - pDevice->dwRxAntennaSel = 0; - if (pDevice->bTxRxAntInv == true) - BBvSetAntennaMode(pDevice, ANT_RXB); - else - BBvSetAntennaMode(pDevice, ANT_RXA); - } + if (pDevice->dwRxAntennaSel == 0) { + pDevice->dwRxAntennaSel = 1; + if (pDevice->bTxRxAntInv == true) + BBvSetAntennaMode(pDevice, ANT_RXA); + else + BBvSetAntennaMode(pDevice, ANT_RXB); + } else { + pDevice->dwRxAntennaSel = 0; + if (pDevice->bTxRxAntInv == true) + BBvSetAntennaMode(pDevice, ANT_RXB); + else + BBvSetAntennaMode(pDevice, ANT_RXA); + } s_bCommandComplete(pDevice); break; @@ -895,16 +888,16 @@ void vRunCommand(struct work_struct *work) case WLAN_CMD_MAC_DISPOWERSAVING_START: ControlvReadByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PSCTL, &byData); - if ((byData & PSCTL_PS) != 0) { - // disable power saving hw function - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_DISABLE_PS, - 0, - 0, - 0, - NULL - ); - } + if ((byData & PSCTL_PS) != 0) { + // disable power saving hw function + CONTROLnsRequestOut(pDevice, + MESSAGE_TYPE_DISABLE_PS, + 0, + 0, + 0, + NULL + ); + } s_bCommandComplete(pDevice); break; @@ -933,95 +926,94 @@ static int s_bCommandComplete(struct vnt_private *pDevice) int bForceSCAN = true; pDevice->eCommandState = WLAN_CMD_IDLE; - if (pDevice->cbFreeCmdQueue == CMD_Q_SIZE) { - //Command Queue Empty - pDevice->bCmdRunning = false; - return true; - } else { - pDevice->eCommand = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].eCmd; - pSSID = (PWLAN_IE_SSID)pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].abyCmdDesireSSID; - bRadioCmd = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].bRadioCmd; - bForceSCAN = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].bForceSCAN; - ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdDequeueIdx, CMD_Q_SIZE); - pDevice->cbFreeCmdQueue++; - pDevice->bCmdRunning = true; - switch (pDevice->eCommand) { - case WLAN_CMD_BSSID_SCAN: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_BSSID_SCAN\n"); - pDevice->eCommandState = WLAN_CMD_SCAN_START; - pMgmt->uScanChannel = 0; - if (pSSID->len != 0) - memcpy(pMgmt->abyScanSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - else - memset(pMgmt->abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); + if (pDevice->cbFreeCmdQueue == CMD_Q_SIZE) { + //Command Queue Empty + pDevice->bCmdRunning = false; + return true; + } else { + pDevice->eCommand = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].eCmd; + pSSID = (PWLAN_IE_SSID)pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].abyCmdDesireSSID; + bRadioCmd = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].bRadioCmd; + bForceSCAN = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].bForceSCAN; + ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdDequeueIdx, CMD_Q_SIZE); + pDevice->cbFreeCmdQueue++; + pDevice->bCmdRunning = true; + switch (pDevice->eCommand) { + case WLAN_CMD_BSSID_SCAN: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_BSSID_SCAN\n"); + pDevice->eCommandState = WLAN_CMD_SCAN_START; + pMgmt->uScanChannel = 0; + if (pSSID->len != 0) + memcpy(pMgmt->abyScanSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); + else + memset(pMgmt->abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); /* - if ((bForceSCAN == false) && (pDevice->bLinkPass == true)) { - if ((pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) && - ( !memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID, pSSID->len))) { - pDevice->eCommandState = WLAN_CMD_IDLE; - } - } + if ((bForceSCAN == false) && (pDevice->bLinkPass == true)) { + if ((pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) && + ( !memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID, pSSID->len))) { + pDevice->eCommandState = WLAN_CMD_IDLE; + } + } */ - break; - case WLAN_CMD_SSID: - pDevice->eCommandState = WLAN_CMD_SSID_START; - if (pSSID->len > WLAN_SSID_MAXLEN) - pSSID->len = WLAN_SSID_MAXLEN; - if (pSSID->len != 0) - memcpy(pMgmt->abyDesireSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_SSID_START\n"); - break; - case WLAN_CMD_DISASSOCIATE: - pDevice->eCommandState = WLAN_CMD_DISASSOCIATE_START; - break; - case WLAN_CMD_RX_PSPOLL: - pDevice->eCommandState = WLAN_CMD_TX_PSPACKET_START; - break; - case WLAN_CMD_RUN_AP: - pDevice->eCommandState = WLAN_CMD_AP_MODE_START; - break; - case WLAN_CMD_RADIO: - pDevice->eCommandState = WLAN_CMD_RADIO_START; - pDevice->bRadioCmd = bRadioCmd; - break; - case WLAN_CMD_CHANGE_BBSENSITIVITY: - pDevice->eCommandState = WLAN_CMD_CHANGE_BBSENSITIVITY_START; - break; + break; + case WLAN_CMD_SSID: + pDevice->eCommandState = WLAN_CMD_SSID_START; + if (pSSID->len > WLAN_SSID_MAXLEN) + pSSID->len = WLAN_SSID_MAXLEN; + if (pSSID->len != 0) + memcpy(pMgmt->abyDesireSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_SSID_START\n"); + break; + case WLAN_CMD_DISASSOCIATE: + pDevice->eCommandState = WLAN_CMD_DISASSOCIATE_START; + break; + case WLAN_CMD_RX_PSPOLL: + pDevice->eCommandState = WLAN_CMD_TX_PSPACKET_START; + break; + case WLAN_CMD_RUN_AP: + pDevice->eCommandState = WLAN_CMD_AP_MODE_START; + break; + case WLAN_CMD_RADIO: + pDevice->eCommandState = WLAN_CMD_RADIO_START; + pDevice->bRadioCmd = bRadioCmd; + break; + case WLAN_CMD_CHANGE_BBSENSITIVITY: + pDevice->eCommandState = WLAN_CMD_CHANGE_BBSENSITIVITY_START; + break; - case WLAN_CMD_TBTT_WAKEUP: - pDevice->eCommandState = WLAN_CMD_TBTT_WAKEUP_START; - break; + case WLAN_CMD_TBTT_WAKEUP: + pDevice->eCommandState = WLAN_CMD_TBTT_WAKEUP_START; + break; - case WLAN_CMD_BECON_SEND: - pDevice->eCommandState = WLAN_CMD_BECON_SEND_START; - break; + case WLAN_CMD_BECON_SEND: + pDevice->eCommandState = WLAN_CMD_BECON_SEND_START; + break; - case WLAN_CMD_SETPOWER: - pDevice->eCommandState = WLAN_CMD_SETPOWER_START; - break; + case WLAN_CMD_SETPOWER: + pDevice->eCommandState = WLAN_CMD_SETPOWER_START; + break; - case WLAN_CMD_CHANGE_ANTENNA: - pDevice->eCommandState = WLAN_CMD_CHANGE_ANTENNA_START; - break; + case WLAN_CMD_CHANGE_ANTENNA: + pDevice->eCommandState = WLAN_CMD_CHANGE_ANTENNA_START; + break; - case WLAN_CMD_REMOVE_ALLKEY: - pDevice->eCommandState = WLAN_CMD_REMOVE_ALLKEY_START; - break; + case WLAN_CMD_REMOVE_ALLKEY: + pDevice->eCommandState = WLAN_CMD_REMOVE_ALLKEY_START; + break; - case WLAN_CMD_MAC_DISPOWERSAVING: - pDevice->eCommandState = WLAN_CMD_MAC_DISPOWERSAVING_START; - break; + case WLAN_CMD_MAC_DISPOWERSAVING: + pDevice->eCommandState = WLAN_CMD_MAC_DISPOWERSAVING_START; + break; - case WLAN_CMD_11H_CHSW: - pDevice->eCommandState = WLAN_CMD_11H_CHSW_START; - break; + case WLAN_CMD_11H_CHSW: + pDevice->eCommandState = WLAN_CMD_11H_CHSW_START; + break; - default: - break; - - } - vCommandTimerWait(pDevice, 0); - } + default: + break; + } + vCommandTimerWait(pDevice, 0); + } return true; } @@ -1030,47 +1022,47 @@ int bScheduleCommand(struct vnt_private *pDevice, CMD_CODE eCommand, u8 *pbyItem0) { - if (pDevice->cbFreeCmdQueue == 0) - return (false); - pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].eCmd = eCommand; - pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = true; - memset(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, 0 , WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - if (pbyItem0 != NULL) { - switch (eCommand) { - case WLAN_CMD_BSSID_SCAN: - pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = false; - memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, - pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - break; + if (pDevice->cbFreeCmdQueue == 0) + return (false); + pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].eCmd = eCommand; + pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = true; + memset(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, 0 , WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); + if (pbyItem0 != NULL) { + switch (eCommand) { + case WLAN_CMD_BSSID_SCAN: + pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = false; + memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, + pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); + break; - case WLAN_CMD_SSID: - memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, - pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - break; + case WLAN_CMD_SSID: + memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, + pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); + break; - case WLAN_CMD_DISASSOCIATE: - pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bNeedRadioOFF = *((int *)pbyItem0); - break; + case WLAN_CMD_DISASSOCIATE: + pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bNeedRadioOFF = *((int *)pbyItem0); + break; /* - case WLAN_CMD_DEAUTH: - pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].wDeAuthenReason = *((u16 *)pbyItem0); - break; + case WLAN_CMD_DEAUTH: + pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].wDeAuthenReason = *((u16 *)pbyItem0); + break; */ - case WLAN_CMD_RADIO: - pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bRadioCmd = *((int *)pbyItem0); - break; + case WLAN_CMD_RADIO: + pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bRadioCmd = *((int *)pbyItem0); + break; - default: - break; - } - } + default: + break; + } + } ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdEnqueueIdx, CMD_Q_SIZE); pDevice->cbFreeCmdQueue--; - if (pDevice->bCmdRunning == false) - s_bCommandComplete(pDevice); + if (pDevice->bCmdRunning == false) + s_bCommandComplete(pDevice); return (true); @@ -1095,15 +1087,15 @@ static int s_bClearBSSID_SCAN(struct vnt_private *pDevice) unsigned int uCmdDequeueIdx = pDevice->uCmdDequeueIdx; unsigned int ii; - if ((pDevice->cbFreeCmdQueue < CMD_Q_SIZE) && (uCmdDequeueIdx != pDevice->uCmdEnqueueIdx)) { - for (ii = 0; ii < (CMD_Q_SIZE - pDevice->cbFreeCmdQueue); ii++) { - if (pDevice->eCmdQueue[uCmdDequeueIdx].eCmd == WLAN_CMD_BSSID_SCAN) - pDevice->eCmdQueue[uCmdDequeueIdx].eCmd = WLAN_CMD_IDLE; - ADD_ONE_WITH_WRAP_AROUND(uCmdDequeueIdx, CMD_Q_SIZE); - if (uCmdDequeueIdx == pDevice->uCmdEnqueueIdx) - break; - } - } + if ((pDevice->cbFreeCmdQueue < CMD_Q_SIZE) && (uCmdDequeueIdx != pDevice->uCmdEnqueueIdx)) { + for (ii = 0; ii < (CMD_Q_SIZE - pDevice->cbFreeCmdQueue); ii++) { + if (pDevice->eCmdQueue[uCmdDequeueIdx].eCmd == WLAN_CMD_BSSID_SCAN) + pDevice->eCmdQueue[uCmdDequeueIdx].eCmd = WLAN_CMD_IDLE; + ADD_ONE_WITH_WRAP_AROUND(uCmdDequeueIdx, CMD_Q_SIZE); + if (uCmdDequeueIdx == pDevice->uCmdEnqueueIdx) + break; + } + } return true; } From 97d59f87433d1a4eb6eafcd8b1896e239bf34569 Mon Sep 17 00:00:00 2001 From: Nandini Hanumanthagowda Date: Tue, 12 Nov 2013 23:05:36 +0530 Subject: [PATCH 229/238] staging: vt6656: indented the code under all function blocks indented the code under all functions to remove unnecessary space at start of a line and indent code wherver possible errors thrown from checkpatch script Signed-off-by: Nandini Hanumanthagowda Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/wcmd.c | 302 +++++++++++++++++----------------- 1 file changed, 151 insertions(+), 151 deletions(-) diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index a53a15a60b4e..fa6234bbca11 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -87,18 +87,18 @@ static void vAdHocBeaconStop(struct vnt_private *pDevice) struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; int bStop; - /* - * temporarily stop Beacon packet for AdHoc Server - * if all of the following coditions are met: - * (1) STA is in AdHoc mode - * (2) VT3253 is programmed as automatic Beacon Transmitting - * (3) One of the following conditions is met - * (3.1) AdHoc channel is in B/G band and the - * current scan channel is in A band - * or - * (3.2) AdHoc channel is in A mode - */ - bStop = false; + /* + * temporarily stop Beacon packet for AdHoc Server + * if all of the following coditions are met: + * (1) STA is in AdHoc mode + * (2) VT3253 is programmed as automatic Beacon Transmitting + * (3) One of the following conditions is met + * (3.1) AdHoc channel is in B/G band and the + * current scan channel is in A band + * or + * (3.2) AdHoc channel is in A mode + */ + bStop = false; if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState >= WMAC_STATE_STARTED)) { if ((pMgmt->uIBSSChannel <= CB_MAX_CHANNEL_24G) && @@ -183,16 +183,16 @@ static void s_vProbeChannel(struct vnt_private *pDevice) else pbyRate = &abyCurrSuppRatesG[0]; - // build an assocreq frame and send it - pTxPacket = s_MgrMakeProbeRequest - ( - pDevice, - pMgmt, - pMgmt->abyScanBSSID, - (PWLAN_IE_SSID)pMgmt->abyScanSSID, - (PWLAN_IE_SUPP_RATES)pbyRate, - (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRatesG - ); + // build an assocreq frame and send it + pTxPacket = s_MgrMakeProbeRequest + ( + pDevice, + pMgmt, + pMgmt->abyScanBSSID, + (PWLAN_IE_SSID)pMgmt->abyScanSSID, + (PWLAN_IE_SUPP_RATES)pbyRate, + (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRatesG + ); if (pTxPacket != NULL) { for (ii = 0; ii < 1; ii++) { @@ -229,34 +229,34 @@ static struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *pDevice, + WLAN_PROBEREQ_FR_MAXLEN); pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket + sizeof(struct vnt_tx_mgmt)); - sFrame.pBuf = (u8 *)pTxPacket->p80211Header; - sFrame.len = WLAN_PROBEREQ_FR_MAXLEN; - vMgrEncodeProbeRequest(&sFrame); - sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( - ( - WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | - WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_PROBEREQ) - )); - memcpy(sFrame.pHdr->sA3.abyAddr1, pScanBSSID, WLAN_ADDR_LEN); - memcpy(sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); - memcpy(sFrame.pHdr->sA3.abyAddr3, pScanBSSID, WLAN_BSSID_LEN); - // Copy the SSID, pSSID->len=0 indicate broadcast SSID - sFrame.pSSID = (PWLAN_IE_SSID)(sFrame.pBuf + sFrame.len); - sFrame.len += pSSID->len + WLAN_IEHDR_LEN; - memcpy(sFrame.pSSID, pSSID, pSSID->len + WLAN_IEHDR_LEN); - sFrame.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); - sFrame.len += pCurrRates->len + WLAN_IEHDR_LEN; - memcpy(sFrame.pSuppRates, pCurrRates, pCurrRates->len + WLAN_IEHDR_LEN); - // Copy the extension rate set + sFrame.pBuf = (u8 *)pTxPacket->p80211Header; + sFrame.len = WLAN_PROBEREQ_FR_MAXLEN; + vMgrEncodeProbeRequest(&sFrame); + sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( + ( + WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | + WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_PROBEREQ) + )); + memcpy(sFrame.pHdr->sA3.abyAddr1, pScanBSSID, WLAN_ADDR_LEN); + memcpy(sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); + memcpy(sFrame.pHdr->sA3.abyAddr3, pScanBSSID, WLAN_BSSID_LEN); + // Copy the SSID, pSSID->len=0 indicate broadcast SSID + sFrame.pSSID = (PWLAN_IE_SSID)(sFrame.pBuf + sFrame.len); + sFrame.len += pSSID->len + WLAN_IEHDR_LEN; + memcpy(sFrame.pSSID, pSSID, pSSID->len + WLAN_IEHDR_LEN); + sFrame.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); + sFrame.len += pCurrRates->len + WLAN_IEHDR_LEN; + memcpy(sFrame.pSuppRates, pCurrRates, pCurrRates->len + WLAN_IEHDR_LEN); + // Copy the extension rate set if (pDevice->byBBType == BB_TYPE_11G) { sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); sFrame.len += pCurrExtSuppRates->len + WLAN_IEHDR_LEN; memcpy(sFrame.pExtSuppRates, pCurrExtSuppRates, pCurrExtSuppRates->len + WLAN_IEHDR_LEN); } - pTxPacket->cbMPDULen = sFrame.len; - pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; + pTxPacket->cbMPDULen = sFrame.len; + pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; - return pTxPacket; + return pTxPacket; } static void @@ -288,11 +288,11 @@ void vRunCommand(struct work_struct *work) if (pDevice->bCmdRunning != true) return; - spin_lock_irq(&pDevice->lock); + spin_lock_irq(&pDevice->lock); - switch (pDevice->eCommandState) { + switch (pDevice->eCommandState) { - case WLAN_CMD_SCAN_START: + case WLAN_CMD_SCAN_START: pDevice->byReAssocCount = 0; if (pDevice->bRadioOff == true) { @@ -307,7 +307,7 @@ void vRunCommand(struct work_struct *work) return; } - pItemSSID = (PWLAN_IE_SSID)pMgmt->abyScanSSID; + pItemSSID = (PWLAN_IE_SSID)pMgmt->abyScanSSID; if (pMgmt->uScanChannel == 0) pMgmt->uScanChannel = pDevice->byMinChannel; @@ -387,11 +387,11 @@ void vRunCommand(struct work_struct *work) } } - break; + break; - case WLAN_CMD_SCAN_END: + case WLAN_CMD_SCAN_END: - // Set Baseband's sensitivity back. + // Set Baseband's sensitivity back. if (pDevice->byBBType != pDevice->byScanBBType) { pDevice->byBBType = pDevice->byScanBBType; CARDvSetBSSMode(pDevice); @@ -403,29 +403,29 @@ void vRunCommand(struct work_struct *work) BBvUpdatePreEDThreshold(pDevice, false); } - // Set channel back - vAdHocBeaconRestart(pDevice); - // Set channel back - CARDbSetMediaChannel(pDevice, pMgmt->uCurrChannel); - // Set Filter + // Set channel back + vAdHocBeaconRestart(pDevice); + // Set channel back + CARDbSetMediaChannel(pDevice, pMgmt->uCurrChannel); + // Set Filter if (pMgmt->bCurrBSSIDFilterOn) { MACvRegBitsOn(pDevice, MAC_REG_RCR, RCR_BSSID); pDevice->byRxMode |= RCR_BSSID; } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel); pMgmt->uScanChannel = 0; - pMgmt->eScanState = WMAC_NO_SCANNING; - pDevice->bStopDataPkt = false; + pMgmt->eScanState = WMAC_NO_SCANNING; + pDevice->bStopDataPkt = false; /*send scan event to wpa_Supplicant*/ PRINT_K("wireless_send_event--->SIOCGIWSCAN(scan done)\n"); memset(&wrqu, 0, sizeof(wrqu)); wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, NULL); - s_bCommandComplete(pDevice); - break; + s_bCommandComplete(pDevice); + break; - case WLAN_CMD_DISASSOCIATE_START: + case WLAN_CMD_DISASSOCIATE_START: pDevice->byReAssocCount = 0; if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState != WMAC_STATE_ASSOC)) { @@ -457,13 +457,13 @@ void vRunCommand(struct work_struct *work) pMgmt->sNodeDBTable[0].bActive = false; // pDevice->bBeaconBufReady = false; } - netif_stop_queue(pDevice->dev); - if (pDevice->bNeedRadioOFF == true) - CARDbRadioPowerOff(pDevice); - s_bCommandComplete(pDevice); - break; + netif_stop_queue(pDevice->dev); + if (pDevice->bNeedRadioOFF == true) + CARDbRadioPowerOff(pDevice); + s_bCommandComplete(pDevice); + break; - case WLAN_CMD_SSID_START: + case WLAN_CMD_SSID_START: pDevice->byReAssocCount = 0; if (pDevice->bRadioOff == true) { @@ -472,13 +472,13 @@ void vRunCommand(struct work_struct *work) return; } - memcpy(pMgmt->abyAdHocSSID, pMgmt->abyDesireSSID, - ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len + WLAN_IEHDR_LEN); + memcpy(pMgmt->abyAdHocSSID, pMgmt->abyDesireSSID, + ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len + WLAN_IEHDR_LEN); - pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; - pItemSSIDCurr = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" cmd: desire ssid = %s\n", pItemSSID->abySSID); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" cmd: curr ssid = %s\n", pItemSSIDCurr->abySSID); + pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; + pItemSSIDCurr = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" cmd: desire ssid = %s\n", pItemSSID->abySSID); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" cmd: curr ssid = %s\n", pItemSSIDCurr->abySSID); if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Cmd pMgmt->eCurrState == WMAC_STATE_ASSOC\n"); @@ -501,13 +501,13 @@ void vRunCommand(struct work_struct *work) pDevice->bLinkPass = false; ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW); } - // set initial state - pMgmt->eCurrState = WMAC_STATE_IDLE; - pMgmt->eCurrMode = WMAC_MODE_STANDBY; - PSvDisablePowerSaving((void *) pDevice); - BSSvClearNodeDBTable(pDevice, 0); - vMgrJoinBSSBegin((void *) pDevice, &Status); - // if Infra mode + // set initial state + pMgmt->eCurrState = WMAC_STATE_IDLE; + pMgmt->eCurrMode = WMAC_MODE_STANDBY; + PSvDisablePowerSaving((void *) pDevice); + BSSvClearNodeDBTable(pDevice, 0); + vMgrJoinBSSBegin((void *) pDevice, &Status); + // if Infra mode if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED)) { // Call mgr to begin the deauthentication // reason = (3) because sta has left ESS @@ -584,11 +584,11 @@ void vRunCommand(struct work_struct *work) } } } - s_bCommandComplete(pDevice); - break; + s_bCommandComplete(pDevice); + break; - case WLAN_AUTHENTICATE_WAIT: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_AUTHENTICATE_WAIT\n"); + case WLAN_AUTHENTICATE_WAIT: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_AUTHENTICATE_WAIT\n"); if (pMgmt->eCurrState == WMAC_STATE_AUTH) { pDevice->byLinkWaitCount = 0; // Call mgr to begin the association @@ -611,12 +611,12 @@ void vRunCommand(struct work_struct *work) vCommandTimerWait((void *) pDevice, AUTHENTICATE_TIMEOUT/2); return; } - pDevice->byLinkWaitCount = 0; + pDevice->byLinkWaitCount = 0; - s_bCommandComplete(pDevice); - break; + s_bCommandComplete(pDevice); + break; - case WLAN_ASSOCIATE_WAIT: + case WLAN_ASSOCIATE_WAIT: if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCurrState == WMAC_STATE_ASSOC\n"); if (pDevice->ePSMode != WMAC_POWER_CAM) { @@ -647,10 +647,10 @@ void vRunCommand(struct work_struct *work) return; } - s_bCommandComplete(pDevice); - break; + s_bCommandComplete(pDevice); + break; - case WLAN_CMD_AP_MODE_START: + case WLAN_CMD_AP_MODE_START: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_AP_MODE_START\n"); if (pMgmt->eConfigMode == WMAC_CONFIG_AP) { @@ -686,8 +686,8 @@ void vRunCommand(struct work_struct *work) s_bCommandComplete(pDevice); break; - case WLAN_CMD_TX_PSPACKET_START: - // DTIM Multicast tx + case WLAN_CMD_TX_PSPACKET_START: + // DTIM Multicast tx if (pMgmt->sNodeDBTable[0].bRxPSPoll) { while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[0].sTxPSQueue)) != NULL) { if (skb_queue_empty(&pMgmt->sNodeDBTable[0].sTxPSQueue)) { @@ -739,12 +739,12 @@ void vRunCommand(struct work_struct *work) } } - s_bCommandComplete(pDevice); - break; + s_bCommandComplete(pDevice); + break; - case WLAN_CMD_RADIO_START: + case WLAN_CMD_RADIO_START: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_RADIO_START\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_RADIO_START\n"); // if (pDevice->bRadioCmd == true) // CARDbRadioPowerOn(pDevice); // else @@ -833,38 +833,38 @@ void vRunCommand(struct work_struct *work) } } - s_bCommandComplete(pDevice); - break; + s_bCommandComplete(pDevice); + break; - case WLAN_CMD_CHANGE_BBSENSITIVITY_START: + case WLAN_CMD_CHANGE_BBSENSITIVITY_START: - pDevice->bStopDataPkt = true; - pDevice->byBBVGACurrent = pDevice->byBBVGANew; - BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Change sensitivity pDevice->byBBVGACurrent = %x\n", pDevice->byBBVGACurrent); - pDevice->bStopDataPkt = false; - s_bCommandComplete(pDevice); - break; + pDevice->bStopDataPkt = true; + pDevice->byBBVGACurrent = pDevice->byBBVGANew; + BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Change sensitivity pDevice->byBBVGACurrent = %x\n", pDevice->byBBVGACurrent); + pDevice->bStopDataPkt = false; + s_bCommandComplete(pDevice); + break; - case WLAN_CMD_TBTT_WAKEUP_START: - PSbIsNextTBTTWakeUp(pDevice); - s_bCommandComplete(pDevice); - break; + case WLAN_CMD_TBTT_WAKEUP_START: + PSbIsNextTBTTWakeUp(pDevice); + s_bCommandComplete(pDevice); + break; - case WLAN_CMD_BECON_SEND_START: - bMgrPrepareBeaconToSend(pDevice, pMgmt); - s_bCommandComplete(pDevice); - break; + case WLAN_CMD_BECON_SEND_START: + bMgrPrepareBeaconToSend(pDevice, pMgmt); + s_bCommandComplete(pDevice); + break; - case WLAN_CMD_SETPOWER_START: + case WLAN_CMD_SETPOWER_START: - RFbSetPower(pDevice, pDevice->wCurrentRate, pMgmt->uCurrChannel); + RFbSetPower(pDevice, pDevice->wCurrentRate, pMgmt->uCurrChannel); - s_bCommandComplete(pDevice); - break; + s_bCommandComplete(pDevice); + break; - case WLAN_CMD_CHANGE_ANTENNA_START: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Change from Antenna%d to", (int)pDevice->dwRxAntennaSel); + case WLAN_CMD_CHANGE_ANTENNA_START: + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Change from Antenna%d to", (int)pDevice->dwRxAntennaSel); if (pDevice->dwRxAntennaSel == 0) { pDevice->dwRxAntennaSel = 1; if (pDevice->bTxRxAntInv == true) @@ -878,16 +878,16 @@ void vRunCommand(struct work_struct *work) else BBvSetAntennaMode(pDevice, ANT_RXA); } - s_bCommandComplete(pDevice); - break; + s_bCommandComplete(pDevice); + break; - case WLAN_CMD_REMOVE_ALLKEY_START: - KeybRemoveAllKey(pDevice, &(pDevice->sKey), pDevice->abyBSSID); - s_bCommandComplete(pDevice); - break; + case WLAN_CMD_REMOVE_ALLKEY_START: + KeybRemoveAllKey(pDevice, &(pDevice->sKey), pDevice->abyBSSID); + s_bCommandComplete(pDevice); + break; - case WLAN_CMD_MAC_DISPOWERSAVING_START: - ControlvReadByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PSCTL, &byData); + case WLAN_CMD_MAC_DISPOWERSAVING_START: + ControlvReadByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PSCTL, &byData); if ((byData & PSCTL_PS) != 0) { // disable power saving hw function CONTROLnsRequestOut(pDevice, @@ -898,24 +898,24 @@ void vRunCommand(struct work_struct *work) NULL ); } - s_bCommandComplete(pDevice); - break; + s_bCommandComplete(pDevice); + break; - case WLAN_CMD_11H_CHSW_START: - CARDbSetMediaChannel(pDevice, pDevice->byNewChannel); - pDevice->bChannelSwitch = false; - pMgmt->uCurrChannel = pDevice->byNewChannel; - pDevice->bStopDataPkt = false; - s_bCommandComplete(pDevice); - break; + case WLAN_CMD_11H_CHSW_START: + CARDbSetMediaChannel(pDevice, pDevice->byNewChannel); + pDevice->bChannelSwitch = false; + pMgmt->uCurrChannel = pDevice->byNewChannel; + pDevice->bStopDataPkt = false; + s_bCommandComplete(pDevice); + break; - default: - s_bCommandComplete(pDevice); - break; - } //switch + default: + s_bCommandComplete(pDevice); + break; + } //switch - spin_unlock_irq(&pDevice->lock); - return; + spin_unlock_irq(&pDevice->lock); + return; } static int s_bCommandComplete(struct vnt_private *pDevice) @@ -925,7 +925,7 @@ static int s_bCommandComplete(struct vnt_private *pDevice) int bRadioCmd = false; int bForceSCAN = true; - pDevice->eCommandState = WLAN_CMD_IDLE; + pDevice->eCommandState = WLAN_CMD_IDLE; if (pDevice->cbFreeCmdQueue == CMD_Q_SIZE) { //Command Queue Empty pDevice->bCmdRunning = false; @@ -1015,7 +1015,7 @@ static int s_bCommandComplete(struct vnt_private *pDevice) vCommandTimerWait(pDevice, 0); } - return true; + return true; } int bScheduleCommand(struct vnt_private *pDevice, @@ -1058,13 +1058,13 @@ int bScheduleCommand(struct vnt_private *pDevice, } } - ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdEnqueueIdx, CMD_Q_SIZE); - pDevice->cbFreeCmdQueue--; + ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdEnqueueIdx, CMD_Q_SIZE); + pDevice->cbFreeCmdQueue--; if (pDevice->bCmdRunning == false) s_bCommandComplete(pDevice); - return (true); + return (true); } @@ -1096,7 +1096,7 @@ static int s_bClearBSSID_SCAN(struct vnt_private *pDevice) break; } } - return true; + return true; } //mike add:reset command timer From 820c9b12153d83319fdfbba2783ff1c07a1ad817 Mon Sep 17 00:00:00 2001 From: Nandini Hanumanthagowda Date: Tue, 12 Nov 2013 23:05:37 +0530 Subject: [PATCH 230/238] staging: vt6656: removed parenthesis from return statement parenthesis is not required in return statement since its not a fucntion, hence remove parentheses to comply with linux coding style Signed-off-by: Nandini Hanumanthagowda Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/wcmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index fa6234bbca11..246a266556a3 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -1023,7 +1023,7 @@ int bScheduleCommand(struct vnt_private *pDevice, { if (pDevice->cbFreeCmdQueue == 0) - return (false); + return false; pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].eCmd = eCommand; pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = true; memset(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, 0 , WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); @@ -1064,7 +1064,7 @@ int bScheduleCommand(struct vnt_private *pDevice, if (pDevice->bCmdRunning == false) s_bCommandComplete(pDevice); - return (true); + return true; } From 2eca4ead3819b375ec169bb9f38eba82bd0e1dca Mon Sep 17 00:00:00 2001 From: Nandini Hanumanthagowda Date: Tue, 12 Nov 2013 23:05:38 +0530 Subject: [PATCH 231/238] staging: vt6656: removed all whitespace errors removed all whitespace errors from the code like no space at the start of line and indent the code wherever possible Signed-off-by: Nandini Hanumanthagowda Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/wcmd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index 246a266556a3..640813e722a8 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -651,7 +651,7 @@ void vRunCommand(struct work_struct *work) break; case WLAN_CMD_AP_MODE_START: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_AP_MODE_START\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_AP_MODE_START\n"); if (pMgmt->eConfigMode == WMAC_CONFIG_AP) { cancel_delayed_work_sync(&pDevice->second_callback_work); @@ -683,8 +683,8 @@ void vRunCommand(struct work_struct *work) ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_INTER); schedule_delayed_work(&pDevice->second_callback_work, HZ); } - s_bCommandComplete(pDevice); - break; + s_bCommandComplete(pDevice); + break; case WLAN_CMD_TX_PSPACKET_START: // DTIM Multicast tx @@ -704,7 +704,7 @@ void vRunCommand(struct work_struct *work) } } - // PS nodes tx + // PS nodes tx for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) { if (pMgmt->sNodeDBTable[ii].bActive && pMgmt->sNodeDBTable[ii].bRxPSPoll) { From 819b920b7d66195c5e118e844239721b92ff8180 Mon Sep 17 00:00:00 2001 From: Nandini Hanumanthagowda Date: Tue, 12 Nov 2013 23:05:39 +0530 Subject: [PATCH 232/238] staging: vt6656: added space after coma operator in funtion call as per coding style a space is required after ',' operator in function calls, hence added the missing space after ',' operator in a function call Signed-off-by: Nandini Hanumanthagowda Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/wcmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index 640813e722a8..9646d72dc9b2 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -448,7 +448,7 @@ void vRunCommand(struct work_struct *work) (8), &Status); pDevice->bLinkPass = false; - ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW); + ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW); // unlock command busy pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; pItemSSID->len = 0; From df6b85138faa297c643542047d09081877c24026 Mon Sep 17 00:00:00 2001 From: Nandini Hanumanthagowda Date: Tue, 12 Nov 2013 23:05:40 +0530 Subject: [PATCH 233/238] staging: vt6656: removed the trailing statement should be on next line error as per linux coding style trailing statments should not be there at the end of line, instead it should be placed in next line. hence removed that error by moving trailing statement to next line Signed-off-by: Nandini Hanumanthagowda Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/wcmd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index 9646d72dc9b2..2d05ccb58a7a 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -604,7 +604,8 @@ void vRunCommand(struct work_struct *work) } } else if (pMgmt->eCurrState < WMAC_STATE_AUTHPENDING) { printk("WLAN_AUTHENTICATE_WAIT:Authen Fail???\n"); - } else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if authenticated_frame delay! + } else if (pDevice->byLinkWaitCount <= 4) { + //mike add:wait another 2 sec if authenticated_frame delay! pDevice->byLinkWaitCount++; printk("WLAN_AUTHENTICATE_WAIT:wait %d times!!\n", pDevice->byLinkWaitCount); spin_unlock_irq(&pDevice->lock); @@ -639,7 +640,8 @@ void vRunCommand(struct work_struct *work) } else if (pMgmt->eCurrState < WMAC_STATE_ASSOCPENDING) { printk("WLAN_ASSOCIATE_WAIT:Association Fail???\n"); - } else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if associated_frame delay! + } else if (pDevice->byLinkWaitCount <= 4) { + //mike add:wait another 2 sec if associated_frame delay! pDevice->byLinkWaitCount++; printk("WLAN_ASSOCIATE_WAIT:wait %d times!!\n", pDevice->byLinkWaitCount); spin_unlock_irq(&pDevice->lock); From 28397dc9a6de41eafbd76a799883ace8f0570bd0 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Mon, 18 Nov 2013 14:33:05 +0100 Subject: [PATCH 234/238] mfd: staging: Constify struct mfd_cell where possible As of commit 03e361b25ee8dfb1fd9b890072c23c4aae01c6c7 ("mfd: Stop setting refcounting pointers in original mfd_cell arrays"), the "cell" parameter of mfd_add_devices() is "const" again. Hence make all cell data passed to mfd_add_devices() const where possible. Signed-off-by: Geert Uytterhoeven Cc: Greg Kroah-Hartman Cc: devel@driverdev.osuosl.org Signed-off-by: Greg Kroah-Hartman --- drivers/staging/nvec/nvec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index 3066ee2e753b..27d74134f187 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c @@ -83,7 +83,7 @@ enum nvec_sleep_subcmds { static struct nvec_chip *nvec_power_handle; -static struct mfd_cell nvec_devices[] = { +static const struct mfd_cell nvec_devices[] = { { .name = "nvec-kbd", .id = 1, From e1970ee78c16adf39cb4d240f7745109909ff26a Mon Sep 17 00:00:00 2001 From: Aldo Iljazi Date: Sat, 16 Nov 2013 16:17:55 +0200 Subject: [PATCH 235/238] Drivers: staging: ft1000-usb: ft1000_proc.c: fixed a few styling issues. Fixed a few styling issues, particularly: Lines 36,42: Inserted a space before the open paranthesis. Line 50: Removed space between function name and open parenthesis. Lines 56,57: Removed trailing whitespace. lines: 130, 133: Replaced spaces with tabs for identation. Signed-off-by: Aldo Iljazi Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/ft1000-usb/ft1000_proc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c b/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c index 5ead942be680..2575d0d6bff3 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c @@ -33,13 +33,13 @@ #define seq_putx(m, message, size, var) \ seq_printf(m, message); \ - for(i = 0; i < (size - 1); i++) \ + for (i = 0; i < (size - 1); i++) \ seq_printf(m, "%02x:", var[i]); \ seq_printf(m, "%02x\n", var[i]) #define seq_putd(m, message, size, var) \ seq_printf(m, message); \ - for(i = 0; i < (size - 1); i++) \ + for (i = 0; i < (size - 1); i++) \ seq_printf(m, "%d.", var[i]); \ seq_printf(m, "%d\n", var[i]) @@ -47,14 +47,14 @@ #define FTNET_PROC init_net.proc_net -int ft1000_read_dpram16 (struct ft1000_usb *ft1000dev, u16 indx, +int ft1000_read_dpram16(struct ft1000_usb *ft1000dev, u16 indx, u8 *buffer, u8 highlow); static int ft1000ReadProc(struct seq_file *m, void *v) { - static const char *status[] = { - "Idle (Disconnect)", + static const char *status[] = { + "Idle (Disconnect)", "Searching", "Active (Connected)", "Waiting for L2", @@ -127,10 +127,10 @@ static int ft1000ReadProc(struct seq_file *m, void *v) } seq_printf(m, "Connection Time: %02ld:%02ld:%02ld\n", - ((delta / 3600) % 24), ((delta / 60) % 60), (delta % 60)); + ((delta / 3600) % 24), ((delta / 60) % 60), (delta % 60)); seq_printf(m, "Connection Time[s]: %ld\n", delta); seq_printf(m, "Asic ID: %s\n", - (info->AsicID) == ELECTRABUZZ_ID ? "ELECTRABUZZ ASIC" : "MAGNEMITE ASIC"); + (info->AsicID) == ELECTRABUZZ_ID ? "ELECTRABUZZ ASIC" : "MAGNEMITE ASIC"); seq_putx(m, "SKU: ", SKUSZ, info->Sku); seq_putx(m, "EUI64: ", EUISZ, info->eui64); seq_putd(m, "DSP version number: ", DSPVERSZ, info->DspVer); From 5ea17d6cb9a72fbb7e5ab75868369bade2c5f2bc Mon Sep 17 00:00:00 2001 From: JC Lafoucriere Date: Thu, 21 Nov 2013 22:24:48 +0800 Subject: [PATCH 236/238] staging/lustre/llite: Access to released file triggers a restore When a client accesses data in a released file, or truncate it, client must trig a restore request. During this restore, the client must not glimpse and must use size from MDT. To bring the "restore is running" information on the client we add a new t_state bit field to mdt_info which will be used to carry transient file state. To memorise this information in the inode we add a new flag LLIF_FILE_RESTORING. Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3432 Lustre-change: http://review.whamcloud.com/6537 Signed-off-by: JC Lafoucriere Reviewed-by: Oleg Drokin Tested-by: Oleg Drokin Signed-off-by: Peng Tao Signed-off-by: Andreas Dilger Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/include/cl_object.h | 6 ++- .../lustre/lustre/include/lustre/lustre_idl.h | 14 +++-- .../lustre/lustre/lclient/lcommon_cl.c | 6 +++ drivers/staging/lustre/lustre/llite/file.c | 39 +++++++++++++- .../lustre/lustre/llite/llite_internal.h | 3 ++ .../staging/lustre/lustre/llite/llite_lib.c | 36 +++++++++++++ drivers/staging/lustre/lustre/llite/vvp_io.c | 54 +++++++++++++++++-- drivers/staging/lustre/lustre/lov/lov_io.c | 15 ++++-- .../lustre/lustre/ptlrpc/pack_generic.c | 2 +- .../staging/lustre/lustre/ptlrpc/wiretest.c | 18 ++++--- 10 files changed, 169 insertions(+), 24 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h index c485206fc6c2..4d692dcd96cf 100644 --- a/drivers/staging/lustre/lustre/include/cl_object.h +++ b/drivers/staging/lustre/lustre/include/cl_object.h @@ -2388,7 +2388,11 @@ struct cl_io { * Right now, only two opertaions need to verify layout: glimpse * and setattr. */ - ci_verify_layout:1; + ci_verify_layout:1, + /** + * file is released, restore has to to be triggered by vvp layer + */ + ci_restore_needed:1; /** * Number of pages owned by this IO. For invariant checking. */ diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index e592a0e0f794..4d8d8c34cd67 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -1725,10 +1725,7 @@ static inline __u32 lov_mds_md_size(__u16 stripes, __u32 lmm_magic) #define OBD_MD_MDS (0x0000000100000000ULL) /* where an inode lives on */ #define OBD_MD_REINT (0x0000000200000000ULL) /* reintegrate oa */ #define OBD_MD_MEA (0x0000000400000000ULL) /* CMD split EA */ - -/* OBD_MD_MDTIDX is used to get MDT index, but it is never been used overwire, - * and it is already obsolete since 2.3 */ -/* #define OBD_MD_MDTIDX (0x0000000800000000ULL) */ +#define OBD_MD_TSTATE (0x0000000800000000ULL) /* transient state field */ #define OBD_MD_FLXATTR (0x0000001000000000ULL) /* xattr */ #define OBD_MD_FLXATTRLS (0x0000002000000000ULL) /* xattr list */ @@ -2208,6 +2205,11 @@ static inline int ll_inode_to_ext_flags(int iflags) ((iflags & S_IMMUTABLE) ? LUSTRE_IMMUTABLE_FL : 0)); } +/* 64 possible states */ +enum md_transient_state { + MS_RESTORE = (1 << 0), /* restore is running */ +}; + struct mdt_body { struct lu_fid fid1; struct lu_fid fid2; @@ -2219,7 +2221,9 @@ struct mdt_body { obd_time ctime; __u64 blocks; /* XID, in the case of MDS_READPAGE */ __u64 ioepoch; - __u64 unused1; /* was "ino" until 2.4.0 */ + __u64 t_state; /* transient file state defined in + * enum md_transient_state + * was "ino" until 2.4.0 */ __u32 fsuid; __u32 fsgid; __u32 capability; diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c index e60c04d5393a..1c628e325750 100644 --- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c +++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c @@ -1006,6 +1006,12 @@ again: cl_io_fini(env, io); if (unlikely(io->ci_need_restart)) goto again; + /* HSM import case: file is released, cannot be restored + * no need to fail except if restore registration failed + * with -ENODATA */ + if (result == -ENODATA && io->ci_restore_needed && + io->ci_result != -ENODATA) + result = 0; cl_env_put(env, &refcheck); return result; } diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 971409ed52e7..82248e9f6bff 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -1107,7 +1107,7 @@ out: cl_io_fini(env, io); /* If any bit been read/written (result != 0), we just return * short read/write instead of restart io. */ - if (result == 0 && io->ci_need_restart) { + if ((result == 0 || result == -ENODATA) && io->ci_need_restart) { CDEBUG(D_VFSTRACE, "Restart %s on %s from %lld, count:%zd\n", iot == CIT_READ ? "read" : "write", file->f_dentry->d_name.name, *ppos, count); @@ -2867,7 +2867,15 @@ int ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it, LTIME_S(inode->i_mtime) = ll_i2info(inode)->lli_lvb.lvb_mtime; LTIME_S(inode->i_ctime) = ll_i2info(inode)->lli_lvb.lvb_ctime; } else { - rc = ll_glimpse_size(inode); + /* In case of restore, the MDT has the right size and has + * already send it back without granting the layout lock, + * inode is up-to-date so glimpse is useless. + * Also to glimpse we need the layout, in case of a running + * restore the MDT holds the layout lock so the glimpse will + * block up to the end of restore (getattr will block) + */ + if (!(ll_i2info(inode)->lli_flags & LLIF_FILE_RESTORING)) + rc = ll_glimpse_size(inode); } return rc; } @@ -3464,3 +3472,30 @@ again: return rc; } + +/** + * This function send a restore request to the MDT + */ +int ll_layout_restore(struct inode *inode) +{ + struct hsm_user_request *hur; + int len, rc; + + len = sizeof(struct hsm_user_request) + + sizeof(struct hsm_user_item); + OBD_ALLOC(hur, len); + if (hur == NULL) + return -ENOMEM; + + hur->hur_request.hr_action = HUA_RESTORE; + hur->hur_request.hr_archive_id = 0; + hur->hur_request.hr_flags = 0; + memcpy(&hur->hur_user_item[0].hui_fid, &ll_i2info(inode)->lli_fid, + sizeof(hur->hur_user_item[0].hui_fid)); + hur->hur_user_item[0].hui_extent.length = -1; + hur->hur_request.hr_itemcount = 1; + rc = obd_iocontrol(LL_IOC_HSM_REQUEST, cl_i2sbi(inode)->ll_md_exp, + len, hur, NULL); + OBD_FREE(hur, len); + return rc; +} diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 1a13330ac966..c326ff24410c 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -125,6 +125,8 @@ enum lli_flags { LLIF_SRVLOCK = (1 << 5), /* File data is modified. */ LLIF_DATA_MODIFIED = (1 << 6), + /* File is being restored */ + LLIF_FILE_RESTORING = (1 << 7), }; struct ll_inode_info { @@ -1588,5 +1590,6 @@ enum { int ll_layout_conf(struct inode *inode, const struct cl_object_conf *conf); int ll_layout_refresh(struct inode *inode, __u32 *gen); +int ll_layout_restore(struct inode *inode); #endif /* LLITE_INTERNAL_H */ diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index fd584ff7e2df..facc39158447 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -1353,6 +1353,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr) struct ll_inode_info *lli = ll_i2info(inode); struct md_op_data *op_data = NULL; struct md_open_data *mod = NULL; + bool file_is_released = false; int rc = 0, rc1 = 0; CDEBUG(D_VFSTRACE, "%s: setattr inode %p/fid:"DFID" from %llu to %llu, " @@ -1436,10 +1437,40 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr) (attr->ia_valid & (ATTR_SIZE | ATTR_MTIME | ATTR_MTIME_SET))) op_data->op_flags = MF_EPOCH_OPEN; + /* truncate on a released file must failed with -ENODATA, + * so size must not be set on MDS for released file + * but other attributes must be set + */ + if (S_ISREG(inode->i_mode)) { + struct lov_stripe_md *lsm; + __u32 gen; + + ll_layout_refresh(inode, &gen); + lsm = ccc_inode_lsm_get(inode); + if (lsm && lsm->lsm_pattern & LOV_PATTERN_F_RELEASED) + file_is_released = true; + ccc_inode_lsm_put(inode, lsm); + } + + /* clear size attr for released file + * we clear the attribute send to MDT in op_data, not the original + * received from caller in attr which is used later to + * decide return code */ + if (file_is_released && (attr->ia_valid & ATTR_SIZE)) + op_data->op_attr.ia_valid &= ~ATTR_SIZE; + rc = ll_md_setattr(dentry, op_data, &mod); if (rc) GOTO(out, rc); + /* truncate failed, others succeed */ + if (file_is_released) { + if (attr->ia_valid & ATTR_SIZE) + GOTO(out, rc = -ENODATA); + else + GOTO(out, rc = 0); + } + /* RPC to MDT is sent, cancel data modification flag */ if (rc == 0 && (op_data->op_bias & MDS_DATA_MODIFIED)) { spin_lock(&lli->lli_lock); @@ -1761,6 +1792,11 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md) LASSERT(md->oss_capa); ll_add_capa(inode, md->oss_capa); } + + if (body->valid & OBD_MD_TSTATE) { + if (body->t_state & MS_RESTORE) + lli->lli_flags |= LLIF_FILE_RESTORING; + } } void ll_read_inode2(struct inode *inode, void *opaque) diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c index 3ff664ce7503..f69e3aa98022 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_io.c +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c @@ -121,8 +121,38 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) CLOBINVRNT(env, obj, ccc_object_invariant(obj)); - CDEBUG(D_VFSTRACE, "ignore/verify layout %d/%d, layout version %d.\n", - io->ci_ignore_layout, io->ci_verify_layout, cio->cui_layout_gen); + CDEBUG(D_VFSTRACE, DFID + " ignore/verify layout %d/%d, layout version %d restore needed %d\n", + PFID(lu_object_fid(&obj->co_lu)), + io->ci_ignore_layout, io->ci_verify_layout, + cio->cui_layout_gen, io->ci_restore_needed); + + if (io->ci_restore_needed == 1) { + int rc; + + /* file was detected release, we need to restore it + * before finishing the io + */ + rc = ll_layout_restore(ccc_object_inode(obj)); + /* if restore registration failed, no restart, + * we will return -ENODATA */ + /* The layout will change after restore, so we need to + * block on layout lock hold by the MDT + * as MDT will not send new layout in lvb (see LU-3124) + * we have to explicitly fetch it, all this will be done + * by ll_layout_refresh() + */ + if (rc == 0) { + io->ci_restore_needed = 0; + io->ci_need_restart = 1; + io->ci_verify_layout = 1; + } else { + io->ci_restore_needed = 1; + io->ci_need_restart = 0; + io->ci_verify_layout = 0; + io->ci_result = rc; + } + } if (!io->ci_ignore_layout && io->ci_verify_layout) { __u32 gen = 0; @@ -130,9 +160,17 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) /* check layout version */ ll_layout_refresh(ccc_object_inode(obj), &gen); io->ci_need_restart = cio->cui_layout_gen != gen; - if (io->ci_need_restart) - CDEBUG(D_VFSTRACE, "layout changed from %d to %d.\n", - cio->cui_layout_gen, gen); + if (io->ci_need_restart) { + CDEBUG(D_VFSTRACE, + DFID" layout changed from %d to %d.\n", + PFID(lu_object_fid(&obj->co_lu)), + cio->cui_layout_gen, gen); + /* today successful restore is the only possible + * case */ + /* restore was done, clear restoring state */ + ll_i2info(ccc_object_inode(obj))->lli_flags &= + ~LLIF_FILE_RESTORING; + } } } @@ -1111,6 +1149,12 @@ int vvp_io_init(const struct lu_env *env, struct cl_object *obj, CLOBINVRNT(env, obj, ccc_object_invariant(obj)); + CDEBUG(D_VFSTRACE, DFID + " ignore/verify layout %d/%d, layout version %d restore needed %d\n", + PFID(lu_object_fid(&obj->co_lu)), + io->ci_ignore_layout, io->ci_verify_layout, + cio->cui_layout_gen, io->ci_restore_needed); + CL_IO_SLICE_CLEAN(cio, cui_cl); cl_io_slice_add(io, &cio->cui_cl, obj, &vvp_io_ops); vio->cui_ra_window_set = 0; diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index 2792fa5c4be2..5a6ab70ed0a1 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -947,14 +947,23 @@ int lov_io_init_released(const struct lu_env *env, struct cl_object *obj, LASSERTF(0, "invalid type %d\n", io->ci_type); case CIT_MISC: case CIT_FSYNC: - result = +1; + result = 1; break; case CIT_SETATTR: + /* the truncate to 0 is managed by MDT: + * - in open, for open O_TRUNC + * - in setattr, for truncate + */ + /* the truncate is for size > 0 so triggers a restore */ + if (cl_io_is_trunc(io)) + io->ci_restore_needed = 1; + result = -ENODATA; + break; case CIT_READ: case CIT_WRITE: case CIT_FAULT: - /* TODO: need to restore the file. */ - result = -EBADF; + io->ci_restore_needed = 1; + result = -ENODATA; break; } if (result == 0) { diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c index 4659314a1865..d831bd7e8e08 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c @@ -1873,7 +1873,7 @@ void lustre_swab_mdt_body(struct mdt_body *b) __swab64s(&b->ctime); __swab64s(&b->blocks); __swab64s(&b->ioepoch); - CLASSERT(offsetof(typeof(*b), unused1) != 0); + __swab64s(&b->t_state); __swab32s(&b->fsuid); __swab32s(&b->fsgid); __swab32s(&b->capability); diff --git a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c index 9890bd9cfb93..e3f02c77f3b9 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c +++ b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c @@ -49,9 +49,10 @@ void lustre_assert_wire_constants(void) { /* Wire protocol assertions generated by 'wirecheck' * (make -C lustre/utils newwiretest) - * running on Linux deva 2.6.32.279.lustre #5 SMP Tue Apr 9 22:52:17 CST 2013 x86_64 x86_64 x - * with gcc version 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC) */ - + * running on Linux centos6-bis 2.6.32-358.0.1.el6-head + * #3 SMP Wed Apr 17 17:37:43 CEST 2013 + * with gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) + */ /* Constants... */ LASSERTF(PTL_RPC_MSG_REQUEST == 4711, "found %lld\n", @@ -1335,6 +1336,8 @@ void lustre_assert_wire_constants(void) OBD_MD_REINT); LASSERTF(OBD_MD_MEA == (0x0000000400000000ULL), "found 0x%.16llxULL\n", OBD_MD_MEA); + LASSERTF(OBD_MD_TSTATE == (0x0000000800000000ULL), + "found 0x%.16llxULL\n", OBD_MD_TSTATE); LASSERTF(OBD_MD_FLXATTR == (0x0000001000000000ULL), "found 0x%.16llxULL\n", OBD_MD_FLXATTR); LASSERTF(OBD_MD_FLXATTRLS == (0x0000002000000000ULL), "found 0x%.16llxULL\n", @@ -1918,10 +1921,11 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct mdt_body, blocks)); LASSERTF((int)sizeof(((struct mdt_body *)0)->blocks) == 8, "found %lld\n", (long long)(int)sizeof(((struct mdt_body *)0)->blocks)); - LASSERTF((int)offsetof(struct mdt_body, unused1) == 96, "found %lld\n", - (long long)(int)offsetof(struct mdt_body, unused1)); - LASSERTF((int)sizeof(((struct mdt_body *)0)->unused1) == 8, "found %lld\n", - (long long)(int)sizeof(((struct mdt_body *)0)->unused1)); + LASSERTF((int)offsetof(struct mdt_body, t_state) == 96, "found %lld\n", + (long long)(int)offsetof(struct mdt_body, t_state)); + LASSERTF((int)sizeof(((struct mdt_body *)0)->t_state) == 8, + "found %lld\n", + (long long)(int)sizeof(((struct mdt_body *)0)->t_state)); LASSERTF((int)offsetof(struct mdt_body, fsuid) == 104, "found %lld\n", (long long)(int)offsetof(struct mdt_body, fsuid)); LASSERTF((int)sizeof(((struct mdt_body *)0)->fsuid) == 4, "found %lld\n", From 6d95e0481be819417a5ecef4e0effdb59133a68a Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Thu, 21 Nov 2013 22:24:49 +0800 Subject: [PATCH 237/238] staging/lustre/ldlm: fix resource/fid check, use DLDLMRES In ll_md_blocking_ast() the FID/resource comparison is incorrectly checking for fid_ver() stored in res_id.name[2] instead of name[1] changed since http://review.whamcloud.com/2271 (commit 4f91d5161d00) landed. This does not impact current clients, since name[2] and fid_ver() are always zero, but it could cause problems in the future. In ldlm_cli_enqueue_fini() use ldlm_res_eq() instead of comparing each of the resource fields separately. Use DLDLMRES/PLDLMRES when printing resource names everywhere. Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2901 Lustre-change: http://review.whamcloud.com/6592 Signed-off-by: Lai Siyao Reviewed-by: Johann Lombardi Signed-off-by: Peng Tao Signed-off-by: Andreas Dilger Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/ldlm/ldlm_request.c | 32 +++++++------------ .../lustre/lustre/ldlm/ldlm_resource.c | 19 +++-------- drivers/staging/lustre/lustre/llite/namei.c | 5 +-- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 9 ++---- .../staging/lustre/lustre/mgc/mgc_request.c | 4 +-- 5 files changed, 21 insertions(+), 48 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index 1e2c0dd67569..1ddcca34bb79 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -610,18 +610,12 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req, lock->l_req_mode = newmode; } - if (memcmp(reply->lock_desc.l_resource.lr_name.name, - lock->l_resource->lr_name.name, - sizeof(struct ldlm_res_id))) { - CDEBUG(D_INFO, "remote intent success, locking " - "(%ld,%ld,%ld) instead of " - "(%ld,%ld,%ld)\n", - (long)reply->lock_desc.l_resource.lr_name.name[0], - (long)reply->lock_desc.l_resource.lr_name.name[1], - (long)reply->lock_desc.l_resource.lr_name.name[2], - (long)lock->l_resource->lr_name.name[0], - (long)lock->l_resource->lr_name.name[1], - (long)lock->l_resource->lr_name.name[2]); + if (!ldlm_res_eq(&reply->lock_desc.l_resource.lr_name, + &lock->l_resource->lr_name)) { + CDEBUG(D_INFO, "remote intent success, locking "DLDLMRES + " instead of "DLDLMRES"\n", + PLDLMRES(&reply->lock_desc.l_resource), + PLDLMRES(lock->l_resource)); rc = ldlm_lock_change_resource(ns, lock, &reply->lock_desc.l_resource.lr_name); @@ -1912,7 +1906,8 @@ int ldlm_cli_cancel_unused_resource(struct ldlm_namespace *ns, 0, flags | LCF_BL_AST, opaque); rc = ldlm_cli_cancel_list(&cancels, count, NULL, flags); if (rc != ELDLM_OK) - CERROR("ldlm_cli_cancel_unused_resource: %d\n", rc); + CERROR("canceling unused lock "DLDLMRES": rc = %d\n", + PLDLMRES(res), rc); LDLM_RESOURCE_DELREF(res); ldlm_resource_putref(res); @@ -1930,15 +1925,10 @@ static int ldlm_cli_hash_cancel_unused(struct cfs_hash *hs, struct cfs_hash_bd * { struct ldlm_resource *res = cfs_hash_object(hs, hnode); struct ldlm_cli_cancel_arg *lc = arg; - int rc; - rc = ldlm_cli_cancel_unused_resource(ldlm_res_to_ns(res), &res->lr_name, - NULL, LCK_MINMODE, - lc->lc_flags, lc->lc_opaque); - if (rc != 0) { - CERROR("ldlm_cli_cancel_unused ("LPU64"): %d\n", - res->lr_name.name[0], rc); - } + ldlm_cli_cancel_unused_resource(ldlm_res_to_ns(res), &res->lr_name, + NULL, LCK_MINMODE, + lc->lc_flags, lc->lc_opaque); /* must return 0 for hash iteration */ return 0; } diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index 77e022bf8bcc..25e14e1b3659 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -762,16 +762,9 @@ static int ldlm_resource_complain(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct ldlm_resource *res = cfs_hash_object(hs, hnode); lock_res(res); - CERROR("Namespace %s resource refcount nonzero " - "(%d) after lock cleanup; forcing " - "cleanup.\n", - ldlm_ns_name(ldlm_res_to_ns(res)), - atomic_read(&res->lr_refcount) - 1); - - CERROR("Resource: %p ("LPU64"/"LPU64"/"LPU64"/" - LPU64") (rc: %d)\n", res, - res->lr_name.name[0], res->lr_name.name[1], - res->lr_name.name[2], res->lr_name.name[3], + CERROR("%s: namespace resource "DLDLMRES + " (%p) refcount nonzero (%d) after lock cleanup; forcing cleanup.\n", + ldlm_ns_name(ldlm_res_to_ns(res)), PLDLMRES(res), res, atomic_read(&res->lr_refcount) - 1); ldlm_resource_dump(D_ERROR, res); @@ -1403,10 +1396,8 @@ void ldlm_resource_dump(int level, struct ldlm_resource *res) if (!((libcfs_debug | D_ERROR) & level)) return; - CDEBUG(level, "--- Resource: %p ("LPU64"/"LPU64"/"LPU64"/"LPU64 - ") (rc: %d)\n", res, res->lr_name.name[0], res->lr_name.name[1], - res->lr_name.name[2], res->lr_name.name[3], - atomic_read(&res->lr_refcount)); + CDEBUG(level, "--- Resource: "DLDLMRES" (%p) refcount = %d\n", + PLDLMRES(res), res, atomic_read(&res->lr_refcount)); if (!list_empty(&res->lr_granted)) { CDEBUG(level, "Granted locks (in reverse order):\n"); diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 34815b550e71..83774684734c 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -233,12 +233,9 @@ int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, ll_have_md_lock(inode, &bits, mode); fid = ll_inode2fid(inode); - if (lock->l_resource->lr_name.name[0] != fid_seq(fid) || - lock->l_resource->lr_name.name[1] != fid_oid(fid) || - lock->l_resource->lr_name.name[2] != fid_ver(fid)) { + if (!fid_res_name_eq(fid, &lock->l_resource->lr_name)) LDLM_ERROR(lock, "data mismatch with object " DFID" (%p)", PFID(fid), inode); - } if (bits & MDS_INODELOCK_OPEN) { int flags = 0; diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index eccbab7561fe..09dee1120ed2 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -971,13 +971,8 @@ static int mdc_finish_intent_lock(struct obd_export *exp, LASSERTF(fid_res_name_eq(&mdt_body->fid1, &lock->l_resource->lr_name), - "Lock res_id: %lu/%lu/%lu, fid: %lu/%lu/%lu.\n", - (unsigned long)lock->l_resource->lr_name.name[0], - (unsigned long)lock->l_resource->lr_name.name[1], - (unsigned long)lock->l_resource->lr_name.name[2], - (unsigned long)fid_seq(&mdt_body->fid1), - (unsigned long)fid_oid(&mdt_body->fid1), - (unsigned long)fid_ver(&mdt_body->fid1)); + "Lock res_id: "DLDLMRES", fid: "DFID"\n", + PLDLMRES(lock->l_resource), PFID(&mdt_body->fid1)); LDLM_LOCK_PUT(lock); memcpy(&old_lock, lockh, sizeof(*lockh)); diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index 12a9ede21a85..93b601d1ff38 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -788,8 +788,8 @@ static int mgc_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, /* We've given up the lock, prepare ourselves to update. */ LDLM_DEBUG(lock, "MGC cancel CB"); - CDEBUG(D_MGC, "Lock res "LPX64" (%.8s)\n", - lock->l_resource->lr_name.name[0], + CDEBUG(D_MGC, "Lock res "DLDLMRES" (%.8s)\n", + PLDLMRES(lock->l_resource), (char *)&lock->l_resource->lr_name.name[0]); if (!cld) { From 4f317748f2660cb62bcf43aac368aa42dbeb2b78 Mon Sep 17 00:00:00 2001 From: Amir Shehata Date: Thu, 21 Nov 2013 22:24:50 +0800 Subject: [PATCH 238/238] staging/lustre/lnet: Fix assert on empty group in selftest module The core of the issue is that the selftest module doesn't sanitize its own API, but it depends on lst utility to do such checks. As a result this issue manifests itself in this particular LU through an assert on an empty group. If the NID is misspelled then an empty group is added. An error output is provided, but if that's never checked in a batch script, as is the case with this issue, then the script will try to add an empty group to a test to run in a batch, and that will cause an assert The fix is two fold. Ensure that lst utility checks that a group is added with at least one node. If not the group is subsequently deleted. And the add_test command would fail, since the group no longer exists. The second fix is to ensure that the kernel module itself sanitizes its own API in this particular case, so that if a different utility is used other than lst to communicate with the selftest kernel module then this error would be caught. This fix looks up the batch and the groups, src and dst, in the ioctl handle and sanitizes that input at this point. If the group looked up either doesn't exist or doesn't have at least one ACTIVE node, then the command fails. NOTE:there are many other cases in the code where the selftest kernel module doesn't check for sanity of the input, but depends totally on the lst module to do such checks. Particularly around length of strings passed in. Thus it is possible to crash the selftest module if someone tries to create another userspace app to communicate with the selftest kernel module without ensuring sanity of the params sent to the kernel module. In effect, it's always assumed that lst is the front end for selftest and no other front end is to be used. Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3093 Lustre-change: http://review.whamcloud.com/6092 Signed-off-by: Amir Shehata Reviewed-by: Isaac Huang Reviewed-by: Liang Zhen Reviewed-by: Oleg Drokin [coding style fix of the original patch is splitted into a new one -- PengTao] Signed-off-by: Peng Tao Signed-off-by: Andreas Dilger Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lnet/selftest/console.c | 79 ++++++++++++++----- .../staging/lustre/lnet/selftest/console.h | 6 +- 2 files changed, 61 insertions(+), 24 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index 067a8b535f7c..9556bc0412d6 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -1237,40 +1237,76 @@ again: goto again; } -int -lstcon_test_add(char *name, int type, int loop, int concur, - int dist, int span, char *src_name, char * dst_name, - void *param, int paramlen, int *retp, - struct list_head *result_up) +static int +lstcon_verify_batch(const char *name, lstcon_batch_t **batch) { - lstcon_group_t *src_grp = NULL; - lstcon_group_t *dst_grp = NULL; - lstcon_test_t *test = NULL; - lstcon_batch_t *batch; - int rc; + int rc; - rc = lstcon_batch_find(name, &batch); + rc = lstcon_batch_find(name, batch); if (rc != 0) { CDEBUG(D_NET, "Can't find batch %s\n", name); return rc; } - if (batch->bat_state != LST_BATCH_IDLE) { + if ((*batch)->bat_state != LST_BATCH_IDLE) { CDEBUG(D_NET, "Can't change running batch %s\n", name); + return -EINVAL; + } + + return 0; +} + +static int +lstcon_verify_group(const char *name, lstcon_group_t **grp) +{ + int rc; + lstcon_ndlink_t *ndl; + + rc = lstcon_group_find(name, grp); + if (rc != 0) { + CDEBUG(D_NET, "can't find group %s\n", name); return rc; } - rc = lstcon_group_find(src_name, &src_grp); - if (rc != 0) { - CDEBUG(D_NET, "Can't find group %s\n", src_name); - goto out; + list_for_each_entry(ndl, &(*grp)->grp_ndl_list, ndl_link) { + if (ndl->ndl_node->nd_state == LST_NODE_ACTIVE) + return 0; } - rc = lstcon_group_find(dst_name, &dst_grp); - if (rc != 0) { - CDEBUG(D_NET, "Can't find group %s\n", dst_name); + CDEBUG(D_NET, "Group %s has no ACTIVE nodes\n", name); + + return -EINVAL; +} + +int +lstcon_test_add(char *batch_name, int type, int loop, + int concur, int dist, int span, + char *src_name, char *dst_name, + void *param, int paramlen, int *retp, + struct list_head *result_up) +{ + lstcon_test_t *test = NULL; + int rc; + lstcon_group_t *src_grp = NULL; + lstcon_group_t *dst_grp = NULL; + lstcon_batch_t *batch = NULL; + + /* + * verify that a batch of the given name exists, and the groups + * that will be part of the batch exist and have at least one + * active node + */ + rc = lstcon_verify_batch(batch_name, &batch); + if (rc != 0) + goto out; + + rc = lstcon_verify_group(src_name, &src_grp); + if (rc != 0) + goto out; + + rc = lstcon_verify_group(dst_name, &dst_grp); + if (rc != 0) goto out; - } if (dst_grp->grp_userland) *retp = 1; @@ -1310,7 +1346,8 @@ lstcon_test_add(char *name, int type, int loop, int concur, if (lstcon_trans_stat()->trs_rpc_errno != 0 || lstcon_trans_stat()->trs_fwk_errno != 0) - CDEBUG(D_NET, "Failed to add test %d to batch %s\n", type, name); + CDEBUG(D_NET, "Failed to add test %d to batch %s\n", type, + batch_name); /* add to test list anyway, so user can check what's going on */ list_add_tail(&test->tes_link, &batch->bat_test_list); diff --git a/drivers/staging/lustre/lnet/selftest/console.h b/drivers/staging/lustre/lnet/selftest/console.h index e61b26687dbb..b57dbd80478a 100644 --- a/drivers/staging/lustre/lnet/selftest/console.h +++ b/drivers/staging/lustre/lnet/selftest/console.h @@ -224,9 +224,9 @@ extern int lstcon_group_stat(char *grp_name, int timeout, struct list_head *result_up); extern int lstcon_nodes_stat(int count, lnet_process_id_t *ids_up, int timeout, struct list_head *result_up); -extern int lstcon_test_add(char *name, int type, int loop, int concur, - int dist, int span, char *src_name, char * dst_name, +extern int lstcon_test_add(char *batch_name, int type, int loop, + int concur, int dist, int span, + char *src_name, char *dst_name, void *param, int paramlen, int *retp, struct list_head *result_up); - #endif