Commit graph

153 commits

Author SHA1 Message Date
Malcolm Priestley
9a6f87704a staging: vt6656: remove difs / sifs adjustments.
Now mac89211 is doing frame timing in rxtx these vendor adjustments need
to be removed.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/034e445c-b245-52c4-c855-431b9783bcff@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-13 13:53:58 +02:00
Oscar Carter
91387f5eb9 staging: vt6656: Refactor the vnt_set_bss_mode function
Remove all the duplicate code in the "if, else if, else" statements as
all the branches in every "if" are almost the same. The only difference
between branches is some value. So, use variables instead of repeat
code.

Also, remove the unnecessary casting to u8 type because the
"priv->bb_type" variable is already an u8 tpe.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200429152307.5871-3-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-05 12:26:43 +02:00
Oscar Carter
35452e1061 staging: vt6656: Check the return values in vnt_set_bss_mode function
Check the return value of all the functions that return zero if
successful or a negative error code on failure inside the function
vnt_set_bss_mode.

Also, remove the unnecessary variable initialization as this variable is
set a few lines later.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200429152307.5871-2-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-05 12:26:43 +02:00
Oscar Carter
f5e5e3024c staging: vt6656: Remove functions' documentation
Remove the functions' documentation as the names of the functions are
clear enought. Also, the actual documentation it's not correct in all
cases.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200425134257.4502-3-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-28 14:16:50 +02:00
Oscar Carter
81969fd8ab staging: vt6656: Check the return value of vnt_control_out_* calls
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-28 14:16:49 +02:00
Oscar Carter
bf42304b55 staging: vt6656: Use fls instead of for loop in vnt_update_top_rates
Replace the for loops of the vnt_update_top_rates function by the fls
function.

The purpose of the two for loops is to find the most significant bit set
in a range of bits. So, they can be replace by the fls function (find
last set) with a previous mask to define the range.

This way avoid the iteration over unnecessary for loops.

The header "linux/bits.h" can be remove as it is included in the header
"linux/bitops.h".

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200420155246.4925-1-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 13:39:51 +02:00
Oscar Carter
9f8c9f4a2e staging: vt6656: Refactor the vnt_ofdm_min_rate function
Replace the for loop by a ternary operator whose condition is an AND
bitmask against the priv->basic_rates variable.

The purpose of the for loop was to check if any of bits from RATE_54M to
RATE_6M was set, but it's not necessary to check every individual bit.
The same result can be achieved using only one single mask which
comprises all the commented bits.

This way avoid the iteration over an unnecessary for loop.

Also change the return type to bool because it's the type that this
function returns.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200418134553.6415-1-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 13:38:08 +02:00
Oscar Carter
91fdbcd909 staging: vt6656: Use BIT() macro instead of bit shift operator
Use the BIT() macro instead of the bit left shift operator. So the code
is more clear.

It's safe to remove the casting to u16 type because the value obtained
never exceeds 16 bits. So the casting is unnecessary.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200414153849.5785-3-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-16 13:40:20 +02:00
Malcolm Priestley
ce92032666 staging: vt6656: formulate rspinf values into tables
Four tables can be extracted from RSPINF_A_* based on BB_TYPE_11A or
else being GB rates.

Preamble short or long tables from fixed size len of 14 for RSPINF_B rates.

Remove function vnt_calculate_ofdm_rate and replace with the tables
calling RSPINF_A and RSPINF_B separately.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/addca9e1-9ea2-59ee-dec9-3afb3c731c2e@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-13 14:59:17 +02:00
Malcolm Priestley
55126bb37d staging: vt6656: set all cck rates to default.
mac80211 rate control decides which cck rates to use so all of
them should be set enabled at the appropriate bit rate.

This means vnt_get_cck_rate is no longer required.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/dec847da-5bad-1920-f275-741f7f704fb3@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-13 08:55:28 +02:00
Malcolm Priestley
1b3409b574 staging: vt6656: set all ofdm rates to default
mac80211 rate control decides which odfm rates to use so all of
them should be set enabled at the appropriate bit rate.

This means vnt_get_ofdm_rate is no longer required.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/9a52d7f4-dd3e-efdc-eef8-bb794f7dea6d@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-13 08:55:28 +02:00
John B. Wyatt IV
afa2e976b1 staging: vt6656: add error code handling to unused variable
Add error code handling to unused 'ret' variable that was never used.
Return an error code from functions called within vnt_radio_power_on.

Issue reported by coccinelle (coccicheck).

Suggested-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
Suggested-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
Signed-off-by: John B. Wyatt IV <jbwyatt4@gmail.com>
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Link: https://lore.kernel.org/r/20200330233900.36938-1-jbwyatt4@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-13 08:55:28 +02:00
Oscar Carter
3017e587e3 staging: vt6656: Use BIT() macro in vnt_mac_reg_bits_* functions
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-21 11:03:16 +01:00
Malcolm Priestley
07f59f180e staging: vt6656: remove bool from vnt_radio_power_on ret
The driver uses logical only error checking a bool true would flag error.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/cc52b67c-9ef8-3e57-815a-44d10701919e@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-03 11:46:58 +01:00
Colin Ian King
57744c8d5c staging: vt6656: fix indentation on break statement
The break statement is indented one level too deep, fix this.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-20 14:32:07 +02:00
Quentin Deslandes
7156f7d9c3 staging: vt6656: avoid discarding called function's return code
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>
2019-05-21 08:25:03 +02:00
Greg Kroah-Hartman
dd41dab5d5 staging: vt6656: Remove redundant license text
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-28 13:20:47 +01:00
Greg Kroah-Hartman
6b4c6ce892 staging: vt6656: add SPDX identifiers to all vt6656 driver files
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-11-28 13:20:47 +01:00
Gustavo A. R. Silva
ddb35ab8d9 staging: vt6656: card: mark expected switch fall-throughs
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 16:21:26 +02:00
Malcolm Priestley
c3972591d9 staging: vt6656: vnt_update_ifs set max_min based on short slot time.
Short slot time is controlled by mac80211 so there is no need to find
odfm rates.

Merge PK_TYPE_11B and PK_TYPE_11GA & PK_TYPE_11GB into one else and
switch on short slot time.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-15 07:41:58 +02:00
Elise Lennion
ce439c425b staging: vt6656: Compress return logic into one line.
Compress the return logic into one line avoids unnecessary variable
declarations. In this case it also makes it easier to understand the
function.

Coccinelle was used to find this return statement. However, additional
compressions were done to make the function clearer.

Semantic patch:
@@
local idexpression ret;
expression e;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-17 10:27:55 +02:00
Mikhail Golubev
f4190ce37f staging:vt6656:card.c: fix block comments should align the * on each line
Block comments should align the * on each line as reported by checkpatch.pl

Signed-off-by: Mikhail Golubev <golubev.mikhail@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-16 10:27:27 +02:00
Rithvik Patibandla
e7c856556a staging:vt6656:card.c: fix camel case issue
Fix "Avoid camel case" issue thrown by checkpatch.pl

Signed-off-by: Rithvik Patibandla <rithvikp98@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 18:10:24 +02:00
Rithvik Patibandla
6d898d6958 staging:vt6656:card.c: fix blank line issue
Fix "Please use a blank line after function declaration" check thrown
by checkpatch.pl

Signed-off-by: Rithvik Patibandla <rithvikp98@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 18:10:24 +02:00
Rithvik Patibandla
7b25c75e55 staging:vt6656:card.c: fix blank lines issue
Fix "Blank lines aren't necessary after an open brace" check thrown by
checkpatch.pl

Signed-off-by: Rithvik Patibandla <rithvikp98@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 18:10:24 +02:00
Rithvik Patibandla
a9f47a456a staging:vt6656:card.c:fix alignment checks
Fix "Alignment should match with open paranthesis" check thrown by
checkpatch.pl

Signed-off-by: Rithvik Patibandla <rithvikp98@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 18:10:24 +02:00
Rithvik Patibandla
b01a5d7160 staging:vt6656:card.c:Fix comment block issue
Fix "Block comments use * on subsequent lines" and "Block comments use
*/ on trailing lines" warnings thrown by checkpatch.pl

Signed-off-by: Rithvik Patibandla <rithvikp98@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 18:10:24 +02:00
Othmar Pasteka
a85994d546 staging: vt6656: remove address from GPL text
Cleanup errors from checkpatch.pl.

Signed-off-by: Othmar Pasteka <pasteka@kabsi.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-19 16:53:09 -08:00
Burcin Akalin
a09ad8c7a3 staging: vt6656: Do not use multiple blank lines.
Remove multiple blank lines. Problem found using checkpatch.pl
"CHECK: Please don't use multiple blank lines"

Signed-off-by: Burcin Akalin <brcnakalin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-27 16:53:12 +09:00
Burcin Akalin
fd49ebb6dd staging: vt6656: Add space around '|'
Add space around operator '|'. Problem found using
checkpatch.pl
CHECK: spaces preferred around that '|' (ctx:VxV)

Signed-off-by: Burcin Akalin <brcnakalin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-27 16:53:12 +09:00
Amitoj Kaur Chawla
574dddc6d7 staging: vt6656: Prefer using BIT Macro
Replace bit shifting on 1 with the BIT(x) Macro

The semantic patch used to find this is:
@@ int g; @@

-(1 << g)
+BIT(g)

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16 23:05:17 -07:00
Amitoj Kaur Chawla
4b1443a248 staging: vt6656: Remove useless initialisation
Remove intialisation of a variable that is immediately reassigned.

The semantic patch used to find this is:

// <smpl>
@@
type T;
identifier x;
constant C;
expression e;
@@

T x
- = C
 ;
x = e;
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-16 23:05:17 -07:00
Abdul Hussain
5699c0f4fc staging: vt6656: Boolean tests don't need comparisons.
This patch remove true and false from boolean tests.

Signed-off-by: Abdul Hussain <habdul@visteon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-17 21:26:45 -07:00
Gustavo A. R. Silva
733b3b0794 Staging: vt6656: Fixed typo in a macro name
Fixed typo in a macro name in card.c and device.h files.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-12 19:46:50 -08:00
Tapasweni Pathak
3e46587ef1 staging: vt6656: remove unnecessary else after return
This patch fixes checkpatch.pl warning in files of vt6656
WARNING: else is not generally useful after a break or return

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 13:41:15 -07:00
Malcolm Priestley
a8492a0baf staging: vt6656: remove comments of old functions nolonger present.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-27 09:03:44 -07:00
Malcolm Priestley
d78551b945 staging: vt6656: remove return from all void functions
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-27 09:03:44 -07:00
Malcolm Priestley
c37cbd3706 staging: vt6656: struct vnt_private replace abyBBVGA with bb_vga
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-21 12:16:29 -07:00
Malcolm Priestley
a641c9ec88 staging: vt6656: struct vnt_private replace bShortSlotTime with short_slot_time
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-21 12:16:29 -07:00
Malcolm Priestley
d80bf43c82 staging: vt6656: struct vnt_private replace byTopCCKBasicRate with top_cck_basic_rate
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-21 12:16:28 -07:00
Malcolm Priestley
3c8a5b2598 staging: vt6656: struct vnt_private replace byTopOFDMBasicRate with top_ofdm_basic_rate
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-21 12:16:28 -07:00
Malcolm Priestley
93a7355883 staging: vt6656: struct vnt_private replace wBasicRate with basic_rates
The same name as in struct ieee80211_bss_conf

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-21 12:16:28 -07:00
Malcolm Priestley
e12471db91 staging: vt6656: struct vnt_private replace byPacketType with packet_type
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-21 12:16:28 -07:00
Malcolm Priestley
65df77e2ca staging: vt6656: struct vnt_private replace byBBType with bb_type
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-21 12:16:28 -07:00
Malcolm Priestley
ff5fee2229 staging: vt6656: struct vnt_private remove camel case IFS names
Camel case changes
uSIFS -> sifs
uDIFS -> difs
uEIFS -> eifs
uSlot -> slot

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-21 12:11:58 -07:00
Malcolm Priestley
995c91e0c2 staging: vt6656: struct vnt_private remove uCwMin/uCwMax
Although set these variables are not used.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-21 12:11:58 -07:00
Malcolm Priestley
113f0b915b staging: vt6656: struct vnt_private rename qwCurrTSF to current_tsf
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-21 12:11:57 -07:00
Malcolm Priestley
6242ecaeb6 staging: vt6656: struct vnt_private replace byRFType with rf_type
Remove camel case

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-21 12:11:56 -07:00
Malcolm Priestley
d7f2d8f61e staging: vt6656: put radio power off and on into correct state every time.
When radio is off bit GPIO3_INTMD should be on and off when radio is on.

Add these to the tail of vnt_radio_power_off and vnt_radio_power_on
and remove variable bHWRadioOff.

In device_init_registers just check GPIO3_DATA are in correct state and
always power on.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-18 16:11:28 -07:00
Malcolm Priestley
409bc044a4 staging: vt6656: struct vnt_private remove unused variable bRadioOff
The variable flips from true to false but does nothing

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-18 16:11:28 -07:00