Commit Graph

1260 Commits

Author SHA1 Message Date
Oscar Carter
d78b62c3ea staging: vt6656: Use return instead of goto
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-28 14:26:29 +02:00
Oscar Carter
8a5baa66b0 staging: vt6656: Remove the local variable "array"
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 12ecd24ef9
("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-28 14:26:29 +02:00
Malcolm Priestley
9075e3180e staging: vt6656: Remove preamble_type setting from vnt_tx_packet.
preamble_type is set in vnt_bss_info_changed no need to set it
here.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/04874ae5-0859-7cb5-619a-ac96a207be5d@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-28 14:25:26 +02:00
Malcolm Priestley
7d1a8c9849 staging: vt6656: Remove set short time in vnt_init_registers.
The short time is set in vnt_bss_info_changed no need to set it
here.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/a2bfc4f5-3f7f-3718-6056-2907a004477f@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-28 14:25:26 +02:00
Malcolm Priestley
ea0c2a6214 staging: vt6656: rxtx: remove duration_id and void returns.
duration_id is not used by driver anymore so remove the returns
and set all functions in patch to void.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/04a9c19f-c374-c175-6e46-d1bfbab2f42e@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-28 14:19:13 +02:00
Oscar Carter
345f2d84dd staging: vt6656: Add formula to the vnt_rf_addpower function
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-28 14:19:13 +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
Greg Kroah-Hartman
e8014d83f6 Merge 5.7-rc3 into staging-next
We need the staging fixes in here too, and this resolves a merge issue
with the vt6656 driver.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-27 12:20:40 +02:00
Malcolm Priestley
664ba51802 staging: vt6656: Fix calling conditions of vnt_set_bss_mode
vnt_set_bss_mode needs to be called on all changes to BSS_CHANGED_BASIC_RATES,
BSS_CHANGED_ERP_PREAMBLE and BSS_CHANGED_ERP_SLOT

Remove all other calls and vnt_update_ifs which is called in vnt_set_bss_mode.

Fixes an issue that preamble mode is not being updated correctly.

Fixes: c12603576e ("staging: vt6656: Only call vnt_set_bss_mode on basic rates change.")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/44110801-6234-50d8-c583-9388f04b486c@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 13:47:34 +02:00
Malcolm Priestley
0b59f10b1d staging: vt6656: Fix pairwise key entry save.
The problem is that the group key was saved as VNT_KEY_DEFAULTKEY
was over written by the VNT_KEY_GROUP_ADDRESS index.

mac80211 could not clear the mac_addr in the default key.

The VNT_KEY_DEFAULTKEY is not necesscary so remove it and set as
VNT_KEY_GROUP_ADDRESS.

mac80211 can clear any key using vnt_mac_disable_keyentry.

Fixes: f9ef05ce13 ("staging: vt6656: Fix pairwise key for non station modes")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/da2f7e7f-1658-1320-6eee-0f55770ca391@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 13:44:32 +02:00
Malcolm Priestley
09057742af staging: vt6656: Fix drivers TBTT timing counter.
The drivers TBTT counter is not synchronized with mac80211 timestamp.

Reorder the functions and use vnt_update_next_tbtt to do the final
synchronize.

Fixes: c15158797d ("staging: vt6656: implement TSF counter")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/375d0b25-e8bc-c8f7-9b10-6cc705d486ee@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 13:43:55 +02:00
Malcolm Priestley
0f8240bfc0 staging: vt6656: Don't set RCR_MULTICAST or RCR_BROADCAST by default.
mac80211/users control whether multicast is on or off don't enable it by default.

Fixes an issue when multicast/broadcast is always on allowing other beacons through
in power save.

Fixes: db8f37fa33 ("staging: vt6656: mac80211 conversion: main_usb add functions...")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/2c24c33d-68c4-f343-bd62-105422418eac@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 13:43:38 +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
Malcolm Priestley
3436accadc staging: vt6656: Move vnt_get_frame_time and vnt_get_phy_field to rxtx
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-23 13:33:36 +02:00
Malcolm Priestley
6f21cb793c staging: vt6656: call vnt_update_pre_ed_threshold from vnt_config.
vnt_update_pre_ed_threshold needs to be updated more often so
call from vnt_config where it updated on any of config changes.

It must have maximum sensitivity when the device is off channel
or idle.

Remove all the other calls in scanning and bss.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/1b00c112-347c-b0bb-61ed-a874ee448ff8@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 13:33:36 +02:00
Malcolm Priestley
72d55ebb50 staging: vt6656: Move firmware functions into main_usb.
The firmware function are not that complicated so
move them into main_usb as static functions in callers
visibility

Firmware definitions moved to device.h and MODULE_FIRMWARE
move to below module_usb_driver.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/7b384871-826b-9365-e3ed-5717ecefd31c@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 13:31:59 +02:00
Malcolm Priestley
ea81c34864 staging: vt6656: Power save stop wake_up_count wrap around.
conf.listen_interval can sometimes be zero causing wake_up_count
to wrap around up to many beacons too late causing
CTRL-EVENT-BEACON-LOSS as in.

wpa_supplicant[795]: message repeated 45 times: [..CTRL-EVENT-BEACON-LOSS ]

Fixes: 43c93d9bf5 ("staging: vt6656: implement power saving code.")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/fce47bb5-7ca6-7671-5094-5c6107302f2b@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-16 13:45:15 +02:00
Colin Ian King
7f3115fbfe staging: vt6656: remove redundant assignment to variable ed_inx
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-16 13:41:00 +02:00
Oscar Carter
5a78455625 staging: vt6656: Remove duplicate code for the phy->service assignment
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-16 13:40:22 +02:00
Oscar Carter
8a29fb1fcf staging: vt6656: Refactor the assignment of the phy->signal variable
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-16 13:40:22 +02:00
Oscar Carter
8b0eb26ad5 staging: vt6656: Use define instead of magic number for tx_rate
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-16 13:40:21 +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
Oscar Carter
f823cce279 staging: vt6656: Return error code in vnt_rf_write_embedded function
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-16 12:54:25 +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
Oscar Carter
823b6a951f staging: vt6656: Remove unnecessary local variable initialization
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-13 14:57:46 +02:00
Oscar Carter
2661509ffa staging: vt6656: Remove duplicate code in vnt_vt3184_init function
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-13 14:57:45 +02:00
Oscar Carter
8d71b5e11d staging: vt6656: Remove unnecessary local variable initialization
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-13 14:55:33 +02:00
Malcolm Priestley
2da5445be1 staging: vt6656: rxtx remove rate change and current_rate.
There is no longer any need to change power in vnt_tx_packet.

Remove current_rate in vnt_tx_packet and struct vnt_private as
it is no longer used elsewhere.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/3ba896aa-5ab2-affb-9ce5-7df8a9b3190a@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-13 14:53:22 +02:00
Malcolm Priestley
463288b981 staging: vt6556: vnt_rf_setpower convert to use ieee80211_channel.
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-13 14:53:21 +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
Malcolm Priestley
5035fc5915 staging: vt6656: replace al2230_power_table array with formula.
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>
2020-04-13 08:55:28 +02:00
Oscar Carter
d12d96ff66 staging: vt6656: Define EnCFG_BBType_MASK as OR between previous defines
Define the EnCFG_BBType_MASK bit as an OR operation between two previous
defines instead of using the OR between two new BIT macros. Thus, the
code is more clear.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
Link: https://lore.kernel.org/r/20200402170103.22520-1-oscar.carter@gmx.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
69a809e156 staging: vt6656: Refactor the vnt_update_pre_ed_threshold function
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-13 08:55:27 +02:00
Oscar Carter
3b643f4311 staging: vt6656: Use defines in preamble_type variables
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-04-13 08:55:27 +02:00
Oscar Carter
e681bb287f staging: vt6656: Use DIV_ROUND_UP macro instead of specific code
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-27 10:05:52 +01: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
Oscar Carter
a74081b442 staging: vt6656: Use BIT() macro instead of hex value
Use the BIT() macro instead of the hexadecimal value to define the
different bits in registers.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200320171056.7841-1-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-21 10:58:16 +01:00
Oscar Carter
cad144d6e5 staging: vt6656: Use ARRAY_SIZE instead of hardcoded size
Use ARRAY_SIZE to replace the hardcoded size so we will never have a
mismatch.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200318174015.7515-1-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-19 15:13:41 +01:00
Oscar Carter
d8dd36459d staging: vt6656: Use BIT_ULL() macro instead of bit shift operation
Replace the bit left shift operation with the BIT_ULL() macro and remove
the unnecessary mask off operation against the bit_nr variable.

This mask is only there for legacy reasons. Originally it was 31 (0x1f)
and the bit_nr variable spread across an mc_filter array with two u32
elements. Now, this mask is not needed because its value is 0x3f and the
mc_filter variable is an u64 type.

In this situation, the 26 bit right shift operation against the value
returned by the ether_crc function set the bit_nr variable to the
following value:

bit 31 to bit 6 -> All 0 (due to the bit shift operation happens over an
unsigned type).

bit 5 to bit 0 -> The 6 msb bits of the value returned by the ether_crc
function.

The purpose of the 0x3f mask against the bit_nr variable is to reset
(set to 0) the 26 msb bits (bit 31 to bit 6), but these bits are yet 0.
So, the mask off operation is now unnecessary.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200314161441.4870-1-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-17 12:28:03 +01:00
Malcolm Priestley
696089de8e staging: vt6656: struct vnt_rcb remove unused in_use.
The variable merely toggles true to false and is unused.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/130a4078-2502-a381-46c4-b473815e153b@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-10 10:51:20 +01:00
Malcolm Priestley
d1ec124246 staging: vt6656: Remove vnt_interrupt_buffer in_use flag.
mac80211 is the only user of in_use to start it and should
not be true when so.

So internal toggling of this variable is not relevant.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/69585034-4318-4bec-7d9b-f64a167df237@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-10 10:51:20 +01:00
Payal Kshirsagar
ad3ee73007 staging: vt6656: remove blank line
To avoid style issues, remove multiple blank lines.

Signed-off-by: Payal Kshirsagar <payalskshirsagar1234@gmail.com>
Acked-by: Julia Lawall <julia.lawall@inria.fr>
Link: https://lore.kernel.org/r/20200309073424.4920-1-payalskshirsagar1234@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-10 10:15:21 +01:00
Oscar Carter
7db73c8c90 staging: vt6656: Remove unnecessary local variables initialization
Don't initialize variables that are then set a few lines later.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Reviewed-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
Link: https://lore.kernel.org/r/20200301135028.11753-1-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-04 07:54:09 +01:00
Malcolm Priestley
3c505f508f staging: vt6656: Move vnt_rx_data to usbpipe.c
vnt_rx_data is a USB function and vnt_submit_rx_urb_complete is
the only caller therefore removing dpc.c/h files and becoming
static.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/d3937276-5a47-7184-e263-84d9c9cb5c7a@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-04 07:54:09 +01:00
Malcolm Priestley
10e9a359ce staging: vt6656: Delete int.c/h file and move functions to usbpipe
Move functions vnt_int_process_data and vnt_int_report_rate to
usbpipe.c and vnt_interrupt_data to usbpipe.h

These form part of the USB structure.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/bc21d3d7-81be-4ec1-030e-4e7a45f98238@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-04 07:52:32 +01:00
Malcolm Priestley
05f665dd0f staging: vt6656: Remove function vnt_int_process_data.
call vnt_start_interrupt_urb directly from vnt_start.

Move debug message to vnt_start_interrupt_urb.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/dff3a1d0-4d24-d9ea-2a15-c81fd544bc79@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-04 07:52:32 +01:00