[PATCH] staging/rtl8192e: Remove function callback casts

2020-05-24 Thread Oscar Carter
In an effort to enable -Wcast-function-type in the top-level Makefile to support Control Flow Integrity builds, remove all the function callback casts. To do this modify the function prototypes accordingly. Signed-off-by: Oscar Carter --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 24

[PATCH] staging: greybus: Fix uninitialized scalar variable

2020-05-10 Thread Oscar Carter
e flow control type, so remove the OR / AND self operator and set the value directly. Addresses-Coverity-ID: 1374016 ("Uninitialized scalar variable") Fixes: e55c25206d5c9 ("greybus: uart: Handle CRTSCTS flag in termios") Signed-off-by: Oscar Carter --- drivers/staging/greybus/u

[PATCH] staging: vt6656: Remove logically dead code

2020-05-10 Thread Oscar Carter
Coverity-ID: 1230228 ("Logically dead code") Fixes: f53d9f12c51a ("staging: vt6656: rf.c additional power.") Signed-off-by: Oscar Carter --- drivers/staging/vt6656/rf.c | 17 - 1 file changed, 17 deletions(-) diff --git a/drivers/staging/vt6656/rf.c

[PATCH] staging: vt6656: Use const for read only data

2020-05-04 Thread Oscar Carter
.GNU-stack 0 0 .note.gnu.property 32 0 Total2251 Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 14 +- drivers/staging/vt6656/usbpipe.c | 2 +- drivers/staging/vt6656/usbpipe.h | 2 +- 3 files changed, 11 insertions(+), 7

[PATCH v3] staging: wilc1000: Increase the size of wid_list array

2020-05-04 Thread Oscar Carter
3cb90b802d ("staging: wilc1000: add passive scan support") Acked-by: Ajay Singh Signed-off-by: Oscar Carter --- Changelog v1 -> v2 - Fix the commit for the "Fixes" tag as Ajay Singh suggested. Changelog v2 -> v3 - Use a #define instead of a hard-coded literal for the a

Re: [PATCH v2] staging: wilc1000: Increase the size of wid_list array

2020-05-04 Thread Oscar Carter
On Sun, May 03, 2020 at 04:29:53PM -0700, Joe Perches wrote: > On Sun, 2020-05-03 at 14:52 +, ajay.kat...@microchip.com wrote: > > On 03/05/20 1:21 pm, Oscar Carter wrote: > > > EXTERNAL EMAIL: Do not click links or open attachments unless you know > &g

[PATCH v2] staging: wilc1000: Increase the size of wid_list array

2020-05-03 Thread Oscar Carter
Increase by one the size of wid_list array as index variable can reach a value of 5. If this happens, an out-of-bounds access is performed. Addresses-Coverity-ID: 1451981 ("Out-of-bounds access") Fixes: f5a3cb90b802d ("staging: wilc1000: add passive scan support") Signed-

Re: [PATCH] staging: wilc1000: Increase the size of wid_list array

2020-05-03 Thread Oscar Carter
On Fri, May 01, 2020 at 06:26:10PM +, ajay.kat...@microchip.com wrote: > > On 01/05/20 10:32 pm, Oscar Carter wrote: > > EXTERNAL EMAIL: Do not click links or open attachments unless you know the > > content is safe > > > > Increase by one the size of wid_li

[PATCH] staging: wilc1000: Increase the size of wid_list array

2020-05-01 Thread Oscar Carter
Increase by one the size of wid_list array as index variable can reach a value of 5. If this happens, an out-of-bounds access is performed. Addresses-Coverity-ID: 1451981 ("Out-of-bounds access") Fixes: c5c77ba18ea66 ("staging: wilc1000: Add SDIO/SPI 802.11 driver") Signed-

[PATCH] staging: gasket: Check the return value of gasket_get_bar_index()

2020-05-01 Thread Oscar Carter
ivers/staging: Gasket driver framework + Apex driver") Signed-off-by: Oscar Carter --- drivers/staging/gasket/gasket_core.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c index 8e0575fcb4c8..67325fbaf760 10

[PATCH] staging: vt6656: Refactor the vnt_rf_table_download function

2020-04-29 Thread Oscar Carter
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 --- drivers/staging/vt6656/rf.c | 111 ++-- 1 file changed, 69 insertions(+), 42 deletions(-) diff --git a/drivers/staging/vt6

