[PATCH 3/3] staging: rtl8192u: Convert u4bAcParam back to little-endian after construction
commit 9304b5b0d4fe8498d3d059db4bb8a7de253355a5 adds casting of le16 values to cpu to get rid of sparse warnings. The u4bAcParam is therefore constructed using machines endianess. However, the parameter ought to be casted back to little endian to keep the function logic the same as before. Unfortunately I don't have the hardware to test this change. Signed-off-by: Tuomo Rinne --- drivers/staging/rtl8192u/r8192U_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 5e84ed7..dceec20 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -2321,10 +2321,10 @@ static void dm_check_edca_turbo( u1bAIFS <<= AC_PARAM_AIFS_OFFSET; u4bAcParam = op_limit | cw_max | cw_min | u1bAIFS; + cpu_to_le32s(u4bAcParam); write_nic_dword(dev, EDCAPARA_BE, u4bAcParam); - /* * Check ACM bit. * If it is set, immediately set ACM control bit to downgrading AC for passing WMM testplan. Annie, 2005-12-13. -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/3] staging: rtl8192u: Improve code readability
Split the u4bAcParam parameter construction to multiple lines for easier readability. Signed-off-by: Tuomo Rinne --- drivers/staging/rtl8192u/r8192U_dm.c | 28 +++- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 16cafb62..5e84ed7 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -2300,20 +2300,30 @@ static void dm_check_edca_turbo( * Restore original EDCA according to the declaration of AP. */ if (priv->bcurrent_turbo_EDCA) { - u8 u1bAIFS; - u32 u4bAcParam; + u8 u1bAIFS; + u32 u4bAcParam, op_limit, cw_max, cw_min; + struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters; u8 mode = priv->ieee80211->mode; /* For Each time updating EDCA parameter, reset EDCA turbo mode status. */ dm_init_edca_turbo(dev); - u1bAIFS = qos_parameters->aifs[0] * ((mode&(IEEE_G|IEEE_N_24G)) ? 9 : 20) + aSifsTime; - u4bAcParam = (((le16_to_cpu(qos_parameters->tx_op_limit[0])) << AC_PARAM_TXOP_LIMIT_OFFSET)| - ((le16_to_cpu(qos_parameters->cw_max[0])) << AC_PARAM_ECW_MAX_OFFSET)| - ((le16_to_cpu(qos_parameters->cw_min[0])) << AC_PARAM_ECW_MIN_OFFSET)| - ((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET)); - /*write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam);*/ - write_nic_dword(dev, EDCAPARA_BE, u4bAcParam); + + u1bAIFS = qos_parameters->aifs[0] * ((mode & (IEEE_G | IEEE_N_24G)) ? 9 : 20) + aSifsTime; + + op_limit = (u32)le16_to_cpu(qos_parameters->tx_op_limit[0]); + cw_max = (u32)le16_to_cpu(qos_parameters->cw_max[0]); + cw_min = (u32)le16_to_cpu(qos_parameters->cw_min[0]); + + op_limit <<= AC_PARAM_TXOP_LIMIT_OFFSET; + cw_max <<= AC_PARAM_ECW_MAX_OFFSET; + cw_min <<= AC_PARAM_ECW_MIN_OFFSET; + u1bAIFS <<= AC_PARAM_AIFS_OFFSET; + + u4bAcParam = op_limit | cw_max | cw_min | u1bAIFS; + + write_nic_dword(dev, EDCAPARA_BE, u4bAcParam); + /* * Check ACM bit. -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/3] staging: rtl8192u: Remove unnecessary scope
Remove scope unnecessary scope that is already enforced by the if statements scope. Signed-off-by: Tuomo Rinne --- drivers/staging/rtl8192u/r8192U_dm.c | 66 +--- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 623d495..16cafb62 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -2300,43 +2300,41 @@ static void dm_check_edca_turbo( * Restore original EDCA according to the declaration of AP. */ if (priv->bcurrent_turbo_EDCA) { + u8 u1bAIFS; + u32 u4bAcParam; + struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters; + u8 mode = priv->ieee80211->mode; + + /* For Each time updating EDCA parameter, reset EDCA turbo mode status. */ + dm_init_edca_turbo(dev); + u1bAIFS = qos_parameters->aifs[0] * ((mode&(IEEE_G|IEEE_N_24G)) ? 9 : 20) + aSifsTime; + u4bAcParam = (((le16_to_cpu(qos_parameters->tx_op_limit[0])) << AC_PARAM_TXOP_LIMIT_OFFSET)| + ((le16_to_cpu(qos_parameters->cw_max[0])) << AC_PARAM_ECW_MAX_OFFSET)| + ((le16_to_cpu(qos_parameters->cw_min[0])) << AC_PARAM_ECW_MIN_OFFSET)| + ((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET)); + /*write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam);*/ + write_nic_dword(dev, EDCAPARA_BE, u4bAcParam); + + /* +* Check ACM bit. +* If it is set, immediately set ACM control bit to downgrading AC for passing WMM testplan. Annie, 2005-12-13. +*/ { - u8 u1bAIFS; - u32 u4bAcParam; - struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters; - u8 mode = priv->ieee80211->mode; - - /* For Each time updating EDCA parameter, reset EDCA turbo mode status. */ - dm_init_edca_turbo(dev); - u1bAIFS = qos_parameters->aifs[0] * ((mode&(IEEE_G|IEEE_N_24G)) ? 9 : 20) + aSifsTime; - u4bAcParam = (((le16_to_cpu(qos_parameters->tx_op_limit[0])) << AC_PARAM_TXOP_LIMIT_OFFSET)| - ((le16_to_cpu(qos_parameters->cw_max[0])) << AC_PARAM_ECW_MAX_OFFSET)| - ((le16_to_cpu(qos_parameters->cw_min[0])) << AC_PARAM_ECW_MIN_OFFSET)| - ((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET)); - /*write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam);*/ - write_nic_dword(dev, EDCAPARA_BE, u4bAcParam); - - /* -* Check ACM bit. -* If it is set, immediately set ACM control bit to downgrading AC for passing WMM testplan. Annie, 2005-12-13. -*/ - { - /* TODO: Modified this part and try to set acm control in only 1 IO processing!! */ - - PACI_AIFSN pAciAifsn = (PACI_AIFSN)&(qos_parameters->aifs[0]); - u8 AcmCtrl; - - read_nic_byte(dev, AcmHwCtrl, &AcmCtrl); - - if (pAciAifsn->f.ACM) { /* ACM bit is 1. */ - AcmCtrl |= AcmHw_BeqEn; - } else {/* ACM bit is 0. */ - AcmCtrl &= (~AcmHw_BeqEn); - } + /* TODO: Modified this part and try to set acm control in only 1 IO processing!! */ - RT_TRACE(COMP_QOS, "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n", AcmCtrl); - write_nic_byte(dev, AcmHwCtrl, AcmCtrl); + PACI_AIFSN pAciAifsn = (PACI_AIFSN)&(qos_parameters->aifs[0]); + u8 AcmCtrl; + + read_nic_byte(dev, AcmHwCtrl, &AcmCtrl); + + if (pAciAifsn->f.ACM) { /* ACM bit is 1. */ + AcmCtrl |= AcmHw_BeqEn; +
[PATCH 2/4] staging: vt6656: always call vnt_update_ifs on short time change.
short time change needs to synchronize parameters in vnt_update_ifs so a call to the function is always necessary. Signed-off-by: Malcolm Priestley --- drivers/staging/vt6656/main_usb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 028f54b453d0..9237930991ca 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -715,6 +715,7 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, priv->short_slot_time = false; vnt_set_short_slot_time(priv); + vnt_update_ifs(priv); vnt_set_vga_gain_offset(priv, priv->bb_vga[0]); vnt_update_pre_ed_threshold(priv, false); } -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/4] staging: vt6656: vnt_update_ifs set max_min based on short slot time.
Short slot time is controlled by mac80211 so there is no need to find odfm rates. Merge PK_TYPE_11B and PK_TYPE_11GA & PK_TYPE_11GB into one else and switch on short slot time. Signed-off-by: Malcolm Priestley --- drivers/staging/vt6656/card.c | 29 ++--- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index 0e5a99375099..c61422ea8846 100644 --- a/drivers/staging/vt6656/card.c +++ b/drivers/staging/vt6656/card.c @@ -359,35 +359,18 @@ void vnt_update_ifs(struct vnt_private *priv) priv->sifs = C_SIFS_A; priv->difs = C_SIFS_A + 2 * C_SLOT_SHORT; max_min = 4; - } else if (priv->packet_type == PK_TYPE_11B) { - priv->slot = C_SLOT_LONG; - priv->sifs = C_SIFS_BG; - priv->difs = C_SIFS_BG + 2 * C_SLOT_LONG; - max_min = 5; - } else {/* PK_TYPE_11GA & PK_TYPE_11GB */ - bool ofdm_rate = false; - unsigned int ii = 0; - + } else { priv->sifs = C_SIFS_BG; - if (priv->short_slot_time) + if (priv->short_slot_time) { priv->slot = C_SLOT_SHORT; - else + max_min = 4; + } else { priv->slot = C_SLOT_LONG; - - priv->difs = C_SIFS_BG + 2 * priv->slot; - - for (ii = RATE_54M; ii >= RATE_6M; ii--) { - if (priv->basic_rates & ((u32)(0x1 << ii))) { - ofdm_rate = true; - break; - } + max_min = 5; } - if (ofdm_rate) - max_min = 4; - else - max_min = 5; + priv->difs = C_SIFS_BG + 2 * priv->slot; } priv->eifs = C_EIFS; -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/4] staging: vt6656: Only call vnt_set_bss_mode on basic rates change.
To ensure the bss is always synchronized only call on basic rate change. Signed-off-by: Malcolm Priestley --- drivers/staging/vt6656/main_usb.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 06f7841d44d3..095b85567306 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -637,7 +637,6 @@ static int vnt_config(struct ieee80211_hw *hw, u32 changed) { struct vnt_private *priv = hw->priv; struct ieee80211_conf *conf = &hw->conf; - u8 bb_type; if (changed & IEEE80211_CONF_CHANGE_PS) { if (conf->flags & IEEE80211_CONF_PS) @@ -651,15 +650,9 @@ static int vnt_config(struct ieee80211_hw *hw, u32 changed) vnt_set_channel(priv, conf->chandef.chan->hw_value); if (conf->chandef.chan->band == NL80211_BAND_5GHZ) - bb_type = BB_TYPE_11A; + priv->bb_type = BB_TYPE_11A; else - bb_type = BB_TYPE_11G; - - if (priv->bb_type != bb_type) { - priv->bb_type = bb_type; - - vnt_set_bss_mode(priv); - } + priv->bb_type = BB_TYPE_11G; } if (changed & IEEE80211_CONF_CHANGE_POWER) { @@ -690,6 +683,7 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, priv->basic_rates = conf->basic_rates; vnt_update_top_rates(priv); + vnt_set_bss_mode(priv); dev_dbg(&priv->usb->dev, "basic rates %x\n", conf->basic_rates); } @@ -850,7 +844,6 @@ static void vnt_sw_scan_start(struct ieee80211_hw *hw, { struct vnt_private *priv = hw->priv; - vnt_set_bss_mode(priv); /* Set max sensitivity*/ vnt_update_pre_ed_threshold(priv, true); } -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/4] staging: vt6556: vnt_start Fix missing call to vnt_key_init_table.
The key table is not intialized correctly without this call. Signed-off-by: Malcolm Priestley Cc: # v3.17+ --- drivers/staging/vt6656/main_usb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 9237930991ca..06f7841d44d3 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -513,6 +513,9 @@ static int vnt_start(struct ieee80211_hw *hw) goto free_all; } + if (vnt_key_init_table(priv)) + goto free_all; + priv->int_interval = 1; /* bInterval is set to 1 */ vnt_int_start_interrupt(priv); -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: wilc1000: Refactor handling of HT caps fields
This addresses the following sparse warnings: drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2006:51: warning: incorrect type in assignment (different base types) drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2006:51:expected unsigned short [unsigned] [assigned] [usertype] ht_capa_info drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2006:51:got restricted __le16 const [usertype] cap_info drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2011:52: warning: incorrect type in assignment (different base types) drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2011:52:expected unsigned short [unsigned] [assigned] [usertype] ht_ext_params drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2011:52:got restricted __le16 const [usertype] extended_ht_cap_info drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2012:51: warning: incorrect type in assignment (different base types) drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2012:51:expected unsigned int [unsigned] [assigned] [usertype] ht_tx_bf_cap drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2012:51:got restricted __le32 const [usertype] tx_BF_cap_info drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2078:51: warning: incorrect type in assignment (different base types) drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2078:51:expected unsigned short [unsigned] [assigned] [usertype] ht_capa_info drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2078:51:got restricted __le16 const [usertype] cap_info drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2083:52: warning: incorrect type in assignment (different base types) drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2083:52:expected unsigned short [unsigned] [assigned] [usertype] ht_ext_params drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2083:52:got restricted __le16 const [usertype] extended_ht_cap_info drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2084:51: warning: incorrect type in assignment (different base types) drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2084:51:expected unsigned int [unsigned] [assigned] [usertype] ht_tx_bf_cap drivers/staging/wilc1000/wilc_wfi_cfgoperations.c:2084:51:got restricted __le32 const [usertype] tx_BF_cap_info This is not the first attempt to address this problem: https://lkml.org/lkml/2017/3/7/808 First, the current code works because the final use of the ht_capa values (in host_interface.c: WILC_HostIf_PackStaParam) packs them into a buffer in little-endian format. Since this matches the byte-order of struct ieee80211_ht_cap, all is seemingly well. What the current code does not do, and what these warnings expose, is clearly communicate what the fields in struct add_sta_param represent -- values with a specific (little endian) byte order. This will lead to problems if the values are ever actually used by the host, and that host is not little endian. The proposed change addresses this by embedding a struct ieee80211_ht_cap into struct add_sta_param. When the values are later packed out, the newly embedded struct is copied directly into the outbound buffer. All 16 and 32 bit types are treated as little endian and marked as such. Future use of the values by the host would still require conversion, or sparse would flag them again. The following items are required for this to be correct: 1. The data is not currently used by the host. 2. struct ieee80211_ht_cap is packed. 3. The packing of the fields matches the order in struct ieee80211_ht_cap. This is similar, I believe, to how the same data is handled in marvell/mwifiex/11n.c. Test-compiled/loaded against staging-next on x86_64 Test-compiled against staging-next for ARM. Applied/built against staging-testing. Testing consists of compilation for the above trees/targets, and a sparse check, no functional testing. Signed-off-by: Jason Litzinger --- Note this leaves in place three checkpatch warnings regarding CamelCase. This was originally presented as an RFC PATCH: http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2017-April/105138.html For completeness, with respect to item two at the bottom of the orignal RFC, the reason I chose not to embed a pointer is lifecycle -- there's zero guarantees the original memory will stay around. drivers/staging/wilc1000/host_interface.c | 20 +++- drivers/staging/wilc1000/host_interface.h | 10 ++ drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 18 ++ 3 files changed, 7 insertions(+), 41 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index c3a8af081880..c8e3229a2809 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2052,23 +2052,9 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, pu8CurrByte += pstrStationParam->rates_len; *pu8CurrByte++ = pst
[PATCH] staging: lustre: fix sparse warnings on assignment
Fixes the following sparse warnings: drivers/staging/lustre/lustre/lmv/lmv_obd.c:2305:23: warning: invalid assignment: |= drivers/staging/lustre/lustre/lmv/lmv_obd.c:2305:23:left side has type restricted __le32 drivers/staging/lustre/lustre/lmv/lmv_obd.c:2305:23:right side has type int drivers/staging/lustre/lustre/lmv/lmv_obd.c:2383:39: warning: invalid assignment: |= drivers/staging/lustre/lustre/lmv/lmv_obd.c:2383:39:left side has type restricted __le32 drivers/staging/lustre/lustre/lmv/lmv_obd.c:2383:39:right side has type int Replaces one final conversion with two conversions on flag assignment. Signed-off-by: Valentin Vidic --- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 09b469243d73..4e6c1202a957 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -2302,7 +2302,7 @@ static int lmv_read_striped_page(struct obd_export *exp, dp = kmap(ent_page); memset(dp, 0, sizeof(*dp)); dp->ldp_hash_start = cpu_to_le64(offset); - dp->ldp_flags |= LDF_COLLIDE; + dp->ldp_flags |= cpu_to_le32(LDF_COLLIDE); area = dp + 1; left_bytes = PAGE_SIZE - sizeof(*dp); @@ -2380,8 +2380,7 @@ static int lmv_read_striped_page(struct obd_export *exp, ent_page = NULL; } else { if (ent == area) - dp->ldp_flags |= LDF_EMPTY; - dp->ldp_flags = cpu_to_le32(dp->ldp_flags); + dp->ldp_flags |= cpu_to_le32(LDF_EMPTY); dp->ldp_hash_end = cpu_to_le64(hash_offset); } -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: fsl-mc/dpio: add cpu <--> LE conversion for dpaa2_fd
On Fri, Apr 28, 2017 at 9:38 AM, Horia Geantă wrote: > > While dpaa2_fd.simple structure fields are marked __leXX, > corresponding cpu_to_leXX / leXX_to_cpu conversions are missing. > > While here, fix dpaa2_fd_{get,set}_bpid such that BMT, IVP bits > sharing the 16-bit field with BPID are not affected. Please split this into 2 separate patches. Don't fix other misc things "while you are at it" in the same patch. Thanks, Stuart ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: fsl-mc/dpio: add cpu <--> LE conversion for dpaa2_fd
On 4/29/2017 7:32 PM, Stuart Yoder wrote: > On Fri, Apr 28, 2017 at 9:38 AM, Horia Geantă wrote: >> >> While dpaa2_fd.simple structure fields are marked __leXX, >> corresponding cpu_to_leXX / leXX_to_cpu conversions are missing. >> >> While here, fix dpaa2_fd_{get,set}_bpid such that BMT, IVP bits >> sharing the 16-bit field with BPID are not affected. > > Please split this into 2 separate patches. Don't fix other misc things "while > you are at it" in the same patch. > I thought that having 2 issues on the same line would allow for this approach. Now that the patch is in staging-next, I am not sure what I am supposed to do. Thanks, Horia ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging/ks7010: Fix type assignment for struct hostif_hdr
Sparse spits out a warnings about __le16 and unsigned short assignment. Change the type of size and event members of struct hostif_hdr to __le16 and correct conversion to the proper cpu type. Signed-off-by: Cezary Gapinski --- drivers/staging/ks7010/ks7010_sdio.c | 10 ++ drivers/staging/ks7010/ks_hostif.h | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c index ec11799..e3a134d 100644 --- a/drivers/staging/ks7010/ks7010_sdio.c +++ b/drivers/staging/ks7010/ks7010_sdio.c @@ -269,7 +269,8 @@ static int write_to_device(struct ks_wlan_private *priv, unsigned char *buffer, hdr = (struct hostif_hdr *)buffer; DPRINTK(4, "size=%d\n", hdr->size); - if (hdr->event < HIF_DATA_REQ || HIF_REQ_MAX < hdr->event) { + if (le16_to_cpu(hdr->event) < HIF_DATA_REQ || + le16_to_cpu(hdr->event) > HIF_REQ_MAX) { DPRINTK(1, "unknown event=%04X\n", hdr->event); return 0; } @@ -327,13 +328,14 @@ int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, unsigned long size, hdr = (struct hostif_hdr *)p; - if (hdr->event < HIF_DATA_REQ || HIF_REQ_MAX < hdr->event) { + if (le16_to_cpu(hdr->event) < HIF_DATA_REQ || + le16_to_cpu(hdr->event) > HIF_REQ_MAX) { DPRINTK(1, "unknown event=%04X\n", hdr->event); return 0; } /* add event to hostt buffer */ - priv->hostt.buff[priv->hostt.qtail] = hdr->event; + priv->hostt.buff[priv->hostt.qtail] = le16_to_cpu(hdr->event); priv->hostt.qtail = (priv->hostt.qtail + 1) % SME_EVENT_BUFF_SIZE; DPRINTK(4, "event=%04X\n", hdr->event); @@ -403,7 +405,7 @@ static void ks_wlan_hw_rx(struct ks_wlan_private *priv, uint16_t size) hdr = (struct hostif_hdr *)&rx_buffer->data[0]; rx_buffer->size = le16_to_cpu(hdr->size) + sizeof(hdr->size); - event = hdr->event; + event = le16_to_cpu(hdr->event); inc_rxqtail(priv); ret = ks7010_sdio_writeb(priv, READ_STATUS, REG_STATUS_IDLE); diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index d773432..7e4d1aa 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -62,8 +62,8 @@ */ struct hostif_hdr { - u16 size; - u16 event; + __le16 size; + __le16 event; } __packed; struct hostif_data_request_t { -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 3/3] staging: rtl8192u: Convert u4bAcParam back to little-endian after construction
Hi Tuomo, [auto build test WARNING on staging/staging-testing] [also build test WARNING on next-20170428] [cannot apply to v4.11-rc8] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Tuomo-Rinne/staging-rtl8192u-Remove-unnecessary-scope/20170430-012804 config: xtensa-allyesconfig (attached as .config) compiler: xtensa-linux-gcc (GCC) 4.9.0 reproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=xtensa All warnings (new ones prefixed by >>): In file included from include/linux/byteorder/big_endian.h:4:0, from arch/xtensa/include/uapi/asm/byteorder.h:7, from arch/xtensa/include/asm/bitops.h:23, from include/linux/bitops.h:36, from include/linux/kernel.h:10, from include/linux/list.h:8, from include/linux/module.h:9, from drivers/staging/rtl8192u/r8192U.h:21, from drivers/staging/rtl8192u/r8192U_dm.c:16: drivers/staging/rtl8192u/r8192U_dm.c: In function 'dm_check_edca_turbo': >> include/uapi/linux/byteorder/big_endian.h:93:27: warning: passing argument 1 >> of '__swab32s' makes pointer from integer without a cast #define __cpu_to_le32s(x) __swab32s((x)) ^ >> include/linux/byteorder/generic.h:111:22: note: in expansion of macro >> '__cpu_to_le32s' #define cpu_to_le32s __cpu_to_le32s ^ >> drivers/staging/rtl8192u/r8192U_dm.c:2324:4: note: in expansion of macro >> 'cpu_to_le32s' cpu_to_le32s(u4bAcParam); ^ In file included from include/linux/swab.h:4:0, from include/uapi/linux/byteorder/big_endian.h:12, from include/linux/byteorder/big_endian.h:4, from arch/xtensa/include/uapi/asm/byteorder.h:7, from arch/xtensa/include/asm/bitops.h:23, from include/linux/bitops.h:36, from include/linux/kernel.h:10, from include/linux/list.h:8, from include/linux/module.h:9, from drivers/staging/rtl8192u/r8192U.h:21, from drivers/staging/rtl8192u/r8192U_dm.c:16: include/uapi/linux/swab.h:241:29: note: expected '__u32 *' but argument is of type 'u32' static __always_inline void __swab32s(__u32 *p) ^ -- In file included from include/linux/byteorder/big_endian.h:4:0, from arch/xtensa/include/uapi/asm/byteorder.h:7, from arch/xtensa/include/asm/bitops.h:23, from include/linux/bitops.h:36, from include/linux/kernel.h:10, from include/linux/list.h:8, from include/linux/module.h:9, from drivers/staging//rtl8192u/r8192U.h:21, from drivers/staging//rtl8192u/r8192U_dm.c:16: drivers/staging//rtl8192u/r8192U_dm.c: In function 'dm_check_edca_turbo': >> include/uapi/linux/byteorder/big_endian.h:93:27: warning: passing argument 1 >> of '__swab32s' makes pointer from integer without a cast #define __cpu_to_le32s(x) __swab32s((x)) ^ >> include/linux/byteorder/generic.h:111:22: note: in expansion of macro >> '__cpu_to_le32s' #define cpu_to_le32s __cpu_to_le32s ^ drivers/staging//rtl8192u/r8192U_dm.c:2324:4: note: in expansion of macro 'cpu_to_le32s' cpu_to_le32s(u4bAcParam); ^ In file included from include/linux/swab.h:4:0, from include/uapi/linux/byteorder/big_endian.h:12, from include/linux/byteorder/big_endian.h:4, from arch/xtensa/include/uapi/asm/byteorder.h:7, from arch/xtensa/include/asm/bitops.h:23, from include/linux/bitops.h:36, from include/linux/kernel.h:10, from include/linux/list.h:8, from include/linux/module.h:9, from drivers/staging//rtl8192u/r8192U.h:21, from drivers/staging//rtl8192u/r8192U_dm.c:16: include/uapi/linux/swab.h:241:29: note: expected '__u32 *' but argument is of type 'u32' static __always_inline void __swab32s(__u32 *p) ^ vim +/cpu_to_le32s +2324 drivers/staging/rtl8192u/r8192U_dm.c 2308 2309 /* For Each time updating EDCA parameter, reset EDCA turbo mode status. */ 2310 dm_init_edca_turbo(dev); 2311 2312 u1bAIFS = qos_parameters->aifs[0] * ((mode & (IEEE_G | IEEE_N_24G)) ? 9 : 20)
[PATCH] staging: atomisp: Add __printf validation and fix fallout
__printf validation adds format and argument validation. Fix the various broken format/argument mismatches. Signed-off-by: Joe Perches --- I'm not at all sure all the modifications are appropriate. Some maybe should use the original format types like %x instead of %p with *pointer instead of just pointer drivers/staging/ks7010/ks_wlan.h | 13 +++-- .../isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c | 6 +++--- .../isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c | 2 +- .../css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr.host.c | 2 +- .../css2400/runtime/debug/interface/ia_css_debug.h| 1 + .../atomisp2/css2400/runtime/debug/src/ia_css_debug.c | 6 +++--- .../media/atomisp/pci/atomisp2/css2400/sh_css.c | 19 ++- .../media/atomisp/pci/atomisp2/css2400/sh_css_mipi.c | 2 +- .../atomisp/pci/atomisp2/css2400/sh_css_params.c | 10 +- 9 files changed, 32 insertions(+), 29 deletions(-) diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h index eb15db90733b..7df01703d861 100644 --- a/drivers/staging/ks7010/ks_wlan.h +++ b/drivers/staging/ks7010/ks_wlan.h @@ -35,13 +35,14 @@ #include "ks7010_sdio.h" #ifdef KS_WLAN_DEBUG -#define DPRINTK(n, fmt, args...) \ - do { \ - if (KS_WLAN_DEBUG > (n)) \ - pr_notice("%s: "fmt, __func__, ## args); \ - } while (0) +#define DPRINTK(n, fmt, ...)\ +do {\ + if (KS_WLAN_DEBUG > (n)) \ + pr_notice("%s: "fmt, __func__, ##__VA_ARGS__); \ +} while (0) #else -#define DPRINTK(n, fmt, args...) +#define DPRINTK(n, fmt, ...) \ + no_printk(fmt, ##__VA_ARGS__) #endif struct ks_wlan_parameter { diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c index 0dde8425c67d..4c77e1463aaa 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c @@ -265,9 +265,9 @@ ia_css_translate_dvs_statistics( assert(isp_stats->hor_proj != NULL); assert(isp_stats->ver_proj != NULL); - IA_CSS_ENTER("hproj=%p, vproj=%p, haddr=%x, vaddr=%x", - host_stats->hor_proj, host_stats->ver_proj, - isp_stats->hor_proj, isp_stats->ver_proj); + IA_CSS_ENTER("hproj=%p, vproj=%p, haddr=%p, vaddr=%p", +host_stats->hor_proj, host_stats->ver_proj, +isp_stats->hor_proj, isp_stats->ver_proj); hor_num_isp = host_stats->grid.aligned_height; ver_num_isp = host_stats->grid.aligned_width; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c index 930061d48df7..5ac81f87bfa3 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c @@ -213,7 +213,7 @@ ia_css_translate_dvs2_statistics( "hor_coefs.even_real=%p, hor_coefs.even_imag=%p, " "ver_coefs.odd_real=%p, ver_coefs.odd_imag=%p, " "ver_coefs.even_real=%p, ver_coefs.even_imag=%p, " -"haddr=%x, vaddr=%x", +"haddr=%p, vaddr=%p", host_stats->hor_prod.odd_real, host_stats->hor_prod.odd_imag, host_stats->hor_prod.even_real, host_stats->hor_prod.even_imag, host_stats->ver_prod.odd_real, host_stats->ver_prod.odd_imag, diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr.host.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr.host.c index 804c19ab4485..222a7bd7f176 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr.host.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr.host.c @@ -55,7 +55,7 @@ ia_css_tnr_dump( "tnr_coef", tnr->coef); ia_css_debug_dtrace(level, "\t%-32s = %d\n", "tnr_threshold_Y", tnr->threshold_Y); - ia_css_debug_dtrace(level, "\t%-32s = %d\n" + ia_css_debug_dtrace(level, "\t%-32s = %d\n", "tnr_threshold_C", tnr->threshold_C); } diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/interface/ia_css_debug.h b/drivers/staging/media/atomisp/pci/atomisp2/c
[patch 3/6] staging: speakup: add tty-based comms functions
This adds spk_ttyio.c file. It contains a set of functions which implement those methods in spk_synth struct which relate to sending bytes out using serial comms. Implementations in this file perform the same function but using TTY subsystem instead. Currently synths access serial ports, directly poking standard ISA ports by trying to steal them from serial driver. Some ISA cards actually need this way of doing it, but most other synthesizers don't, and can actually work by using the proper TTY subsystem through a new N_SPEAKUP line discipline. So this adds the methods for drivers to switch to accessing serial ports through the TTY subsystem, whenever appropriate. Signed-off-by: Okash Khawaja Reviewed-by: Samuel Thibault Index: linux-staging/drivers/staging/speakup/Makefile === --- linux-staging.orig/drivers/staging/speakup/Makefile +++ linux-staging/drivers/staging/speakup/Makefile @@ -25,6 +25,7 @@ speakup-y := \ kobjects.o \ selection.o \ serialio.o \ + spk_ttyio.o \ synth.o \ thread.o \ varhandlers.o Index: linux-staging/drivers/staging/speakup/spk_priv.h === --- linux-staging.orig/drivers/staging/speakup/spk_priv.h +++ linux-staging/drivers/staging/speakup/spk_priv.h @@ -44,6 +44,7 @@ const struct old_serial_port *spk_serial void spk_stop_serial_interrupt(void); int spk_wait_for_xmitr(struct spk_synth *in_synth); void spk_serial_release(void); +void spk_ttyio_release(void); void synth_buffer_skip_nonlatin1(void); u16 synth_buffer_getc(void); @@ -56,7 +57,9 @@ ssize_t spk_var_store(struct kobject *ko const char *buf, size_t count); int spk_serial_synth_probe(struct spk_synth *synth); +int spk_ttyio_synth_probe(struct spk_synth *synth); const char *spk_serial_synth_immediate(struct spk_synth *synth, const char *buff); +const char *spk_ttyio_synth_immediate(struct spk_synth *synth, const char *buff); void spk_do_catch_up(struct spk_synth *synth); void spk_synth_flush(struct spk_synth *synth); unsigned char spk_synth_get_index(struct spk_synth *synth); @@ -78,5 +81,6 @@ extern struct speakup_info_t speakup_inf extern struct var_t synth_time_vars[]; extern struct spk_io_ops spk_serial_io_ops; +extern struct spk_io_ops spk_ttyio_ops; #endif Index: linux-staging/drivers/staging/speakup/spk_ttyio.c === --- /dev/null +++ linux-staging/drivers/staging/speakup/spk_ttyio.c @@ -0,0 +1,143 @@ +#include +#include + +#include "speakup.h" +#include "spk_types.h" + +static struct tty_struct *speakup_tty; + +static int spk_ttyio_ldisc_open(struct tty_struct *tty) +{ + if (tty->ops->write == NULL) + return -EOPNOTSUPP; + speakup_tty = tty; + + return 0; +} + +static void spk_ttyio_ldisc_close(struct tty_struct *tty) +{ + speakup_tty = NULL; +} + +static struct tty_ldisc_ops spk_ttyio_ldisc_ops = { + .owner = THIS_MODULE, + .magic = TTY_LDISC_MAGIC, + .name = "speakup_ldisc", + .open = spk_ttyio_ldisc_open, + .close = spk_ttyio_ldisc_close, +}; + +static int spk_ttyio_out(struct spk_synth *in_synth, const char ch); +struct spk_io_ops spk_ttyio_ops = { + .synth_out = spk_ttyio_out, +}; +EXPORT_SYMBOL_GPL(spk_ttyio_ops); + +static int spk_ttyio_initialise_ldisc(int ser) +{ + int ret = 0; + struct tty_struct *tty; + + ret = tty_register_ldisc(N_SPEAKUP, &spk_ttyio_ldisc_ops); + if (ret) { + pr_err("Error registering line discipline.\n"); + return ret; + } + + if (ser < 0 || ser > (255 - 64)) { + pr_err("speakup: Invalid ser param. Must be between 0 and 191 inclusive.\n"); + return -EINVAL; + } + + /* TODO: support more than ttyS* */ + tty = tty_open_by_driver(MKDEV(4, (ser + 64)), NULL, NULL); + if (IS_ERR(tty)) + return PTR_ERR(tty); + + if (tty->ops->open) + ret = tty->ops->open(tty, NULL); + else + ret = -ENODEV; + + if (ret) { + tty_unlock(tty); + return ret; + } + + clear_bit(TTY_HUPPED, &tty->flags); + tty_unlock(tty); + + ret = tty_set_ldisc(tty, N_SPEAKUP); + + return ret; +} + +static int spk_ttyio_out(struct spk_synth *in_synth, const char ch) +{ + if (in_synth->alive && speakup_tty && speakup_tty->ops->write) { + int ret = speakup_tty->ops->write(speakup_tty, &ch, 1); + if (ret == 0) + /* No room */ + return 0; + if (ret < 0) { + pr_warn("%s: I/O error, deactivating speakup\n", in_synth->long_name); + /* No synth any more, so nobody will
[patch 4/6] staging: speakup: migrate acntsa, bns, dummy and txprt to ttyio
This changes the above five synths to TTY-based comms. They were chosen as a first pass because their serial comms are straightforward, i.e. they don't use serial input and don't do internal port knocking. Signed-off-by: Okash Khawaja Reviewed-by: Samuel Thibault Index: linux-staging/drivers/staging/speakup/speakup_dummy.c === --- linux-staging.orig/drivers/staging/speakup/speakup_dummy.c +++ linux-staging/drivers/staging/speakup/speakup_dummy.c @@ -98,10 +98,10 @@ static struct spk_synth synth_dummy = { .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, - .io_ops = &spk_serial_io_ops, - .probe = spk_serial_synth_probe, - .release = spk_serial_release, - .synth_immediate = spk_serial_synth_immediate, + .io_ops = &spk_ttyio_ops, + .probe = spk_ttyio_synth_probe, + .release = spk_ttyio_release, + .synth_immediate = spk_ttyio_synth_immediate, .catch_up = spk_do_catch_up, .flush = spk_synth_flush, .is_alive = spk_synth_is_alive_restart, Index: linux-staging/drivers/staging/speakup/speakup_acntsa.c === --- linux-staging.orig/drivers/staging/speakup/speakup_acntsa.c +++ linux-staging/drivers/staging/speakup/speakup_acntsa.c @@ -99,10 +99,10 @@ static struct spk_synth synth_acntsa = { .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, - .io_ops = &spk_serial_io_ops, + .io_ops = &spk_ttyio_ops, .probe = synth_probe, - .release = spk_serial_release, - .synth_immediate = spk_serial_synth_immediate, + .release = spk_ttyio_release, + .synth_immediate = spk_ttyio_synth_immediate, .catch_up = spk_do_catch_up, .flush = spk_synth_flush, .is_alive = spk_synth_is_alive_restart, @@ -125,7 +125,7 @@ static int synth_probe(struct spk_synth { int failed; - failed = spk_serial_synth_probe(synth); + failed = spk_ttyio_synth_probe(synth); if (failed == 0) { synth->synth_immediate(synth, "\033=R\r"); mdelay(100); Index: linux-staging/drivers/staging/speakup/speakup_txprt.c === --- linux-staging.orig/drivers/staging/speakup/speakup_txprt.c +++ linux-staging/drivers/staging/speakup/speakup_txprt.c @@ -95,10 +95,10 @@ static struct spk_synth synth_txprt = { .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, - .io_ops = &spk_serial_io_ops, - .probe = spk_serial_synth_probe, - .release = spk_serial_release, - .synth_immediate = spk_serial_synth_immediate, + .io_ops = &spk_ttyio_ops, + .probe = spk_ttyio_synth_probe, + .release = spk_ttyio_release, + .synth_immediate = spk_ttyio_synth_immediate, .catch_up = spk_do_catch_up, .flush = spk_synth_flush, .is_alive = spk_synth_is_alive_restart, ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[patch 6/6] staging: speakup: migrate apollo, ltlk, audptr, decext, dectlk and spkout
This patch simply uses the changes introduced in previous patches and migrates apollo, ltlk, audptr, decext, spkout and dectlk. Migrations are straightforward function pointer updates. Signed-off by: Okash Khawaja Reviewed-by: Samuel Thibault Index: linux-staging/drivers/staging/speakup/speakup_apollo.c === --- linux-staging.orig/drivers/staging/speakup/speakup_apollo.c +++ linux-staging/drivers/staging/speakup/speakup_apollo.c @@ -22,9 +22,9 @@ #include #include #include +#include /* for UART_MCR* constants */ #include "spk_priv.h" -#include "serialio.h" #include "speakup.h" #define DRV_VERSION "2.21" @@ -108,10 +108,10 @@ static struct spk_synth synth_apollo = { .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, - .io_ops = &spk_serial_io_ops, - .probe = spk_serial_synth_probe, - .release = spk_serial_release, - .synth_immediate = spk_serial_synth_immediate, + .io_ops = &spk_ttyio_ops, + .probe = spk_ttyio_synth_probe, + .release = spk_ttyio_release, + .synth_immediate = spk_ttyio_synth_immediate, .catch_up = do_catch_up, .flush = spk_synth_flush, .is_alive = spk_synth_is_alive_restart, Index: linux-staging/drivers/staging/speakup/speakup_ltlk.c === --- linux-staging.orig/drivers/staging/speakup/speakup_ltlk.c +++ linux-staging/drivers/staging/speakup/speakup_ltlk.c @@ -20,7 +20,6 @@ */ #include "speakup.h" #include "spk_priv.h" -#include "serialio.h" #include "speakup_dtlk.h" /* local header file for LiteTalk values */ #define DRV_VERSION "2.11" @@ -111,10 +110,10 @@ static struct spk_synth synth_ltlk = { .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, - .io_ops = &spk_serial_io_ops, + .io_ops = &spk_ttyio_ops, .probe = synth_probe, - .release = spk_serial_release, - .synth_immediate = spk_serial_synth_immediate, + .release = spk_ttyio_release, + .synth_immediate = spk_ttyio_synth_immediate, .catch_up = spk_do_catch_up, .flush = spk_synth_flush, .is_alive = spk_synth_is_alive_restart, @@ -159,7 +158,7 @@ static int synth_probe(struct spk_synth { int failed = 0; - failed = spk_serial_synth_probe(synth); + failed = spk_ttyio_synth_probe(synth); if (failed == 0) synth_interrogate(synth); synth->alive = !failed; Index: linux-staging/drivers/staging/speakup/speakup_audptr.c === --- linux-staging.orig/drivers/staging/speakup/speakup_audptr.c +++ linux-staging/drivers/staging/speakup/speakup_audptr.c @@ -20,7 +20,6 @@ */ #include "spk_priv.h" #include "speakup.h" -#include "serialio.h" #define DRV_VERSION "2.11" #define SYNTH_CLEAR 0x18 /* flush synth buffer */ @@ -104,10 +103,10 @@ static struct spk_synth synth_audptr = { .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, - .io_ops = &spk_serial_io_ops, + .io_ops = &spk_ttyio_ops, .probe = synth_probe, - .release = spk_serial_release, - .synth_immediate = spk_serial_synth_immediate, + .release = spk_ttyio_release, + .synth_immediate = spk_ttyio_synth_immediate, .catch_up = spk_do_catch_up, .flush = synth_flush, .is_alive = spk_synth_is_alive_restart, @@ -154,7 +153,7 @@ static int synth_probe(struct spk_synth { int failed; - failed = spk_serial_synth_probe(synth); + failed = spk_ttyio_synth_probe(synth); if (failed == 0) synth_version(synth); synth->alive = !failed; Index: linux-staging/drivers/staging/speakup/speakup_decext.c === --- linux-staging.orig/drivers/staging/speakup/speakup_decext.c +++ linux-staging/drivers/staging/speakup/speakup_decext.c @@ -24,12 +24,12 @@ #include #include "spk_priv.h" -#include "serialio.h" #include "speakup.h" #define DRV_VERSION "2.14" #define SYNTH_CLEAR 0x03 #define PROCSPEECH 0x0b + static volatile unsigned char last_char; static void read_buff_add(u_char ch) @@ -123,10 +123,10 @@ static struct spk_synth synth_decext = { .startup = SYNTH_START, .checkval = SYNTH_CHECK, .vars = vars, - .io_ops = &spk_serial_io_ops, - .probe = spk_serial_synth_probe, - .release = spk_serial_release, - .synth_immediate = spk_serial_synth_immediate, + .io_ops = &spk_ttyio_ops, + .probe = spk_ttyio_synth_probe, + .release = spk_ttyio_release, + .synth_immediate = spk_ttyio_synth_immediate, .catch_up = do_catch_up, .flush = synth_flush, .is_alive = spk_synth_is_alive_restart, Index: linux-staging/drivers/staging/speakup/speakup_
[patch 2/6] tty: export tty_open_by_driver
This applies on top of the changes already in staging-next branch which allow kernel access to TTY dev. Signe-doff-by: Okash Khawaja Reviewed-by: Samuel Thibault Index: linux-staging/drivers/tty/tty_io.c === --- linux-staging.orig/drivers/tty/tty_io.c +++ linux-staging/drivers/tty/tty_io.c @@ -1369,7 +1369,10 @@ static struct tty_struct *tty_driver_loo struct tty_struct *tty; if (driver->ops->lookup) - tty = driver->ops->lookup(driver, file, idx); + if (!file) + tty = ERR_PTR(-EIO); + else + tty = driver->ops->lookup(driver, file, idx); else tty = driver->ttys[idx]; @@ -2001,7 +2004,7 @@ static struct tty_driver *tty_lookup_dri struct tty_driver *console_driver = console_device(index); if (console_driver) { driver = tty_driver_kref_get(console_driver); - if (driver) { + if (driver && filp) { /* Don't let /dev/console block */ filp->f_flags |= O_NONBLOCK; break; @@ -2034,7 +2037,7 @@ static struct tty_driver *tty_lookup_dri * - concurrent tty driver removal w/ lookup * - concurrent tty removal from driver table */ -static struct tty_struct *tty_open_by_driver(dev_t device, struct inode *inode, +struct tty_struct *tty_open_by_driver(dev_t device, struct inode *inode, struct file *filp) { struct tty_struct *tty; @@ -2079,6 +2082,7 @@ out: tty_driver_kref_put(driver); return tty; } +EXPORT_SYMBOL(tty_open_by_driver); /** * tty_open- open a tty device Index: linux-staging/include/linux/tty.h === --- linux-staging.orig/include/linux/tty.h +++ linux-staging/include/linux/tty.h @@ -401,6 +401,8 @@ extern struct tty_struct *get_current_tt /* tty_io.c */ extern int __init tty_init(void); extern const char *tty_name(const struct tty_struct *tty); +extern struct tty_struct *tty_open_by_driver(dev_t device, struct inode *inode, + struct file *filp); #else static inline void console_init(void) { } ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[patch 1/6] staging: speakup: make input functionality swappable
This moves functions which take input from external synth, into struct spk_io_ops. The calling code then uses serial implementation of those methods through spk_io_ops. That way we can add a parallel TTY-based implementation and simply replace serial with TTY. That is what the next patch in this series does. speakup_decext.c has get_last_char function which reads the most recent available character from the synth. This patch changes that by defining read_buff_add callback method of spk_syth and letting that update the last_char global character read from the synth. read_buff_add is called from ISR, so there is a possibility for last_char to be stale. Therefore it is marked as volatile. It also pulls a repeated get_index implementation into synth.c, to be used as a utility function. Signed-off-by: Okash Khawaja Reviewed-by: Samuel Thibault Index: linux-staging/drivers/staging/speakup/serialio.c === --- linux-staging.orig/drivers/staging/speakup/serialio.c +++ linux-staging/drivers/staging/speakup/serialio.c @@ -28,11 +28,15 @@ static int timeouts; static int spk_serial_out(struct spk_synth *in_synth, const char ch); static void spk_serial_send_xchar(char ch); static void spk_serial_tiocmset(unsigned int set, unsigned int clear); +static unsigned char spk_serial_in(void); +static unsigned char spk_serial_in_nowait(void); struct spk_io_ops spk_serial_io_ops = { .synth_out = spk_serial_out, .send_xchar = spk_serial_send_xchar, .tiocmset = spk_serial_tiocmset, + .synth_in = spk_serial_in, + .synth_in_nowait = spk_serial_in_nowait, }; EXPORT_SYMBOL_GPL(spk_serial_io_ops); @@ -240,7 +244,7 @@ int spk_wait_for_xmitr(struct spk_synth return 1; } -unsigned char spk_serial_in(void) +static unsigned char spk_serial_in(void) { int tmout = SPK_SERIAL_TIMEOUT; @@ -253,9 +257,8 @@ unsigned char spk_serial_in(void) } return inb_p(speakup_info.port_tts + UART_RX); } -EXPORT_SYMBOL_GPL(spk_serial_in); -unsigned char spk_serial_in_nowait(void) +static unsigned char spk_serial_in_nowait(void) { unsigned char lsr; @@ -264,7 +267,6 @@ unsigned char spk_serial_in_nowait(void) return 0; return inb_p(speakup_info.port_tts + UART_RX); } -EXPORT_SYMBOL_GPL(spk_serial_in_nowait); static int spk_serial_out(struct spk_synth *in_synth, const char ch) { Index: linux-staging/drivers/staging/speakup/speakup_audptr.c === --- linux-staging.orig/drivers/staging/speakup/speakup_audptr.c +++ linux-staging/drivers/staging/speakup/speakup_audptr.c @@ -138,11 +138,11 @@ static void synth_version(struct spk_syn char synth_id[40] = ""; synth->synth_immediate(synth, "\x05[Q]"); - synth_id[test] = spk_serial_in(); + synth_id[test] = synth->io_ops->synth_in(); if (synth_id[test] == 'A') { do { /* read version string from synth */ - synth_id[++test] = spk_serial_in(); + synth_id[++test] = synth->io_ops->synth_in(); } while (synth_id[test] != '\n' && test < 32); synth_id[++test] = 0x00; } Index: linux-staging/drivers/staging/speakup/speakup_dectlk.c === --- linux-staging.orig/drivers/staging/speakup/speakup_dectlk.c +++ linux-staging/drivers/staging/speakup/speakup_dectlk.c @@ -42,7 +42,7 @@ static inline int synth_full(void) static void do_catch_up(struct spk_synth *synth); static void synth_flush(struct spk_synth *synth); static void read_buff_add(u_char c); -static unsigned char get_index(void); +static unsigned char get_index(struct spk_synth *synth); static int in_escape; static int is_flushing; @@ -163,7 +163,7 @@ static int is_indnum(u_char *ch) static u_char lastind; -static unsigned char get_index(void) +static unsigned char get_index(struct spk_synth *synth) { u_char rv; Index: linux-staging/drivers/staging/speakup/spk_priv.h === --- linux-staging.orig/drivers/staging/speakup/spk_priv.h +++ linux-staging/drivers/staging/speakup/spk_priv.h @@ -43,8 +43,6 @@ const struct old_serial_port *spk_serial_init(int index); void spk_stop_serial_interrupt(void); int spk_wait_for_xmitr(struct spk_synth *in_synth); -unsigned char spk_serial_in(void); -unsigned char spk_serial_in_nowait(void); void spk_serial_release(void); void synth_buffer_skip_nonlatin1(void); @@ -61,6 +59,7 @@ int spk_serial_synth_probe(struct spk_sy const char *spk_serial_synth_immediate(struct spk_synth *synth, const char *buff); void spk_do_catch_up(struct spk_synth *synth); void spk_synth_flush(struct spk_synth *synth); +unsigned char spk_synth_get_index(struct spk_synth *synth); int spk_synth_is_alive_nop(struc
[patch 0/6] staging: speakup: migrate synths to use TTY-based comms
___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[patch 5/6] staging: speakup: add send_xchar, tiocmset and input functionality for tty
This patch adds further TTY-based functionality, specifically implementation of send_xchar and tiocmset methods, and input. send_xchar and tiocmset methods simply delegate to corresponding TTY operations. For input, it implements the receive_buf2 callback in tty_ldisc_ops of speakup's ldisc. If a synth defines read_buff_add method then receive_buf2 simply delegates to that and returns. For spk_ttyio_in, the data is passed from receive_buf2 thread to spk_ttyio_in thread through spk_ldisc_data structure. It has following members: - char buf: represents data received - struct semaphore sem: used to signal to spk_ttyio_in thread that data is available to be read without having to busy wait - bool buf_free: this is used in comination with mb() calls to syncronise the two threads over buf receive_buf2 only writes to buf if buf_free is true. The check for buf_free and writing to buf are separated by mb() to ensure that spk_ttyio_in has read buf before receive_buf2 writes to it. After writing, it ups the semaphore to signal to spk_ttyio_in that there is now data to read. spk_ttyio_in waits for data to read by downing the semaphore. Thus when signalled by receive_buf2 thread above, it reads from buf and sets buf_free to true. These two operations are separated by mb() to ensure that receive_buf2 thread finds buf_free to be true only after buf has been read. After that spk_ttyio_in calls tty_schedule_flip for subsequent data to come in through receive_buf2. Signed-off-by: Okash Khawaja Reviewed-by: Samuel Thibault Index: linux-staging/drivers/staging/speakup/spk_ttyio.c === --- linux-staging.orig/drivers/staging/speakup/spk_ttyio.c +++ linux-staging/drivers/staging/speakup/spk_ttyio.c @@ -1,36 +1,97 @@ #include #include +#include +#include #include "speakup.h" #include "spk_types.h" +#include "spk_priv.h" +struct spk_ldisc_data { + char buf; + struct semaphore sem; + bool buf_free; +}; + +static struct spk_synth *spk_ttyio_synth; static struct tty_struct *speakup_tty; static int spk_ttyio_ldisc_open(struct tty_struct *tty) { + struct spk_ldisc_data *ldisc_data; + if (tty->ops->write == NULL) return -EOPNOTSUPP; speakup_tty = tty; + ldisc_data = kmalloc(sizeof(struct spk_ldisc_data), GFP_KERNEL); + if (!ldisc_data) { + pr_err("speakup: Failed to allocate ldisc_data.\n"); + return -ENOMEM; + } + + sema_init(&ldisc_data->sem, 0); + ldisc_data->buf_free = true; + speakup_tty->disc_data = ldisc_data; + return 0; } static void spk_ttyio_ldisc_close(struct tty_struct *tty) { + kfree(speakup_tty->disc_data); speakup_tty = NULL; } +static int spk_ttyio_receive_buf2(struct tty_struct *tty, + const unsigned char *cp, char *fp, int count) +{ + struct spk_ldisc_data *ldisc_data = tty->disc_data; + + if (spk_ttyio_synth->read_buff_add) { + int i; + for (i = 0; i < count; i++) + spk_ttyio_synth->read_buff_add(cp[i]); + + return count; + } + + if (!ldisc_data->buf_free) + /* ttyio_in will tty_schedule_flip */ + return 0; + + /* Make sure the consumer has read buf before we have seen + * buf_free == true and overwrite buf */ + mb(); + + ldisc_data->buf = cp[0]; + ldisc_data->buf_free = false; + up(&ldisc_data->sem); + + return 1; +} + static struct tty_ldisc_ops spk_ttyio_ldisc_ops = { .owner = THIS_MODULE, .magic = TTY_LDISC_MAGIC, .name = "speakup_ldisc", .open = spk_ttyio_ldisc_open, .close = spk_ttyio_ldisc_close, + .receive_buf2 = spk_ttyio_receive_buf2, }; static int spk_ttyio_out(struct spk_synth *in_synth, const char ch); +static void spk_ttyio_send_xchar(char ch); +static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear); +static unsigned char spk_ttyio_in(void); +static unsigned char spk_ttyio_in_nowait(void); + struct spk_io_ops spk_ttyio_ops = { .synth_out = spk_ttyio_out, + .send_xchar = spk_ttyio_send_xchar, + .tiocmset = spk_ttyio_tiocmset, + .synth_in = spk_ttyio_in, + .synth_in_nowait = spk_ttyio_in_nowait, }; EXPORT_SYMBOL_GPL(spk_ttyio_ops); @@ -95,6 +156,51 @@ return 0; } +static void spk_ttyio_send_xchar(char ch) +{ + speakup_tty->ops->send_xchar(speakup_tty, ch); +} + +static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear) +{ + speakup_tty->ops->tiocmset(speakup_tty, set, clear); +} + +static unsigned char ttyio_in(int timeout) +{ + struct spk_ldisc_data *ldisc_data = speakup_tty->disc_data; + char rv; + + if (down_timeout(&ldisc_data->sem, usecs_to_jiffies(timeout)) == -ETIME) { +
Re: [patch 0/6] staging: speakup: migrate synths to use TTY-based comms
Hi, Forgot to add intro. Following is what I wanted to say: This patchset migrates all external synths from using raw serial i/o to using tty-based comms. The synths not migrated are internal ones - plugged directly into motherboard, communicating over ISA etc. It's important to note that these patches access TTY from inside kernel. Here is the summary of the patches in this set. Patch 1: Refactors to make input functionality swappable between serial i/o and tty. This is part of series of previous patches already submitted, which refactor the code in order to pave the way for actual migration to come. Patch 2: Exports tty_open_by_driver in order to allow the speakup to access it. Patch 3: Adds spk_ttyio.c, a container of TTY-based comms. Patch 4: Migrates some synths which use relatively simple comms - output only. Patch 5: Adds more TTY-based functionality that wasn't already added in patch 3. Patch 6: Migrates remaining external synths based. Thanks, Okash ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/8] Avoid CamelCases in ks7010 driver
This patchset fix CamelCases in ks7010 driver except michael_mic which will be replaced by kernel implementation in the future. Janusz Lisiecki (8): staging: ks7010: avoid CamelCase in fields of struct local_gain_t staging: ks7010: avoid CamelCase: receiveDTIMs staging: ks7010: avoid CamelCase: FhParms_t fields staging: ks7010: avoid CamelCase: link_ap_info_t fields staging: ks7010: avoid CamelCase: CfParms_t fields staging: ks7010: avoid CamelCase: atimWindow staging: ks7010: avoid CamelCase: reqIEs_size and respIEs_size staging: ks7010: avoid CamelCase: local variables in ks_hostif.c drivers/staging/ks7010/ks_hostif.c | 65 ++-- drivers/staging/ks7010/ks_hostif.h | 42 +++ drivers/staging/ks7010/ks_wlan.h | 8 ++--- drivers/staging/ks7010/ks_wlan_net.c | 20 +-- 4 files changed, 68 insertions(+), 67 deletions(-) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/8] staging: ks7010: avoid CamelCase: link_ap_info_t fields
Replace CamelCase struct field names with underscores to comply with the standard kernel coding style. Changed: - FhParms_t - DsParms_t - CfParms_t - IbssParms_t - ErpParams_t Signed-off-by: Janusz Lisiecki --- drivers/staging/ks7010/ks_hostif.h | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index ba0bd92..769dbe8 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -239,25 +239,25 @@ struct rate_set8_t { u8 rate_pad; } __packed; -struct FhParms_t { +struct fh_parms_t { u16 dwell_time; u8 hop_set; u8 hop_pattern; u8 hop_index; } __packed; -struct DsParms_t { +struct ds_parms_t { u8 channel; } __packed; -struct CfParms_t { +struct cf_parms_t { u8 count; u8 period; u16 maxDuration; u16 durRemaining; } __packed; -struct IbssParms_t { +struct ibss_parms_t { u16 atimWindow; } __packed; @@ -267,7 +267,7 @@ struct rsn_t { u8 body[RSN_BODY_SIZE]; } __packed; -struct ErpParams_t { +struct erp_params_t { u8 erp_info; } __packed; @@ -313,11 +313,11 @@ struct link_ap_info_t { u16 beacon_period; /* +10 */ u16 capability; /* +12 */ struct rate_set8_t rate_set;/* +14 */ - struct FhParms_t fh_parameter; /* +24 */ - struct DsParms_t ds_parameter; /* +29 */ - struct CfParms_t cf_parameter; /* +30 */ - struct IbssParms_t ibss_parameter; /* +36 */ - struct ErpParams_t erp_parameter; /* +38 */ + struct fh_parms_t fh_parameter; /* +24 */ + struct ds_parms_t ds_parameter; /* +29 */ + struct cf_parms_t cf_parameter; /* +30 */ + struct ibss_parms_t ibss_parameter; /* +36 */ + struct erp_params_t erp_parameter; /* +38 */ u8 pad1;/* +39 */ struct rate_set8_t ext_rate_set;/* +40 */ u8 DTIM_period; /* +50 */ -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/8] staging: ks7010: avoid CamelCase in fields of struct local_gain_t
Replace CamelCase fields of struct with underscores to comply with the standard kernel coding style Signed-off-by: Janusz Lisiecki --- drivers/staging/ks7010/ks_hostif.c | 6 +++--- drivers/staging/ks7010/ks_wlan.h | 8 drivers/staging/ks7010/ks_wlan_net.c | 20 ++-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 7151f16..1f8405e 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -566,9 +566,9 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv) break; case LOCAL_GAIN: memcpy(&priv->gain, priv->rxp, sizeof(priv->gain)); - DPRINTK(3, "TxMode=%d, RxMode=%d, TxGain=%d, RxGain=%d\n", - priv->gain.TxMode, priv->gain.RxMode, priv->gain.TxGain, - priv->gain.RxGain); + DPRINTK(3, "tx_mode=%d, rx_mode=%d, tx_gain=%d, rx_gain=%d\n", + priv->gain.tx_mode, priv->gain.rx_mode, + priv->gain.tx_gain, priv->gain.rx_gain); break; case LOCAL_EEPROM_SUM: memcpy(&priv->eeprom_sum, priv->rxp, sizeof(priv->eeprom_sum)); diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h index eb15db9..9a3b806 100644 --- a/drivers/staging/ks7010/ks_wlan.h +++ b/drivers/staging/ks7010/ks_wlan.h @@ -264,10 +264,10 @@ struct local_aplist_t { }; struct local_gain_t { - u8 TxMode; - u8 RxMode; - u8 TxGain; - u8 RxGain; + u8 tx_mode; + u8 rx_mode; + u8 tx_gain; + u8 rx_gain; }; struct local_eeprom_sum_t { diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index 0ef52c8..8c86d94 100644 --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -2428,14 +2428,14 @@ static int ks_wlan_set_tx_gain(struct net_device *dev, return -EPERM; /* for SLEEP MODE */ if (*uwrq >= 0 && *uwrq <= 0xFF)/* 0-255 */ - priv->gain.TxGain = (uint8_t)*uwrq; + priv->gain.tx_gain = (uint8_t)*uwrq; else return -EINVAL; - if (priv->gain.TxGain < 0xFF) - priv->gain.TxMode = 1; + if (priv->gain.tx_gain < 0xFF) + priv->gain.tx_mode = 1; else - priv->gain.TxMode = 0; + priv->gain.tx_mode = 0; hostif_sme_enqueue(priv, SME_SET_GAIN); return 0; @@ -2451,7 +2451,7 @@ static int ks_wlan_get_tx_gain(struct net_device *dev, if (priv->sleep_mode == SLP_SLEEP) return -EPERM; /* for SLEEP MODE */ - *uwrq = priv->gain.TxGain; + *uwrq = priv->gain.tx_gain; hostif_sme_enqueue(priv, SME_GET_GAIN); return 0; } @@ -2467,14 +2467,14 @@ static int ks_wlan_set_rx_gain(struct net_device *dev, return -EPERM; /* for SLEEP MODE */ if (*uwrq >= 0 && *uwrq <= 0xFF)/* 0-255 */ - priv->gain.RxGain = (uint8_t)*uwrq; + priv->gain.rx_gain = (uint8_t)*uwrq; else return -EINVAL; - if (priv->gain.RxGain < 0xFF) - priv->gain.RxMode = 1; + if (priv->gain.rx_gain < 0xFF) + priv->gain.rx_mode = 1; else - priv->gain.RxMode = 0; + priv->gain.rx_mode = 0; hostif_sme_enqueue(priv, SME_SET_GAIN); return 0; @@ -2490,7 +2490,7 @@ static int ks_wlan_get_rx_gain(struct net_device *dev, if (priv->sleep_mode == SLP_SLEEP) return -EPERM; /* for SLEEP MODE */ - *uwrq = priv->gain.RxGain; + *uwrq = priv->gain.rx_gain; hostif_sme_enqueue(priv, SME_GET_GAIN); return 0; } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 7/8] staging: ks7010: avoid CamelCase: reqIEs_size and respIEs_size
Replace CamelCase association_request_t and association_response_t struct field names with underscores to comply with the standard kernel coding style. Signed-off-by: Janusz Lisiecki --- drivers/staging/ks7010/ks_hostif.c | 10 +- drivers/staging/ks7010/ks_hostif.h | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 856f714..05436bb 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -947,18 +947,18 @@ void hostif_associate_indication(struct ks_wlan_private *priv) wrqu.data.length += sizeof(associnfo_leader0) - 1; pbuf += sizeof(associnfo_leader0) - 1; - for (i = 0; i < assoc_req->reqIEs_size; i++) + for (i = 0; i < assoc_req->req_ies_size; i++) pbuf += sprintf(pbuf, "%02x", *(pb + i)); - wrqu.data.length += (assoc_req->reqIEs_size) * 2; + wrqu.data.length += (assoc_req->req_ies_size) * 2; memcpy(pbuf, associnfo_leader1, sizeof(associnfo_leader1) - 1); wrqu.data.length += sizeof(associnfo_leader1) - 1; pbuf += sizeof(associnfo_leader1) - 1; - pb += assoc_req->reqIEs_size; - for (i = 0; i < assoc_resp->respIEs_size; i++) + pb += assoc_req->req_ies_size; + for (i = 0; i < assoc_resp->resp_ies_size; i++) pbuf += sprintf(pbuf, "%02x", *(pb + i)); - wrqu.data.length += (assoc_resp->respIEs_size) * 2; + wrqu.data.length += (assoc_resp->resp_ies_size) * 2; pbuf += sprintf(pbuf, ")"); wrqu.data.length += 1; diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index 27274d4..0e3a956 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -482,7 +482,7 @@ struct association_request_t { u16 capability; u16 listen_interval; u8 ap_address[6]; - u16 reqIEs_size; + u16 req_ies_size; } __packed; struct association_response_t { @@ -493,14 +493,14 @@ struct association_response_t { u16 capability; u16 status; u16 association_id; - u16 respIEs_size; + u16 resp_ies_size; } __packed; struct hostif_associate_indication_t { struct hostif_hdr header; struct association_request_t assoc_req; struct association_response_t assoc_resp; - /* followed by (reqIEs_size + respIEs_size) octets of data */ + /* followed by (req_ies_size + resp_ies_size) octets of data */ /* reqIEs data *//* respIEs data */ } __packed; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 8/8] staging: ks7010: avoid CamelCase: local variables in ks_hostif.c
Replace CamelCase local variables' name with underscores to comply with the standard kernel coding style. Changed: - LinkSpeed - TransmittedFrameCount - ReceivedFragmentCount - FailedCount - FCSErrorCount Signed-off-by: Janusz Lisiecki --- drivers/staging/ks7010/ks_hostif.c | 25 + 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 05436bb..8dec8ba 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -993,30 +993,31 @@ void hostif_phy_information_confirm(struct ks_wlan_private *priv) { struct iw_statistics *wstats = &priv->wstats; unsigned char rssi, signal, noise; - unsigned char LinkSpeed; - unsigned int TransmittedFrameCount, ReceivedFragmentCount; - unsigned int FailedCount, FCSErrorCount; + unsigned char link_speed; + unsigned int transmitted_frame_count, received_fragment_count; + unsigned int failed_count, fcs_error_count; DPRINTK(3, "\n"); rssi = get_BYTE(priv); signal = get_BYTE(priv); noise = get_BYTE(priv); - LinkSpeed = get_BYTE(priv); - TransmittedFrameCount = get_DWORD(priv); - ReceivedFragmentCount = get_DWORD(priv); - FailedCount = get_DWORD(priv); - FCSErrorCount = get_DWORD(priv); + link_speed = get_BYTE(priv); + transmitted_frame_count = get_DWORD(priv); + received_fragment_count = get_DWORD(priv); + failed_count = get_DWORD(priv); + fcs_error_count = get_DWORD(priv); DPRINTK(4, "phyinfo confirm rssi=%d signal=%d\n", rssi, signal); - priv->current_rate = (LinkSpeed & RATE_MASK); + priv->current_rate = (link_speed & RATE_MASK); wstats->qual.qual = signal; wstats->qual.level = 256 - rssi; wstats->qual.noise = 0; /* invalid noise value */ wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; - DPRINTK(3, "\nrssi=%u\nsignal=%u\nLinkSpeed=%ux500Kbps\n \ - TransmittedFrameCount=%u\nReceivedFragmentCount=%u\n FailedCount=%u\n \ - FCSErrorCount=%u\n", rssi, signal, LinkSpeed, TransmittedFrameCount, ReceivedFragmentCount, FailedCount, FCSErrorCount); + DPRINTK(3, "\nrssi=%u\nsignal=%u\nlink_speed=%ux500Kbps\n \ + transmitted_frame_count=%u\nreceived_fragment_count=%u\n failed_count=%u\n \ + fcs_error_count=%u\n", rssi, signal, link_speed, transmitted_frame_count, + received_fragment_count, failed_count, fcs_error_count); /* wake_up_interruptible_all(&priv->confirm_wait); */ complete(&priv->confirm_wait); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/8] staging: ks7010: avoid CamelCase: receiveDTIMs
Replace CamelCase variable name with underscores to comply with the standard kernel coding style. Signed-off-by: Janusz Lisiecki --- drivers/staging/ks7010/ks_hostif.c | 24 drivers/staging/ks7010/ks_hostif.h | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 1f8405e..856f714 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -1696,12 +1696,12 @@ void hostif_phy_information_request(struct ks_wlan_private *priv) static void hostif_power_mngmt_request(struct ks_wlan_private *priv, unsigned long mode, unsigned long wake_up, - unsigned long receiveDTIMs) + unsigned long receive_dtims) { struct hostif_power_mngmt_request_t *pp; - DPRINTK(3, "mode=%lu wake_up=%lu receiveDTIMs=%lu\n", mode, wake_up, - receiveDTIMs); + DPRINTK(3, "mode=%lu wake_up=%lu receive_dtims=%lu\n", mode, wake_up, + receive_dtims); /* make primitive */ pp = kmalloc(hif_align_size(sizeof(*pp)), KS_WLAN_MEM_FLAG); if (!pp) { @@ -1713,7 +1713,7 @@ void hostif_power_mngmt_request(struct ks_wlan_private *priv, pp->header.event = cpu_to_le16((uint16_t)HIF_POWERMGT_REQ); pp->mode = cpu_to_le32((uint32_t)mode); pp->wake_up = cpu_to_le32((uint32_t)wake_up); - pp->receiveDTIMs = cpu_to_le32((uint32_t)receiveDTIMs); + pp->receive_dtims = cpu_to_le32((uint32_t)receive_dtims); /* send to device request */ ps_confirm_wait_inc(priv); @@ -2270,44 +2270,44 @@ void hostif_sme_multicast_set(struct ks_wlan_private *priv) static void hostif_sme_powermgt_set(struct ks_wlan_private *priv) { - unsigned long mode, wake_up, receiveDTIMs; + unsigned long mode, wake_up, receive_dtims; DPRINTK(3, "\n"); switch (priv->reg.powermgt) { case POWMGT_ACTIVE_MODE: mode = POWER_ACTIVE; wake_up = 0; - receiveDTIMs = 0; + receive_dtims = 0; break; case POWMGT_SAVE1_MODE: if (priv->reg.operation_mode == MODE_INFRASTRUCTURE) { mode = POWER_SAVE; wake_up = 0; - receiveDTIMs = 0; + receive_dtims = 0; } else { mode = POWER_ACTIVE; wake_up = 0; - receiveDTIMs = 0; + receive_dtims = 0; } break; case POWMGT_SAVE2_MODE: if (priv->reg.operation_mode == MODE_INFRASTRUCTURE) { mode = POWER_SAVE; wake_up = 0; - receiveDTIMs = 1; + receive_dtims = 1; } else { mode = POWER_ACTIVE; wake_up = 0; - receiveDTIMs = 0; + receive_dtims = 0; } break; default: mode = POWER_ACTIVE; wake_up = 0; - receiveDTIMs = 0; + receive_dtims = 0; break; } - hostif_power_mngmt_request(priv, mode, wake_up, receiveDTIMs); + hostif_power_mngmt_request(priv, mode, wake_up, receive_dtims); } static diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index d773432..3e53a90 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -188,7 +188,7 @@ struct hostif_power_mngmt_request_t { u32 wake_up; #define SLEEP_FALSE 0 #define SLEEP_TRUE 1 /* not used */ - u32 receiveDTIMs; + u32 receive_dtims; #define DTIM_FALSE 0 #define DTIM_TRUE 1 } __packed; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/8] staging: ks7010: avoid CamelCase: CfParms_t fields
Replace CamelCase struct field names with underscores to comply with the standard kernel coding style. Changed: - maxDuration - durRemaining Signed-off-by: Janusz Lisiecki --- drivers/staging/ks7010/ks_hostif.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index 769dbe8..19a1489 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -253,8 +253,8 @@ struct ds_parms_t { struct cf_parms_t { u8 count; u8 period; - u16 maxDuration; - u16 durRemaining; + u16 max_duration; + u16 dur_remaining; } __packed; struct ibss_parms_t { -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 6/8] staging: ks7010: avoid CamelCase: atimWindow
Replace CamelCase variable name with underscores to comply with the standard kernel coding style. Signed-off-by: Janusz Lisiecki --- drivers/staging/ks7010/ks_hostif.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index 19a1489..27274d4 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -258,7 +258,7 @@ struct cf_parms_t { } __packed; struct ibss_parms_t { - u16 atimWindow; + u16 atim_window; } __packed; struct rsn_t { -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/8] staging: ks7010: avoid CamelCase: FhParms_t fields
Replace CamelCase struct field names with underscores to comply with the standard kernel coding style. Changed: - dwellTime - hopSet - hopPattern - hopIndex Signed-off-by: Janusz Lisiecki --- drivers/staging/ks7010/ks_hostif.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index 3e53a90..ba0bd92 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -240,10 +240,10 @@ struct rate_set8_t { } __packed; struct FhParms_t { - u16 dwellTime; - u8 hopSet; - u8 hopPattern; - u8 hopIndex; + u16 dwell_time; + u8 hop_set; + u8 hop_pattern; + u8 hop_index; } __packed; struct DsParms_t { -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V2] staging: atomisp: Add __printf validation and fix fallout
__printf validation adds format and argument validation. Fix the various broken format/argument mismatches. Signed-off-by: Joe Perches --- v2: bah, now without unrelated changes to other staging files... I'm not at all sure all the modifications are appropriate. Some maybe should use the original format types like %x instead of %p with *pointer instead of just pointer .../isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c | 6 +++--- .../isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c | 2 +- .../css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr.host.c | 2 +- .../css2400/runtime/debug/interface/ia_css_debug.h| 1 + .../atomisp2/css2400/runtime/debug/src/ia_css_debug.c | 6 +++--- .../media/atomisp/pci/atomisp2/css2400/sh_css.c | 19 ++- .../media/atomisp/pci/atomisp2/css2400/sh_css_mipi.c | 2 +- .../atomisp/pci/atomisp2/css2400/sh_css_params.c | 10 +- 8 files changed, 25 insertions(+), 23 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c index 0dde8425c67d..4c77e1463aaa 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c @@ -265,9 +265,9 @@ ia_css_translate_dvs_statistics( assert(isp_stats->hor_proj != NULL); assert(isp_stats->ver_proj != NULL); - IA_CSS_ENTER("hproj=%p, vproj=%p, haddr=%x, vaddr=%x", - host_stats->hor_proj, host_stats->ver_proj, - isp_stats->hor_proj, isp_stats->ver_proj); + IA_CSS_ENTER("hproj=%p, vproj=%p, haddr=%p, vaddr=%p", +host_stats->hor_proj, host_stats->ver_proj, +isp_stats->hor_proj, isp_stats->ver_proj); hor_num_isp = host_stats->grid.aligned_height; ver_num_isp = host_stats->grid.aligned_width; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c index 930061d48df7..5ac81f87bfa3 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c @@ -213,7 +213,7 @@ ia_css_translate_dvs2_statistics( "hor_coefs.even_real=%p, hor_coefs.even_imag=%p, " "ver_coefs.odd_real=%p, ver_coefs.odd_imag=%p, " "ver_coefs.even_real=%p, ver_coefs.even_imag=%p, " -"haddr=%x, vaddr=%x", +"haddr=%p, vaddr=%p", host_stats->hor_prod.odd_real, host_stats->hor_prod.odd_imag, host_stats->hor_prod.even_real, host_stats->hor_prod.even_imag, host_stats->ver_prod.odd_real, host_stats->ver_prod.odd_imag, diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr.host.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr.host.c index 804c19ab4485..222a7bd7f176 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr.host.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr.host.c @@ -55,7 +55,7 @@ ia_css_tnr_dump( "tnr_coef", tnr->coef); ia_css_debug_dtrace(level, "\t%-32s = %d\n", "tnr_threshold_Y", tnr->threshold_Y); - ia_css_debug_dtrace(level, "\t%-32s = %d\n" + ia_css_debug_dtrace(level, "\t%-32s = %d\n", "tnr_threshold_C", tnr->threshold_C); } diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/interface/ia_css_debug.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/interface/ia_css_debug.h index be7df3a30c21..91c105cc6204 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/interface/ia_css_debug.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/interface/ia_css_debug.h @@ -137,6 +137,7 @@ ia_css_debug_vdtrace(unsigned int level, const char *fmt, va_list args) sh_css_vprint(fmt, args); } +__printf(2, 3) extern void ia_css_debug_dtrace(unsigned int level, const char *fmt, ...); /*! @brief Dump sp thread's stack contents diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c index 030810bd0878..bcc0d464084f 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c +++ b/drivers/staging/media/atomisp/pci/atomis
Re: [PATCH] staging: fsl-mc/dpio: add cpu <--> LE conversion for dpaa2_fd
On Sat, Apr 29, 2017 at 05:18:04PM +, Horia Geantă wrote: > On 4/29/2017 7:32 PM, Stuart Yoder wrote: > > On Fri, Apr 28, 2017 at 9:38 AM, Horia Geantă wrote: > >> > >> While dpaa2_fd.simple structure fields are marked __leXX, > >> corresponding cpu_to_leXX / leXX_to_cpu conversions are missing. > >> > >> While here, fix dpaa2_fd_{get,set}_bpid such that BMT, IVP bits > >> sharing the 16-bit field with BPID are not affected. > > > > Please split this into 2 separate patches. Don't fix other misc things > > "while > > you are at it" in the same patch. > > > I thought that having 2 issues on the same line would allow for this > approach. > > Now that the patch is in staging-next, I am not sure what I am supposed > to do. It's non-rebase tree. Nothing to do. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel