Michael Straube [Sun, 15 Jan 2023 21:07:34 +0000 (22:07 +0100)]
staging: r8188eu: convert PHY_BBConfig8188E() to common error logic
Convert the function PHY_BBConfig8188E() away from returning _FAIL or
_SUCCESS which uses inverted error logic. Use the common error logic
instead. Return 0 for success and negative values for failure.
Michael Straube [Sun, 15 Jan 2023 21:07:33 +0000 (22:07 +0100)]
staging: r8188eu: convert phy_BB8188E_Config_ParaFile() to common error logic
Convert the fubction phy_BB8188E_Config_ParaFile() away from returning
_FAIL or _SUCCESS which uses inverted error logic. Use the common error
logic instead. Return 0 for success and negative values for failure.
Michael Straube [Sun, 15 Jan 2023 21:07:32 +0000 (22:07 +0100)]
staging: r8188eu: convert phy_RF6052_Config_ParaFile() to common error logic
Convert the function phy_RF6052_Config_ParaFile() away from returning
_FAIL or _SUCCESS which uses inverted error logic. Use the common error
logic instead. Return 0 for success and negative values for failure.
Michael Straube [Sun, 15 Jan 2023 21:07:31 +0000 (22:07 +0100)]
staging: r8188eu: convert PHY_MACConfig8188E() to common error logic
Convert the function PHY_MACConfig8188E() away from returning _FAIL or
_SUCCESS which uses inverted error logic. Use the common error logic
instead. Return 0 for success and negative values for failure.
Martin Kaiser [Wed, 11 Jan 2023 19:56:21 +0000 (20:56 +0100)]
staging: r8188eu: remove struct io_priv
struct io_priv has only one member (and a pointer to the enclosing struct
adapter). We can remove struct io_priv and move its member directly into
struct adapter.
Martin Kaiser [Tue, 10 Jan 2023 20:56:26 +0000 (21:56 +0100)]
staging: r8188eu: always process urb status
Remove the if clause in usb_write_port_complete and process the urb
status regardless of bSurpriseRemoved, bDriverStopped and
bWritePortCancel.
The only possible results of urb status processing are updates to
bSurpriseRemoved and bDriverStopped. All of the three status variable are
set to true only if the whole USB processing has to be stopped (when the
driver is unloaded or when the system goes to sleep).
It's no problem if one of the "stop everything" variables is already set
and the urb status processing sets another one.
This patch removes the last goto in usb_write_port_complete. It's also
part of the ongoing effort to limit the use of the "stop everything"
variables.
Michael Straube [Sun, 8 Jan 2023 12:38:04 +0000 (13:38 +0100)]
staging: r8188eu: convert rtw_writeN() to common error logic
Convert the function rtw_writeN() away from returning _FAIL or
_SUCCESS which uses inverted error logic. Use the common error logic
instead. Return 0 for success and negative values for failure.
Martin Kaiser [Fri, 30 Dec 2022 18:06:45 +0000 (19:06 +0100)]
staging: r8188eu: rtw_init_hwxmits is not needed
The _rtw_init_xmit_priv function calls rtw_alloc_hwxmits to allocate
memory for pxmitpriv->hwxmits (this is an array of struct hw_xmit). This
allocation uses kzalloc, the allocated memory is initialised with 0.
After the allocation, _rtw_init_xmit_priv calls rtw_init_hwxmits to set an
element of each hw_xmit to 0. This is not necessary, we can remove the
rtw_init_hwxmits call and the now unused function rtw_init_hwxmits.
There's no need to call rtw_free_xmitframe before we dequeue the first
frame. pxmitframe is always NULL at this point, rtw_free_xmitframe will do
nothing in this case.
Martin Kaiser [Fri, 30 Dec 2022 18:06:37 +0000 (19:06 +0100)]
staging: r8188eu: clean up qos_option setting
The qos_option variable in function rtw_make_wlanhdr should be a boolean
as it's set to true or false. We can directly set it to
pqospriv->qos_option instead of using a default value and if statements.
Martin Kaiser [Fri, 30 Dec 2022 18:06:35 +0000 (19:06 +0100)]
staging: r8188eu: simplify frame type check
Reorder the code in rtw_make_wlanhdr to make the function simpler.
There's a large if statement to check that we process only data frames.
Revert the condition and exit for non-data frames.
Martin Kaiser [Fri, 30 Dec 2022 18:06:34 +0000 (19:06 +0100)]
staging: r8188eu: remove duplicate psta check
We do not need the psta check in the while loop of rtw_xmitframe_coalesce.
psta is already checked near the start of the function and is not modified
afterwards.
Martin Kaiser [Fri, 30 Dec 2022 18:06:31 +0000 (19:06 +0100)]
staging: r8188eu: remove unused parameter
All callers of rtl8188eu_xmitframe_complete set the pxmitbuf parameter to
NULL, in which case rtl8188eu_xmitframe_complete allocates another
xmit_buf internally.
Remove the pxmitbuf parameter and resulting dead code.
Martin Kaiser [Fri, 30 Dec 2022 18:06:30 +0000 (19:06 +0100)]
staging: r8188eu: return immediately if we're not meant to encrypt
In function xmitframe_swencrypt, we can return immediately if our packet
needs no encryption. This is simpler than wrapping all the code into a
large if statement.
Martin Kaiser [Fri, 30 Dec 2022 18:06:27 +0000 (19:06 +0100)]
staging: r8188eu: make xmitframe_swencrypt a void function
xmitframe_swencrypt always returns _SUCCESS and the caller does not check
the return value. We can remove the return value and make
xmitframe_swencrypt a void function.
Martin Kaiser [Fri, 30 Dec 2022 17:53:23 +0000 (18:53 +0100)]
staging: r8188eu: merge on_action_public_vendor into its caller
Apart from declaring variables, on_action_public_vendor is only an if
statement. Merge this function into its only caller. This makes the code a
tiny bit smaller.
Xu Panda [Mon, 26 Dec 2022 11:05:47 +0000 (19:05 +0800)]
staging: r8188eu: use strscpy() to instead of strncpy()
The implementation of strscpy() is more robust and safer.
That's now the recommended way to copy NUL-terminated strings.
Signed-off-by: Xu Panda <xu.panda@zte.com.cn> Signed-off-by: Yang Yang <yang.yang29@zte.com> Reviewed-by: Dan Carpenter <error27@gmail.com> Link: https://lore.kernel.org/r/202212261905476729002@zte.com.cn Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Philipp Hortmann [Sun, 15 Jan 2023 20:21:14 +0000 (21:21 +0100)]
staging: rtl8192e: Rename EEPROMTxPower.., AutoloadF.. and SilentReset..
Rename variable SilentResetRxSlotIndex to silent_reset_rx_slot_index,
IC_Cut to ic_cut and Rf_Mode to rf_mode to avoid CamelCase which is not
accepted by checkpatch.
Philipp Hortmann [Sun, 15 Jan 2023 20:21:07 +0000 (21:21 +0100)]
staging: rtl8192e: Rename EEPROMTxPower.., AutoloadF.. and SilentReset..
Rename variable EEPROMTxPowerLevelCCK to eeprom_tx_pwr_level_cck,
AutoloadFailFlag to autoload_fail_flag and SilentResetRxStuckEvent to
silent_reset_rx_stuck_event to avoid CamelCase which is not accepted by
checkpatch.
Philipp Hortmann [Sun, 15 Jan 2023 20:20:58 +0000 (21:20 +0100)]
staging: rtl8192e: Rename EEPROMTherma.., EEPROMAntPw.. and EEPROMTxPow..
Rename variable EEPROMThermalMeter to eeprom_thermal_meter,
EEPROMAntPwDiff to eeprom_ant_pwr_diff and EEPROMTxPowerLevelOFDM24G to
eeprom_tx_pwr_level_ofdm24g to avoid CamelCase which is not accepted by
checkpatch.
Philipp Hortmann [Sun, 15 Jan 2023 20:20:48 +0000 (21:20 +0100)]
staging: rtl8192e: Rename CrystalCap, EEPROMLegacyHTT.. and EEPROMCrys..
Rename variable CrystalCap to crystal_cap, EEPROMLegacyHTTxPowerDiff to
eeprom_legacy_ht_tx_pwr_diff and EEPROMCrystalCap to eeprom_crystal_cap
to avoid CamelCase which is not accepted by checkpatch.
Philipp Hortmann [Sun, 15 Jan 2023 20:20:40 +0000 (21:20 +0100)]
staging: rtl8192e: Rename SetBWModeIn.., SwChnlInPro.. and ThermalMet..
Rename variable SetBWModeInProgress to set_bw_mode_in_progress,
SwChnlInProgress to sw_chnl_in_progress and ThermalMeter to thermal_meter
to avoid CamelCase which is not accepted by checkpatch.
Philipp Hortmann [Sun, 15 Jan 2023 20:20:32 +0000 (21:20 +0100)]
staging: rtl8192e: Rename bResetInPro.., framesyncMo.. and nCur40MhzPri..
Rename variable bResetInProgress to reset_in_progress, framesyncMonitor to
frame_sync_monitor and nCur40MhzPrimeSC to n_cur_40mhz_prime_sc to avoid
CamelCase which is not accepted by checkpatch.
Philipp Hortmann [Sun, 15 Jan 2023 20:20:18 +0000 (21:20 +0100)]
staging: rtl8192e: Rename rateCountDi.., ContinueDif.. and TxCounter
Rename variable rateCountDiffRecord to rate_count_diff_rec,
ContinueDiffCount to continue_diff_count and TxCounter to tx_counter to
avoid CamelCase which is not accepted by checkpatch.
Philipp Hortmann [Sun, 15 Jan 2023 20:20:10 +0000 (21:20 +0100)]
staging: rtl8192e: Rename Record_CCK_2.., Record_CCK_4.. and DefaultIn..
Rename variable Record_CCK_20Mindex to rec_cck_20m_idx,
Record_CCK_40Mindex to rec_cck_40m_idx and DefaultInitialGain to
def_initial_gain to avoid CamelCase which is not accepted by checkpatch.
Philipp Hortmann [Sun, 15 Jan 2023 20:19:56 +0000 (21:19 +0100)]
staging: rtl8192e: Rename bLastDTPFlag_Low, OFDM_index and CCK_index
Rename variable bLastDTPFlag_Low to last_dtp_flag_low, OFDM_index to
ofdm_index and CCK_index to cck_index to avoid CamelCase which is not
accepted by checkpatch.
Philipp Hortmann [Sun, 15 Jan 2023 20:19:31 +0000 (21:19 +0100)]
staging: rtl8192e: Rename bDynamicTxHig.., bDynamicTxL.. and bLastDTPF..
Rename variable bDynamicTxHighPower to dynamic_tx_high_pwr,
bDynamicTxLowPower to dynamic_tx_low_pwr and bLastDTPFlag_High to
last_dtp_flag_high to avoid CamelCase which is not accepted by checkpatch.
Philipp Hortmann [Mon, 9 Jan 2023 19:09:11 +0000 (20:09 +0100)]
staging: rtl8192e: Rename SetRFPowerSta.., RfReg0Value and bTXPowerDa..
Rename variable SetRFPowerStateInProgress to set_rf_pwr_state_in_progress,
RfReg0Value to rf_reg_0value and bTXPowerDataReadFromEEPORM to
tx_pwr_data_read_from_eeprom to avoid CamelCase which is not accepted by
checkpatch.
Philipp Hortmann [Mon, 9 Jan 2023 19:09:05 +0000 (20:09 +0100)]
staging: rtl8192e: Rename MCSTxPowerL.., LegacyHTTxPowe.. and AntennaTx..
Rename variable MCSTxPowerLevelOriginalOffset to
mcs_tx_pwr_level_org_offset, LegacyHTTxPowerDiff to legacy_ht_tx_pwr_diff
and AntennaTxPwDiff to antenna_tx_pwr_diff to avoid CamelCase which is not
accepted by checkpatch.
Philipp Hortmann [Mon, 9 Jan 2023 19:08:58 +0000 (20:08 +0100)]
staging: rtl8192e: Rename TxPowerLevelOFDM24G...
Rename variable TxPowerLevelOFDM24G to tx_pwr_level_ofdm_24g,
TxPowerLevelOFDM24G_A to tx_pwr_level_ofdm_24g_a and TxPowerLevelOFDM24G_C
to tx_pwr_level_ofdm_24g_c to avoid CamelCase which is not accepted by
checkpatch.
Philipp Hortmann [Mon, 9 Jan 2023 19:08:51 +0000 (20:08 +0100)]
staging: rtl8192e: Rename TxPowerLevelCCK...
Rename variable TxPowerLevelCCK to tx_pwr_level_cck, TxPowerLevelCCK_A to
tx_pwr_level_cck_a and TxPowerLevelCCK_C to tx_pwr_level_cck_c to avoid
CamelCase which is not accepted by checkpatch.
Philipp Hortmann [Mon, 9 Jan 2023 19:08:41 +0000 (20:08 +0100)]
staging: rtl8192e: Rename CCKPresentAtt...
Rename variable CCKPresentAttentuation_20Mdefault to
cck_present_attn_20m_def, CCKPresentAttentuation_40Mdefault to
cck_present_attn_40m_def and CCKPresentAttentuation_difference to
cck_present_attn_diff to avoid CamelCase which is not accepted by
checkpatch.
Philipp Hortmann [Mon, 9 Jan 2023 19:08:32 +0000 (20:08 +0100)]
staging: rtl8192e: Rename TSSI_13dBm, Pwr_Track and NumTotalRFPath
Rename variable TSSI_13dBm to tssi_13dBm, Pwr_Track to pwr_track and
NumTotalRFPath to num_total_rf_path to avoid CamelCase which is not
accepted by checkpatch.
Philipp Hortmann [Mon, 9 Jan 2023 19:08:24 +0000 (20:08 +0100)]
staging: rtl8192e: Rename ChannelPlan, eeprom_ChannelPlan and CckPwEnl
Rename variable ChannelPlan to chnl_plan, eeprom_ChannelPlan to
eeprom_chnl_plan and CckPwEnl to cck_pwr_enl to avoid CamelCase which is
not accepted by checkpatch.
Xu Panda [Mon, 26 Dec 2022 11:03:24 +0000 (19:03 +0800)]
staging: ks7010: use strscpy() to instead of strncpy()
The implementation of strscpy() is more robust and safer.
That's now the recommended way to copy NUL-terminated strings.
Signed-off-by: Xu Panda <xu.panda@zte.com.cn> Signed-off-by: Yang Yang <yang.yang29@zte.com> Reviewed-by: Dan Carpenter <error27@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/202212261903245548969@zte.com.cn Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Umang Jain [Fri, 23 Dec 2022 12:24:02 +0000 (17:54 +0530)]
staging: vc04_services: vchiq_arm: Drop VCHIQ_RETRY usage on disconnect
Drop the usage of VCHIQ_RETRY when the vchiq has connection status
VCHIQ_CONNSTATE_DISCONNECTED. Disconnected status will not be valid to
carry on a retry, hence replace the VCHIQ_RETRY with -ENOTCONN.
This patch removes the usage of vCHIQ_RETRY completely and act as
intermediatory to address the TODO item:
* Get rid of custom function return values
for vc04_services/interface.
Umang Jain [Fri, 23 Dec 2022 12:24:01 +0000 (17:54 +0530)]
staging: vc04_services: Drop VCHIQ_RETRY usage
Drop the usage of VCHIQ_RETRY vchiq_status enum type in most of the
places and replace it with -EAGAIN. The exception to this replacement
is vchiq_send_remote_use() and vchiq_send_remote_use_active() which will
be addressed in the subsequent commit.
This patch acts as intermediatory to address the TODO item:
* Get rid of custom function return values
for vc04_services/interface.
Umang Jain [Fri, 23 Dec 2022 12:24:00 +0000 (17:54 +0530)]
staging: vc04_services: Drop VCHIQ_ERROR usage
Drop the usage of VCHIQ_ERROR vchiq_status enum type. Replace it with
-EINVAL to report the error in most cases, -ENOMEM for out-of-memory
errors and -EHOSTDOWN for service shutdown.
This patch acts as intermediatory to address the TODO item:
* Get rid of custom function return values
for vc04_services/interface.
Umang Jain [Fri, 23 Dec 2022 12:23:58 +0000 (17:53 +0530)]
staging: vc04_services: Replace vchiq_status return type to int
Modify the functions' signature using enum vchiq_status to return int.
Currently, this patch only touches the function signatures and
in subsequent patches each vchiq_status enumerated value will be
replaced by a integer value.
This patch acts as an initial point to address the TODO item:
* Get rid of custom function return values
for vc04_services/interface.
Phil Elwell [Thu, 22 Dec 2022 14:15:53 +0000 (15:15 +0100)]
staging: vchiq_core: Add comments to remote event parts
struct remote_event and the related functions remote_event_*() provides
a higher function between ARM core and VPU. It's very helpful for a
reviewer to have explaining comments about these parts.
Deepak R Varma [Wed, 4 Jan 2023 15:18:38 +0000 (20:48 +0530)]
staging: greybus: Replace zero-length array by DECLARE_FLEX_ARRAY() helper
The code currently uses C90 standard extension based zero length array
struct which is now deprecated and the new C99 standard extension of
flexible array declarations are to be used instead. Also, the macro
DECLARE_FLEX_ARRAY() allows to use single flexible array member in a
structure. Refer to these links [1], [2], and [3] for details.