summaryrefslogtreecommitdiffstats
path: root/drivers/staging/ks7010/ks_wlan_net.c
Commit message (Collapse)AuthorAgeFilesLines
* Staging: ks7010: Replace typecast to intWentao Cai2019-03-011-1/+1
| | | | | | | | This patch fixes the checkpatch.pl warning: WARNING: Unnecessary typecast of c90 int constant Signed-off-by: Wentao Cai <etsai042@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: replace uint8_t with u8 in ks_wlan_set_rx_gainSergio Paracuellos2018-05-141-1/+1
| | | | | | | | | In function ks_wlan_set_rx_gain a cast to uint8_t is being used to assign reception gain. 'rx_gain' field is defined as u8 so replace the cast to the correct type Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: replace uint8_t with u8 in ks_wlan_set_tx_gainSergio Paracuellos2018-05-141-1/+1
| | | | | | | | | In function ks_wlan_set_tx_gain a cast to uint8_t is being used to assign transmission gain. 'tx_gain' field is defined as u8 so replace the cast to the correct type. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: change uint8_t casts to u8 in ks_wlan_set_rateSergio Paracuellos2018-05-141-4/+4
| | | | | | | | | There are some casts to uint8_t in ks_wlan_set_rate function to assign values of the bitrate. Just change it to u8 which is the one defined for the field 'body' of the struct which is in use. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: Remove unnecessary limit checksNathan Chancellor2018-05-081-3/+3
| | | | | | | uwrq is an unsigned 32-bit integer, it cannot be less than zero. Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: refactor ks_get_wireless_stats functionSergio Paracuellos2018-05-071-7/+4Star
| | | | | | | | | This commit refactor a bit ks_get_wireless_stats using ternary operator for return code. It also change a comment to use preferred style. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: refactor ks_wlan_set_mlme functionSergio Paracuellos2018-05-071-13/+10Star
| | | | | | | | | This commit refactors ks_wlan_set_mlme function changing switch-case block for more simple if paths improving readability. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: refactor ks_wlan_set_phy_type functionSergio Paracuellos2018-05-071-9/+6Star
| | | | | | | | Handle invalid values first and assign good ones at the end if it is the case. This makes code simplier. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: refactor ks_wlan_set_sleep_mode functionSergio Paracuellos2018-05-071-12/+10Star
| | | | | | | | | | This commit refactors ks_wlan_set_sleep_mode function avoiding to use switch-case statement ans using simple if logic to handle invalid values first. This simplifies data paths as well as improves readability. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: use ether_addr_copy in ks_wlan_net_startSergio Paracuellos2018-05-071-1/+1
| | | | | | | | Instead of use memcpy for copying ethernet addresses, use ether_addr_copy that do the same. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: use ether_addr_copy in ks_wlan_set_mac_addressSergio Paracuellos2018-05-071-1/+1
| | | | | | | | Use ether_addr_copy to copy ethernet address instad of using memcpy in ks_wlan_set_mac_address function. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: change type for rsn_enabled in wpa_status structSergio Paracuellos2018-05-071-2/+2
| | | | | | | | | | Field rsn_enabled included in wpa_status struct is declared as unsigned int but it is only be set using 0 and 1 values and in conditional if code is just being used as a boolean. Change its type to be a boolean. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: move two preprocessor definitions to ks_wlan.hSergio Paracuellos2018-05-071-3/+1Star
| | | | | | | | | | | | | | | | In ks_wlan_translate_scan function there are two preprocessor definitions: - RSN_INFO_ELEM_ID - GENERIC_INFO_ELEM_ID These can be moved to common ks_wlan.h because they can be used in get_current_ap function instead of use hardcoded values. GENERIC_INFO_ELEM_ID has been renamed to WPA_INFO_ELEM_ID which is more clear. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: add SPDX identifiers to all filesSergio Paracuellos2018-05-071-4/+1Star
| | | | | | | | | | | | | | | It's good to have SPDX identifiers in all files to make it easier to audit the kernel tree for correct licenses. Fix up the all of the staging ks7010 files to have a proper SPDX identifier, based on the license text in the file itself. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. Extra GPL text wording can be removed as it is no longer needed at all. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: refactor ks_wlan_translate_scan functionSergio Paracuellos2018-04-261-84/+66Star
| | | | | | | | | | | | | | | | | | This commit refactors ks_wlan_translate_scan function with the following changes: - reorder local variables - use ether_addr_copy to copy ethernet addresses - change style in 'current_ev' variable assignments - make use of some ternaries avoiding if-else code - use preferred style for comments - extract common code into a new ks_wlan_add_leader_event function After this changes readability has been improved. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: avoid blank line between declarations in ks_wlan_get_aplistSergio Paracuellos2018-04-261-1/+0Star
| | | | | | | | This commit removes a blank line which is included between declarations and it has not sense at all. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: use ether_addr_copy in ks_wlan_get_aplistSergio Paracuellos2018-04-261-2/+1Star
| | | | | | | | Use ether_addr_copy to copy ethernet addresses instead of using custom memcpy for that. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: avoid if-else condition in ks_wlan_get_powerSergio Paracuellos2018-04-261-4/+1Star
| | | | | | | | The if-else code in ks_wlan_get_power function is not needed at all and can be achieved with a simple boolean assignation. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: avoid an 'else' in ks_wlan_set_powerSergio Paracuellos2018-04-261-3/+2Star
| | | | | | | | Change if logic to handle invalid case for operation_mode at first avoiding an 'else' path. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: use ether_addr_copy in ks_wlan_get_wapSergio Paracuellos2018-04-261-1/+1
| | | | | | | | Use ether_addr_copy to copy ethernet addresses instead of a custom memcpy. This improves readability. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: refactor ks_wlan_set_wap functionSergio Paracuellos2018-04-261-8/+6Star
| | | | | | | | | Make use of ether_addr_copy instead of memcpy for copying ethernet address data in ks_wlan_set_wap function and avoid an 'else' just changing if logic to check invalid values first. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: align values in frequency_list arraySergio Paracuellos2018-04-261-1/+2
| | | | | | | | To avoid a long line align values in static array frequency_list array. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: use ether_addr_copy in ks_wlan_set_encode_extSergio Paracuellos2018-04-261-1/+1
| | | | | | | | Instead of manually memcpy ethernet addresses use ether_addr_copy function for this purpose. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: refactor ks_wlan_set_pmksa functionSergio Paracuellos2018-04-261-24/+21Star
| | | | | | | | | | This commit cleans a bit ks_wlan_set_pmksa function removing nonsense comments as well as make use of ether_addr_* family functions written to not do manually things that were being here. Minor single if brackets has been removed also. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: refactor ks_wlan_set_cts_mode functionSergio Paracuellos2018-04-261-11/+6Star
| | | | | | | | | This commit refactors ks_wlan_set_cts_mode function to handle invalid values first and then assign the good one changing a bit logic to use a ternary operator. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: refactor ks_wlan_set_preamble functionSergio Paracuellos2018-04-261-6/+2Star
| | | | | | | | Change if logic to handle invalid values first and just assign at the end the valid one if it is the case. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: refactor ks_wlan_set_power_mgmt functionSergio Paracuellos2018-04-261-15/+8Star
| | | | | | | | | This commit change logic to simplify conditional paths in ks_wlan_set_power_mgmt function. It handles invalid's first and just finally assign a valid value. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: refactor ks_wlan_set_scan_type functionSergio Paracuellos2018-04-261-6/+3Star
| | | | | | | | This commit changes logic to handle invalid values first and just assign valid ones afterwards. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: refactor ks_wlan_set_beacon_lost functionSergio Paracuellos2018-04-261-5/+5
| | | | | | | | Change if condition to handle invalid value first and avoid nonsense else's path improving readability. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: use ether_addr_copy() instead of custom copySergio Paracuellos2018-04-251-8/+1Star
| | | | | | | | | In order to achieve ethernet address copies, ether_addr_copy() function exists. So just use it and avoid the byte by byte copy. This increase readability. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: remove duplicated ks_wlan_handler_def declarationSergio Paracuellos2018-04-251-3/+0Star
| | | | | | | | This declaration is declared twice so just remove this one because the other one is the one which contains static struct initializers. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: remove WPS definition conditional codeSergio Paracuellos2018-04-251-11/+0Star
| | | | | | | | | WPS definition was defined by default in ks_wlan.h header file. So it makes no sense to have conditional preprocessor stuff along the code about this. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: fix line exceding 80 characters in ks_wlan_get_rangeSergio Paracuellos2018-04-251-1/+2
| | | | | | | | Avoid very long if condition just changing its style. This makes checkpatch script not complains about this line. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: refactor ks_wlan_get_mode functionSergio Paracuellos2018-04-251-11/+2Star
| | | | | | | | Avoid the use of switch-case block which is not necessary at all and just use a ternary operator to achieve this. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: refactor ks_wlan_set_mode functionSergio Paracuellos2018-04-251-17/+6Star
| | | | | | | | | | | Most cases which are being handled in the switch-case of ks_wlan_set_mode function are just returning EINVAL. Avoid the use of switch-case stament and just use a simple if to handle those. This decrease LOC as well as improves readability. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: remove some duplicated definitions in ks_wlan_net.cSergio Paracuellos2018-04-251-6/+0Star
| | | | | | | | This definitions are in linux/wireless.h header so it is not necessary at all to have this compatibility stuff duplicated here. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: remove KSC_OPNOTSUPP related codeSergio Paracuellos2018-04-251-79/+0Star
| | | | | | | | | | This commit reviews KSC_OPNOTSUPP related code. The preprocessor KSC_OPNOTSUPP is defined by default so related wext functions are not being used. Just clean code removing all of this stuff. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: use IW_HANDLER macro in ks_wlan_handlerSergio Paracuellos2018-04-251-233/+213Star
| | | | | | | | | | | | | This commit make use of IW_HANDLER to set wext operations of the device. Using this, comments are not neccessary anymore and also NULL entries so readability is clearly increased. In order to avoid casting because of the use of a different prototype in all related functions, those which are affected have been updated also to make use of the union iwreq_data as third parameter updating code accordly. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: change name and type for device_open_status fieldSergio Paracuellos2018-04-251-3/+2Star
| | | | | | | | | | | | This commit changes type for device_open_status field of ks_wlan_private structure from int to bool. This variable is only be set to 1 on ks_wlan_net_start and set to 0 on ks_wlan_net_stop. For this purpose it is not necessary at all to use an integer because a bool is enough. This also renames field name from device_open_status to is_device_open. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: align comments in ks_wlan_private_handlerSergio Paracuellos2018-04-231-20/+19Star
| | | | | | | | This commit align comment inside ks_wlan_private_handler WEXT private driver operations. This improves readability. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: review includes of ks_wlan_net.c fileSergio Paracuellos2018-04-231-15/+3Star
| | | | | | | | | This commit reviews really needed includes in ks_wlan_net.c source file. It removes those which are not needed at all. It also reorder the remaining ones in alphabetical order. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: refactor ks_wlan_set_wps_enable functionSergio Paracuellos2018-04-231-3/+2Star
| | | | | | | | | This commit refactors ks_wlan_set_wps_enable function to improve readability handling the error first to avoid an 'else'. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: refactor ks_wlan_set_tx_gain functionSergio Paracuellos2018-04-231-8/+3Star
| | | | | | | | | | This commit refactors ks_wlan_set_rx_gain function to improve readability: - error condition is handling the error to avoid an 'else' - ternary operator is used to clean if-else block assignment. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: refactor ks_wlan_set_rx_gain functionSergio Paracuellos2018-04-231-8/+3Star
| | | | | | | | | | This commit refactors ks_wlan_set_rx_gain function to improve readability: - error condition is handling the error to avoid an 'else' - ternary operator is used to clean if-else block assignment. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: change if-else condition assignment to use ternary operatorSergio Paracuellos2018-04-231-4/+1Star
| | | | | | | | | This commit changes an if-else block used to just assign a variable to use a ternary operator to do the same improving readability. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: refactor ks_wlan_set_encode functionSergio Paracuellos2018-04-231-53/+31Star
| | | | | | | | | | | | | | | | | | | | This commit refactors ks_wlan_set_encode function to improve readability. It just removes level indentation in some paths as well as removes not needed conditions paths which was checked before. Changes are as follows: - (dwrq->length > MAX_KEY_SIZE) check has been moved to the top. - extra check about (dwrq->length > 0) inside an if block where that was the condition to enter inside it has been removed. - (dwrq->flags & IW_ENCODE_NOKEY) check has been turned to avoid one level indentation. - extra check (index >= 0) && (index < 4) has been removed. In the top of the file invalid index values are being checked so it has no sense to check that again. - remove commented line. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: remove auxiliar zeros buffer in ks_wlan_get_encodeSergio Paracuellos2018-04-231-13/+4Star
| | | | | | | | | | | | | | | | | | This commit removes the local buffer zeros in ks_wlan_get_encode function. It also refactors related conditions in order to fill 'extra' output parameter of the function. Originally this zeros is just memset to zeros and only being used if drw->length is truncated to zero because of priv->reg.wep_key[index].size is greater than 16 chars. In those cases the final if statement is just using zeros but it is using memcpy with a length of zero bytes which has no sense. Instead of that just handle the good case copying from the same source the number of bytes of priv->reg.wep_key[index].size. If it is zero the final 'extra' parameter won't be copied at all because the number of bytes to copy will be zero. With this change the code gets simplified. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: remove nosense #if 1 directiveSergio Paracuellos2018-04-231-2/+1Star
| | | | | | | | | This commit removes #if 1 directive from code to improve readability. It is always true, so it makes no sense to have it there. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: Remove unnecessary casts in 'struct ks_wlan_handler_def'.Quytelda Kahja2018-04-231-3/+3
| | | | | | | | The casts used when initializing members of this data structure mirror the types the variables already have. Remove the casts. Signed-off-by: Quytelda Kahja <quytelda@tamalin.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ks7010: Change 'device_open_status' to a bool.Quytelda Kahja2018-04-231-3/+2Star
| | | | | | | | | The 'device_open_status' member of 'struct ks_wlan_private' is only ever set to zero or one, so it makes more sense for it to be a bool instead of an int. Signed-off-by: Quytelda Kahja <quytelda@tamalin.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>