Re: [PATCH 2/2] staging: vt6656: Fix functions' documentation
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 all the > names of the functions are enough. > Then, it would be better leave the documentation as it was before or remove it? > card.c needs to 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 2/2] Staging: rtl8188eu: core: rtw_pwrctrl: fixed a coding style issue
From: porfavorde Fixed a checkpatch.pl warning: the constant should be in the right side of the comparison. Signed-off-by: porfavorde --- drivers/staging/rtl8188eu/core/rtw_pwrctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c index c4f58507dbfd..c000382c96d9 100644 --- a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c @@ -173,7 +173,7 @@ int ips_leave(struct adapter *padapter) DBG_88E_LEVEL(_drv_info_, "nolinked power save leave\n"); - if ((_WEP40_ == psecuritypriv->dot11PrivacyAlgrthm) || (_WEP104_ == psecuritypriv->dot11PrivacyAlgrthm)) { + if ((psecuritypriv->dot11PrivacyAlgrthm == _WEP40_) || (psecuritypriv->dot11PrivacyAlgrthm == _WEP104_)) { DBG_88E("==>%s, channel(%d), processing(%x)\n", __func__, padapter->mlmeextpriv.cur_channel, pwrpriv->bips_processing); set_channel_bwmode(padapter, padapter->mlmeextpriv.cur_channel, HAL_PRIME_CHNL_OFFSET_DONT_CARE, HT_CHANNEL_WIDTH_20); for (keyid = 0; keyid < 4; keyid++) { -- 2.26.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] staging: vt6656: Fix functions' documentation
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 all the >> names of the functions are enough. >> > Then, it would be better leave the documentation as it was before or remove > it? > I would remove them all except for comments inside functions. Regards Malcolm ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] 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 --- drivers/staging/vt6656/card.c | 28 ++-- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index 9bd37e57c727..952a7726fdd3 100644 --- a/drivers/staging/vt6656/card.c +++ b/drivers/staging/vt6656/card.c @@ -26,7 +26,7 @@ * */ -#include +#include #include "device.h" #include "card.h" #include "baseband.h" @@ -223,29 +223,13 @@ void vnt_update_ifs(struct vnt_private *priv) void vnt_update_top_rates(struct vnt_private *priv) { - u8 top_ofdm = RATE_24M, top_cck = RATE_1M; - u8 i; + int pos; - /*Determines the highest basic rate.*/ - for (i = RATE_54M; i >= RATE_6M; i--) { - if (priv->basic_rates & (u16)(1 << i)) { - top_ofdm = i; - break; - } - } - - priv->top_ofdm_basic_rate = top_ofdm; - - for (i = RATE_11M;; i--) { - if (priv->basic_rates & (u16)(1 << i)) { - top_cck = i; - break; - } - if (i == RATE_1M) - break; - } + pos = fls(priv->basic_rates & GENMASK(RATE_54M, RATE_6M)); + priv->top_ofdm_basic_rate = pos ? pos-- : RATE_24M; - priv->top_cck_basic_rate = top_cck; + pos = fls(priv->basic_rates & GENMASK(RATE_11M, RATE_1M)); + priv->top_cck_basic_rate = pos ? pos-- : RATE_1M; } int vnt_ofdm_min_rate(struct vnt_private *priv) -- 2.20.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] staging: vt6656: Fix functions' documentation
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 all > >> the > >> names of the functions are enough. > >> > > Then, it would be better leave the documentation as it was before or remove > > it? > > > > I would remove them all except for comments inside functions. > Ok, then I make the suggested changes and send a new version serie. > Regards > > Malcolm Thanks, Oscar Carter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] 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 --- drivers/staging/vt6656/Makefile | 3 +- drivers/staging/vt6656/device.h | 4 ++ drivers/staging/vt6656/firmware.c | 106 -- drivers/staging/vt6656/firmware.h | 25 --- drivers/staging/vt6656/main_usb.c | 81 ++- 5 files changed, 85 insertions(+), 134 deletions(-) delete mode 100644 drivers/staging/vt6656/firmware.c delete mode 100644 drivers/staging/vt6656/firmware.h diff --git a/drivers/staging/vt6656/Makefile b/drivers/staging/vt6656/Makefile index 375f54e9f58b..a0f3862dea75 100644 --- a/drivers/staging/vt6656/Makefile +++ b/drivers/staging/vt6656/Makefile @@ -13,7 +13,6 @@ vt6656_stage-y += main_usb.o \ key.o \ rf.o \ usbpipe.o \ - channel.o \ - firmware.o + channel.o obj-$(CONFIG_VT6656) +=vt6656_stage.o diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index 1630d2163a23..613062ad0122 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -73,6 +73,10 @@ #define DEVICE_VERSION "mac80211" +#define FIRMWARE_VERSION 0x133 /* version 1.51 */ +#define FIRMWARE_NAME "vntwusb.fw" +#define FIRMWARE_CHUNK_SIZE0x400 + #define CONFIG_PATH"/etc/vntconfiguration.dat" #define MAX_UINTS 8 diff --git a/drivers/staging/vt6656/firmware.c b/drivers/staging/vt6656/firmware.c deleted file mode 100644 index 70358d427211.. --- a/drivers/staging/vt6656/firmware.c +++ /dev/null @@ -1,106 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. - * All rights reserved. - * - * File: baseband.c - * - * Purpose: Implement functions to access baseband - * - * Author: Yiching Chen - * - * Date: May 20, 2004 - * - * Functions: - * - * Revision History: - * - */ - -#include -#include "firmware.h" -#include "usbpipe.h" - -#define FIRMWARE_VERSION 0x133 /* version 1.51 */ -#define FIRMWARE_NAME "vntwusb.fw" - -#define FIRMWARE_CHUNK_SIZE0x400 - -int vnt_download_firmware(struct vnt_private *priv) -{ - struct device *dev = &priv->usb->dev; - const struct firmware *fw; - u16 length; - int ii; - int ret = 0; - - dev_dbg(dev, ">Download firmware\n"); - - ret = request_firmware(&fw, FIRMWARE_NAME, dev); - if (ret) { - dev_err(dev, "firmware file %s request failed (%d)\n", - FIRMWARE_NAME, ret); - goto end; - } - - for (ii = 0; ii < fw->size; ii += FIRMWARE_CHUNK_SIZE) { - length = min_t(int, fw->size - ii, FIRMWARE_CHUNK_SIZE); - - ret = vnt_control_out(priv, 0, 0x1200 + ii, 0x, length, - fw->data + ii); - if (ret) - goto free_fw; - - dev_dbg(dev, "Download firmware...%d %zu\n", ii, fw->size); - } - -free_fw: - release_firmware(fw); -end: - return ret; -} -MODULE_FIRMWARE(FIRMWARE_NAME); - -int vnt_firmware_branch_to_sram(struct vnt_private *priv) -{ - dev_dbg(&priv->usb->dev, ">Branch to Sram\n"); - - return vnt_control_out(priv, 1, 0x1200, 0x, 0, NULL); -} - -int vnt_check_firmware_version(struct vnt_private *priv) -{ - int ret = 0; - - ret = vnt_control_in(priv, MESSAGE_TYPE_READ, 0, -MESSAGE_REQUEST_VERSION, 2, -(u8 *)&priv->firmware_version); - if (ret) { - dev_dbg(&priv->usb->dev, - "Could not get firmware version: %d.\n", ret); - goto end; - } - - dev_dbg(&priv->usb->dev, "Firmware Version [%04x]\n", - priv->firmware_version); - - if (priv->firmware_version == 0x) { - dev_dbg(&priv->usb->dev, "In Loader.\n"); - ret = -EINVAL; - goto end; - } - - if (priv->firmware_version < FIRMWARE_VERSION) { - /* branch to loader for download new firmware */ - ret = vnt_firmware_branch_to_sram(priv); - if (ret) { - dev_dbg(&priv->usb->dev, - "Could not branch to SRAM: %d.\n", ret); - } else { - ret = -EINVAL; - } - } - -end: - return ret; -} diff --git a/drivers/staging/vt6656/firmware.h b/drivers/staging/vt6656/firmware.h deleted file mode 100644 index 161126faf396.. --- a/dr
[PATCH v2 2/2] 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 --- drivers/staging/vt6656/card.c | 79 -- drivers/staging/vt6656/mac.c | 52 -- drivers/staging/vt6656/power.c | 10 - 3 files changed, 141 deletions(-) diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index 99ad56b7617d..e5e44d0a07ff 100644 --- a/drivers/staging/vt6656/card.c +++ b/drivers/staging/vt6656/card.c @@ -46,16 +46,6 @@ static const u16 cw_rxbcntsf_off[MAX_RATE] = { 192, 96, 34, 17, 34, 23, 17, 11, 8, 5, 4, 3 }; -/* - * Description: Set NIC media channel - * - * Parameters: - * In: - * pDevice - The adapter to be set - * connection_channel - Channel to be set - * Out: - * none - */ int vnt_set_channel(struct vnt_private *priv, u32 connection_channel) { int ret; @@ -99,19 +89,6 @@ static const u8 vnt_rspinf_gb_table[] = { 0x0e, 0x8d, 0x0a, 0x88, 0x0a, 0x8c, 0x0a, 0x8c, 0x0a }; -/* - * Description: Set RSPINF - * - * Parameters: - * In: - * pDevice - The adapter to be set - * Out: - * none - * - * Return Value: None. - * - */ - int vnt_set_rspinf(struct vnt_private *priv, u8 bb_type) { const u8 *data; @@ -145,18 +122,6 @@ int vnt_set_rspinf(struct vnt_private *priv, u8 bb_type) MESSAGE_REQUEST_MACREG, len, data); } -/* - * Description: Update IFS - * - * Parameters: - * In: - * priv - The adapter to be set - * Out: - * none - * - * Return Value: None. - * - */ int vnt_update_ifs(struct vnt_private *priv) { u8 max_min = 0; @@ -300,21 +265,6 @@ u64 vnt_get_tsf_offset(u8 rx_rate, u64 tsf1, u64 tsf2) return tsf1 - tsf2 - (u64)cw_rxbcntsf_off[rx_rate % MAX_RATE]; } -/* - * Description: Sync. TSF counter to BSS - * Get TSF offset and write to HW - * - * Parameters: - * In: - * priv - The adapter to be sync. - * time_stamp - Rx BCN's TSF - * local_tsf - Local TSF - * Out: - * none - * - * Return Value: none - * - */ int vnt_adjust_tsf(struct vnt_private *priv, u8 rx_rate, u64 time_stamp, u64 local_tsf) { @@ -408,20 +358,6 @@ u64 vnt_get_next_tbtt(u64 tsf, u16 beacon_interval) return tsf; } -/* - * Description: Set NIC TSF counter for first Beacon time - * Get NEXTTBTT from adjusted TSF and Beacon Interval - * - * Parameters: - * In: - * dwIoBase- IO Base - * beacon_interval - Beacon Interval - * Out: - * none - * - * Return Value: none - * - */ int vnt_reset_next_tbtt(struct vnt_private *priv, u16 beacon_interval) { u64 next_tbtt = 0; @@ -444,21 +380,6 @@ int vnt_reset_next_tbtt(struct vnt_private *priv, u16 beacon_interval) MESSAGE_REQUEST_TBTT, 0, 8, data); } -/* - * Description: Sync NIC TSF counter for Beacon time - * Get NEXTTBTT and write to HW - * - * Parameters: - * In: - * priv- The adapter to be set - * tsf- Current TSF counter - * beacon_interval - Beacon Interval - * Out: - * none - * - * Return Value: none - * - */ int vnt_update_next_tbtt(struct vnt_private *priv, u64 tsf, u16 beacon_interval) { diff --git a/drivers/staging/vt6656/mac.c b/drivers/staging/vt6656/mac.c index 639172fad0f3..da7067c34643 100644 --- a/drivers/staging/vt6656/mac.c +++ b/drivers/staging/vt6656/mac.c @@ -22,19 +22,6 @@ #include "mac.h" #include "usbpipe.h" -/* - * Description: - * Write MAC Multicast Address Mask - * - * Parameters: - * In: - * mc_filter (mac filter) - * Out: - * none - * - * Return Value: none - * - */ int vnt_mac_set_filter(struct vnt_private *priv, u64 mc_filter) { __le64 le_mc = cpu_to_le64(mc_filter); @@ -44,17 +31,6 @@ int vnt_mac_set_filter(struct vnt_private *priv, u64 mc_filter) (u8 *)&le_mc); } -/* - * Description: - * Shut Down MAC - * - * Parameters: - * In: - * Out: - * none - * - * - */ int vnt_mac_shutdown(struct vnt_private *priv) { return vnt_control_out(priv, MESSAGE_TYPE_MACSHUTDOWN, 0, 0, 0, NULL); @@ -72,40 +48,12 @@ int vnt_mac_set_bb_type(struct vnt_private *priv, u8 type) data); } -/* - * Description: - * Disable the Key Entry by MISCFIFO - * - * Parameters: - * In: - * dwIoBase- Base Address for MAC - * - * Out: - * none - * - * Return Value: none - * - */ int vnt_mac_disable_keyentry(struct vnt_private *priv, u8 entry_idx) { return vnt_control_out(priv, MESSAGE_TYPE_CLRKEYENTRY, 0, 0, sizeof(entry_idx), &entry_idx); } -/* - * Description: - * Set the Key by MISCFIFO - * - * Parameters: - * In: - * dwIoBase- Base A
[PATCH v2 0/2] staging: vt6656: Check the return value of vnt_control_out_* calls
This patch series checks the return value of vnt_control_out_* function calls. The first patch checks the return value and when necessary modify the function prototype to be able to return the new checked error code. The second patch removes the documentation of functions that their prototype 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 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 | 176 +++--- drivers/staging/vt6656/card.h | 18 +-- drivers/staging/vt6656/mac.c | 128 +++--- drivers/staging/vt6656/mac.h | 26 ++--- drivers/staging/vt6656/power.c| 22 ++-- drivers/staging/vt6656/power.h| 2 +- 8 files changed, 156 insertions(+), 255 deletions(-) -- 2.20.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 1/2] 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 --- drivers/staging/vt6656/baseband.c | 35 ++- drivers/staging/vt6656/baseband.h | 4 +- drivers/staging/vt6656/card.c | 97 --- drivers/staging/vt6656/card.h | 18 +++--- drivers/staging/vt6656/mac.c | 76 drivers/staging/vt6656/mac.h | 26 - drivers/staging/vt6656/power.c| 12 +++- drivers/staging/vt6656/power.h| 2 +- 8 files changed, 156 insertions(+), 114 deletions(-) diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index e0352405e4cf..91cf00615ef3 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -23,6 +23,7 @@ */ #include +#include #include #include "mac.h" #include "baseband.h" @@ -559,21 +560,22 @@ int vnt_set_short_slot_time(struct vnt_private *priv) ret = vnt_control_in_u8(priv, MESSAGE_REQUEST_BBREG, 0xe7, &bb_vga); if (ret) - goto end; + return ret; if (bb_vga == priv->bb_vga[0]) priv->bb_rx_conf |= 0x20; - ret = vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0a, -priv->bb_rx_conf); - -end: - return ret; + return vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0a, + priv->bb_rx_conf); } -void vnt_set_vga_gain_offset(struct vnt_private *priv, u8 data) +int vnt_set_vga_gain_offset(struct vnt_private *priv, u8 data) { - vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0xE7, data); + int ret; + + ret = vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0xE7, data); + if (ret) + return ret; /* patch for 3253B0 Baseband with Cardbus module */ if (priv->short_slot_time) @@ -581,7 +583,8 @@ void vnt_set_vga_gain_offset(struct vnt_private *priv, u8 data) else priv->bb_rx_conf |= 0x20; /* 0010 */ - vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0a, priv->bb_rx_conf); + return vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0a, + priv->bb_rx_conf); } /* @@ -622,12 +625,13 @@ int vnt_exit_deep_sleep(struct vnt_private *priv) return vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0d, 0x01); } -void vnt_update_pre_ed_threshold(struct vnt_private *priv, int scanning) +int vnt_update_pre_ed_threshold(struct vnt_private *priv, int scanning) { const struct vnt_threshold *threshold = NULL; u8 length; u8 cr_201, cr_206; u8 ed_inx = priv->bb_pre_ed_index; + int ret; switch (priv->rf_type) { case RF_AL2230: @@ -650,7 +654,7 @@ void vnt_update_pre_ed_threshold(struct vnt_private *priv, int scanning) } if (!threshold) - return; + return -EINVAL; for (ed_inx = scanning ? 0 : length - 1; ed_inx > 0; ed_inx--) { if (priv->bb_pre_ed_rssi <= threshold[ed_inx].bb_pre_ed_rssi) @@ -661,14 +665,17 @@ void vnt_update_pre_ed_threshold(struct vnt_private *priv, int scanning) cr_206 = threshold[ed_inx].cr_206; if (ed_inx == priv->bb_pre_ed_index && !scanning) - return; + return 0; priv->bb_pre_ed_index = ed_inx; dev_dbg(&priv->usb->dev, "%s bb_pre_ed_rssi %d\n", __func__, priv->bb_pre_ed_rssi); - vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0xc9, cr_201); - vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0xce, cr_206); + ret = vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0xc9, cr_201); + if (ret) + return ret; + + return vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0xce, cr_206); } diff --git a/drivers/staging/vt6656/baseband.h b/drivers/staging/vt6656/baseband.h index dc42aa6ae1d9..8739988bf9e8 100644 --- a/drivers/staging/vt6656/baseband.h +++ b/drivers/staging/vt6656/baseband.h @@ -80,11 +80,11 @@ void vnt_get_phy_field(struct vnt_private *priv, u32 frame_length, u16 tx_rate, u8 pkt_type, struct vnt_phy_field *phy); int vnt_set_short_slot_time(struct vnt_private *priv); -void vnt_set_vga_gain_offset(struct vnt_private *priv, u8 data); +int vnt_set_vga_gain_offset(struct vnt_private *priv, u8 data); int vnt_set_antenna_mode(struct vnt_private *priv, u8 antenna_mode); int vnt_vt3184_init(struct vnt_private *priv); int vnt_set_deep_sleep(struct vnt_private *priv); int vnt_exit_deep_sleep(struct vnt_private *priv); -void vnt_update_pre_ed_threshold(struct vnt_private *priv, int scanning);
CURSOS BONIFICABLES DESDE CASA (Empleados activos y en ERTE)
Buenos días Se encuentra abierto el plazo de inscripción de Cursos Bonificables para empleados en activo y en situación de ERTE. Todos los cursos son totalmente Bonificables con cargo al Crédito de Formación 2020 que dispone las empresa. Se realizan desde casa en modalidad individual E-learning a través de la plataforma web y con total flexibilidad horaria. Deseáis que os mandemos la información? Saludos cordiales. Alex Pons Director departamento formación. FOESCO Formación Estatal Continua. Entidad Organizadora: B171823AP www.foesco.com e-mail: cur...@foesco.net Tel: 910 323 794 (Horario de 9h a 15h y de 17h a 20h de Lunes a Viernes) FOESCO ofrece formación a empresas y trabajadores en activo a través de cursos bonificados por la Fundación Estatal para la Formación en el Empleo (antiguo FORCEM) que gestiona las acciones formativas de FORMACIÓN CONTINUA para trabajadores y se rige por la ley 30/2015 de 9 de Septiembre. Si no desea recibir mas información de FOESCO responda a este correo con la palabra BAJA en el asunto. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] 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 --- drivers/staging/vt6656/main_usb.c | 28 ++-- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 3268d86fe93b..4bca0b99cf45 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -763,6 +763,12 @@ static int vnt_config(struct ieee80211_hw *hw, u32 changed) if (changed & IEEE80211_CONF_CHANGE_POWER) vnt_rf_setpower(priv, conf->chandef.chan); + if (conf->flags & (IEEE80211_CONF_OFFCHANNEL | IEEE80211_CONF_IDLE)) + /* Set max sensitivity*/ + vnt_update_pre_ed_threshold(priv, true); + else + vnt_update_pre_ed_threshold(priv, false); + return 0; } @@ -810,7 +816,6 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, vnt_set_short_slot_time(priv); vnt_set_vga_gain_offset(priv, priv->bb_vga[0]); - vnt_update_pre_ed_threshold(priv, false); } if (changed & (BSS_CHANGED_BASIC_RATES | BSS_CHANGED_ERP_PREAMBLE | @@ -937,25 +942,6 @@ static int vnt_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, return 0; } -static void vnt_sw_scan_start(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - const u8 *addr) -{ - struct vnt_private *priv = hw->priv; - - /* Set max sensitivity*/ - vnt_update_pre_ed_threshold(priv, true); -} - -static void vnt_sw_scan_complete(struct ieee80211_hw *hw, -struct ieee80211_vif *vif) -{ - struct vnt_private *priv = hw->priv; - - /* Return sensitivity to channel level*/ - vnt_update_pre_ed_threshold(priv, false); -} - static int vnt_get_stats(struct ieee80211_hw *hw, struct ieee80211_low_level_stats *stats) { @@ -1001,8 +987,6 @@ static const struct ieee80211_ops vnt_mac_ops = { .prepare_multicast = vnt_prepare_multicast, .configure_filter = vnt_configure, .set_key= vnt_set_key, - .sw_scan_start = vnt_sw_scan_start, - .sw_scan_complete = vnt_sw_scan_complete, .get_stats = vnt_get_stats, .get_tsf= vnt_get_tsf, .set_tsf= vnt_set_tsf, -- 2.25.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: qlge: cleanup indent in qlge_main.c
Cleanup indentation style in qlge_main.c. Fix 2 warnings found by checkpatch.pl. Signed-off-by: Mathieu Dolmen --- drivers/staging/qlge/qlge_main.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c index c92820f07968..d6b78c200383 100644 --- a/drivers/staging/qlge/qlge_main.c +++ b/drivers/staging/qlge/qlge_main.c @@ -4125,11 +4125,11 @@ static struct net_device_stats *qlge_get_stats(struct net_device /* Get RX stats. */ pkts = mcast = dropped = errors = bytes = 0; for (i = 0; i < qdev->rss_ring_count; i++, rx_ring++) { - pkts += rx_ring->rx_packets; - bytes += rx_ring->rx_bytes; - dropped += rx_ring->rx_dropped; - errors += rx_ring->rx_errors; - mcast += rx_ring->rx_multicast; + pkts += rx_ring->rx_packets; + bytes += rx_ring->rx_bytes; + dropped += rx_ring->rx_dropped; + errors += rx_ring->rx_errors; + mcast += rx_ring->rx_multicast; } ndev->stats.rx_packets = pkts; ndev->stats.rx_bytes = bytes; @@ -4140,9 +4140,9 @@ static struct net_device_stats *qlge_get_stats(struct net_device /* Get TX stats. */ pkts = errors = bytes = 0; for (i = 0; i < qdev->tx_ring_count; i++, tx_ring++) { - pkts += tx_ring->tx_packets; - bytes += tx_ring->tx_bytes; - errors += tx_ring->tx_errors; + pkts += tx_ring->tx_packets; + bytes += tx_ring->tx_bytes; + errors += tx_ring->tx_errors; } ndev->stats.tx_packets = pkts; ndev->stats.tx_bytes = bytes; -- 2.25.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] 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 --- drivers/staging/vt6656/baseband.c | 139 -- drivers/staging/vt6656/baseband.h | 13 --- drivers/staging/vt6656/rxtx.c | 111 drivers/staging/vt6656/rxtx.h | 7 ++ 4 files changed, 118 insertions(+), 152 deletions(-) diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index d21a9cf0afe5..e7000bba644a 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -112,10 +112,6 @@ static u8 vnt_vt3184_vt3226d0[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0xff */ }; -static const u16 vnt_frame_time[MAX_RATE] = { - 10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216 -}; - struct vnt_threshold { u8 bb_pre_ed_rssi; u8 cr_201; @@ -196,141 +192,6 @@ static const struct vnt_threshold vt3342_vnt_threshold[] = { {41, 0xff, 0x00} }; -static const u8 vnt_phy_signal[] = { - 0x00, /* RATE_1M */ - 0x01, /* RATE_2M */ - 0x02, /* RATE_5M */ - 0x03, /* RATE_11M */ - 0x8b, /* RATE_6M */ - 0x8f, /* RATE_9M */ - 0x8a, /* RATE_12M */ - 0x8e, /* RATE_18M */ - 0x89, /* RATE_24M */ - 0x8d, /* RATE_36M */ - 0x88, /* RATE_48M */ - 0x8c/* RATE_54M */ -}; - -/* - * Description: Calculate data frame transmitting time - * - * Parameters: - * In: - * preamble_type - Preamble Type - * pkt_type- PK_TYPE_11A, PK_TYPE_11B, PK_TYPE_11GB, PK_TYPE_11GA - * frame_length- Baseband Type - * tx_rate - Tx Rate - * Out: - * - * Return Value: FrameTime - * - */ -unsigned int vnt_get_frame_time(u8 preamble_type, u8 pkt_type, - unsigned int frame_length, u16 tx_rate) -{ - unsigned int frame_time; - unsigned int preamble; - unsigned int rate; - - if (tx_rate > RATE_54M) - return 0; - - rate = (unsigned int)vnt_frame_time[tx_rate]; - - if (tx_rate <= RATE_11M) { - if (preamble_type == PREAMBLE_SHORT) - preamble = 96; - else - preamble = 192; - - frame_time = DIV_ROUND_UP(frame_length * 80, rate); - return preamble + frame_time; - } - - frame_time = DIV_ROUND_UP(frame_length * 8 + 22, rate); - frame_time = frame_time * 4; - - if (pkt_type != PK_TYPE_11A) - frame_time += 6; - return 20 + frame_time; -} - -/* - * Description: Calculate Length, Service, and Signal fields of Phy for Tx - * - * Parameters: - * In: - * priv - Device Structure - * frame_length - Tx Frame Length - * tx_rate - Tx Rate - * Out: - * struct vnt_phy_field *phy - * - pointer to Phy Length field - * - pointer to Phy Service field - * - pointer to Phy Signal field - * - * Return Value: none - * - */ -void vnt_get_phy_field(struct vnt_private *priv, u32 frame_length, - u16 tx_rate, u8 pkt_type, struct vnt_phy_field *phy) -{ - u32 bit_count; - u32 count = 0; - u32 tmp; - int ext_bit; - int i; - u8 mask = 0; - u8 preamble_type = priv->preamble_type; - - bit_count = frame_length * 8; - ext_bit = false; - - switch (tx_rate) { - case RATE_1M: - count = bit_count; - break; - case RATE_2M: - count = bit_count / 2; - break; - case RATE_5M: - count = DIV_ROUND_UP(bit_count * 10, 55); - break; - case RATE_11M: - count = bit_count / 11; - tmp = count * 11; - - if (tmp != bit_count) { - count++; - - if ((bit_count - tmp) <= 3) - ext_bit = true; - } - - break; - } - - if (tx_rate > RATE_11M) { - if (pkt_type == PK_TYPE_11A) - mask = BIT(4); - } else if (tx_rate > RATE_1M) { - if (preamble_type == PREAMBLE_SHORT) - mask = BIT(3); - } - - i = tx_rate > RATE_54M ? RATE_54M : tx_rate; - phy->signal = vnt_phy_signal[i] | mask; - phy->service = 0x00; - - if (pkt_type == PK_TYPE_11B) { - if (ext_bit) - phy->service |= 0x80; - phy->len = cpu_to_le16((u16)count); - } else { - phy->len = cpu_to_le16((u16)frame_length); - } -} - /* * Description: Set Antenna mode * diff --git a/drivers/staging/vt6656/baseband.h b/drivers/staging/vt6656/baseband.h index dc42aa6ae1d9..ee7325d942fe 100644 --- a/drivers/staging/vt6656/bas
Re: [PATCH] staging: vt6656: Refactor the vnt_ofdm_min_rate function
Hi Oscar, On Sat, 18 Apr 2020 15:45:53 +0200 Oscar Carter wrote: > 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 > --- > drivers/staging/vt6656/card.c | 11 ++- > drivers/staging/vt6656/card.h | 2 +- > 2 files changed, 3 insertions(+), 10 deletions(-) > > diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c > index 9bd37e57c727..adaf93cf653a 100644 > --- a/drivers/staging/vt6656/card.c > +++ b/drivers/staging/vt6656/card.c > @@ -248,16 +248,9 @@ void vnt_update_top_rates(struct vnt_private *priv) > priv->top_cck_basic_rate = top_cck; > } > > -int vnt_ofdm_min_rate(struct vnt_private *priv) > +bool vnt_ofdm_min_rate(struct vnt_private *priv) > { > - int ii; > - > - for (ii = RATE_54M; ii >= RATE_6M; ii--) { > - if ((priv->basic_rates) & ((u16)BIT(ii))) > - return true; > - } > - > - return false; > + return priv->basic_rates & GENMASK(RATE_54M, RATE_6M) ? true : false; priv->basic_rates & GENMASK(RATE_54M, RATE_6M) is already true if non-zero and false otherwise. Note that I haven't checked if the rest is correct. -- Stefano ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: vt6656: Refactor the vnt_ofdm_min_rate function
Hi all On 19/04/2020 18:55, Stefano Brivio wrote: Hi Oscar, On Sat, 18 Apr 2020 15:45:53 +0200 Oscar Carter wrote: 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. -int vnt_ofdm_min_rate(struct vnt_private *priv) +bool vnt_ofdm_min_rate(struct vnt_private *priv) { - int ii; - - for (ii = RATE_54M; ii >= RATE_6M; ii--) { - if ((priv->basic_rates) & ((u16)BIT(ii))) - return true; - } - - return false; + return priv->basic_rates & GENMASK(RATE_54M, RATE_6M) ? true : false; priv->basic_rates & GENMASK(RATE_54M, RATE_6M) is already true if non-zero and false otherwise. Note that I haven't checked if the rest is correct. Yes only 1 or more needs to be true and it is false when none present. I have run-time checked the patch and it does function as before. Regards Malcolm. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: comedi: Fix comedi_device refcnt leak in comedi_open
comedi_open() invokes comedi_dev_get_from_minor(), which returns a reference of the COMEDI device to "dev" with increased refcount. When comedi_open() returns, "dev" becomes invalid, so the refcount should be decreased to keep refcount balanced. The reference counting issue happens in one exception handling path of comedi_open(). When "cfp" allocation is failed, the refcnt increased by comedi_dev_get_from_minor() is not decreased, causing a refcnt leak. Fix this issue by calling comedi_dev_put() on this error path when "cfp" allocation is failed. Fixes: 20f083c07565 ("staging: comedi: prepare support for per-file read and write subdevices") Signed-off-by: Xiyu Yang Signed-off-by: Xin Tan --- drivers/staging/comedi/comedi_fops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 08d1bbbebf2d..e84b4fb493d6 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2725,8 +2725,10 @@ static int comedi_open(struct inode *inode, struct file *file) } cfp = kzalloc(sizeof(*cfp), GFP_KERNEL); - if (!cfp) + if (!cfp) { + comedi_dev_put(dev); return -ENOMEM; + } cfp->dev = dev; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel