[driver-core:debugfs_cleanup] BUILD REGRESSION 6cdbeae3773b0bb611d8caf5e84650f58a02748b

2020-04-06 Thread kbuild test robot
tree/branch: 
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git  
debugfs_cleanup
branch HEAD: 6cdbeae3773b0bb611d8caf5e84650f58a02748b  nouveau: no need to 
check return value of debugfs_create functions

Error/Warning in current branch:

drivers/gpu/drm/drm_debugfs.c:232:5: error: conflicting types for 
'drm_debugfs_remove_files'
drivers/gpu/drm/drm_debugfs.c:253:1: note: in expansion of macro 'EXPORT_SYMBOL'
drivers/gpu/drm/i915/display/intel_display_debugfs.c:1943:9: error: void value 
not ignored as it ought to be
drivers/gpu/drm/i915/display/intel_display_debugfs.c:1946:1: warning: control 
reaches end of non-void function [-Wreturn-type]
drivers/gpu/drm/i915/i915_debugfs.c:2179:6: error: conflicting types for 
'i915_debugfs_register'

Error/Warning ids grouped by kconfigs:

recent_errors
|-- alpha-allyesconfig
|   |-- 
drivers-gpu-drm-drm_debugfs.c:error:conflicting-types-for-drm_debugfs_remove_files
|   `-- drivers-gpu-drm-drm_debugfs.c:note:in-expansion-of-macro-EXPORT_SYMBOL
|-- alpha-randconfig-a001-20200406
|   |-- 
drivers-gpu-drm-drm_debugfs.c:error:conflicting-types-for-drm_debugfs_remove_files
|   `-- drivers-gpu-drm-drm_debugfs.c:note:in-expansion-of-macro-EXPORT_SYMBOL
|-- arc-randconfig-a001-20200407
|   |-- 
drivers-gpu-drm-drm_debugfs.c:error:conflicting-types-for-drm_debugfs_remove_files
|   `-- drivers-gpu-drm-drm_debugfs.c:note:in-expansion-of-macro-EXPORT_SYMBOL
|-- arm-allmodconfig
|   |-- 
drivers-gpu-drm-drm_debugfs.c:error:conflicting-types-for-drm_debugfs_remove_files
|   `-- drivers-gpu-drm-drm_debugfs.c:note:in-expansion-of-macro-EXPORT_SYMBOL
|-- arm-allyesconfig
|   |-- 
drivers-gpu-drm-drm_debugfs.c:error:conflicting-types-for-drm_debugfs_remove_files
|   `-- drivers-gpu-drm-drm_debugfs.c:note:in-expansion-of-macro-EXPORT_SYMBOL
|-- arm-at91_dt_defconfig
|   |-- 
drivers-gpu-drm-drm_debugfs.c:error:conflicting-types-for-drm_debugfs_remove_files
|   `-- drivers-gpu-drm-drm_debugfs.c:note:in-expansion-of-macro-EXPORT_SYMBOL
|-- arm-defconfig
|   |-- 
drivers-gpu-drm-drm_debugfs.c:error:conflicting-types-for-drm_debugfs_remove_files
|   `-- drivers-gpu-drm-drm_debugfs.c:note:in-expansion-of-macro-EXPORT_SYMBOL
|-- arm-exynos_defconfig
|   |-- 
drivers-gpu-drm-drm_debugfs.c:error:conflicting-types-for-drm_debugfs_remove_files
|   `-- drivers-gpu-drm-drm_debugfs.c:note:in-expansion-of-macro-EXPORT_SYMBOL
|-- arm-hisi_defconfig
|   `-- 
drivers-gpu-drm-drm_debugfs.c:error:conflicting-types-for-drm_debugfs_remove_files
|-- arm-imx_v6_v7_defconfig
|   |-- 
drivers-gpu-drm-drm_debugfs.c:error:conflicting-types-for-drm_debugfs_remove_files
|   `-- drivers-gpu-drm-drm_debugfs.c:note:in-expansion-of-macro-EXPORT_SYMBOL
|-- arm-multi_v5_defconfig
|   |-- 
drivers-gpu-drm-drm_debugfs.c:error:conflicting-types-for-drm_debugfs_remove_files
|   `-- drivers-gpu-drm-drm_debugfs.c:note:in-expansion-of-macro-EXPORT_SYMBOL
|-- arm-multi_v7_defconfig
|   |-- 
drivers-gpu-drm-drm_debugfs.c:error:conflicting-types-for-drm_debugfs_remove_files
|   `-- drivers-gpu-drm-drm_debugfs.c:note:in-expansion-of-macro-EXPORT_SYMBOL
|-- arm-omap2plus_defconfig
|   |-- 
drivers-gpu-drm-drm_debugfs.c:error:conflicting-types-for-drm_debugfs_remove_files
|   `-- drivers-gpu-drm-drm_debugfs.c:note:in-expansion-of-macro-EXPORT_SYMBOL
|-- arm-randconfig-a001-20200406
|   |-- 
drivers-gpu-drm-drm_debugfs.c:error:conflicting-types-for-drm_debugfs_remove_files
|   `-- drivers-gpu-drm-drm_debugfs.c:note:in-expansion-of-macro-EXPORT_SYMBOL
|-- arm-randconfig-a001-20200407
|   |-- 
drivers-gpu-drm-drm_debugfs.c:error:conflicting-types-for-drm_debugfs_remove_files
|   `-- drivers-gpu-drm-drm_debugfs.c:note:in-expansion-of-macro-EXPORT_SYMBOL
|-- arm-shmobile_defconfig
|   `-- 
drivers-gpu-drm-drm_debugfs.c:error:conflicting-types-for-drm_debugfs_remove_files
|-- arm-sunxi_defconfig
|   |-- 
drivers-gpu-drm-drm_debugfs.c:error:conflicting-types-for-drm_debugfs_remove_files
|   `-- drivers-gpu-drm-drm_debugfs.c:note:in-expansion-of-macro-EXPORT_SYMBOL
|-- arm64-allmodconfig
|   |-- 
drivers-gpu-drm-drm_debugfs.c:error:conflicting-types-for-drm_debugfs_remove_files
|   `-- drivers-gpu-drm-drm_debugfs.c:note:in-expansion-of-macro-EXPORT_SYMBOL
|-- arm64-allyesconfig
|   |-- 
drivers-gpu-drm-drm_debugfs.c:error:conflicting-types-for-drm_debugfs_remove_files
|   `-- drivers-gpu-drm-drm_debugfs.c:note:in-expansion-of-macro-EXPORT_SYMBOL
|-- arm64-defconfig
|   |-- 
drivers-gpu-drm-drm_debugfs.c:error:conflicting-types-for-drm_debugfs_remove_files
|   `-- drivers-gpu-drm-drm_debugfs.c:note:in-expansion-of-macro-EXPORT_SYMBOL
|-- arm64-randconfig-a001-20200406
|   |-- 
drivers-gpu-drm-drm_debugfs.c:error:conflicting-types-for-drm_debugfs_remove_files
|   `-- drivers-gpu-drm-drm_debugfs.c:note:in-expansion-of-macro-EXPORT_SYMBOL
|-- c6x-allyesconfig
|   |-- 
drivers-gpu-drm-drm_debugfs.c:error:conflicting-types-for-drm_debugfs_remove_files
|   `-- drivers-gpu-drm-drm_debugfs.c:note:in-expansion-of-macro

[driver-core:debugfs_remove_return_value] BUILD SUCCESS 5607303ec5411cf9e24005053ea4064f43f8911d

2020-04-06 Thread kbuild test robot
tree/branch: 
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git  
debugfs_remove_return_value
branch HEAD: 5607303ec5411cf9e24005053ea4064f43f8911d  debugfs: remove return 
value of debugfs_create_u32()

elapsed time: 484m

configs tested: 162
configs skipped: 0

The following configs have been built successfully.
More configs may be tested in the coming days.

arm64allyesconfig
arm  allmodconfig
arm64 allnoconfig
arm   allnoconfig
arm at91_dt_defconfig
arm   efm32_defconfig
arm  exynos_defconfig
armmulti_v5_defconfig
armmulti_v7_defconfig
armshmobile_defconfig
arm   sunxi_defconfig
arm64   defconfig
sparcallyesconfig
nios2 10m50_defconfig
riscv  rv32_defconfig
m68k  multi_defconfig
ia64defconfig
powerpc defconfig
m68k   m5475evb_defconfig
um   x86_64_defconfig
i386  allnoconfig
i386 alldefconfig
i386 allyesconfig
i386  debian-10.3
i386defconfig
ia64 allmodconfig
ia64  allnoconfig
ia64 allyesconfig
ia64 alldefconfig
arm64allmodconfig
nios2 3c120_defconfig
c6xevmc6678_defconfig
xtensa  iss_defconfig
c6x  allyesconfig
xtensa   common_defconfig
openrisc simple_smp_defconfig
openriscor1ksim_defconfig
nds32   defconfig
nds32 allnoconfig
cskydefconfig
alpha   defconfig
h8300 edosk2674_defconfig
h8300h8300h-sim_defconfig
h8300   h8s-sim_defconfig
m68k allmodconfig
m68k   sun3_defconfig
arc  allyesconfig
arc defconfig
microblaze  mmu_defconfig
microblazenommu_defconfig
powerpc   allnoconfig
powerpc   ppc64_defconfig
powerpc  rhel-kconfig
mips  fuloong2e_defconfig
mips  malta_kvm_defconfig
mips allyesconfig
mips 64r6el_defconfig
mips  allnoconfig
mips   32r2_defconfig
mips allmodconfig
pariscallnoconfig
parisc   allyesconfig
pariscgeneric-32bit_defconfig
pariscgeneric-64bit_defconfig
x86_64   randconfig-a003-20200406
i386 randconfig-a002-20200406
x86_64   randconfig-a002-20200406
x86_64   randconfig-a001-20200406
i386 randconfig-a001-20200406
i386 randconfig-a003-20200406
mips randconfig-a001-20200406
nds32randconfig-a001-20200406
m68k randconfig-a001-20200406
parisc   randconfig-a001-20200406
alpharandconfig-a001-20200406
riscvrandconfig-a001-20200406
sparc64  randconfig-a001-20200406
h8300randconfig-a001-20200406
nios2randconfig-a001-20200406
microblaze   randconfig-a001-20200406
c6x  randconfig-a001-20200406
s390 randconfig-a001-20200406
xtensa   randconfig-a001-20200406
csky randconfig-a001-20200406
openrisc randconfig-a001-20200406
sh   randconfig-a001-20200406
x86_64   randconfig-b001-20200406
x86_64   randconfig-b002-20200406
x86_64   randconfig-b003-20200406
i386 randconfig-b001-20200406
i386 randconfig-b002-20200406
i386 randconfig-b003-20200406
x86_64   randconfig-c001-20200406
x86_64   randconfig-c002-20200406
x86_64   randconfig-c003-20200406
i386 randconfig-c001-20200406
i386 randconfig-c002-20200406
i386 randconfig-c003-20200406
x86_64   randconfig-d003-20200406
x86_64   randconfig-d001-20200406
i386

[staging:staging-testing] BUILD SUCCESS 28910cbdc813ef8d7fa14b78d220457388c05c61

2020-04-06 Thread kbuild test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
 staging-testing
branch HEAD: 28910cbdc813ef8d7fa14b78d220457388c05c61  staging: wfx: remove 
hack about tx_rate policies

Error/Warning in current branch:

drivers/staging/vt6655/baseband.c:1711:15: warning: The scope of the variable 
'preamble' can be reduced. [variableScope]
drivers/staging/vt6655/baseband.c:1912:16: warning: The scope of the variable 
'by_value' can be reduced. [variableScope]
drivers/staging/wfx/queue.c:349:18: warning: The scope of the variable 'skb' 
can be reduced. [variableScope]
drivers/staging/wfx/queue.c:92:18: warning: The scope of the variable 'hif_msg' 
can be reduced. [variableScope]
struct hif_msg *hif_msg;
unsigned char by_value;

Error/Warning ids grouped by kconfigs:

