summaryrefslogtreecommitdiff
path: root/drivers/staging/vt6656/baseband.c
AgeCommit message (Collapse)Author
2020-05-05staging: vt6656: Use const for read only dataOscar Carter
Use const for the arrays that are used as "read only". Also, modify the prototype of vnt_control_out_blocks() function to use a pointer to a const type. The vnt_vt3184_al2230 array can't be converted to const as it's modified later. Then in the vnt_vt3184_init() function use two types of pointers (to const type and to no const type) to avoid the compiler warning: assignment discards 'const' qualifiers from pointer target type This way decrease the .data section and increase the .rodata section limiting the surface attack. Before this change: ------------------- drivers/staging/vt6656/baseband.o : section size addr .text 1278 0 .data 576 0 .bss 0 0 .rodata 319 0 .comment 45 0 .note.GNU-stack 0 0 .note.gnu.property 32 0 Total 2250 After this change: ------------------ drivers/staging/vt6656/baseband.o : section size addr .text 1278 0 .data 256 0 .bss 0 0 .rodata 640 0 .comment 45 0 .note.GNU-stack 0 0 .note.gnu.property 32 0 Total 2251 Signed-off-by: Oscar Carter <oscar.carter@gmx.com> Link: https://lore.kernel.org/r/20200504171414.11307-1-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-28staging: vt6656: Check the return value of vnt_control_out_* callsOscar Carter
Check the return value of vnt_control_out_* function calls. When necessary modify the function prototype to be able to return the new checked error code. It's safe to modify all the function prototypes without fix the call because the only change is the return value from void to int. If before the call didn't check the return value, now neither. Signed-off-by: Oscar Carter <oscar.carter@gmx.com> Link: https://lore.kernel.org/r/20200425134257.4502-2-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23staging: vt6656: Move vnt_get_frame_time and vnt_get_phy_field to rxtxMalcolm Priestley
These functions are only used by rxtx so move them and their arrays used with them abbreviating the function description. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Link: https://lore.kernel.org/r/2a4fd665-2fe1-f1ad-1e9a-1b01f698ea79@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-16staging: vt6656: remove redundant assignment to variable ed_inxColin Ian King
The variable ed_inx is being initialized with a value that is never read and it is being updated later with a new value. The initialization is redundant and can be removed. Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20200414143502.237803-1-colin.king@canonical.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-16staging: vt6656: Remove duplicate code for the phy->service assignmentOscar Carter
Take out the "phy->service" assignment from the if-else statement due to it's the same for the two branches. Signed-off-by: Oscar Carter <oscar.carter@gmx.com> Link: https://lore.kernel.org/r/20200414153849.5785-6-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-16staging: vt6656: Refactor the assignment of the phy->signal variableOscar Carter
Create a constant array with the values of the "phy->signal" for every rate. Remove all "phy->signal" assignments inside the switch statement and replace these with a single reading from the new vnt_phy_signal array. The constant array can be of one dimension because the OR mask with BIT(3) or BIT(4) allow obtain a second value according to the rate, the preamble_type and the pkt_type. Signed-off-by: Oscar Carter <oscar.carter@gmx.com> Link: https://lore.kernel.org/r/20200414153849.5785-5-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-16staging: vt6656: Use define instead of magic number for tx_rateOscar Carter
Use the define RATE_11M present in the file "device.h" instead of the magic number 3. So the code is more clear. Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Oscar Carter <oscar.carter@gmx.com> Link: https://lore.kernel.org/r/20200414153849.5785-4-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-13staging: vt6656: Remove unnecessary local variable initializationOscar Carter
Don't initialize the ret variable as it is set a few lines later. Signed-off-by: Oscar Carter <oscar.carter@gmx.com> Link: https://lore.kernel.org/r/20200411125104.9625-3-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-13staging: vt6656: Remove duplicate code in vnt_vt3184_init functionOscar Carter
Remove duplicate code in "if" statements because different branches are almost the same. Signed-off-by: Oscar Carter <oscar.carter@gmx.com> Link: https://lore.kernel.org/r/20200411125104.9625-2-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-13staging: vt6656: Remove unnecessary local variable initializationOscar Carter
Don't initialize the rate variable as it is set a few lines later. Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Oscar Carter <oscar.carter@gmx.com> Link: https://lore.kernel.org/r/20200407163915.7491-3-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-13staging: vt6656: Refactor the vnt_update_pre_ed_threshold functionOscar Carter
Create three arrays with the threshold data use in the switch statement of the vnt_update_pre_ed_threshold function. These three arrays contains elements of struct vnt_threshold new type. Create a for loop in the vnt_update_pre_ed_threshold function to do exactly the same that the if-elseif-else statements in the switch statement. Also, remove the if check against the !cr_201 && !cr_206 due to now it is replace by the NULL check against the threshold pointer. When this pointer is NULL means that the cr_201 and cr_206 variables have not been assigned, that is the same that the old comparison against cr_201 and cr_206 due to these variables were initialized with 0. The statistics of the old baseband object file are: section size addr .text 3415 0 .data 576 0 .bss 0 0 .rodata 120 0 .comment 45 0 .note.GNU-stack 0 0 .note.gnu.property 28 0 Total 4184 The statistics of the new baseband object file are: section size addr .text 2209 0 .data 576 0 .bss 0 0 .rodata 344 0 .comment 45 0 .note.GNU-stack 0 0 .note.gnu.property 28 0 Total 3202 With this refactoring it increase a little the readonly data but it decrease much more the .text section. This refactoring decrease the footprint and makes the code more clear. Signed-off-by: Oscar Carter <oscar.carter@gmx.com> Reviewed-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk> Link: https://lore.kernel.org/r/20200328181706.14276-1-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-13staging: vt6656: Use defines in preamble_type variablesOscar Carter
Use the PREAMBLE_SHORT and PREAMBLE_LONG defines present in the file "baseband.h" to assign values to preamble_type variables. Also, use the same defines to make comparisons against these variables. In this way, avoid the use of numerical literals or boolean values and make the code more clear. Signed-off-by: Oscar Carter <oscar.carter@gmx.com> Reviewed-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk> Link: https://lore.kernel.org/r/20200328141738.23810-1-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-27staging: vt6656: Use DIV_ROUND_UP macro instead of specific codeOscar Carter
Use DIV_ROUND_UP macro instead of specific code with the same purpose. Also, remove the unused variables. Signed-off-by: Oscar Carter <oscar.carter@gmx.com> Reviewed-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk> Link: https://lore.kernel.org/r/20200326175902.14467-1-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-21staging: vt6656: Use BIT() macro in vnt_mac_reg_bits_* functionsOscar Carter
The last parameter in the functions vnt_mac_reg_bits_on and vnt_mac_reg_bits_off defines the bits to set or unset. So, it's more clear to use the BIT() macro instead of an hexadecimal value. Signed-off-by: Oscar Carter <oscar.carter@gmx.com> Link: https://lore.kernel.org/r/20200320181326.12156-1-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-04staging: vt6656: vnt_vt3184_init remove stack copy to array.Malcolm Priestley
use u8 pointer addr directly and remove stack array. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Link: https://lore.kernel.org/r/49f34764-c90c-8c5f-b4f2-a3668b13e519@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-04staging: vt6656: use vnt_vt3184_agc array directlyMalcolm Priestley
vnt_vt3184_agc is always the same regardless of rf type so use the array directly removing from stack buffer. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Link: https://lore.kernel.org/r/4b455ee4-7ac7-e1ff-4a10-2d99f2e30714@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-13Merge 5.5-rc6 into staging-nextGreg Kroah-Hartman
We need the staging fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-03staging: vt6656: limit reg output to block sizeMalcolm Priestley
vnt_control_out appears to fail when BBREG is greater than 64 writes. Create new function that will relay an array in no larger than the indicated block size. It appears that this command has always failed but was ignored by driver until the introduction of error checking. Cc: stable <stable@vger.kernel.org> # v5.3+ Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Link: https://lore.kernel.org/r/a41f0601-df46-ce6e-ab7c-35e697946e2a@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-03staging: vt6656: remove unnecessary parenthesisAmir Mahdi Ghorbanian
Remove unnecessary parenthesis to abide by kernel coding-style. Signed-off-by: Amir Mahdi Ghorbanian <indigoomega021@gmail.com> Link: https://lore.kernel.org/r/20191230155520.GA27072@user-ThinkPad-X230 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21staging: vt6656: avoid discarding called function's return codeQuentin Deslandes
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-Hartman
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-Hartman
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>
2016-04-29staging: vt6656: Add space to align functionshan tai
Issue found by checkpatch.pl CHECK: Alignment should match open parenthesis Signed-off-by: han tai <hantai1248@hotmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-19staging: vt6656: remove address from GPL textOthmar Pasteka
Cleanup errors from checkpatch.pl. Signed-off-by: Othmar Pasteka <pasteka@kabsi.at> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-08staging: vt6656: Remove space before closing braceAmitoj Kaur Chawla
Remove space before closing brace '}'. Problem found using checkpatch.pl CHECK: Blank lines aren't necessary before a close brace '}' Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-08staging: vt6656: Remove space after opening braceAmitoj Kaur Chawla
Remove space after opening brace '{'. Problem found using checkpatch.pl CHECK: Blank lines aren't necessary after an open brace '{' Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19Staging: vt6656: Removing else after break statement to fix warningRajbinder Brar
This patch fixes the checkpatch.pl warning in baseband.c file WARNING: else is not useful after a break or return Signed-off-by: Rajbinder Brar <brar.rajbinder@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-21staging: vt6656: struct vnt_private rename byBBPreEDIndex with bb_pre_ed_indexMalcolm Priestley
Removing type prefix and camel case. 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 byBBPreEDRSSI with bb_pre_ed_rssiMalcolm Priestley
Remove type prefix and camel case. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-21staging: vt6656: struct vnt_private remove dead code ldBmThresholdMalcolm Priestley
ldBmThreshold was used in old function s_vCheckSensitivity which had been disabled in orginal vendors code. 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 abyBBVGA with bb_vgaMalcolm Priestley
Removing type prefix and camel case. 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 bShortSlotTime with short_slot_timeMalcolm Priestley
Removing type prefix and camel case 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 byPreambleType with preamble_typeMalcolm Priestley
Removing type prefix and camel case. 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 abyEEPROM with eepromMalcolm Priestley
Removing type prefix and camel case. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-21staging: vt6656: remove variable byZoneTypeMalcolm Priestley
Zone types are nolonger handled by driver. 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 byBBRxConf to bb_rx_confMalcolm Priestley
Remove camel case 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 Priestley
Remove camel case Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-17staging: vt6656: rename BBvUpdatePreEDThreshold to vnt_update_pre_ed_thresholdMalcolm Priestley
Dropping BB Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-17staging: vt6656: rename BBvExitDeepSleep to vnt_exit_deep_sleepMalcolm Priestley
Dropping BB Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-17staging: vt6656: rename BBvSetDeepSleep to vnt_set_deep_sleepMalcolm Priestley
Dropping BB Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-17staging: vt6656: rename BBvSetVGAGainOffset to vnt_set_vga_gain_offsetMalcolm Priestley
Dropping BB Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-17staging: vt6656: rename BBvSetShortSlotTime to vnt_set_short_slot_timeMalcolm Priestley
Dropping BB Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-17staging: vt6656: rename BBbVT3184Init to vnt_vt3184_initMalcolm Priestley
Dropping BB Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-17staging: vt6656: rename BBvSetAntennaMode to vnt_set_antenna_modeMalcolm Priestley
Dropping BB Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-17staging: vt6656: baseband.c rename awcFrameTime to vnt_frame_timeMalcolm Priestley
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-15staging: vt6556: Cleanup coding style: lines over 80 charsPeter Senna Tschudin
This patch cleanup the follwoing coding style issues: - line over 80 chars - spaces on the beginning of a line - put { and } on the correct places Tested by compilation only. Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-15staging: vt6556: Cleanup coding style: commentsPeter Senna Tschudin
This patch cleanup coding style issues on comments. Tested by compilation only. Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-15staging: vt6556: Remove double parenthesesPeter Senna Tschudin
This patch cleanup a checkpatch warning by removing double parentheses from if condition. Additionally it fixes a line over 80 chars. Tested by compilation only. Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-12staging: vt6656: baseband.c rename abyVT3184_VT3226D0 to vnt_vt3184_vt3226d0Malcolm Priestley
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-12staging: vt6656: baseband.c remame abyVT3184_AL2230 to vnt_vt3184_al2230Malcolm Priestley
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>