[PATCH 1/2] staging: vt6656: Check the return values in vnt_set_bss_mode function

2020-04-29 Thread Oscar Carter
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 --- drivers/staging

[PATCH 0/2] staging: vt6656: Refactor the vnt_set_bss_mode function

2020-04-29 Thread Oscar Carter
statements as all the branches in every "if" are almost the same. Oscar Carter (2): staging: vt6656: Check the return values in vnt_set_bss_mode function staging: vt6656: Refactor the vnt_set_bss_mode function drivers/staging/vt6656/card.c | 77 ++-

[PATCH 2/2] staging: vt6656: Refactor the vnt_set_bss_mode function

2020-04-29 Thread Oscar Carter
e the "priv->bb_type" variable is already an u8 tpe. Signed-off-by: Oscar Carter --- drivers/staging/vt6656/card.c | 68 --- 1 file changed, 31 insertions(+), 37 deletions(-) diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index

[PATCH v2 0/3] Refactor the vnt_rf_table_download function

2020-04-25 Thread Oscar Carter
v2 - Modify the commit changelog of the first patch to clarify the change as Joe Perches suggested. Oscar Carter (3): staging: vt6656: Remove the local variable "array" staging: vt6656: Use return instead of goto staging: vt6656: Remove duplicate code in vnt_rf_table_

[PATCH v2 3/3] staging: vt6656: Remove duplicate code in vnt_rf_table_download

2020-04-25 Thread Oscar Carter
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 --- drivers/staging/vt6656/rf.c | 65

[PATCH v2 1/3] staging: vt6656: Remove the local variable "array"

2020-04-25 Thread Oscar Carter
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 --- drivers/staging/vt6656/rf.c | 21 + 1 file changed, 5 insertions(+), 16 dele

[PATCH v2 2/3] staging: vt6656: Use return instead of goto

2020-04-25 Thread Oscar Carter
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 --- drivers/staging/vt6656/rf.c | 1

Re: [PATCH 1/3] staging: vt6656: Remove the local variable "array"

2020-04-25 Thread Oscar Carter
On Sat, Apr 25, 2020 at 05:50:39AM -0700, Joe Perches wrote: > On Sat, 2020-04-25 at 14:38 +0200, Oscar Carter wrote: > > Remove the local variable "array" and all the memcpy function calls > > because this copy operation from different arrays to this variable is >

[PATCH v3] staging: vt6656: Add formula to the vnt_rf_addpower function

2020-04-25 Thread Oscar Carter
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 --- Changelog v1 -> v2 - Change the type of "base" variable from s32 to int as Dan Carpente

Re: [PATCH v2] staging: vt6656: Add formula to the vnt_rf_addpower function

2020-04-25 Thread Oscar Carter
On Sat, Apr 25, 2020 at 12:57:14PM +0200, Greg Kroah-Hartman wrote: > On Thu, Apr 23, 2020 at 07:05:57PM +0200, Oscar Carter wrote: > > Use a formula to calculate the return value of the vnt_rf_addpower > > function instead of the "if" statement with literal

[PATCH v4 2/2] staging: vt6656: Remove functions' documentation

2020-04-25 Thread Oscar Carter
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 --- drivers/staging/vt6656/card.c | 79 -- drivers/staging/vt6656/mac.c | 52

[PATCH v4 1/2] staging: vt6656: Check the return value of vnt_control_out_* calls

2020-04-25 Thread Oscar Carter
the call didn't check the return value, now neither. Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 35 ++- drivers/staging/vt6656/baseband.h | 4 +- drivers/staging/vt6656/card.c | 97 --- drivers/staging/vt6656/card.h | 18

[PATCH v4 0/2] staging: vt6656: Check the return value of vnt_control_out_* calls

2020-04-25 Thread Oscar Carter
Greg's staging tree. Changelog v3 -> v4 - Rebase again. Oscar Carter (2): staging: vt6656: Check the return value of vnt_control_out_* calls staging: vt6656: Remove functions' documentation drivers/staging/vt6656/baseband.c | 35 +++--- drivers/staging/vt6656/baseband.h | 4 +- drivers/stagi

Re: [PATCH v3 0/2] staging: vt6656: Check the return value of vnt_control_out_* calls

2020-04-25 Thread Oscar Carter
On Sat, Apr 25, 2020 at 12:56:26PM +0200, Greg Kroah-Hartman wrote: > On Thu, Apr 23, 2020 at 05:38:34PM +0200, Oscar Carter wrote: > > This patch series checks the return value of vnt_control_out_* function > > calls. > > > > The first patch checks the return valu

