summaryrefslogtreecommitdiffstats
path: root/drivers/staging/vt6656/rf.c
AgeCommit message (Collapse)AuthorFilesLines
2020-05-13staging: vt6656: Remove logically dead codeOscar Carter1-17/+0
In the start of the "vnt_rf_set_txpower" function the "power" variable is set at most to VNT_RF_MAX_POWER (hex = 0x3f, dec = 63). Then, in the switch statement there are four comparisons with the "power" variable against AL7230_PWR_IDX_LEN (dec = 64), VT3226_PWR_IDX_LEN (dec = 64), VT3342_PWR_IDX_LEN (dec = 64). Due to all the commented comparisons are to check if the "power" variable is "greater than or equal" to 64, this never happens. So, remove the logically dead code. Also, remove all the defines that are no longer required. Addresses-Coverity-ID: 1230228 ("Logically dead code") Fixes: f53d9f12c51a ("staging: vt6656: rf.c additional power.") Signed-off-by: Oscar Carter <oscar.carter@gmx.com> Link: https://lore.kernel.org/r/20200510090950.7633-1-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-05staging: vt6656: Refactor the vnt_rf_table_download functionOscar Carter1-42/+69
Create a constant array of struct vnt_table_info type elements with the necessary info (address and length) about all the rf tables for every rf type. In every case of the "switch" statement replace the hardcoded info about these tables with and index to the new constant array. Moreover, use this array index to extract the necessary info in every call to the vnt_control_out_* functions. Check if this index has been set and return without error otherwise. So, avoid the execution of code that previously did nothing due to lengths with values of zero for some rf types. Also remove all the variables that are now unused. This way reduce the stack footprint, and make the code more clear. Signed-off-by: Oscar Carter <oscar.carter@gmx.com> Link: https://lore.kernel.org/r/20200429153838.7216-1-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-28staging: vt6656: Remove duplicate code in vnt_rf_table_downloadOscar Carter1-53/+12
Replace three while loops with three calls to the vnt_control_out_blocks function. This way avoid repeat a functionality that already exists. Also remove the variables that now are not used. Signed-off-by: Oscar Carter <oscar.carter@gmx.com> Link: https://lore.kernel.org/r/20200425151747.8199-4-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-28staging: vt6656: Use return instead of gotoOscar Carter1-8/+7
Replace the "goto" statements with a direct "return ret" as the jump label only returns the ret variable. Also, remove the unnecessary variable initialization because the ret variable is set a few lines later. Signed-off-by: Oscar Carter <oscar.carter@gmx.com> Link: https://lore.kernel.org/r/20200425151747.8199-3-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-28staging: vt6656: Remove the local variable "array"Oscar Carter1-16/+5
Remove the local variable "array" and all the memcpy function calls because this copy operation from different arrays to this variable is unnecessary. The vnt_control_out function already does a kmemdup copy of its const char *buffer argument and this was made unnecessary by: commit 12ecd24ef932 ("staging: vt6656: use off stack for out buffer USB transfers.") Author: Malcolm Priestley <tvboxspy@gmail.com> Date: Sat Apr 22 11:14:57 2017 +0100 staging: vt6656: use off stack for out buffer USB transfers. Since 4.9 mandated USB buffers be heap allocated this causes the driver to fail. Since there is a wide range of buffer sizes use kmemdup to create allocated buffer. So, the same result can be achieved using the arrays directly. Signed-off-by: Oscar Carter <oscar.carter@gmx.com> Link: https://lore.kernel.org/r/20200425151747.8199-2-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-28staging: vt6656: Add formula to the vnt_rf_addpower functionOscar Carter1-15/+8
Use a formula to calculate the return value of the vnt_rf_addpower function instead of the "if" statement with literal values for every case. Signed-off-by: Oscar Carter <oscar.carter@gmx.com> Link: https://lore.kernel.org/r/20200425141514.5528-1-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-16staging: vt6656: Return error code in vnt_rf_write_embedded functionOscar Carter1-35/+64
Use the error code returned by the vnt_control_out function as the returned value of the vnt_rf_write_embedded function instead of a boolean value. Then, fix all vnt_rf_write_embedded calls removing the "and" operations and replace with a direct assignment to the ret variable and add a check condition after every call. Also replace the boolean values true or false in the vnt_rf_set_txpower function to 0 or error code EINVAL to follow the coding style guide. The vnt_rf_set_txpower function is called only in the vnt_rf_setpower function that already returns error codes. The calls to this function (vnt_rf_set_txpower) not use the returned values, so they not need to be fixed. Signed-off-by: Oscar Carter <oscar.carter@gmx.com> Link: https://lore.kernel.org/r/20200414153849.5785-2-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-13staging: vt6556: vnt_rf_setpower convert to use ieee80211_channel.Malcolm Priestley1-42/+37
ieee80211_channel contains all the necessary information to change power according to tx mode required. vnt_rf_setpower is moved and so that vnt_rf_set_txpower the only caller becomes static. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Link: https://lore.kernel.org/r/9eab9af8-fde9-1dc6-fced-95c7a36ecc01@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-13staging: vt6656: replace al2230_power_table array with formula.Malcolm Priestley1-75/+4
The power table can replaced with calculation 0x0404090 | (power << 12) removing array and length macro. variable power never goes beyond the maximum setting. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Link: https://lore.kernel.org/r/e277409a-4509-d09c-515d-59b952f8310d@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21staging: vt6656: avoid discarding called function's return codeQuentin Deslandes1-12/+26
Change some of the driver's functions in order to handle error codes instead of discarding them. These function now returns 0 on success and a negative errno value on error. Signed-off-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28staging: vt6656: Remove redundant license textGreg Kroah-Hartman1-11/+0
Now that the SPDX tag is in all vt6656 files, that identifies the license in a specific and legally-defined manner. So the extra GPL text wording can be removed as it is no longer needed at all. This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text. And there's unneeded stuff like the address (sometimes incorrect) for the FSF which is never needed. No copyright headers or other non-license-description text was removed. Cc: Forest Bond <forest@alittletooquiet.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28staging: vt6656: add SPDX identifiers to all vt6656 driver filesGreg Kroah-Hartman1-0/+1
It's good to have SPDX identifiers in all files to make it easier to audit the kernel tree for correct licenses. Update the vt6656 driver files with the correct SPDX license 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. This work is based on a script and data from Thomas Gleixner, Philippe Ombredanne, and Kate Stewart. Cc: Forest Bond <forest@alittletooquiet.net> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Kate Stewart <kstewart@linuxfoundation.org> Cc: Philippe Ombredanne <pombredanne@nexb.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-16staging: vt6656: Align function parametersSimon Sandström1-1/+1
Fixes checkpatch.pl warnings "Alignment should match open parenthesis". Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-16staging: vt6656: Add spaces between operatorsSimon Sandström1-2/+2
Fixes checkpatch.pl warnings "spaces preferred around that <operator>". Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-08staging: vt6656: Split arguments to avoid 80-char violation in rf.cDan Cashman1-1/+2
Wrap arguments of call to vnt_control_out() to avoid exceeding 80 character limit, but maintain alignment. Signed-off-by: Daniel Cashman <dan.a.cashman@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-08staging: vt6656: Replace embedded function name with __func__ in rf.cDan Cashman1-1/+1
Change embedded function name in vnt_rf_set_txpower with %s format with __func__ argument to make it consistent with other part of if-else and kernel coding style standards as reported by checkpatch. Signed-off-by: Daniel Cashman <dan.a.cashman@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-08staging: vt6656: convert spaces to tabs for rf.cDan Cashman1-5/+5
Address checkpatch errors encountered in rf.c by removing use of spaces and replacing with properly aligned tabs. Signed-off-by: Daniel Cashman <dan.a.cashman@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-16staging: vt6656: Alignment should match open parenthesisArushi Singhal1-6/+6
Fix checkpatch issues: "CHECK: Alignment should match open parenthesis" Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-21staging: vt6656: Fix coding style warnings on Block commentsVijai Kumar K1-3/+3
Fix checkpatch.pl warnings related to Block comments in staging/vt6656/rf.c file. Signed-off-by: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-24staging: vt6656: Remove unnecessary parentheses.Elise Lennion1-2/+2
The removed parentheses are unnecessary and don't add readability. Found using Coccinelle semantic patch: @@ expression e, e1, e2; @@ e += ( (e1 == e2) | - (e1) + e1 ) @@ expression e, e1, e2; @@ e = ( (e1 == e2) | - (e1) + e1 ) Signed-off-by: Elise Lennion <elise.lennion@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10staging: vt6656: Remove unnecessary parenthesesRehas Sachdeva1-2/+2
This patch removes the following checkpatch.pl warnings: Unnecessary parentheses around al7230_init_table_amode[0][0] Unnecessary parentheses around al7230_channel_table2[0][0] Signed-off-by: Rehas Sachdeva <aquannie@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-19staging: vt6656: remove address from GPL textOthmar Pasteka1-4/+0
Cleanup errors from checkpatch.pl. Signed-off-by: Othmar Pasteka <pasteka@kabsi.at> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-09staging: vt6656: vnt_rf_setpower: fix missing rate RATE_12MMalcolm Priestley1-0/+1
When the driver sets this rate a power of zero value is set causing data flow stoppage until another rate is tried. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Cc: <stable@vger.kernel.org> # v3.17+ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23Staging: vt6656: Merge two lines of code into oneRajbinder Brar1-4/+1
This patch merges an assignment with an immediately following return of the assigned variable. The following Coccinelle semantic patch was used to make this transformation: @@ expression ret; identifier f; @@ -ret= +return f(...); -return ret; A variable that became unused due to this transformation was also removed. Signed-off-by: Rajbinder Brar <brar.rajbinder@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-21staging: vt6656: struct vnt_private rf power table remove camel caseMalcolm Priestley1-7/+7
Camel case changes byCCKPwr -> cck_pwr byOFDMPwrG -> ofdm_pwr_g byOFDMPwrA -> ofdm_pwr_a byCurPwr -> power abyCCKPwrTbl -> cck_pwr_tbl abyOFDMPwrTbl -> ofdm_pwr_tbl abyOFDMAPwrTbl -> ofdm_a_pwr_tbl Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-21staging: vt6656: struct vnt_private rename uCurrRSSI to current_rssiMalcolm Priestley1-1/+1
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-21staging: vt6656: struct vnt_private replace byRFType with rf_typeMalcolm Priestley1-5/+5
Remove camel case Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-12staging: vt6656: rf.c cleanup commentsMalcolm Priestley1-61/+4
named comments are already referenced in revision history in high-level comment. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-12staging: vt6656: vnt_rf_write_embedded add reg length and IFREGCTL_REGWMalcolm Priestley1-121/+98
The rf register always have *_REG_LEN and IFREGCTL_REGW macros added. *_REG_LEN is always 23(0x17) replace them with VNT_RF_REG_LEN. Remove *_REG_LEN and IFREGCTL_REGW from tables and vnt_rf_set_txpower and apply VNT_RF_REG_LEN and IFREGCTL_REGW in vnt_rf_write_embedded Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-12staging: vt6656: rf.c remove dead code RFaby11aChannelIndexMalcolm Priestley1-31/+0
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-12staging: vt6656: rf.c clean up channel and power tablesMalcolm Priestley1-562/+515
Remove comments to channel number execpt where there is a change to 5gHz channel 15 named comments are already referenced in revision history in high-level comment. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-08staging: vt6656: vnt_rf_setpower rate <= RATE_11M check array boundMalcolm Priestley1-1/+4
decrement channel by one and check array bound. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-08staging: vt6656: vnt_rf_set_txpower use power for priv->byCurPwrMalcolm Priestley1-15/+13
The byCurPwr value can change state while in another thread,. Change to local variable power which is the last set value. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26staging: vt6656: remove dead code datarateMalcolm Priestley1-1/+0
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-26staging: vt6656: mac80211 conversion: change vnt_rf_set_txpowerMalcolm Priestley1-14/+9
Remove old eScanState code and use. priv->hw->conf.chandef.chan->hw_value to find current channel Check hw_value for bounds of vt3226d0_lo_current_table Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-28staging: vt6656: rf.c replace DBG_PRT debug messagesMalcolm Priestley1-5/+3
replace with dev_dbg Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-28staging: vt6656: rf.c Fix typo error at3226*Malcolm Priestley1-4/+4
In commit 78a650dc19ba44e2e07768c6d3b2ff080cf9d245 there was a typo error abyVT3226_InitTable -> at3226_init_table abyVT3226D0_InitTable -> at3226d0_init_table Shoud be vt3226_init_table and vt3226d0_init_table Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-28staging: vt6656: rf.c rename RFbRFTableDownload to vnt_rf_table_download.Malcolm Priestley1-1/+1
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-28staging: vt6656: rf.c/h rename RFvRSSITodBm to vnt_rf_rssi_to_dbmMalcolm Priestley1-1/+1
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-28staging: vt6656: rf.c/h rename RFbRawSetPower to vnt_rf_set_txpowerMalcolm Priestley1-5/+5
Remove raw and use txpower. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-28staging: vt6656: rf.c/h rename RFbSetPower to vnt_rf_setpowerMalcolm Priestley1-1/+1
Removing camel case Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-28staging: vt6656: rf.c: rename IFRFbWriteEmbedded to vnt_rf_write_embeddedMalcolm Priestley1-24/+24
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-28staging: vt6656: IFRFbWriteEmbedded remove camel caseMalcolm Priestley1-8/+8
Camel case changes pDevice -> priv dwData -> data pbyData -> reg_data Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-28staging: vt6656: IFRFbWriteEmbedded use ARRAY_SIZEMalcolm Priestley1-1/+1
Replace magic number with ARRAY_SIZE of pbyData Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-26staging: vt6656: dead code remove control.c/hMalcolm Priestley1-1/+1
Replace control.h headers with usbpipe.h Also add to usbpipe.c its header Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-26staging: vt6656: rename PIPEnsControlOut/CONTROLnsRequestOut to vnt_control_outMalcolm Priestley1-6/+6
Rename all CONTROLnsRequestOut and remove macro from control.h Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-18staging: vt6656: rndis.h move all to device.hMalcolm Priestley1-1/+0
Commands macros are common to all source files. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-18staging: vt6656: rf.c additional power.Malcolm Priestley1-0/+30
Provides extra power on weak RSSI. The values orginate from the vendors driver. It is applied later in RFbRawSetPower to simplify and check that it doesn't exceed the max power. Vendor driver VT6656_Linux_src_v1.21.03_x86_11.04.zip http://www.viaembedded.com/servlet/downloadSvl?id=1890&download_file_id=14704 This is GPL-licensed code. vendors code ... if (pDevice->byRFType == RF_VT3226D0) { if (lRSSI == 0){ lAdditionalPower = 7; } else if ((lRSSI < -60) && (lRSSI >= -65)){ lAdditionalPower = 5; //lAdditionalPower = 9; } else if ((lRSSI < -65) && (lRSSI >= -70)){ lAdditionalPower = 7; //lAdditionalPower = 9; } else if ((lRSSI < -70) && (lRSSI >= -80)){ lAdditionalPower = 9; } else if (lRSSI < -80) { lAdditionalPower = 9; } } else { if (lRSSI == 0){ lAdditionalPower = 7; } else if ((lRSSI < -70) && (lRSSI >= -75)){ lAdditionalPower = 5; } else if ((lRSSI < -75) && (lRSSI >= -80)){ lAdditionalPower = 7; } else if (lRSSI < -80) { lAdditionalPower = 9; } } ... Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-11-25staging: vt6656: Remove always 0 variable dwDiagRefCountMalcolm Priestley1-3/+0
Remove > 0 code. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-11-10staging: vt6656: Fix (most) sparse warnings regarding static functions/variablesValentina Manea1-2/+2
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 <valentina.manea.m@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>