recent_errors
|-- i386-allmodconfig
|   |-- 
drivers-staging-vt6655-baseband.c:warning:The-scope-of-the-variable-by_value-can-be-reduced.-variableScope
|   |-- 
drivers-staging-vt6655-baseband.c:warning:The-scope-of-the-variable-preamble-can-be-reduced.-variableScope
|   `-- unsigned-char-by_value
`-- x86_64-allyesconfig
|-- 
drivers-staging-vt6655-baseband.c:warning:The-scope-of-the-variable-by_value-can-be-reduced.-variableScope
|-- 
drivers-staging-vt6655-baseband.c:warning:The-scope-of-the-variable-preamble-can-be-reduced.-variableScope
|-- 
drivers-staging-wfx-queue.c:warning:The-scope-of-the-variable-hif_msg-can-be-reduced.-variableScope
|-- 
drivers-staging-wfx-queue.c:warning:The-scope-of-the-variable-skb-can-be-reduced.-variableScope
|-- struct-hif_msg-hif_msg
`-- unsigned-char-by_value

elapsed time: 483m

configs tested: 157
configs skipped: 0

The following configs have been built successfully.
More configs may be tested in the coming days.

arm64allyesconfig
arm  allyesconfig
arm64allmodconfig
arm  allmodconfig
arm64 allnoconfig
arm   allnoconfig
arm   efm32_defconfig
arm at91_dt_defconfig
armshmobile_defconfig
arm  exynos_defconfig
armmulti_v5_defconfig
armmulti_v7_defconfig
arm   sunxi_defconfig
arm64   defconfig
sparcallyesconfig
ia64defconfig
openrisc simple_smp_defconfig
nios2 10m50_defconfig
riscv  rv32_defconfig
m68k  multi_defconfig
powerpc defconfig
m68k   m5475evb_defconfig
um   x86_64_defconfig
i386  allnoconfig
i386 alldefconfig
i386 allyesconfig
i386  debian-10.3
i386defconfig
ia64 allmodconfig
ia64  allnoconfig
ia64 allyesconfig
ia64 alldefconfig
nios2 3c120_defconfig
c6xevmc6678_defconfig
xtensa  iss_defconfig
c6x  allyesconfig
xtensa   common_defconfig
openriscor1ksim_defconfig
nds32   defconfig
nds32 allnoconfig
cskydefconfig
alpha   defconfig
h8300   h8s-sim_defconfig
h8300 edosk2674_defconfig
m68k allmodconfig
h8300h8300h-sim_defconfig
m68k   sun3_defconfig
arc  allyesconfig
arc defconfig
microblaze  mmu_defconfig
microblazenommu_defconfig
powerpc   allnoconfig
powerpc   ppc64_defconfig
powerpc  rhel-kconfig
mips  fuloong2e_defconfig
mips  malta_kvm_defconfig
mips allyesconfig
mips 64r6el_defconfig
mips  allnoconfig
mips   32r2_defconfig
mips allmodconfig
pariscallnoconfig
parisc   allyesconfig
pariscgeneric-32bit_defconfig
pariscgeneric-64bit_defconfig
x86_64   randconfig-a003-20200406
i386 randconfig-a002-20200406
x86_64   randconfig-a002-20200406
x86_64   randconfig-a001-20200406
i386 randconfig-a001

[PATCH 2/2 v2] staging: vt6656: rxtx remove rate change and current_rate.

2020-04-06 Thread Malcolm Priestley
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 
---
v2
Patch 1 had wrong array.

 drivers/staging/vt6656/device.h |  1 -
 drivers/staging/vt6656/rxtx.c   | 15 ---
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index e6ee9411f080..41226cd599c6 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -344,7 +344,6 @@ struct vnt_private {
u8 ofdm_pwr_tbl[14];
u8 ofdm_a_pwr_tbl[42];
 
-   u16 current_rate;
u16 tx_rate_fb0;
u16 tx_rate_fb1;
 
diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 9439d190f431..8363d54cd821 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -547,7 +547,7 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff 
*skb)
struct vnt_tx_fifo_head *tx_buffer_head;
struct vnt_usb_send_context *tx_context;
unsigned long flags;
-   u16 tx_bytes, tx_header_size, tx_body_size, current_rate, duration_id;
+   u16 tx_bytes, tx_header_size, tx_body_size, duration_id;
u8 pkt_type;
bool need_rts = false;
bool need_mic = false;
@@ -556,14 +556,7 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff 
*skb)
 
rate = ieee80211_get_tx_rate(priv->hw, info);
 
-   current_rate = rate->hw_value;
-   if (priv->current_rate != current_rate &&
-   !(priv->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) {
-   priv->current_rate = current_rate;
-   vnt_schedule_command(priv, WLAN_CMD_SETPOWER);
-   }
-
-   if (current_rate > RATE_11M) {
+   if (rate->hw_value > RATE_11M) {
if (info->band == NL80211_BAND_5GHZ) {
pkt_type = PK_TYPE_11A;
} else {
@@ -593,7 +586,7 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff 
*skb)
tx_context->pkt_type = pkt_type;
tx_context->need_ack = false;
tx_context->frame_len = skb->len + 4;
-   tx_context->tx_rate = current_rate;
+   tx_context->tx_rate =  rate->hw_value;
 
spin_unlock_irqrestore(>lock, flags);
 
@@ -666,7 +659,7 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff 
*skb)
tx_context->frame_len += tx_key->icv_len;
}
 
-   tx_buffer_head->current_rate = cpu_to_le16(current_rate);
+   tx_buffer_head->current_rate = cpu_to_le16(rate->hw_value);
 
duration_id = vnt_generate_tx_parameter(tx_context, tx_buffer, _hdr,
need_mic, need_rts);
-- 
2.25.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/2 v2] staging: vt6556: vnt_rf_setpower convert to use ieee80211_channel.

2020-04-06 Thread Malcolm Priestley
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 
---
v2
ARRAY_SIZE(priv->ofdm_pwr_tbl) pointing to wrong array.

 drivers/staging/vt6656/main_usb.c | 16 ++-
 drivers/staging/vt6656/rf.c   | 79 +++
 drivers/staging/vt6656/rf.h   |  3 +-
 drivers/staging/vt6656/wcmd.c |  3 +-
 4 files changed, 43 insertions(+), 58 deletions(-)

diff --git a/drivers/staging/vt6656/main_usb.c 
b/drivers/staging/vt6656/main_usb.c
index dd89f98cc18c..3c76d3cb5bbe 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -685,15 +685,8 @@ static int vnt_config(struct ieee80211_hw *hw, u32 changed)
priv->bb_type = BB_TYPE_11G;
}
 
-   if (changed & IEEE80211_CONF_CHANGE_POWER) {
-   if (priv->bb_type == BB_TYPE_11B)
-   priv->current_rate = RATE_1M;
-   else
-   priv->current_rate = RATE_54M;
-
-   vnt_rf_setpower(priv, priv->current_rate,
-   conf->chandef.chan->hw_value);
-   }
+   if (changed & IEEE80211_CONF_CHANGE_POWER)
+   vnt_rf_setpower(priv, conf->chandef.chan);
 
return 0;
 }
@@ -747,9 +740,8 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw,
vnt_update_pre_ed_threshold(priv, false);
}
 
-   if (changed & BSS_CHANGED_TXPOWER)
-   vnt_rf_setpower(priv, priv->current_rate,
-   conf->chandef.chan->hw_value);
+   if (changed & (BSS_CHANGED_TXPOWER | BSS_CHANGED_BANDWIDTH))
+   vnt_rf_setpower(priv, conf->chandef.chan);
 
if (changed & BSS_CHANGED_BEACON_ENABLED) {
dev_dbg(>usb->dev,
diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c
index 4f9aba0f21b0..633e2b9aca7a 100644
--- a/drivers/staging/vt6656/rf.c
+++ b/drivers/staging/vt6656/rf.c
@@ -537,42 +537,6 @@ int vnt_rf_write_embedded(struct vnt_private *priv, u32 
data)
return true;
 }
 
-/* Set Tx power by rate and channel number */
-int vnt_rf_setpower(struct vnt_private *priv, u32 rate, u32 channel)
-{
-   u8 power = priv->cck_pwr;
-
-   if (channel == 0)
-   return -EINVAL;
-
-   switch (rate) {
-   case RATE_1M:
-   case RATE_2M:
-   case RATE_5M:
-   case RATE_11M:
-   channel--;
-
-   if (channel < sizeof(priv->cck_pwr_tbl))
-   power = priv->cck_pwr_tbl[channel];
-   break;
-   case RATE_6M:
-   case RATE_9M:
-   case RATE_12M:
-   case RATE_18M:
-   case RATE_24M:
-   case RATE_36M:
-   case RATE_48M:
-   case RATE_54M:
-   if (channel > CB_MAX_CHANNEL_24G)
-   power = priv->ofdm_a_pwr_tbl[channel - 15];
-   else
-   power = priv->ofdm_pwr_tbl[channel - 1];
-   break;
-   }
-
-   return vnt_rf_set_txpower(priv, power, rate);
-}
-
 static u8 vnt_rf_addpower(struct vnt_private *priv)
 {
s32 rssi = -priv->current_rssi;
@@ -600,7 +564,8 @@ static u8 vnt_rf_addpower(struct vnt_private *priv)
 }
 
 /* Set Tx power by power level and rate */
-int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, u32 rate)
+static int vnt_rf_set_txpower(struct vnt_private *priv, u8 power,
+ struct ieee80211_channel *ch)
 {
u32 power_setting = 0;
int ret = true;
@@ -620,7 +585,7 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, 
u32 rate)
 
ret &= vnt_rf_write_embedded(priv, power_setting);
 
-   if (rate <= RATE_11M)
+   if (ch->flags & IEEE80211_CHAN_NO_OFDM)
ret &= vnt_rf_write_embedded(priv, 0x0001b400);
else
ret &= vnt_rf_write_embedded(priv, 0x0005a400);
@@ -630,7 +595,7 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, 
u32 rate)
 
ret &= vnt_rf_write_embedded(priv, power_setting);
 
-   if (rate <= RATE_11M) {
+   if (ch->flags & IEEE80211_CHAN_NO_OFDM) {
ret &= vnt_rf_write_embedded(priv, 0x040c1400);
ret &= vnt_rf_write_embedded(priv, 0x00299b00);
} else {
@@ -640,7 +605,7 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, 
u32 rate)
break;
 
case RF_AIROHA7230:
-   if (rate <= RATE_11M)
+   if (ch->flags & IEEE80211_CHAN_NO_OFDM)
ret &= vnt_rf_write_embedded(priv, 0x111bb900);
else
ret &= vnt_rf_write_embedded(priv, 0x221bb900);
@@ -670,8 +635,8 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, 

Re: [PATCH 1/2] staging: vt6556: vnt_rf_setpower convert to use ieee80211_channel.

2020-04-06 Thread Malcolm Priestley
Drop these patches I have just noticed a mistake.

Regards

Malcolm
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] staging: vt6656: rxtx remove rate change and current_rate.

2020-04-06 Thread Malcolm Priestley
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 
---
 drivers/staging/vt6656/device.h |  1 -
 drivers/staging/vt6656/rxtx.c   | 15 ---
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index e6ee9411f080..41226cd599c6 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -344,7 +344,6 @@ struct vnt_private {
u8 ofdm_pwr_tbl[14];
u8 ofdm_a_pwr_tbl[42];
 
-   u16 current_rate;
u16 tx_rate_fb0;
u16 tx_rate_fb1;
 
diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 9439d190f431..8363d54cd821 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -547,7 +547,7 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff 
*skb)
struct vnt_tx_fifo_head *tx_buffer_head;
struct vnt_usb_send_context *tx_context;
unsigned long flags;
-   u16 tx_bytes, tx_header_size, tx_body_size, current_rate, duration_id;
+   u16 tx_bytes, tx_header_size, tx_body_size, duration_id;
u8 pkt_type;
bool need_rts = false;
bool need_mic = false;
@@ -556,14 +556,7 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff 
*skb)
 
rate = ieee80211_get_tx_rate(priv->hw, info);
 
-   current_rate = rate->hw_value;
-   if (priv->current_rate != current_rate &&
-   !(priv->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) {
-   priv->current_rate = current_rate;
-   vnt_schedule_command(priv, WLAN_CMD_SETPOWER);
-   }
-
-   if (current_rate > RATE_11M) {
+   if (rate->hw_value > RATE_11M) {
if (info->band == NL80211_BAND_5GHZ) {
pkt_type = PK_TYPE_11A;
} else {
@@ -593,7 +586,7 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff 
*skb)
tx_context->pkt_type = pkt_type;
tx_context->need_ack = false;
tx_context->frame_len = skb->len + 4;
-   tx_context->tx_rate = current_rate;
+   tx_context->tx_rate =  rate->hw_value;
 
spin_unlock_irqrestore(>lock, flags);
 
@@ -666,7 +659,7 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff 
*skb)
tx_context->frame_len += tx_key->icv_len;
}
 
-   tx_buffer_head->current_rate = cpu_to_le16(current_rate);
+   tx_buffer_head->current_rate = cpu_to_le16(rate->hw_value);
 
duration_id = vnt_generate_tx_parameter(tx_context, tx_buffer, _hdr,
need_mic, need_rts);
-- 
2.25.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/2] staging: vt6556: vnt_rf_setpower convert to use ieee80211_channel.

2020-04-06 Thread Malcolm Priestley
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 
---
 drivers/staging/vt6656/main_usb.c | 16 ++-
 drivers/staging/vt6656/rf.c   | 79 +++
 drivers/staging/vt6656/rf.h   |  3 +-
 drivers/staging/vt6656/wcmd.c |  3 +-
 4 files changed, 43 insertions(+), 58 deletions(-)

diff --git a/drivers/staging/vt6656/main_usb.c 
b/drivers/staging/vt6656/main_usb.c
index dd89f98cc18c..3c76d3cb5bbe 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -685,15 +685,8 @@ static int vnt_config(struct ieee80211_hw *hw, u32 changed)
priv->bb_type = BB_TYPE_11G;
}
 
-   if (changed & IEEE80211_CONF_CHANGE_POWER) {
-   if (priv->bb_type == BB_TYPE_11B)
-   priv->current_rate = RATE_1M;
-   else
-   priv->current_rate = RATE_54M;
-
-   vnt_rf_setpower(priv, priv->current_rate,
-   conf->chandef.chan->hw_value);
-   }
+   if (changed & IEEE80211_CONF_CHANGE_POWER)
+   vnt_rf_setpower(priv, conf->chandef.chan);
 
return 0;
 }
@@ -747,9 +740,8 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw,
vnt_update_pre_ed_threshold(priv, false);
}
 
-   if (changed & BSS_CHANGED_TXPOWER)
-   vnt_rf_setpower(priv, priv->current_rate,
-   conf->chandef.chan->hw_value);
+   if (changed & (BSS_CHANGED_TXPOWER | BSS_CHANGED_BANDWIDTH))
+   vnt_rf_setpower(priv, conf->chandef.chan);
 
if (changed & BSS_CHANGED_BEACON_ENABLED) {
dev_dbg(>usb->dev,
diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c
index 4f9aba0f21b0..633e2b9aca7a 100644
--- a/drivers/staging/vt6656/rf.c
+++ b/drivers/staging/vt6656/rf.c
@@ -537,42 +537,6 @@ int vnt_rf_write_embedded(struct vnt_private *priv, u32 
data)
return true;
 }
 
-/* Set Tx power by rate and channel number */
-int vnt_rf_setpower(struct vnt_private *priv, u32 rate, u32 channel)
-{
-   u8 power = priv->cck_pwr;
-
-   if (channel == 0)
-   return -EINVAL;
-
-   switch (rate) {
-   case RATE_1M:
-   case RATE_2M:
-   case RATE_5M:
-   case RATE_11M:
-   channel--;
-
-   if (channel < sizeof(priv->cck_pwr_tbl))
-   power = priv->cck_pwr_tbl[channel];
-   break;
-   case RATE_6M:
-   case RATE_9M:
-   case RATE_12M:
-   case RATE_18M:
-   case RATE_24M:
-   case RATE_36M:
-   case RATE_48M:
-   case RATE_54M:
-   if (channel > CB_MAX_CHANNEL_24G)
-   power = priv->ofdm_a_pwr_tbl[channel - 15];
-   else
-   power = priv->ofdm_pwr_tbl[channel - 1];
-   break;
-   }
-
-   return vnt_rf_set_txpower(priv, power, rate);
-}
-
 static u8 vnt_rf_addpower(struct vnt_private *priv)
 {
s32 rssi = -priv->current_rssi;
@@ -600,7 +564,8 @@ static u8 vnt_rf_addpower(struct vnt_private *priv)
 }
 
 /* Set Tx power by power level and rate */
-int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, u32 rate)
+static int vnt_rf_set_txpower(struct vnt_private *priv, u8 power,
+ struct ieee80211_channel *ch)
 {
u32 power_setting = 0;
int ret = true;
@@ -620,7 +585,7 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, 
u32 rate)
 
ret &= vnt_rf_write_embedded(priv, power_setting);
 
-   if (rate <= RATE_11M)
+   if (ch->flags & IEEE80211_CHAN_NO_OFDM)
ret &= vnt_rf_write_embedded(priv, 0x0001b400);
else
ret &= vnt_rf_write_embedded(priv, 0x0005a400);
@@ -630,7 +595,7 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, 
u32 rate)
 
ret &= vnt_rf_write_embedded(priv, power_setting);
 
-   if (rate <= RATE_11M) {
+   if (ch->flags & IEEE80211_CHAN_NO_OFDM) {
ret &= vnt_rf_write_embedded(priv, 0x040c1400);
ret &= vnt_rf_write_embedded(priv, 0x00299b00);
} else {
@@ -640,7 +605,7 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, 
u32 rate)
break;
 
case RF_AIROHA7230:
-   if (rate <= RATE_11M)
+   if (ch->flags & IEEE80211_CHAN_NO_OFDM)
ret &= vnt_rf_write_embedded(priv, 0x111bb900);
else
ret &= vnt_rf_write_embedded(priv, 0x221bb900);
@@ -670,8 +635,8 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, 
u32 rate)
if (power >= VT3226_PWR_IDX_LEN)
  

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

2020-04-06 Thread Greg Kroah-Hartman
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:
> > > 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 
> > > Reviewed-by: Dan Carpenter 
> > > ---
> > >  drivers/staging/vt6656/baseband.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/staging/vt6656/baseband.c 
> > > b/drivers/staging/vt6656/baseband.c
> > > index 3e4bd637849a..a785f91c1566 100644
> > > --- a/drivers/staging/vt6656/baseband.c
> > > +++ b/drivers/staging/vt6656/baseband.c
> > > @@ -24,6 +24,7 @@
> > >
> > >  #include 
> > >  #include 
> > > +#include "device.h"
> > >  #include "mac.h"
> > >  #include "baseband.h"
> > >  #include "rf.h"
> > > @@ -141,7 +142,7 @@ unsigned int vnt_get_frame_time(u8 preamble_type, u8 
> > > pkt_type,
> > >
> > >   rate = (unsigned int)vnt_frame_time[tx_rate];
> > >
> > > - if (tx_rate <= 3) {
> > > + if (tx_rate <= RATE_11M) {
> > >   if (preamble_type == 1)
> > >   preamble = 96;
> > >   else
> > > --
> > > 2.20.1
> >
> > This doesn't apply to my tree :(
> >
> Sorry, but I don't understand what it means. This meant that I need to rebase
> this patch against your staging-next branch of your staging tree ?

Yes, and 3/3 as well, because I dropped the 1/3 patch here.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


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.
> >
> > Signed-off-by: Oscar Carter 
> > Reviewed-by: Dan Carpenter 
> > ---
> >  drivers/staging/vt6656/baseband.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/vt6656/baseband.c 
> > b/drivers/staging/vt6656/baseband.c
> > index 3e4bd637849a..a785f91c1566 100644
> > --- a/drivers/staging/vt6656/baseband.c
> > +++ b/drivers/staging/vt6656/baseband.c
> > @@ -24,6 +24,7 @@
> >
> >  #include 
> >  #include 
> > +#include "device.h"
> >  #include "mac.h"
> >  #include "baseband.h"
> >  #include "rf.h"
> > @@ -141,7 +142,7 @@ unsigned int vnt_get_frame_time(u8 preamble_type, u8 
> > pkt_type,
> >
> > rate = (unsigned int)vnt_frame_time[tx_rate];
> >
> > -   if (tx_rate <= 3) {
> > +   if (tx_rate <= RATE_11M) {
> > if (preamble_type == 1)
> > preamble = 96;
> > else
> > --
> > 2.20.1
>
> This doesn't apply to my tree :(
>
Sorry, but I don't understand what it means. This meant that I need to rebase
this patch against your staging-next branch of your staging tree ? Or it means
something else ?

Thanks,
oscar carter
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


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
> > this define is changed in the future to a greater value.
> >
>
> Future proofing is not really a valid reason to change this.

Ok, then I leave it as is.

> We have to assume that future programmers are not idiots.
>
That was not my intention. I'm sorry.

> The only valid reason to do this is readability, but I'm not convinced
> the new version is more readable.
>
Ok.

> regards,
> dan carpenter
>
Thanks,
oscar carter
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[driver-core:debugfs_cleanup 1/3] drivers/gpu/drm/drm_debugfs.c:232:5: error: conflicting types for 'drm_debugfs_remove_files'

2020-04-06 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 
debugfs_cleanup
head:   6cdbeae3773b0bb611d8caf5e84650f58a02748b
commit: a05adcf1157e64eb2bf411cb92896af1082a26b9 [1/3] drm: make .debugfs_init 
and drm_debugfs_create_files() return void
config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce:
git checkout a05adcf1157e64eb2bf411cb92896af1082a26b9
# save the attached .config to linux build tree
make ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot 

All error/warnings (new ones prefixed by >>):

>> drivers/gpu/drm/drm_debugfs.c:232:5: error: conflicting types for 
>> 'drm_debugfs_remove_files'
int drm_debugfs_remove_files(const struct drm_info_list *files, int count,
^~~~
   In file included from drivers/gpu/drm/drm_debugfs.c:35:0:
   include/drm/drm_debugfs.h:86:6: note: previous declaration of 
'drm_debugfs_remove_files' was here
void drm_debugfs_remove_files(const struct drm_info_list *files,
 ^~~~
   In file included from include/linux/linkage.h:7:0,
from include/linux/fs.h:5,
from include/linux/debugfs.h:15,
from drivers/gpu/drm/drm_debugfs.c:26:
   drivers/gpu/drm/drm_debugfs.c:253:15: error: conflicting types for 
'drm_debugfs_remove_files'
EXPORT_SYMBOL(drm_debugfs_remove_files);
  ^
   include/linux/export.h:98:21: note: in definition of macro '___EXPORT_SYMBOL'
 extern typeof(sym) sym;   \
^~~
   include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL'
#define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
 ^~~
   include/linux/export.h:158:29: note: in expansion of macro '_EXPORT_SYMBOL'
#define EXPORT_SYMBOL(sym)  _EXPORT_SYMBOL(sym, "")
^~
>> drivers/gpu/drm/drm_debugfs.c:253:1: note: in expansion of macro 
>> 'EXPORT_SYMBOL'
EXPORT_SYMBOL(drm_debugfs_remove_files);
^
   In file included from drivers/gpu/drm/drm_debugfs.c:35:0:
   include/drm/drm_debugfs.h:86:6: note: previous declaration of 
'drm_debugfs_remove_files' was here
void drm_debugfs_remove_files(const struct drm_info_list *files,
 ^~~~
--
   drivers/gpu/drm/i915/display/intel_display_debugfs.c: In function 
'intel_display_debugfs_register':
>> drivers/gpu/drm/i915/display/intel_display_debugfs.c:1943:9: error: void 
>> value not ignored as it ought to be
 return drm_debugfs_create_files(intel_display_debugfs_list,
^~~~
 ARRAY_SIZE(intel_display_debugfs_list),
 ~~~
 minor->debugfs_root, minor);
 ~~~
>> drivers/gpu/drm/i915/display/intel_display_debugfs.c:1946:1: warning: 
>> control reaches end of non-void function [-Wreturn-type]
}
^
--
>> drivers/gpu/drm/i915/i915_debugfs.c:2179:6: error: conflicting types for 
>> 'i915_debugfs_register'
void i915_debugfs_register(struct drm_i915_private *dev_priv)
 ^
   In file included from drivers/gpu/drm/i915/i915_debugfs.c:42:0:
   drivers/gpu/drm/i915/i915_debugfs.h:15:5: note: previous declaration of 
'i915_debugfs_register' was here
int i915_debugfs_register(struct drm_i915_private *dev_priv);
^

vim +/drm_debugfs_remove_files +232 drivers/gpu/drm/drm_debugfs.c

28a62277e06f93 Ben Gamari  2009-02-17  230  
28a62277e06f93 Ben Gamari  2009-02-17  231  
7d74795b740135 Lespiau, Damien 2013-10-17 @232  int 
drm_debugfs_remove_files(const struct drm_info_list *files, int count,
28a62277e06f93 Ben Gamari  2009-02-17  233   
struct drm_minor *minor)
28a62277e06f93 Ben Gamari  2009-02-17  234  {
28a62277e06f93 Ben Gamari  2009-02-17  235  struct list_head *pos, 
*q;
28a62277e06f93 Ben Gamari  2009-02-17  236  struct drm_info_node 
*tmp;
28a62277e06f93 Ben Gamari  2009-02-17  237  int i;
28a62277e06f93 Ben Gamari  2009-02-17  238  
b3e067c0b27619 Marcin Slusarz  2011-11-09  239  
mutex_lock(>debugfs_lock);
28a62277e06f93 Ben Gamari  2009-02-17  240  for (i = 0; i < count; 
i++) {
b3e067c0b27619 Marcin Slusarz  2011-11-09  241  
list_for_each_safe(pos, q, >debugfs_list) {
28a62277e06f93 Ben Gamari  2009-02-17  242  tmp = 
list_entry(pos, struct drm_info_node, list);
28a62277e06f93 Ben Gamari  2009-02-17  243  if 
(tmp->info_ent == [i]) {
28a62277e06f93 Ben Gamari  2009-02-17  244  
debugfs_remove(tmp->dent);
28a62277e06f93 Ben Gamari  2009-02-17  245

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

2020-04-06 Thread Greg Kroah-Hartman
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.
> 
> Signed-off-by: Oscar Carter 
> Reviewed-by: Dan Carpenter 
> ---
>  drivers/staging/vt6656/baseband.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/vt6656/baseband.c 
> b/drivers/staging/vt6656/baseband.c
> index 3e4bd637849a..a785f91c1566 100644
> --- a/drivers/staging/vt6656/baseband.c
> +++ b/drivers/staging/vt6656/baseband.c
> @@ -24,6 +24,7 @@
> 
>  #include 
>  #include 
> +#include "device.h"
>  #include "mac.h"
>  #include "baseband.h"
>  #include "rf.h"
> @@ -141,7 +142,7 @@ unsigned int vnt_get_frame_time(u8 preamble_type, u8 
> pkt_type,
> 
>   rate = (unsigned int)vnt_frame_time[tx_rate];
> 
> - if (tx_rate <= 3) {
> + if (tx_rate <= RATE_11M) {
>   if (preamble_type == 1)
>   preamble = 96;
>   else
> --
> 2.20.1

This doesn't apply to my tree :(

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: comedi: dt2815: fix writing hi byte of analog output

2020-04-06 Thread Ian Abbott
The DT2815 analog output command is 16 bits wide, consisting of the
12-bit sample value in bits 15 to 4, the channel number in bits 3 to 1,
and a voltage or current selector in bit 0.  Both bytes of the 16-bit
command need to be written in turn to a single 8-bit data register.
However, the driver currently only writes the low 8-bits.  It is broken
and appears to have always been broken.

Electronic copies of the DT2815 User's Manual seem impossible to find
online, but looking at the source code, a best guess for the sequence
the driver intended to use to write the analog output command is as
follows:

1. Wait for the status register to read 0x00.
2. Write the low byte of the command to the data register.
3. Wait for the status register to read 0x80.
4. Write the high byte of the command to the data register.

Step 4 is missing from the driver.  Add step 4 to (hopefully) fix the
driver.

Also add a "FIXME" comment about setting bit 0 of the low byte of the
command.  Supposedly, it is used to choose between voltage output and
current output, but the current driver always sets it to 1.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/dt2815.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/comedi/drivers/dt2815.c 
b/drivers/staging/comedi/drivers/dt2815.c
index 83026ba63d1c..78a7c1b3448a 100644
--- a/drivers/staging/comedi/drivers/dt2815.c
+++ b/drivers/staging/comedi/drivers/dt2815.c
@@ -92,6 +92,7 @@ static int dt2815_ao_insn(struct comedi_device *dev, struct 
comedi_subdevice *s,
int ret;
 
for (i = 0; i < insn->n; i++) {
+   /* FIXME: lo bit 0 chooses voltage output or current output */
lo = ((data[i] & 0x0f) << 4) | (chan << 1) | 0x01;
hi = (data[i] & 0xff0) >> 4;
 
@@ -105,6 +106,8 @@ static int dt2815_ao_insn(struct comedi_device *dev, struct 
comedi_subdevice *s,
if (ret)
return ret;
 
+   outb(hi, dev->iobase + DT2815_DATA);
+
devpriv->ao_readback[chan] = data[i];
}
return i;
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: rtl8192e: remove set but not used variable 'tmpRegC'

2020-04-06 Thread Greg KH
On Tue, Apr 07, 2020 at 08:36:04AM -0400, Wang Hai wrote:
> Fixes gcc '-Wunused-but-set-variable' warning:
> 
> drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c: In function 
> rtl92e_start_adapter:
> drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c:693:15: warning: variable 
> ‘tmpRegC’ set but not used [-Wunused-but-set-variable]
> 
> commit 94a799425eee ("rtl8192e: Split into two directories")
> involved this, remove it.
> 
> Reported-by: Hulk Robot 
> Signed-off-by: Wang Hai 
> ---
>  drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c 
> b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
> index ddcd788..ff934ae 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
> @@ -690,7 +690,7 @@ bool rtl92e_start_adapter(struct net_device *dev)
>   u8 tmpvalue;
>   u8 ICVersion, SwitchingRegulatorOutput;
>   bool bfirmwareok = true;
> - u32 tmpRegA, tmpRegC, TempCCk;
> + u32 tmpRegA, TempCCk;
>   int i = 0;
>   u32 retry_times = 0;
>  
> @@ -889,8 +889,8 @@ bool rtl92e_start_adapter(struct net_device *dev)
>   if (priv->IC_Cut >= IC_VersionCut_D) {
>   tmpRegA = rtl92e_get_bb_reg(dev, rOFDM0_XATxIQImbalance,
>   bMaskDWord);
> - tmpRegC = rtl92e_get_bb_reg(dev, rOFDM0_XCTxIQImbalance,
> - bMaskDWord);
> + rtl92e_get_bb_reg(dev, rOFDM0_XCTxIQImbalance,
> +   bMaskDWord);

That is odd, are you sure you aren't supposed to do something with that
value you read?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: rtl8192u: Remove some set but not used variables

2020-04-06 Thread Greg KH
On Tue, Apr 07, 2020 at 08:07:44AM -0400, Wang Hai wrote:
> Fixes gcc '-Wunused-but-set-variable' warning:
> 
> drivers/staging/rtl8192u/r8192U_core.c: In function rtl8192_hard_data_xmit:
> drivers/staging/rtl8192u/r8192U_core.c:905:6: warning: variable ‘ret’ set but 
> not used [-Wunused-but-set-variable]
> drivers/staging/rtl8192u/r8192U_core.c: In function rtl8192_commit:
> drivers/staging/rtl8192u/r8192U_core.c:3418:6: warning: variable 
> ‘reset_status’ set but not used [-Wunused-but-set-variable]
> 
> Fixes: 8fc8598e61f6 ("Staging: Added Realtek rtl8192u driver to staging")
> Reported-by: Hulk Robot 
> Signed-off-by: Wang Hai 
> ---
>  drivers/staging/rtl8192u/r8192U_core.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
> b/drivers/staging/rtl8192u/r8192U_core.c
> index fcfb902..bb28670 100644
> --- a/drivers/staging/rtl8192u/r8192U_core.c
> +++ b/drivers/staging/rtl8192u/r8192U_core.c
> @@ -902,7 +902,6 @@ static void rtl8192_hard_data_xmit(struct sk_buff *skb, 
> struct net_device *dev,
>  int rate)
>  {
>   struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
> - int ret;
>   unsigned long flags;
>   struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + 
> MAX_DEV_ADDR_SIZE);
>   u8 queue_index = tcb_desc->queue_index;
> @@ -915,7 +914,7 @@ static void rtl8192_hard_data_xmit(struct sk_buff *skb, 
> struct net_device *dev,
>   *(struct net_device **)(skb->cb) = dev;
>   tcb_desc->bTxEnableFwCalcDur = 1;
>   skb_push(skb, priv->ieee80211->tx_headroom);
> - ret = rtl8192_tx(dev, skb);
> + rtl8192_tx(dev, skb);

Shouldn't we do something about an error if that function returns an
error?  Why are we ignoring it?

>  
>   spin_unlock_irqrestore(>tx_lock, flags);
>  }
> @@ -3415,7 +3414,6 @@ int rtl8192_down(struct net_device *dev)
>  void rtl8192_commit(struct net_device *dev)
>  {
>   struct r8192_priv *priv = ieee80211_priv(dev);
> - int reset_status = 0;
>  
>   if (priv->up == 0)
>   return;
> @@ -3427,7 +3425,7 @@ void rtl8192_commit(struct net_device *dev)
>   ieee80211_softmac_stop_protocol(priv->ieee80211);
>  
>   rtl8192_rtx_disable(dev);
> - reset_status = _rtl8192_up(dev);
> + _rtl8192_up(dev);

Same here, should that really be ignored?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: comedi: dt2815: remove set but not used variable 'hi'

2020-04-06 Thread Ian Abbott

On 07/04/2020 13:59, Wang Hai wrote:

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/staging/comedi/drivers/dt2815.c: In function dt2815_ao_insn:
drivers/staging/comedi/drivers/dt2815.c:91:19: warning: variable 'hi' set but 
not used [-Wunused-but-set-variable]

commit d6a929b7608a ("Staging: comedi: add dt2815 driver")
involved this, remove it.

Reported-by: Hulk Robot 
Signed-off-by: Wang Hai 
---
  drivers/staging/comedi/drivers/dt2815.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dt2815.c 
b/drivers/staging/comedi/drivers/dt2815.c
index 83026ba..bcf85ec 100644
--- a/drivers/staging/comedi/drivers/dt2815.c
+++ b/drivers/staging/comedi/drivers/dt2815.c
@@ -88,12 +88,11 @@ static int dt2815_ao_insn(struct comedi_device *dev, struct 
comedi_subdevice *s,
struct dt2815_private *devpriv = dev->private;
int i;
int chan = CR_CHAN(insn->chanspec);
-   unsigned int lo, hi;
+   unsigned int lo;
int ret;
  
  	for (i = 0; i < insn->n; i++) {

lo = ((data[i] & 0x0f) << 4) | (chan << 1) | 0x01;
-   hi = (data[i] & 0xff0) >> 4;
  
  		ret = comedi_timeout(dev, s, insn, dt2815_ao_status, 0x00);

if (ret)



That 'hi' value should be written to the hardware, but the driver is 
broken.  I don't think this driver has ever been tested as working 
because it has never written the 'hi' value to the hardware!


I think I know how to fix it.  I'll send a patch.

--
-=( Ian Abbott  || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268.  Registered address:)=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 08/11] staging: wfx: place hif_tx_mib functions into a .c file

2020-04-06 Thread Jerome Pouiller
From: Jérôme Pouiller 

Until now, all functions from hif_tx_mib.h are declared "static inline".
However, they are not time critical. So, it does not make so much sense.

We prefer to place them in a .c file as for other hif functions.

Signed-off-by: Jérôme Pouiller 
---
 drivers/staging/wfx/Makefile |   1 +
 drivers/staging/wfx/data_tx.c|   1 +
 drivers/staging/wfx/hif_tx_mib.c | 396 
 drivers/staging/wfx/hif_tx_mib.h | 435 ---
 drivers/staging/wfx/key.c|   1 +
 drivers/staging/wfx/sta.c|   1 +
 6 files changed, 444 insertions(+), 391 deletions(-)
 create mode 100644 drivers/staging/wfx/hif_tx_mib.c

diff --git a/drivers/staging/wfx/Makefile b/drivers/staging/wfx/Makefile
index 0d9c1ed092f6..0e0cc982ceab 100644
--- a/drivers/staging/wfx/Makefile
+++ b/drivers/staging/wfx/Makefile
@@ -7,6 +7,7 @@ wfx-y := \
bh.o \
hwio.o \
fwio.o \
+   hif_tx_mib.o \
hif_tx.o \
hif_rx.o \
queue.o \
diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c
index a34f6231b878..c30e4f5b6e2d 100644
--- a/drivers/staging/wfx/data_tx.c
+++ b/drivers/staging/wfx/data_tx.c
@@ -6,6 +6,7 @@
  * Copyright (c) 2010, ST-Ericsson
  */
 #include 
+#include 
 
 #include "data_tx.h"
 #include "wfx.h"
diff --git a/drivers/staging/wfx/hif_tx_mib.c b/drivers/staging/wfx/hif_tx_mib.c
new file mode 100644
index ..5bca1e06995f
--- /dev/null
+++ b/drivers/staging/wfx/hif_tx_mib.c
@@ -0,0 +1,396 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Implementation of host-to-chip MIBs of WFxxx Split Mac (WSM) API.
+ *
+ * Copyright (c) 2017-2019, Silicon Laboratories, Inc.
+ * Copyright (c) 2010, ST-Ericsson
+ * Copyright (C) 2010, ST-Ericsson SA
+ */
+
+#include 
+
+#include "wfx.h"
+#include "hif_tx.h"
+#include "hif_tx_mib.h"
+#include "hif_api_mib.h"
+
+int hif_set_output_power(struct wfx_vif *wvif, int val)
+{
+   struct hif_mib_current_tx_power_level arg = {
+   .power_level = cpu_to_le32(val * 10),
+   };
+
+   return hif_write_mib(wvif->wdev, wvif->id,
+HIF_MIB_ID_CURRENT_TX_POWER_LEVEL,
+, sizeof(arg));
+}
+
+int hif_set_beacon_wakeup_period(struct wfx_vif *wvif,
+unsigned int dtim_interval,
+unsigned int listen_interval)
+{
+   struct hif_mib_beacon_wake_up_period val = {
+   .wakeup_period_min = dtim_interval,
+   .receive_dtim = 0,
+   .wakeup_period_max = cpu_to_le16(listen_interval),
+   };
+
+   if (dtim_interval > 0xFF || listen_interval > 0x)
+   return -EINVAL;
+   return hif_write_mib(wvif->wdev, wvif->id,
+HIF_MIB_ID_BEACON_WAKEUP_PERIOD,
+, sizeof(val));
+}
+
+int hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif,
+   int rssi_thold, int rssi_hyst)
+{
+   struct hif_mib_rcpi_rssi_threshold arg = {
+   .rolling_average_count = 8,
+   .detection = 1,
+   };
+
+   if (!rssi_thold && !rssi_hyst) {
+   arg.upperthresh = 1;
+   arg.lowerthresh = 1;
+   } else {
+   arg.upper_threshold = rssi_thold + rssi_hyst;
+   arg.upper_threshold = (arg.upper_threshold + 110) * 2;
+   arg.lower_threshold = rssi_thold;
+   arg.lower_threshold = (arg.lower_threshold + 110) * 2;
+   }
+
+   return hif_write_mib(wvif->wdev, wvif->id,
+HIF_MIB_ID_RCPI_RSSI_THRESHOLD, , sizeof(arg));
+}
+
+int hif_get_counters_table(struct wfx_dev *wdev,
+  struct hif_mib_extended_count_table *arg)
+{
+   if (wfx_api_older_than(wdev, 1, 3)) {
+   // extended_count_table is wider than count_table
+   memset(arg, 0xFF, sizeof(*arg));
+   return hif_read_mib(wdev, 0, HIF_MIB_ID_COUNTERS_TABLE,
+   arg, sizeof(struct hif_mib_count_table));
+   } else {
+   return hif_read_mib(wdev, 0,
+   HIF_MIB_ID_EXTENDED_COUNTERS_TABLE, arg,
+   sizeof(struct hif_mib_extended_count_table));
+   }
+}
+
+int hif_set_macaddr(struct wfx_vif *wvif, u8 *mac)
+{
+   struct hif_mib_mac_address msg = { };
+
+   if (mac)
+   ether_addr_copy(msg.mac_addr, mac);
+   return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_DOT11_MAC_ADDRESS,
+, sizeof(msg));
+}
+
+int hif_set_rx_filter(struct wfx_vif *wvif,
+ bool filter_bssid, bool fwd_probe_req)
+{
+   struct hif_mib_rx_filter val = { };
+
+   if (filter_bssid)
+   val.bssid_filter = 1;
+   if (fwd_probe_req)
+   val.fwd_probe_req = 1;
+   return hif_write_mib(wvif->wdev, 

[PATCH 09/11] staging: wfx: allow to connect an IBSS with an existing SSID

2020-04-06 Thread Jerome Pouiller
From: Jérôme Pouiller 

With current code, chip is not able to join an existing IBSS network.

Signed-off-by: Jérôme Pouiller 
---
 drivers/staging/wfx/hif_tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c
index 445906035e9d..d44e5cacbbce 100644
--- a/drivers/staging/wfx/hif_tx.c
+++ b/drivers/staging/wfx/hif_tx.c
@@ -310,7 +310,7 @@ int hif_join(struct wfx_vif *wvif, const struct 
ieee80211_bss_conf *conf,
body->basic_rate_set =
cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, conf->basic_rates));
memcpy(body->bssid, conf->bssid, sizeof(body->bssid));
-   if (!conf->ibss_joined && ssid) {
+   if (ssid) {
body->ssid_length = cpu_to_le32(ssidlen);
memcpy(body->ssid, ssid, ssidlen);
}
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 06/11] staging: wfx: fix endianness of hif API

2020-04-06 Thread Jerome Pouiller
From: Jérôme Pouiller 

The chip expects little endian in all structs it sends/receives. This
patch fixes the hif API to reflect this fact. Sparse should now report
meaningful errors.

Signed-off-by: Jérôme Pouiller 
---
 drivers/staging/wfx/hif_api_cmd.h | 120 -
 drivers/staging/wfx/hif_api_general.h |  56 ++--
 drivers/staging/wfx/hif_api_mib.h | 124 +-
 3 files changed, 150 insertions(+), 150 deletions(-)

diff --git a/drivers/staging/wfx/hif_api_cmd.h 
b/drivers/staging/wfx/hif_api_cmd.h
index 321f4fb27b35..82a9f4ae4555 100644
--- a/drivers/staging/wfx/hif_api_cmd.h
+++ b/drivers/staging/wfx/hif_api_cmd.h
@@ -94,25 +94,25 @@ struct hif_req_reset {
 } __packed;
 
 struct hif_req_read_mib {
-   u16   mib_id;
-   u16   reserved;
+   __le16 mib_id;
+   __le16 reserved;
 } __packed;
 
 struct hif_cnf_read_mib {
-   u32   status;
-   u16   mib_id;
-   u16   length;
+   __le32 status;
+   __le16 mib_id;
+   __le16 length;
u8mib_data[];
 } __packed;
 
 struct hif_req_write_mib {
-   u16   mib_id;
-   u16   length;
+   __le16 mib_id;
+   __le16 length;
u8mib_data[];
 } __packed;
 
 struct hif_cnf_write_mib {
-   u32   status;
+   __le32 status;
 } __packed;
 
 struct hif_ie_flags {
@@ -131,12 +131,12 @@ struct hif_ie_tlv {
 
 struct hif_req_update_ie {
struct hif_ie_flags ie_flags;
-   u16   num_ies;
+   __le16 num_ies;
struct hif_ie_tlv ie[];
 } __packed;
 
 struct hif_cnf_update_ie {
-   u32   status;
+   __le32 status;
 } __packed;
 
 struct hif_scan_type {
@@ -153,13 +153,13 @@ struct hif_scan_flags {
 } __packed;
 
 struct hif_auto_scan_param {
-   u16   interval;
+   __le16 interval;
u8reserved;
s8 rssi_thr;
 } __packed;
 
 struct hif_ssid_def {
-   u32   ssid_length;
+   __le32 ssid_length;
u8ssid[HIF_API_SSID_SIZE];
 } __packed;
 
@@ -176,19 +176,19 @@ struct hif_req_start_scan_alt {
u8probe_delay;
u8num_of_ssids;
u8num_of_channels;
-   u32   min_channel_time;
-   u32   max_channel_time;
-   s32tx_power_level;
+   __le32 min_channel_time;
+   __le32 max_channel_time;
+   __le32 tx_power_level; // signed value
struct hif_ssid_def ssid_def[HIF_API_MAX_NB_SSIDS];
u8channel_list[];
 } __packed;
 
 struct hif_cnf_start_scan {
-   u32   status;
+   __le32 status;
 } __packed;
 
 struct hif_cnf_stop_scan {
-   u32   status;
+   __le32 status;
 } __packed;
 
 enum hif_pm_mode_status {
@@ -198,10 +198,10 @@ enum hif_pm_mode_status {
 };
 
 struct hif_ind_scan_cmpl {
-   u32   status;
+   __le32 status;
u8pm_mode;
u8num_channels_completed;
-   u16   reserved;
+   __le16 reserved;
 } __packed;
 
 enum hif_queue_id {
@@ -254,13 +254,13 @@ struct hif_ht_tx_parameters {
 } __packed;
 
 struct hif_req_tx {
-   u32   packet_id;
+   __le32 packet_id;
u8max_tx_rate;
struct hif_queue queue_id;
struct hif_data_flags data_flags;
struct hif_tx_flags tx_flags;
-   u32   reserved;
-   u32   expire_time;
+   __le32 reserved;
+   __le32 expire_time;
struct hif_ht_tx_parameters ht_tx_parameters;
u8frame[];
 } __packed;
@@ -282,17 +282,17 @@ struct hif_tx_result_flags {
 } __packed;
 
 struct hif_cnf_tx {
-   u32   status;
-   u32   packet_id;
+   __le32 status;
+   __le32 packet_id;
u8txed_rate;
u8ack_failures;
struct hif_tx_result_flags tx_result_flags;
-   u32   media_delay;
-   u32   tx_queue_delay;
+   __le32 media_delay;
+   __le32 tx_queue_delay;
 } __packed;
 
 struct hif_cnf_multi_transmit {
-   u32   num_tx_confs;
+   __le32 num_tx_confs;
struct hif_cnf_tx   tx_conf_payload[];
 } __packed;
 
@@ -331,8 +331,8 @@ struct hif_rx_flags {
 } __packed;
 
 struct hif_ind_rx {
-   u32   status;
-   u16   channel_number;
+   __le32 status;
+   __le16 channel_number;
u8rxed_rate;
u8rcpi_rssi;
struct hif_rx_flags rx_flags;
@@ -345,15 +345,15 @@ struct hif_req_edca_queue_params {
u8reserved1;
u8aifsn;
u8reserved2;
-   u16   cw_min;
-   u16   cw_max;
-   u16   tx_op_limit;
-   u16   allowed_medium_time;
-   u32   reserved3;
+   __le16 cw_min;
+   __le16 cw_max;
+   __le16 tx_op_limit;
+   __le16 allowed_medium_time;
+   __le32 reserved3;
 } __packed;
 
 struct hif_cnf_edca_queue_params {
-   u32   status;
+   __le32 status;
 } __packed;
 
 struct hif_join_flags {
@@ -367,26 +367,26 @@ struct hif_req_join {
u8infrastructure_bss_mode:1;
u8reserved1:7;
u8band;
-   u16   channel_number;
+   __le16 channel_number;
u8

[PATCH 02/11] staging: wfx: relocate LINK_ID_NO_ASSOC and MAX_STA_IN_AP_MODE to hif API

2020-04-06 Thread Jerome Pouiller
From: Jérôme Pouiller 

The definitions LINK_ID_NO_ASSOC and MAX_STA_IN_AP_MODE are imposed by
the hardware. Therefore, they should be located in the hardware
interface API.

Signed-off-by: Jérôme Pouiller 
---
 drivers/staging/wfx/data_tx.c | 2 +-
 drivers/staging/wfx/hif_api_cmd.h | 3 +++
 drivers/staging/wfx/main.c| 2 +-
 drivers/staging/wfx/queue.h   | 3 ---
 drivers/staging/wfx/sta.c | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c
index c88d14fe614b..757e37454391 100644
--- a/drivers/staging/wfx/data_tx.c
+++ b/drivers/staging/wfx/data_tx.c
@@ -246,7 +246,7 @@ static u8 wfx_tx_get_link_id(struct wfx_vif *wvif, struct 
ieee80211_sta *sta,
return 0;
if (is_multicast_ether_addr(da))
return 0;
-   return WFX_LINK_ID_NO_ASSOC;
+   return HIF_LINK_ID_NOT_ASSOCIATED;
 }
 
 static void wfx_tx_fixup_rates(struct ieee80211_tx_rate *rates)
diff --git a/drivers/staging/wfx/hif_api_cmd.h 
b/drivers/staging/wfx/hif_api_cmd.h
index 071b71e2a107..f6934598f319 100644
--- a/drivers/staging/wfx/hif_api_cmd.h
+++ b/drivers/staging/wfx/hif_api_cmd.h
@@ -480,6 +480,9 @@ struct hif_cnf_beacon_transmit {
u32   status;
 } __packed;
 
+#define HIF_LINK_ID_MAX14
+#define HIF_LINK_ID_NOT_ASSOCIATED (HIF_LINK_ID_MAX + 1)
+
 enum hif_sta_map_direction {
HIF_STA_MAP   = 0x0,
HIF_STA_UNMAP = 0x1
diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c
index 738016d45d63..1e9f6da75024 100644
--- a/drivers/staging/wfx/main.c
+++ b/drivers/staging/wfx/main.c
@@ -313,7 +313,7 @@ struct wfx_dev *wfx_init_common(struct device *dev,
hw->wiphy->flags |= WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD;
hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD;
hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
-   hw->wiphy->max_ap_assoc_sta = WFX_MAX_STA_IN_AP_MODE;
+   hw->wiphy->max_ap_assoc_sta = HIF_LINK_ID_MAX;
hw->wiphy->max_scan_ssids = 2;
hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
hw->wiphy->n_iface_combinations = ARRAY_SIZE(wfx_iface_combinations);
diff --git a/drivers/staging/wfx/queue.h b/drivers/staging/wfx/queue.h
index ab45e32cbfbc..1020dfde399b 100644
--- a/drivers/staging/wfx/queue.h
+++ b/drivers/staging/wfx/queue.h
@@ -13,9 +13,6 @@
 
 #include "hif_api_cmd.h"
 
-#define WFX_MAX_STA_IN_AP_MODE14
-#define WFX_LINK_ID_NO_ASSOC  15
-
 struct wfx_dev;
 struct wfx_vif;
 
diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c
index 2e8d3f571c3e..64cf58122661 100644
--- a/drivers/staging/wfx/sta.c
+++ b/drivers/staging/wfx/sta.c
@@ -563,7 +563,7 @@ int wfx_sta_add(struct ieee80211_hw *hw, struct 
ieee80211_vif *vif,
sta_priv->link_id = ffz(wvif->link_id_map);
wvif->link_id_map |= BIT(sta_priv->link_id);
WARN_ON(!sta_priv->link_id);
-   WARN_ON(sta_priv->link_id >= WFX_MAX_STA_IN_AP_MODE);
+   WARN_ON(sta_priv->link_id >= HIF_LINK_ID_MAX);
hif_map_link(wvif, sta->addr, 0, sta_priv->link_id);
 
return 0;
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 01/11] staging: wfx: drop unused WFX_LINK_ID_GC_TIMEOUT

2020-04-06 Thread Jerome Pouiller
From: Jérôme Pouiller 

The definition WFX_LINK_ID_GC_TIMEOUT is not used anymore since
commit d6aeba575f27 ("staging: wfx: simplify the link-id allocation")

Signed-off-by: Jérôme Pouiller 
---
 drivers/staging/wfx/data_tx.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c
index 93ed0ed63bb2..c88d14fe614b 100644
--- a/drivers/staging/wfx/data_tx.c
+++ b/drivers/staging/wfx/data_tx.c
@@ -17,7 +17,6 @@
 #include "hif_tx_mib.h"
 
 #define WFX_INVALID_RATE_ID15
-#define WFX_LINK_ID_GC_TIMEOUT ((unsigned long)(10 * HZ))
 
 static int wfx_get_hw_rate(struct wfx_dev *wdev,
   const struct ieee80211_tx_rate *rate)
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 07/11] staging: wfx: align members declarations in hif API

2020-04-06 Thread Jerome Pouiller
From: Jérôme Pouiller 

Hardware API headers were not uniformly aligned.

Signed-off-by: Jérôme Pouiller 
---
 drivers/staging/wfx/hif_api_cmd.h | 484 +-
 drivers/staging/wfx/hif_api_general.h | 272 +++
 drivers/staging/wfx/hif_api_mib.h | 388 ++---
 3 files changed, 572 insertions(+), 572 deletions(-)

diff --git a/drivers/staging/wfx/hif_api_cmd.h 
b/drivers/staging/wfx/hif_api_cmd.h
index 82a9f4ae4555..6f70801949bb 100644
--- a/drivers/staging/wfx/hif_api_cmd.h
+++ b/drivers/staging/wfx/hif_api_cmd.h
@@ -13,51 +13,51 @@
 #define HIF_API_SSID_SIZE  API_SSID_SIZE
 
 enum hif_requests_ids {
-   HIF_REQ_ID_RESET = 0x0a,
-   HIF_REQ_ID_READ_MIB  = 0x05,
-   HIF_REQ_ID_WRITE_MIB = 0x06,
-   HIF_REQ_ID_START_SCAN= 0x07,
-   HIF_REQ_ID_STOP_SCAN = 0x08,
-   HIF_REQ_ID_TX= 0x04,
-   HIF_REQ_ID_JOIN  = 0x0b,
-   HIF_REQ_ID_SET_PM_MODE   = 0x10,
-   HIF_REQ_ID_SET_BSS_PARAMS= 0x11,
-   HIF_REQ_ID_ADD_KEY   = 0x0c,
-   HIF_REQ_ID_REMOVE_KEY= 0x0d,
-   HIF_REQ_ID_EDCA_QUEUE_PARAMS = 0x13,
-   HIF_REQ_ID_START = 0x17,
-   HIF_REQ_ID_BEACON_TRANSMIT   = 0x18,
-   HIF_REQ_ID_UPDATE_IE = 0x1b,
-   HIF_REQ_ID_MAP_LINK  = 0x1c,
+   HIF_REQ_ID_RESET= 0x0a,
+   HIF_REQ_ID_READ_MIB = 0x05,
+   HIF_REQ_ID_WRITE_MIB= 0x06,
+   HIF_REQ_ID_START_SCAN   = 0x07,
+   HIF_REQ_ID_STOP_SCAN= 0x08,
+   HIF_REQ_ID_TX   = 0x04,
+   HIF_REQ_ID_JOIN = 0x0b,
+   HIF_REQ_ID_SET_PM_MODE  = 0x10,
+   HIF_REQ_ID_SET_BSS_PARAMS   = 0x11,
+   HIF_REQ_ID_ADD_KEY  = 0x0c,
+   HIF_REQ_ID_REMOVE_KEY   = 0x0d,
+   HIF_REQ_ID_EDCA_QUEUE_PARAMS= 0x13,
+   HIF_REQ_ID_START= 0x17,
+   HIF_REQ_ID_BEACON_TRANSMIT  = 0x18,
+   HIF_REQ_ID_UPDATE_IE= 0x1b,
+   HIF_REQ_ID_MAP_LINK = 0x1c,
 };
 
 enum hif_confirmations_ids {
-   HIF_CNF_ID_RESET = 0x0a,
-   HIF_CNF_ID_READ_MIB  = 0x05,
-   HIF_CNF_ID_WRITE_MIB = 0x06,
-   HIF_CNF_ID_START_SCAN= 0x07,
-   HIF_CNF_ID_STOP_SCAN = 0x08,
-   HIF_CNF_ID_TX= 0x04,
-   HIF_CNF_ID_MULTI_TRANSMIT= 0x1e,
-   HIF_CNF_ID_JOIN  = 0x0b,
-   HIF_CNF_ID_SET_PM_MODE   = 0x10,
-   HIF_CNF_ID_SET_BSS_PARAMS= 0x11,
-   HIF_CNF_ID_ADD_KEY   = 0x0c,
-   HIF_CNF_ID_REMOVE_KEY= 0x0d,
-   HIF_CNF_ID_EDCA_QUEUE_PARAMS = 0x13,
-   HIF_CNF_ID_START = 0x17,
-   HIF_CNF_ID_BEACON_TRANSMIT   = 0x18,
-   HIF_CNF_ID_UPDATE_IE = 0x1b,
-   HIF_CNF_ID_MAP_LINK  = 0x1c,
+   HIF_CNF_ID_RESET= 0x0a,
+   HIF_CNF_ID_READ_MIB = 0x05,
+   HIF_CNF_ID_WRITE_MIB= 0x06,
+   HIF_CNF_ID_START_SCAN   = 0x07,
+   HIF_CNF_ID_STOP_SCAN= 0x08,
+   HIF_CNF_ID_TX   = 0x04,
+   HIF_CNF_ID_MULTI_TRANSMIT   = 0x1e,
+   HIF_CNF_ID_JOIN = 0x0b,
+   HIF_CNF_ID_SET_PM_MODE  = 0x10,
+   HIF_CNF_ID_SET_BSS_PARAMS   = 0x11,
+   HIF_CNF_ID_ADD_KEY  = 0x0c,
+   HIF_CNF_ID_REMOVE_KEY   = 0x0d,
+   HIF_CNF_ID_EDCA_QUEUE_PARAMS= 0x13,
+   HIF_CNF_ID_START= 0x17,
+   HIF_CNF_ID_BEACON_TRANSMIT  = 0x18,
+   HIF_CNF_ID_UPDATE_IE= 0x1b,
+   HIF_CNF_ID_MAP_LINK = 0x1c,
 };
 
 enum hif_indications_ids {
-   HIF_IND_ID_RX= 0x84,
-   HIF_IND_ID_SCAN_CMPL = 0x86,
-   HIF_IND_ID_JOIN_COMPLETE = 0x8f,
-   HIF_IND_ID_SET_PM_MODE_CMPL  = 0x89,
-   HIF_IND_ID_SUSPEND_RESUME_TX = 0x8c,
-   HIF_IND_ID_EVENT = 0x85
+   HIF_IND_ID_RX   = 0x84,
+   HIF_IND_ID_SCAN_CMPL= 0x86,
+   HIF_IND_ID_JOIN_COMPLETE= 0x8f,
+   HIF_IND_ID_SET_PM_MODE_CMPL = 0x89,
+   HIF_IND_ID_SUSPEND_RESUME_TX= 0x8c,
+   HIF_IND_ID_EVENT= 0x85
 

[PATCH 00/11] staging: wfx: clean up HIF API

2020-04-06 Thread Jerome Pouiller
From: Jérôme Pouiller 

Hello all,

This series try to clean up the Hardware InterFace (HIF) API of the
wfx driver.

Notice it intended to be applied on top of Pull-Request named
"staging: wfx: rework the Tx queue".

Jérôme Pouiller (11):
  staging: wfx: drop unused WFX_LINK_ID_GC_TIMEOUT
  staging: wfx: relocate LINK_ID_NO_ASSOC and MAX_STA_IN_AP_MODE to hif
API
  staging: wfx: relocate TX_RETRY_POLICY_MAX and TX_RETRY_POLICY_INVALID
to hif API
  staging: wfx: remove unused definitions from the hif API
  staging: wfx: remove useless defines
  staging: wfx: fix endianness of hif API
  staging: wfx: align members declarations in hif API
  staging: wfx: place hif_tx_mib functions into a .c file
  staging: wfx: allow to connect an IBSS with an existing SSID
  staging: wfx: make hif_ie_table_entry const
  staging: wfx: send just necessary bytes

 drivers/staging/wfx/Makefile  |   1 +
 drivers/staging/wfx/data_tx.c |  20 +-
 drivers/staging/wfx/data_tx.h |   2 +-
 drivers/staging/wfx/hif_api_cmd.h | 625 
 drivers/staging/wfx/hif_api_general.h | 429 +++-
 drivers/staging/wfx/hif_api_mib.h | 671 ++
 drivers/staging/wfx/hif_tx.c  |   2 +-
 drivers/staging/wfx/hif_tx_mib.c  | 397 +++
 drivers/staging/wfx/hif_tx_mib.h  | 435 ++---
 drivers/staging/wfx/key.c |   1 +
 drivers/staging/wfx/main.c|   2 +-
 drivers/staging/wfx/queue.h   |   3 -
 drivers/staging/wfx/sta.c |   5 +-
 13 files changed, 1185 insertions(+), 1408 deletions(-)
 create mode 100644 drivers/staging/wfx/hif_tx_mib.c

-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/2] staging: rtl8188eu: remove unnecessary asignment

2020-04-06 Thread Dan Carpenter
On Sun, Apr 05, 2020 at 01:22:29PM +0200, Michael Straube wrote:
> Remove unnecessary asignment in SwLedBlink1(). The code path with the
> asignment 'pLed->BlinkTimes = 0' is only executed when
> 'pLed->BlinkTimes' is already zero and the value is not changed between
> the test 'if (pLed->BlinkTimes == 0)' and the asignment.
> 

Better to get rid of the bStopBlinking variable and this becomes more
obvious.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/2] staging: rtl8188eu: remove unnecessary asignment

2020-04-06 Thread Dan Carpenter
On Mon, Apr 06, 2020 at 02:25:20PM +0300, Dan Carpenter wrote:
> On Sun, Apr 05, 2020 at 01:22:29PM +0200, Michael Straube wrote:
> > Remove unnecessary asignment in SwLedBlink1(). The code path with the
> > asignment 'pLed->BlinkTimes = 0' is only executed when
> > 'pLed->BlinkTimes' is already zero and the value is not changed between
> > the test 'if (pLed->BlinkTimes == 0)' and the asignment.
> > 
> 
> Better to get rid of the bStopBlinking variable and this becomes more
> obvious.

Oh, never mind.  You did that in patch 2.  This is fine then.

Reviewed-by: Dan Carpenter 

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 11/11] staging: wfx: send just necessary bytes

2020-04-06 Thread Jerome Pouiller
From: Jérôme Pouiller 

Size of hif_mib_template_frame must be sufficient to contains bytes
declared by frame_length and cannot exceed 700bytes.

Change the API to reflect that.

Signed-off-by: Jérôme Pouiller 
---
 drivers/staging/wfx/hif_api_mib.h | 4 +++-
 drivers/staging/wfx/hif_tx_mib.c  | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wfx/hif_api_mib.h 
b/drivers/staging/wfx/hif_api_mib.h
index 0490157b4f3b..9f30cf503ad5 100644
--- a/drivers/staging/wfx/hif_api_mib.h
+++ b/drivers/staging/wfx/hif_api_mib.h
@@ -270,12 +270,14 @@ enum hif_tmplt {
HIF_TMPLT_NA = 0x7
 };
 
+#define HIF_API_MAX_TEMPLATE_FRAME_SIZE 700
+
 struct hif_mib_template_frame {
u8 frame_type;
u8 init_rate:7;
u8 mode:1;
__le16 frame_length;
-   u8 frame[700];
+   u8 frame[];
 } __packed;
 
 struct hif_mib_beacon_wake_up_period {
diff --git a/drivers/staging/wfx/hif_tx_mib.c b/drivers/staging/wfx/hif_tx_mib.c
index ac534406144c..41f3090d29be 100644
--- a/drivers/staging/wfx/hif_tx_mib.c
+++ b/drivers/staging/wfx/hif_tx_mib.c
@@ -148,6 +148,7 @@ int hif_set_template_frame(struct wfx_vif *wvif, struct 
sk_buff *skb,
 {
struct hif_mib_template_frame *arg;
 
+   WARN(skb->len > HIF_API_MAX_TEMPLATE_FRAME_SIZE, "frame is too big");
skb_push(skb, 4);
arg = (struct hif_mib_template_frame *)skb->data;
skb_pull(skb, 4);
@@ -155,7 +156,7 @@ int hif_set_template_frame(struct wfx_vif *wvif, struct 
sk_buff *skb,
arg->frame_type = frame_type;
arg->frame_length = cpu_to_le16(skb->len);
return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_TEMPLATE_FRAME,
-arg, sizeof(*arg));
+arg, sizeof(*arg) + skb->len);
 }
 
 int hif_set_mfp(struct wfx_vif *wvif, bool capable, bool required)
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 10/11] staging: wfx: make hif_ie_table_entry const

2020-04-06 Thread Jerome Pouiller
From: Jérôme Pouiller 

In wfx_update_filtering(), filter_ies is never modified. So, make it
constant.

Signed-off-by: Jérôme Pouiller 
---
 drivers/staging/wfx/hif_tx_mib.c | 4 ++--
 drivers/staging/wfx/hif_tx_mib.h | 4 ++--
 drivers/staging/wfx/sta.c| 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wfx/hif_tx_mib.c b/drivers/staging/wfx/hif_tx_mib.c
index 5bca1e06995f..ac534406144c 100644
--- a/drivers/staging/wfx/hif_tx_mib.c
+++ b/drivers/staging/wfx/hif_tx_mib.c
@@ -102,8 +102,8 @@ int hif_set_rx_filter(struct wfx_vif *wvif,
 , sizeof(val));
 }
 
-int hif_set_beacon_filter_table(struct wfx_vif *wvif,
-   int tbl_len, struct hif_ie_table_entry *tbl)
+int hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len,
+   const struct hif_ie_table_entry *tbl)
 {
int ret;
struct hif_mib_bcn_filter_table *val;
diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h
index 77dedda0465e..0f8b3bd9f14e 100644
--- a/drivers/staging/wfx/hif_tx_mib.h
+++ b/drivers/staging/wfx/hif_tx_mib.h
@@ -25,8 +25,8 @@ int hif_get_counters_table(struct wfx_dev *wdev,
 int hif_set_macaddr(struct wfx_vif *wvif, u8 *mac);
 int hif_set_rx_filter(struct wfx_vif *wvif,
  bool filter_bssid, bool fwd_probe_req);
-int hif_set_beacon_filter_table(struct wfx_vif *wvif,
-   int tbl_len, struct hif_ie_table_entry *tbl);
+int hif_set_beacon_filter_table(struct wfx_vif *wvif, int tbl_len,
+   const struct hif_ie_table_entry *tbl);
 int hif_beacon_filter_control(struct wfx_vif *wvif,
  int enable, int beacon_count);
 int hif_set_operational_mode(struct wfx_dev *wdev, enum hif_op_power_mode 
mode);
diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c
index c250b117a138..4d5dbfc24f52 100644
--- a/drivers/staging/wfx/sta.c
+++ b/drivers/staging/wfx/sta.c
@@ -148,7 +148,7 @@ void wfx_update_filtering(struct wfx_vif *wvif)
int bf_enable;
int bf_count;
int n_filter_ies;
-   struct hif_ie_table_entry filter_ies[] = {
+   const struct hif_ie_table_entry filter_ies[] = {
{
.ie_id= WLAN_EID_VENDOR_SPECIFIC,
.has_changed  = 1,
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 03/11] staging: wfx: relocate TX_RETRY_POLICY_MAX and TX_RETRY_POLICY_INVALID to hif API

2020-04-06 Thread Jerome Pouiller
From: Jérôme Pouiller 

The definitions TX_RETRY_POLICY_MAX and TX_RETRY_POLICY_INVALID are
imposed by the hardware. Therefore, they should be located in the
hardware interface API.

Signed-off-by: Jérôme Pouiller 
---
 drivers/staging/wfx/data_tx.c | 16 +++-
 drivers/staging/wfx/data_tx.h |  2 +-
 drivers/staging/wfx/hif_api_mib.h |  3 ++-
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c
index 757e37454391..a34f6231b878 100644
--- a/drivers/staging/wfx/data_tx.c
+++ b/drivers/staging/wfx/data_tx.c
@@ -16,8 +16,6 @@
 #include "traces.h"
 #include "hif_tx_mib.h"
 
-#define WFX_INVALID_RATE_ID15
-
 static int wfx_get_hw_rate(struct wfx_dev *wdev,
   const struct ieee80211_tx_rate *rate)
 {
@@ -117,7 +115,7 @@ static int wfx_tx_policy_get(struct wfx_vif *wvif,
if (list_empty(>free)) {
WARN(1, "unable to get a valid Tx policy");
spin_unlock_bh(>lock);
-   return WFX_INVALID_RATE_ID;
+   return HIF_TX_RETRY_POLICY_INVALID;
}
idx = wfx_tx_policy_find(cache, );
if (idx >= 0) {
@@ -146,7 +144,7 @@ static void wfx_tx_policy_put(struct wfx_vif *wvif, int idx)
int usage, locked;
struct tx_policy_cache *cache = >tx_policy_cache;
 
-   if (idx == WFX_INVALID_RATE_ID)
+   if (idx == HIF_TX_RETRY_POLICY_INVALID)
return;
spin_lock_bh(>lock);
locked = list_empty(>free);
@@ -164,11 +162,11 @@ static int wfx_tx_policy_upload(struct wfx_vif *wvif)
 
do {
spin_lock_bh(>tx_policy_cache.lock);
-   for (i = 0; i < HIF_MIB_NUM_TX_RATE_RETRY_POLICIES; ++i)
+   for (i = 0; i < HIF_TX_RETRY_POLICY_MAX; ++i)
if (!policies[i].uploaded &&
memzcmp(policies[i].rates, 
sizeof(policies[i].rates)))
break;
-   if (i < HIF_MIB_NUM_TX_RATE_RETRY_POLICIES) {
+   if (i < HIF_TX_RETRY_POLICY_MAX) {
policies[i].uploaded = true;
memcpy(tmp_rates, policies[i].rates, sizeof(tmp_rates));
spin_unlock_bh(>tx_policy_cache.lock);
@@ -176,7 +174,7 @@ static int wfx_tx_policy_upload(struct wfx_vif *wvif)
} else {
spin_unlock_bh(>tx_policy_cache.lock);
}
-   } while (i < HIF_MIB_NUM_TX_RATE_RETRY_POLICIES);
+   } while (i < HIF_TX_RETRY_POLICY_MAX);
return 0;
 }
 
@@ -200,7 +198,7 @@ void wfx_tx_policy_init(struct wfx_vif *wvif)
INIT_LIST_HEAD(>used);
INIT_LIST_HEAD(>free);
 
-   for (i = 0; i < HIF_MIB_NUM_TX_RATE_RETRY_POLICIES; ++i)
+   for (i = 0; i < HIF_TX_RETRY_POLICY_MAX; ++i)
list_add(>cache[i].link, >free);
 }
 
@@ -308,7 +306,7 @@ static u8 wfx_tx_get_rate_id(struct wfx_vif *wvif,
 
rate_id = wfx_tx_policy_get(wvif,
tx_info->driver_rates, _policy_renew);
-   if (rate_id == WFX_INVALID_RATE_ID)
+   if (rate_id == HIF_TX_RETRY_POLICY_INVALID)
dev_warn(wvif->wdev->dev, "unable to get a valid Tx policy");
 
if (tx_policy_renew) {
diff --git a/drivers/staging/wfx/data_tx.h b/drivers/staging/wfx/data_tx.h
index 7f201f626410..a308af3d68ad 100644
--- a/drivers/staging/wfx/data_tx.h
+++ b/drivers/staging/wfx/data_tx.h
@@ -26,7 +26,7 @@ struct tx_policy {
 };
 
 struct tx_policy_cache {
-   struct tx_policy cache[HIF_MIB_NUM_TX_RATE_RETRY_POLICIES];
+   struct tx_policy cache[HIF_TX_RETRY_POLICY_MAX];
// FIXME: use a trees and drop hash from tx_policy
struct list_head used;
struct list_head free;
diff --git a/drivers/staging/wfx/hif_api_mib.h 
b/drivers/staging/wfx/hif_api_mib.h
index 0c67cd4c1593..36c9152785c4 100644
--- a/drivers/staging/wfx/hif_api_mib.h
+++ b/drivers/staging/wfx/hif_api_mib.h
@@ -500,7 +500,8 @@ struct hif_mib_tx_rate_retry_policy {
u8rates[12];
 } __packed;
 
-#define HIF_MIB_NUM_TX_RATE_RETRY_POLICIES15
+#define HIF_TX_RETRY_POLICY_MAX15
+#define HIF_TX_RETRY_POLICY_INVALIDHIF_TX_RETRY_POLICY_MAX
 
 struct hif_mib_set_tx_rate_retry_policy {
u8num_tx_rate_policies;
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 04/11] staging: wfx: remove unused definitions from the hif API

2020-04-06 Thread Jerome Pouiller
From: Jérôme Pouiller 

Until now, hif API was directly imported from firmware sources.
However, it does not make sense to keep ton of unused structures in
the driver. Moreover, the hif API is now stable enough to be keep in
sync by importing delta from firmware.

So, drop unused definitions from the hif API.

Signed-off-by: Jérôme Pouiller 
---
 drivers/staging/wfx/hif_api_cmd.h |  18 ---
 drivers/staging/wfx/hif_api_general.h |  90 ---
 drivers/staging/wfx/hif_api_mib.h | 155 --
 3 files changed, 263 deletions(-)

diff --git a/drivers/staging/wfx/hif_api_cmd.h 
b/drivers/staging/wfx/hif_api_cmd.h
index f6934598f319..321f4fb27b35 100644
--- a/drivers/staging/wfx/hif_api_cmd.h
+++ b/drivers/staging/wfx/hif_api_cmd.h
@@ -10,8 +10,6 @@
 
 #include "hif_api_general.h"
 
-#define HIF_NUM_AC 4
-
 #define HIF_API_SSID_SIZE  API_SSID_SIZE
 
 enum hif_requests_ids {
@@ -168,22 +166,6 @@ struct hif_ssid_def {
 #define HIF_API_MAX_NB_SSIDS   2
 #define HIF_API_MAX_NB_CHANNELS   14
 
-struct hif_req_start_scan {
-   u8band;
-   struct hif_scan_type scan_type;
-   struct hif_scan_flags scan_flags;
-   u8max_transmit_rate;
-   struct hif_auto_scan_param auto_scan_param;
-   u8num_of_probe_requests;
-   u8probe_delay;
-   u8num_of_ssids;
-   u8num_of_channels;
-   u32   min_channel_time;
-   u32   max_channel_time;
-   s32tx_power_level;
-   u8ssid_and_channel_lists[];
-} __packed;
-
 struct hif_req_start_scan_alt {
u8band;
struct hif_scan_type scan_type;
diff --git a/drivers/staging/wfx/hif_api_general.h 
b/drivers/staging/wfx/hif_api_general.h
index a069c3a21b4d..73016135f538 100644
--- a/drivers/staging/wfx/hif_api_general.h
+++ b/drivers/staging/wfx/hif_api_general.h
@@ -191,12 +191,6 @@ struct hif_req_control_gpio {
u8 gpio_mode;
 } __packed;
 
-enum hif_gpio_error {
-   HIF_GPIO_ERROR_0= 0x0,
-   HIF_GPIO_ERROR_1= 0x1,
-   HIF_GPIO_ERROR_2= 0x2
-};
-
 struct hif_cnf_control_gpio {
u32 status;
u32 value;
@@ -350,88 +344,4 @@ struct hif_cnf_sl_configure {
u32 status;
 } __packed;
 
-struct hif_req_prevent_rollback {
-   u32   magic_word;
-} __packed;
-
-struct hif_cnf_prevent_rollback {
-   u32status;
-} __packed;
-
-enum hif_pta_mode {
-   PTA_1W_WLAN_MASTER = 0,
-   PTA_1W_COEX_MASTER = 1,
-   PTA_2W = 2,
-   PTA_3W = 3,
-   PTA_4W = 4
-};
-
-enum hif_signal_level {
-   SIGNAL_LOW  = 0,
-   SIGNAL_HIGH = 1
-};
-
-enum hif_coex_type {
-   COEX_TYPE_GENERIC = 0,
-   COEX_TYPE_BLE = 1
-};
-
-enum hif_grant_state {
-   NO_GRANT = 0,
-   GRANT= 1
-};
-
-struct hif_req_pta_settings {
-   u8 pta_mode;
-   u8 request_signal_active_level;
-   u8 priority_signal_active_level;
-   u8 freq_signal_active_level;
-   u8 grant_signal_active_level;
-   u8 coex_type;
-   u8 default_grant_state;
-   u8 simultaneous_rx_accesses;
-   u8 priority_sampling_time;
-   u8 tx_rx_sampling_time;
-   u8 freq_sampling_time;
-   u8 grant_valid_time;
-   u8 fem_control_time;
-   u8 first_slot_time;
-   u16 periodic_tx_rx_sampling_time;
-   u16 coex_quota;
-   u16 wlan_quota;
-} __packed;
-
-struct hif_cnf_pta_settings {
-   u32 status;
-} __packed;
-
-enum hif_pta_priority {
-   HIF_PTA_PRIORITY_COEX_MAXIMIZED = 0x0562,
-   HIF_PTA_PRIORITY_COEX_HIGH  = 0x0462,
-   HIF_PTA_PRIORITY_BALANCED   = 0x1461,
-   HIF_PTA_PRIORITY_WLAN_HIGH  = 0x1851,
-   HIF_PTA_PRIORITY_WLAN_MAXIMIZED = 0x1A51
-};
-
-struct hif_req_pta_priority {
-   u32 priority;
-} __packed;
-
-struct hif_cnf_pta_priority {
-   u32 status;
-} __packed;
-
-enum hif_pta_state {
-   PTA_OFF = 0,
-   PTA_ON  = 1
-};
-
-struct hif_req_pta_state {
-   u32 pta_state;
-} __packed;
-
-struct hif_cnf_pta_state {
-   u32 status;
-} __packed;
-
 #endif
diff --git a/drivers/staging/wfx/hif_api_mib.h 
b/drivers/staging/wfx/hif_api_mib.h
index 36c9152785c4..732f82d10a19 100644
--- a/drivers/staging/wfx/hif_api_mib.h
+++ b/drivers/staging/wfx/hif_api_mib.h
@@ -63,8 +63,6 @@ enum hif_mib_ids {
HIF_MIB_ID_BEACON_STATS= 0x2056,
 };
 
-#define HIF_OP_POWER_MODE_MASK 0xf
-
 enum hif_op_power_mode {
HIF_OP_POWER_MODE_ACTIVE   = 0x0,
HIF_OP_POWER_MODE_DOZE = 0x1,
@@ -78,78 +76,12 @@ struct hif_mib_gl_operational_power_mode {
u8reserved2[3];
 } __packed;
 
-struct hif_mib_gl_block_ack_info {
-   u8rx_buffer_size;
-   u8rx_max_num_agreements;
-   u8tx_buffer_size;
- 

[PATCH 05/11] staging: wfx: remove useless defines

2020-04-06 Thread Jerome Pouiller
From: Jérôme Pouiller 

Several values defined in hif API are only here to define length of some
arrays. In most cases, they do not provide any extra information about
the size of the array (ie. "API_FIRMWARE_LABEL_SIZE" is only used to
define the size of member "firmware_label").

Remove these useless definitions.

Signed-off-by: Jérôme Pouiller 
---
 drivers/staging/wfx/hif_api_general.h | 27 +--
 drivers/staging/wfx/hif_api_mib.h | 11 +++
 2 files changed, 12 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/wfx/hif_api_general.h 
b/drivers/staging/wfx/hif_api_general.h
index 73016135f538..c58b9a1eff3d 100644
--- a/drivers/staging/wfx/hif_api_general.h
+++ b/drivers/staging/wfx/hif_api_general.h
@@ -135,16 +135,11 @@ struct hif_otp_phy_info {
u8otp_phy_ver:2;
 } __packed;
 
-#define API_OPN_SIZE14
-#define API_UID_SIZE8
-#define API_DISABLED_CHANNEL_LIST_SIZE  2
-#define API_FIRMWARE_LABEL_SIZE 128
-
 struct hif_ind_startup {
u32   status;
u16   hardware_id;
-   u8opn[API_OPN_SIZE];
-   u8uid[API_UID_SIZE];
+   u8opn[14];
+   u8uid[8];
u16   num_inp_ch_bufs;
u16   size_inp_ch_buf;
u8num_links_ap;
@@ -157,11 +152,11 @@ struct hif_ind_startup {
u8firmware_minor;
u8firmware_major;
u8firmware_type;
-   u8disabled_channel_list[API_DISABLED_CHANNEL_LIST_SIZE];
+   u8disabled_channel_list[2];
struct hif_otp_regul_sel_mode_info regul_sel_mode_info;
struct hif_otp_phy_info otp_phy_info;
u32   supported_rate_mask;
-   u8firmware_label[API_FIRMWARE_LABEL_SIZE];
+   u8firmware_label[128];
 } __packed;
 
 struct hif_ind_wakeup {
@@ -229,10 +224,8 @@ struct hif_ind_generic {
 } __packed;
 
 
-#define HIF_EXCEPTION_DATA_SIZE124
-
 struct hif_ind_exception {
-   u8data[HIF_EXCEPTION_DATA_SIZE];
+   u8data[124];
 } __packed;
 
 
@@ -302,14 +295,14 @@ struct hif_cnf_set_sl_mac_key {
u32   status;
 } __packed;
 
-#define API_HOST_PUB_KEY_SIZE   32
-#define API_HOST_PUB_KEY_MAC_SIZE   64
-
 enum hif_sl_session_key_alg {
HIF_SL_CURVE25519= 0x01,
HIF_SL_KDF   = 0x02
 };
 
+#define API_HOST_PUB_KEY_SIZE   32
+#define API_HOST_PUB_KEY_MAC_SIZE   64
+
 struct hif_req_sl_exchange_pub_keys {
u8algorithm:2;
u8reserved1:6;
@@ -331,10 +324,8 @@ struct hif_ind_sl_exchange_pub_keys {
u8ncp_pub_key_mac[API_NCP_PUB_KEY_MAC_SIZE];
 } __packed;
 
-#define API_ENCR_BMP_SIZE32
-
 struct hif_req_sl_configure {
-   u8encr_bmp[API_ENCR_BMP_SIZE];
+   u8encr_bmp[32];
u8disable_session_key_protection:1;
u8reserved1:7;
u8reserved2[3];
diff --git a/drivers/staging/wfx/hif_api_mib.h 
b/drivers/staging/wfx/hif_api_mib.h
index 732f82d10a19..e6d05789720c 100644
--- a/drivers/staging/wfx/hif_api_mib.h
+++ b/drivers/staging/wfx/hif_api_mib.h
@@ -149,9 +149,6 @@ struct hif_mib_rx_filter {
u8reserved4[3];
 } __packed;
 
-#define HIF_API_OUI_SIZE3
-#define HIF_API_MATCH_DATA_SIZE 3
-
 struct hif_ie_table_entry {
u8ie_id;
u8has_changed:1;
@@ -159,8 +156,8 @@ struct hif_ie_table_entry {
u8has_appeared:1;
u8reserved:1;
u8num_match_data:4;
-   u8oui[HIF_API_OUI_SIZE];
-   u8match_data[HIF_API_MATCH_DATA_SIZE];
+   u8oui[3];
+   u8match_data[3];
 } __packed;
 
 struct hif_mib_bcn_filter_table {
@@ -273,14 +270,12 @@ enum hif_tmplt {
HIF_TMPLT_NA   = 0x7
 };
 
-#define HIF_API_MAX_TEMPLATE_FRAME_SIZE  700
-
 struct hif_mib_template_frame {
u8frame_type;
u8init_rate:7;
u8mode:1;
u16   frame_length;
-   u8frame[HIF_API_MAX_TEMPLATE_FRAME_SIZE];
+   u8frame[700];
 } __packed;
 
 struct hif_mib_beacon_wake_up_period {
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


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

2020-04-06 Thread Dan Carpenter
Reviewed-by: Dan Carpenter 

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


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

2020-04-06 Thread Dan Carpenter
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.
> 
> 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 
> b/drivers/staging/vt6656/baseband.c
> index 3e4bd637849a..a785f91c1566 100644
> --- a/drivers/staging/vt6656/baseband.c
> +++ b/drivers/staging/vt6656/baseband.c
> @@ -24,6 +24,7 @@
> 
>  #include 
>  #include 
> +#include "device.h"
>  #include "mac.h"
>  #include "baseband.h"
>  #include "rf.h"
> @@ -141,7 +142,7 @@ unsigned int vnt_get_frame_time(u8 preamble_type, u8 
> pkt_type,
> 
>   rate = (unsigned int)vnt_frame_time[tx_rate];
> 
> - if (tx_rate <= 3) {
> + if (tx_rate <= RATE_11M) {

This is nice.  And if we don't apply patch 1 then it's even nicer
because then "tx_rate" is treated consistently.

Reviewed-by: Dan Carpenter 

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


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

2020-04-06 Thread Dan Carpenter
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
> this define is changed in the future to a greater value.
> 

Future proofing is not really a valid reason to change this.  We have to
assume that future programmers are not idiots.

The only valid reason to do this is readability, but I'm not convinced
the new version is more readable.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 3/3] staging: iio: ad5933: use iio_device_attach_kfifo_buffer() helper

2020-04-06 Thread Ardelean, Alexandru
On Sun, 2020-04-05 at 11:49 +0100, Jonathan Cameron wrote:
> [External]
> 
> On Wed, 1 Apr 2020 15:59:36 +0300
> Alexandru Ardelean  wrote:
> 
> > This driver calls iio_kfifo_allocate() vs devm_iio_kfifo_allocate(). But
> > the conversion is still simpler here, and cleans-up/reduces some error
> > paths.
> > 
> > Signed-off-by: Alexandru Ardelean 
> 
> This mixes devm managed stuff an unmanaged.  Hence it fails the 'obviously
> correct'
> test.  If you wanted to do this you'd first need to sort out the unmanaged
> bits to be automatically unwound (regulators and clocks). Or potentially
> reorder
> the driver so those happen after this allocation is done.
> 

Yeah.
I was a bit sloppy here.
I think tried a broader cleanup/rework would be a better idea here.


> Thanks,
> 
> Jonathan
> 
> > ---
> >  .../staging/iio/impedance-analyzer/ad5933.c   | 28 ---
> >  1 file changed, 5 insertions(+), 23 deletions(-)
> > 
> > diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c
> > b/drivers/staging/iio/impedance-analyzer/ad5933.c
> > index af0bcf95ee8a..7bde93c6dd74 100644
> > --- a/drivers/staging/iio/impedance-analyzer/ad5933.c
> > +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
> > @@ -602,22 +602,6 @@ static const struct iio_buffer_setup_ops
> > ad5933_ring_setup_ops = {
> > .postdisable = ad5933_ring_postdisable,
> >  };
> >  
> > -static int ad5933_register_ring_funcs_and_init(struct iio_dev *indio_dev)
> > -{
> > -   struct iio_buffer *buffer;
> > -
> > -   buffer = iio_kfifo_allocate();
> > -   if (!buffer)
> > -   return -ENOMEM;
> > -
> > -   iio_device_attach_buffer(indio_dev, buffer);
> > -
> > -   /* Ring buffer functions - here trigger setup related */
> > -   indio_dev->setup_ops = _ring_setup_ops;
> > -
> > -   return 0;
> > -}
> > -
> >  static void ad5933_work(struct work_struct *work)
> >  {
> > struct ad5933_state *st = container_of(work,
> > @@ -738,26 +722,25 @@ static int ad5933_probe(struct i2c_client *client,
> > indio_dev->dev.parent = >dev;
> > indio_dev->info = _info;
> > indio_dev->name = id->name;
> > -   indio_dev->modes = (INDIO_BUFFER_SOFTWARE | INDIO_DIRECT_MODE);
> > +   indio_dev->modes = INDIO_DIRECT_MODE;
> > indio_dev->channels = ad5933_channels;
> > indio_dev->num_channels = ARRAY_SIZE(ad5933_channels);
> >  
> > -   ret = ad5933_register_ring_funcs_and_init(indio_dev);
> > +   ret = iio_device_attach_kfifo_buffer(indio_dev, INDIO_BUFFER_SOFTWARE,
> > +_ring_setup_ops);
> > if (ret)
> > goto error_disable_mclk;
> >  
> > ret = ad5933_setup(st);
> > if (ret)
> > -   goto error_unreg_ring;
> > +   goto error_disable_mclk;
> >  
> > ret = iio_device_register(indio_dev);
> > if (ret)
> > -   goto error_unreg_ring;
> > +   goto error_disable_mclk;
> >  
> > return 0;
> >  
> > -error_unreg_ring:
> > -   iio_kfifo_free(indio_dev->buffer);
> >  error_disable_mclk:
> > clk_disable_unprepare(st->mclk);
> >  error_disable_reg:
> > @@ -772,7 +755,6 @@ static int ad5933_remove(struct i2c_client *client)
> > struct ad5933_state *st = iio_priv(indio_dev);
> >  
> > iio_device_unregister(indio_dev);
> > -   iio_kfifo_free(indio_dev->buffer);
> > regulator_disable(st->reg);
> > clk_disable_unprepare(st->mclk);
> >  
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/3] iio: kfifo: add iio_device_attach_kfifo_buffer() helper

2020-04-06 Thread Ardelean, Alexandru
On Sun, 2020-04-05 at 11:46 +0100, Jonathan Cameron wrote:
> [External]
> 
> On Wed, 1 Apr 2020 15:59:34 +0300
> Alexandru Ardelean  wrote:
> 
> > This change adds the iio_device_attach_kfifo_buffer() helper/short-hand,
> > which groups the simple routine of allocating a kfifo buffers via
> > devm_iio_kfifo_allocate() and calling iio_device_attach_buffer().
> > 
> > The mode_flags parameter is required. The setup_ops parameter is optional.
> > 
> > This function will be a bit more useful when needing to define multiple
> > buffers per IIO device.
> > 
> > One requirement [that is more a recommendation] for this helper, is to call
> > it after 'indio_dev' has been populated.
> > 
> > Also, one consequence related to using this helper is that the resource
> > management of the buffer will be tied to 'indio_dev->dev'. Previously it
> > was open-coded, and each driver does it slightly differently. Most of them
> > tied it to the parent device, some of them to 'indio_dev->dev'.
> > This shouldn't be a problem, and may be a good idea when adding more
> > buffers per-device.
> 
> I'm glad you highlighted this subtlety.  I'm not sure it's safe in all cases
> because the result is that the managed cleanup for this will occur once we
> get to the cleanup for devm_iio_device_alloc and we release the indio_dev->dev
> 
> That would put it 'after' any other devm calls that are still hung off the
> parent
> device.
> 
> Now the question is whether that ever causes us problems... See next patch.
> It potentially does.  I think we need to provide the dev separately even
> if it feels a bit silly to do so.  Scope management is complex so I don't
> really want to force people to mix and match between different devices
> and so get it wrong by accident.
> 
> The other issue is that it's not readily apparent from the naming that
> this function is registering stuff that is cleaned up automatically or
> that it even allocates anything that might need that..
> 
> devm_iio_device_attach_new_kfifo_buffer maybe?
> 
> I'm sort of wondering if we should do what dma did and have
> 
> iiom_device_attach_new_kfifo_buffer to indicate it's managed in the
> scope of the iio device?
> 
> What do people think?
> 
> However, see patch 2 before commenting.  Reality is I'm not sure forcing
> managed calls to hang off iio_dev->dev is a good idea (at this stage given
> where we are).

What I am really after with this patch is to hide away these:
 iio_kfifo_free(indio_dev->buffer);
 iio_buffer_set_attrs(indio_dev->buffer, _fifo_attributes); 
i.e. not have 'indio_dev->buffer' open-coded in drivers, and hide it in IIO core
somewhere.
Some ideas can go in parallel [like this one] to add support for multiple
buffers.

So, I will think of a better [less sloppy] V2 for this.

One intermediate alternative is to do 'iio_device_kfifo_free(indio_dev)', but
I'll still try to think of a better devm_ approach.
devm_iio_device_attach_new_kfifo_buffer() sounds a bit long but may work.
iiom_device_attach_new_kfifo_buffer() can also work.

What if we just default attaching to the parent device?

Would it work to also attach the parent device in devm_iio_device_alloc() by
default?
Or change 'iio_device_alloc()' to take a parent device as argument?
Which for devm_iio_device_alloc(dev,...) would implicitly mean that 'dev' is
'parent'?

These are just some thoughts.


> 
> Thanks
> 
> Jonathan
> 
> 
> > Signed-off-by: Alexandru Ardelean 
> > ---
> >  drivers/iio/buffer/kfifo_buf.c | 37 ++
> >  include/linux/iio/kfifo_buf.h  |  4 
> >  2 files changed, 41 insertions(+)
> > 
> > diff --git a/drivers/iio/buffer/kfifo_buf.c b/drivers/iio/buffer/kfifo_buf.c
> > index 3150f8ab984b..05b7c5fc6f1d 100644
> > --- a/drivers/iio/buffer/kfifo_buf.c
> > +++ b/drivers/iio/buffer/kfifo_buf.c
> > @@ -228,4 +228,41 @@ void devm_iio_kfifo_free(struct device *dev, struct
> > iio_buffer *r)
> >  }
> >  EXPORT_SYMBOL(devm_iio_kfifo_free);
> >  
> > +/**
> > + * iio_device_attach_kfifo_buffer - Allocate a kfifo buffer & attach it to
> > an IIO device
> > + * @indio_dev: The device the buffer should be attached to
> > + * @mode_flags: The mode flags for this buffer (INDIO_BUFFER_SOFTWARE
> > and/or
> > + * INDIO_BUFFER_TRIGGERED).
> > + * @setup_ops: The setup_ops required to configure the HW part of the
> > buffer (optional)
> > + *
> > + * This function allocates a kfifo buffer via devm_iio_kfifo_allocate() and
> > + * attaches it to the IIO device via iio_device_attach_buffer().
> > + * This is meant to be a bit of a short-hand/helper function as many driver
> > + * seem to do this.
> > + */
> > +int iio_device_attach_kfifo_buffer(struct iio_dev *indio_dev,
> > +  int mode_flags,
> > +  const struct iio_buffer_setup_ops *setup_ops)
> > +{
> > +   struct iio_buffer *buffer;
> > +
> > +   if (mode_flags)
> > +   mode_flags &= kfifo_access_funcs.modes;
> > +
> > +   if