[PATCH 1/3] staging: vt6656: Remove the local variable "array"

2020-04-25 Thread Oscar Carter
Remove the local variable "array" and all the memcpy function calls because this copy operation from different arrays to this variable is unnecessary. The same result can be achieved using the arrays directly. Signed-off-by: Oscar Carter --- drivers/staging/vt6656

[PATCH 3/3] staging: vt6656: Remove duplicate code in vnt_rf_table_download

2020-04-25 Thread Oscar Carter
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 --- drivers/staging/vt6656/rf.c | 65

[PATCH 2/3] staging: vt6656: Use return instead of goto

2020-04-25 Thread Oscar Carter
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 --- drivers/staging/vt6656/rf.c | 1

[PATCH 0/3] Refactor the vnt_rf_table_download function

2020-04-25 Thread Oscar Carter
the "goto" statements with a direct "return ret" as the jump label only returns the ret variable. The third patch replaces three while loops with three calls to the vnt_control_out_blocks function. This way avoid repeat a functionality that already exists. Oscar Carter (3): sta

[PATCH v2] staging: vt6656: Add formula to the vnt_rf_addpower function

2020-04-23 Thread Oscar Carter
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 --- Changelog v1 -> v2 - Change the type of "base" variable from s32 to int as Dan Carpente

[PATCH v3 1/2] staging: vt6656: Check the return value of vnt_control_out_* calls

2020-04-23 Thread Oscar Carter
the call didn't check the return value, now neither. Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 35 ++- drivers/staging/vt6656/baseband.h | 4 +- drivers/staging/vt6656/card.c | 97 --- drivers/staging/vt6656/card.h | 18

[PATCH v3 2/2] staging: vt6656: Remove functions' documentation

2020-04-23 Thread Oscar Carter
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 --- drivers/staging/vt6656/card.c | 79 -- drivers/staging/vt6656/mac.c | 52

[PATCH v3 0/2] staging: vt6656: Check the return value of vnt_control_out_* calls

2020-04-23 Thread Oscar Carter
Greg's staging tree. Oscar Carter (2): staging: vt6656: Check the return value of vnt_control_out_* calls staging: vt6656: Remove functions' documentation drivers/staging/vt6656/baseband.c | 35 +++--- drivers/staging/vt6656/baseband.h | 4 +- drivers/staging/vt6656/card.c

Re: [PATCH v2 1/2] staging: vt6656: Check the return value of vnt_control_out_* calls

2020-04-23 Thread Oscar Carter
On Thu, Apr 23, 2020 at 01:40:32PM +0200, Greg Kroah-Hartman wrote: > On Sun, Apr 19, 2020 at 12:48:20PM +0200, Oscar Carter wrote: > > Check the return value of vnt_control_out_* function calls. When > > necessary modify the function prototype to be able to return the new > &g

Re: [RFC] staging: vt6656: Add formula to the vnt_rf_addpower function

2020-04-20 Thread Oscar Carter
On Wed, Apr 15, 2020 at 06:25:41PM +0200, Oscar Carter wrote: > On Tue, Apr 14, 2020 at 04:12:14PM +0300, Dan Carpenter wrote: > > On Mon, Apr 13, 2020 at 04:02:09PM +0200, Oscar Carter wrote: > > > diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c > &

[PATCH v2] staging: vt6656: Use fls instead of for loop in vnt_update_top_rates

2020-04-20 Thread Oscar Carter
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 --- Changelog v1 -> v2 - Replace the expression pos-- with the expresion (pos - 1) as Dan Carpenter suggested.

Re: [PATCH] staging: vt6656: Use fls instead of for loop in vnt_update_top_rates

2020-04-20 Thread Oscar Carter
On Mon, Apr 20, 2020 at 03:10:59PM +0300, Dan Carpenter wrote: > On Sun, Apr 19, 2020 at 12:09:21PM +0200, Oscar Carter wrote: > > - for (i = RATE_11M;; i--) { > > - if (priv->basic_rates & (u16)(1 << i)) { > > - top_cck

[PATCH v2 1/2] staging: vt6656: Check the return value of vnt_control_out_* calls

2020-04-19 Thread Oscar Carter
the call didn't check the return value, now neither. Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 35 ++- drivers/staging/vt6656/baseband.h | 4 +- drivers/staging/vt6656/card.c | 97 --- drivers/staging/vt6656/card.h | 18

[PATCH v2 0/2] staging: vt6656: Check the return value of vnt_control_out_* calls

2020-04-19 Thread Oscar Carter
has changed as the function names are clear enought. Also, the actual documentation is not correct in all cases. Changelog v1 -> v2 - Remove the function's documentation instead of fix them as suggested Malcolm Priestley. Oscar Carter (2): staging: vt6656: Check the return va

[PATCH v2 2/2] staging: vt6656: Remove functions' documentation

2020-04-19 Thread Oscar Carter
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 --- drivers/staging/vt6656/card.c | 79 -- drivers/staging/vt6656/mac.c | 52

Re: [PATCH 2/2] staging: vt6656: Fix functions' documentation

2020-04-19 Thread Oscar Carter
On Sun, Apr 19, 2020 at 10:22:50AM +0100, Malcolm Priestley wrote: > > > On 19/04/2020 08:47, Oscar Carter wrote: > > On Sat, Apr 18, 2020 at 07:05:53PM +0100, Malcolm Priestley wrote: > >> Actually I don't really think the function descriptions are needed at

[PATCH] staging: vt6656: Use fls instead of for loop in vnt_update_top_rates

2020-04-19 Thread Oscar Carter
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 --- drivers/staging/vt6656/card.c | 28 ++-- 1 file changed, 6 insertions(+), 22 deletions(-)

Re: [PATCH 2/2] staging: vt6656: Fix functions' documentation

2020-04-19 Thread Oscar Carter
o be removed the bss callers to baseband.c, the tbtt's to > power.c > and the rest to mac.c > > Regards > > Malcolm Thanks, Oscar Carter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

[PATCH] staging: vt6656: Refactor the vnt_ofdm_min_rate function

2020-04-18 Thread Oscar Carter
ved 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 --- drivers/staging/vt6656/card.c | 11 ++- driv

[PATCH 1/2] staging: vt6656: Check the return value of vnt_control_out_* calls

2020-04-18 Thread Oscar Carter
the call didn't check the return value, now neither. Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 35 ++- drivers/staging/vt6656/baseband.h | 4 +- drivers/staging/vt6656/card.c | 97 --- drivers/staging/vt6656/card.h | 18

[PATCH 2/2] staging: vt6656: Fix functions' documentation

2020-04-18 Thread Oscar Carter
Replace the functions' documentation by the kernel-doc style fixing the parameters and return value. Signed-off-by: Oscar Carter --- drivers/staging/vt6656/card.c | 101 +++-- drivers/staging/vt6656/mac.c | 67 -- drivers/staging/vt6656

[PATCH 0/2] staging: vt6656: Check the return value of vnt_control_out_* calls

2020-04-18 Thread Oscar Carter
has changed by the kernel-doc style, fixing the parameters and return value. Oscar Carter (2): staging: vt6656: Check the return value of vnt_control_out_* calls staging: vt6656: Fix functions' documentation drivers/staging/vt6656/baseband.c | 35 +++--- drivers/staging/vt6656/baseband.h

Re: [RFC] staging: vt6656: Add formula to the vnt_rf_addpower function

2020-04-15 Thread Oscar Carter
On Tue, Apr 14, 2020 at 04:12:14PM +0300, Dan Carpenter wrote: > On Mon, Apr 13, 2020 at 04:02:09PM +0200, Oscar Carter wrote: > > diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c > > index 4f9aba0f21b0..3b200d7290a5 100644 > > --- a/drivers/staging/

[PATCH 0/5] staging: vt6656: Rebase all rejected patches

2020-04-14 Thread Oscar Carter
fourth patch creates a constant array with the values of the "phy->signal" variable for every rate and makes a refactor of the assignment of this variable. The fifth path takes out the "phy->service" assignment from the if-else statement due to it's the same for the two branches

[PATCH 4/5] staging: vt6656: Refactor the assignment of the phy->signal variable

2020-04-14 Thread Oscar Carter
use 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 --- drivers/staging/vt6656/baseband.c | 105 -- 1 file changed, 26 insertions(+), 79 deletions(-) diff --git a/drivers/st

[PATCH 3/5] staging: vt6656: Use define instead of magic number for tx_rate

2020-04-14 Thread Oscar 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 Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drive

[PATCH 1/5] staging: vt6656: Return error code in vnt_rf_write_embedded function

2020-04-14 Thread Oscar Carter
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 --- drivers/staging/vt6656/rf.c | 99 - 1 file changed, 64 insertions(+), 35 deletions(-) diff --git a/drivers/staging/vt6656/rf.c

[PATCH 2/5] staging: vt6656: Use BIT() macro instead of bit shift operator

2020-04-14 Thread Oscar Carter
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 --- drivers/staging/vt6656/card.c | 4 ++-- 1 file

[PATCH 5/5] staging: vt6656: Remove duplicate code for the phy->service assignment

2020-04-14 Thread Oscar 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 --- drivers/staging/vt6656/baseband.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/vt6656/baseband

Re: [PATCH v2 1/2] staging: vt6656: Refactor the assignment of the phy->signal variable

2020-04-13 Thread Oscar Carter
On Mon, Apr 13, 2020 at 04:32:58PM +0200, Greg Kroah-Hartman wrote: > On Mon, Apr 13, 2020 at 04:25:17PM +0200, Oscar Carter wrote: > > On Mon, Apr 13, 2020 at 02:56:16PM +0200, Greg Kroah-Hartman wrote: > > > On Sat, Apr 11, 2020 at 02:26:09PM +0200, Oscar Carter wrote: > &g

Re: [PATCH v3 1/2] staging: vt6656: Use define instead of magic number for tx_rate

2020-04-13 Thread Oscar Carter
On Mon, Apr 13, 2020 at 04:29:07PM +0200, Greg Kroah-Hartman wrote: > On Mon, Apr 13, 2020 at 04:13:15PM +0200, Oscar Carter wrote: > > On Mon, Apr 13, 2020 at 02:56:33PM +0200, Greg Kroah-Hartman wrote: > > > On Tue, Apr 07, 2020 at 06:39:14PM +0200, Oscar Carter wrote: >

Re: [PATCH v2 1/2] staging: vt6656: Refactor the assignment of the phy->signal variable

2020-04-13 Thread Oscar Carter
On Mon, Apr 13, 2020 at 02:56:16PM +0200, Greg Kroah-Hartman wrote: > On Sat, Apr 11, 2020 at 02:26:09PM +0200, Oscar Carter wrote: > > Create a constant array with the values of the "phy->signal" for every > > rate. Remove all "phy->signal" assignments in

Re: [PATCH v3 1/2] staging: vt6656: Use define instead of magic number for tx_rate

2020-04-13 Thread Oscar Carter
On Mon, Apr 13, 2020 at 02:56:33PM +0200, Greg Kroah-Hartman wrote: > On Tue, Apr 07, 2020 at 06:39:14PM +0200, Oscar Carter wrote: > > Use the define RATE_11M present in the file "device.h" instead of the > > magic number 3. So the code is more clear. > >

[RFC] staging: vt6656: Add formula to the vnt_rf_addpower function

2020-04-13 Thread Oscar Carter
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 --- What is the better approach for this function ? Leave it as is or use a formula although it is less clear.

[PATCH] staging: vt6656: Return error code in vnt_rf_write_embedded function

2020-04-13 Thread Oscar Carter
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 --- drivers/staging/vt6656/rf.c | 99 - 1 file changed, 64 insertions(+), 35 deletions(-) diff --git a/drivers/staging/vt6656/rf.c

[PATCH] staging: vt6656: Use BIT() macro instead of bit shift operator

2020-04-12 Thread Oscar Carter
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 --- drivers/staging/vt6656/card.c | 8 1 file

[PATCH 0/2] staging: vt6656: Refactor the vnt_vt3184_init function

2020-04-11 Thread Oscar Carter
This patch series makes a refactor of the vnt_vt3184_init function through two patches. The first one removes duplicate code in the if statements because different branches are almost the same. The second patch remove unnecessary local variable initialization. Oscar Carter (2): staging

[PATCH 2/2] staging: vt6656: Remove unnecessary local variable initialization

2020-04-11 Thread Oscar Carter
Don't initialize the ret variable as it is set a few lines later. Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index 276210a7284e

[PATCH 1/2] staging: vt6656: Remove duplicate code in vnt_vt3184_init function

2020-04-11 Thread Oscar Carter
Remove duplicate code in "if" statements because different branches are almost the same. Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 52 +++ 1 file changed, 12 insertions(+), 40 deletions(-) diff --git a/drivers/staging/vt6656/bas

[PATCH v2 2/2] staging: vt6656: Remove duplicate code for the phy->service assignment

2020-04-11 Thread Oscar 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 --- drivers/staging/vt6656/baseband.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/vt6656/baseband

[PATCH v2 1/2] staging: vt6656: Refactor the assignment of the phy->signal variable

2020-04-11 Thread Oscar Carter
use 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 --- drivers/staging/vt6656/baseband.c | 105 -- 1 file changed, 26 insertions(+), 79 deletions(-) diff --git a/drivers/st

[PATCH v2 0/2] staging: vt6656: Refactor the vnt_get_phy_field function

2020-04-11 Thread Oscar Carter
nsion as Malcolm Priestley has suggested. Oscar Carter (2): staging: vt6656: Refactor the assignment of the phy->signal variable staging: vt6656: Remove duplicate code for the phy->service assignment drivers/staging/vt6656/baseband.c | 108 -- 1 file chang

Re: [PATCH 1/2] staging: vt6656: Refactor the assignment of the phy->signal variable

2020-04-10 Thread Oscar Carter
On Fri, Apr 10, 2020 at 05:40:52PM +0100, Malcolm Priestley wrote: > > > On 10/04/2020 16:59, Oscar Carter wrote: > > On Fri, Apr 10, 2020 at 04:37:59PM +0100, Malcolm Priestley wrote: > > > > > > > > > On 10/04/2020 12:28, Oscar Carter wrote: >

Re: [PATCH 1/2] staging: vt6656: Refactor the assignment of the phy->signal variable

2020-04-10 Thread Oscar Carter
On Fri, Apr 10, 2020 at 04:37:59PM +0100, Malcolm Priestley wrote: > > > On 10/04/2020 12:28, Oscar Carter wrote: > > Create a constant array with the values of the "phy->signal" for every > > rate. Remove all "phy->signal" assignme

[PATCH 1/2] staging: vt6656: Refactor the assignment of the phy->signal variable

2020-04-10 Thread Oscar 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. Signed-off-by: Oscar Carter --- drivers/stagi

[PATCH 2/2] staging: vt6656: Remove duplicate code for the phy->service assignment

2020-04-10 Thread Oscar 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 --- drivers/staging/vt6656/baseband.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/vt6656/baseband

[PATCH 0/2] staging: vt6656: Refactor the vnt_get_phy_field function

2020-04-10 Thread Oscar Carter
t of the "phy->service" variable by putting it outside the if-else statement due to it's the same for the two branches. Oscar Carter (2): staging: vt6656: Refactor the assignment of the phy->signal variable staging: vt6656: Remove duplicate code for the phy->service ass

Re: [PATCH v2 0/2] staging: vt6656: Cleanup of the vnt_get_frame_time function

2020-04-07 Thread Oscar Carter
On Tue, Apr 07, 2020 at 06:29:57PM +0200, Oscar Carter wrote: > This patch series makes a cleanup of the vnt_get_frame_time function. > > The first patch makes use of the define RATE_11M instead of a magic > number. The second patch remove unnecessary local variable initialization. &

[PATCH v3 1/2] staging: vt6656: Use define instead of magic number for tx_rate

2020-04-07 Thread Oscar 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 Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drive

[PATCH v3 2/2] staging: vt6656: Remove unnecessary local variable initialization

2020-04-07 Thread Oscar Carter
Don't initialize the rate variable as it is set a few lines later. Reviewed-by: Dan Carpenter Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656

[PATCH v3 0/2] staging: vt6656: Cleanup of the vnt_get_frame_time function

2020-04-07 Thread Oscar Carter
ate variable. Changelog v2 -> v3 - Use the version number in the subject line of patch 1/2 and 2/2. Oscar Carter (2): staging: vt6656: Use define instead of magic number for tx_rate staging: vt6656: Remove unnecessary local variable initialization drivers/staging/vt6656/baseband.c | 5 ++

[PATCH v2 0/2] staging: vt6656: Cleanup of the vnt_get_frame_time function

2020-04-07 Thread Oscar Carter
ate variable. Oscar Carter (2): staging: vt6656: Use define instead of magic number for tx_rate staging: vt6656: Remove unnecessary local variable initialization drivers/staging/vt6656/baseband.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.2

[PATCH 2/2] staging: vt6656: Remove unnecessary local variable initialization

2020-04-07 Thread Oscar Carter
Don't initialize the rate variable as it is set a few lines later. Reviewed-by: Dan Carpenter Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656

[PATCH 1/2] staging: vt6656: Use define instead of magic number for tx_rate

2020-04-07 Thread Oscar 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 Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drive

Re: [PATCH 2/3] staging: vt6656: Use define instead of magic number for tx_rate

2020-04-07 Thread Oscar Carter
On Mon, Apr 06, 2020 at 07:58:08PM +0200, Greg Kroah-Hartman wrote: > On Mon, Apr 06, 2020 at 06:38:36PM +0200, Oscar Carter wrote: > > On Mon, Apr 06, 2020 at 04:22:12PM +0200, Greg Kroah-Hartman wrote: > > > On Sat, Apr 04, 2020 at 04:13:59PM +0200, Oscar Carter wrote: >

Re: [PATCH 2/3] staging: vt6656: Use define instead of magic number for tx_rate

2020-04-06 Thread Oscar Carter
On Mon, Apr 06, 2020 at 04:22:12PM +0200, Greg Kroah-Hartman wrote: > On Sat, Apr 04, 2020 at 04:13:59PM +0200, Oscar Carter wrote: > > Use the define RATE_11M present in the file "device.h" instead of the > > magic number 3. So the code is more clear. > >

Re: [PATCH 1/3] staging: vt6656: Use ARRAY_SIZE instead of define RATE_54M

2020-04-06 Thread Oscar Carter
On Mon, Apr 06, 2020 at 02:13:23PM +0300, Dan Carpenter wrote: > On Sat, Apr 04, 2020 at 04:13:58PM +0200, Oscar Carter wrote: > > Use ARRAY_SIZE to replace the define RATE_54M so we will never have a > > mismatch. In this way, avoid the possibility of a buffer overflow if

[PATCH 3/3] staging: vt6656: Remove unnecessary local variable initialization

2020-04-04 Thread Oscar Carter
Don't initialize the rate variable as it is set a few lines later. Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index a785f91c1566

[PATCH 0/3] staging: vt6656: Cleanup of the vnt_get_frame_time function

2020-04-04 Thread Oscar Carter
. The second patch makes use of the define RATE_11M instead of a magic number. The third patch remove unnecessary local variable initialization. Oscar Carter (3): staging: vt6656: Use ARRAY_SIZE instead of define RATE_54M staging: vt6656: Use define instead of magic number for tx_rate

[PATCH 2/3] staging: vt6656: Use define instead of magic number for tx_rate

2020-04-04 Thread Oscar Carter
Use the define RATE_11M present in the file "device.h" instead of the magic number 3. So the code is more clear. Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/vt6656/baseband.c

[PATCH 1/3] staging: vt6656: Use ARRAY_SIZE instead of define RATE_54M

2020-04-04 Thread Oscar Carter
Use ARRAY_SIZE to replace the define RATE_54M so we will never have a mismatch. In this way, avoid the possibility of a buffer overflow if this define is changed in the future to a greater value. Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 2 +- 1 file changed, 1

[PATCH v2] staging: vt6656: Define EnCFG_BBType_MASK as OR between previous defines

2020-04-02 Thread Oscar Carter
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 Reviewed-by: Dan Carpenter Reviewed-by: Quentin Deslandes --- Changelog v1 -> v2 - Remove the &qu

Re: [PATCH] staging: vt6656: Use defines in vnt_mac_reg_bits_* functions

2020-04-02 Thread Oscar Carter
On Thu, Apr 02, 2020 at 11:58:07AM +0100, Malcolm Priestley wrote: > > > On 02/04/2020 10:19, Quentin Deslandes wrote: > > On 04/01/20 18:55:38, Oscar Carter wrote: > > > On Tue, Mar 31, 2020 at 01:29:06PM +0300, Dan Carpenter wrote: > > > > On Sat, Mar 28, 20

Re: [PATCH] staging: vt6656: Use defines in vnt_mac_reg_bits_* functions

2020-04-01 Thread Oscar Carter
On Tue, Mar 31, 2020 at 01:29:06PM +0300, Dan Carpenter wrote: > On Sat, Mar 28, 2020 at 10:54:33AM +0100, Oscar Carter wrote: > > Define the necessary bits in the CHANNEL, PAPEDELAY and GPIOCTL0 > > registers to can use them in the calls to vnt_mac_reg_bits_on and > >

Re: [PATCH] staging: vt6656: Define EnCFG_BBType_MASK as OR between previous defines

2020-04-01 Thread Oscar Carter
On Mon, Mar 30, 2020 at 02:27:14PM +0200, Greg Kroah-Hartman wrote: > On Fri, Mar 27, 2020 at 05:58:02PM +0100, Oscar Carter wrote: > > Define the EnCFG_BBType_MASK bit as an OR operation between two previous > > defines instead of using the OR between two new BIT macros. Thu

Re: [PATCH] staging: vt6656: Use BIT() macro in vnt_mac_reg_bits_* functions

2020-04-01 Thread Oscar Carter
On Tue, Mar 31, 2020 at 01:41:30PM +0300, Dan Carpenter wrote: > On Thu, Mar 26, 2020 at 06:10:43PM +0100, Oscar Carter wrote: > > I will make these changes and i will send and incremental patch with the > > "Fixes:" tag due to the this patch has already been added

[PATCH] staging: vt6656: Refactor the vnt_update_pre_ed_threshold function

2020-03-28 Thread Oscar Carter
decrease the footprint and makes the code more clear. Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 335 +- 1 file changed, 100 insertions(+), 235 deletions(-) diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband

[PATCH v2] staging: vt6656: Use defines in preamble_type variables

2020-03-28 Thread Oscar Carter
more clear. Signed-off-by: Oscar Carter --- Changelog v1 -> v2 - Spell checking correction in the changelog. drivers/staging/vt6656/baseband.c | 8 drivers/staging/vt6656/main_usb.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/vt6656/

[PATCH] staging: vt6656: Use defines in preamble_type variables

2020-03-28 Thread Oscar Carter
more clear. Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 8 drivers/staging/vt6656/main_usb.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index a19a563d8bcc..9bbafa7ff

[PATCH] staging: vt6656: Use defines in vnt_mac_reg_bits_* functions

2020-03-28 Thread Oscar Carter
macro in vnt_mac_reg_bits_* functions") Suggested-by: Dan Carpenter Signed-off-by: Oscar Carter --- drivers/staging/vt6656/baseband.c | 6 -- drivers/staging/vt6656/card.c | 3 +-- drivers/staging/vt6656/mac.h | 12 drivers/staging/vt6656/main_usb.c | 2 +- 4 files c

[PATCH] staging: vt6656: Define EnCFG_BBType_MASK as OR between previous defines

2020-03-27 Thread Oscar Carter
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. Fixes: a74081b44291 ("staging: vt6656: Use BIT() macro instead of hex value") Signed-off-by: Oscar Carter Reviewed-by: Dan

[PATCH v2] staging: vt6656: Use DIV_ROUND_UP macro instead of specific code

2020-03-26 Thread Oscar Carter
Use DIV_ROUND_UP macro instead of specific code with the same purpose. Also, remove the unused variables. Signed-off-by: Oscar Carter --- Changelog v1 -> v2 - Rebase the original patch [1] against the staging-next branch of the greg's staging.git tree. [1] https://lore.kernel.org/l

Re: [PATCH v2] staging: vt6656: Use ARRAY_SIZE instead of hardcoded size

2020-03-26 Thread Oscar Carter
results in a > > buffer overflow then static checkers would complain. If they changed it > > and it resulted in uninitialized data being used then it would be zero > > so that's okay. > > I wasn't sure where I should stand on this, that's clearer now. > > Thanks, &g

Re: [PATCH] staging: vt6656: Use BIT() macro in vnt_mac_reg_bits_* functions

2020-03-26 Thread Oscar Carter
On Mon, Mar 23, 2020 at 10:32:14AM +0300, Dan Carpenter wrote: > On Fri, Mar 20, 2020 at 07:13:26PM +0100, Oscar Carter wrote: > > +#include > > #include "mac.h" > > #include "baseband.h" > > #include "rf.h" > > @

Re: [PATCH] staging: vt6656: Use BIT() macro instead of hex value

2020-03-26 Thread Oscar Carter
On Mon, Mar 23, 2020 at 10:35:18AM +0300, Dan Carpenter wrote: > On Fri, Mar 20, 2020 at 06:10:56PM +0100, Oscar Carter wrote: > > -#define RSR_ADDRBROAD 0x80 > > -#define RSR_ADDRMULTI 0x40 > > +#define RSR_ADDRBROAD BIT(7) > > +#define RSR_ADDRMULT

  1   2   >