staging: rtl8192e: Use BIT() instead of << for bit field MSR_LINK_MASK
Use commonly used BIT() macro to define MSR_LINK_MASK. Equation is
not accepted by checkpatch because of missing spaces. Therefore line
needs to change anyhow.
Rename variable DM_RxPathSelTable to dm_rx_path_sel_table to avoid
CamelCase which is not accepted by checkpatch. Remove "extern struct
drx_path_sel DM_RxPathSelTable;" in rtl_dm.h as it is dead code.
staging: rtl8192e: Rename RateAdaptiveTH.., VeryLowRSSI and WAIotTHVal
Rename constants RateAdaptiveTH_Low_40M to RATE_ADAPTIVE_TH_LOW_40M,
VeryLowRSSI to VERY_LOW_RSSI and WAIotTHVal to WA_IOT_TH_VAL to avoid
CamelCase which is not accepted by checkpatch.
staging: rtl8192e: Rename RxPathSelectio.., RateAdaptive.. and RateAdap..
Rename constants RxPathSelection_diff_TH to RX_PATH_SEL_DIFF_TH,
RateAdaptiveTH_High to RATE_ADAPTIVE_TH_HIGH and RateAdaptiveTH_Low_20M
to RATE_ADAPTIVE_TH_LOW_20M to avoid CamelCase which is not accepted by
checkpatch.
staging: rtl8192e: Rename OFDM_Table.., CCK_Table_.. and RxPathSelecti..
Rename constants OFDM_Table_Length to OFDM_TABLE_LEN, CCK_Table_length to
CCK_TABLE_LEN and RxPathSelection_SS_TH_low to RX_PATH_SEL_SS_TH_LOW to
avoid CamelCase which is not accepted by checkpatch.
staging: rtl8192e: Remove blank lines in r8192E_hw.h, rtl_core.h and ..
Remove or add blank lines in r8192E_hw.h, rtl_core.h and rtl_dm.h so that
code fits to kernel coding style as shown by checkpatch. Remove one line
break after "}" to fit to kernel coding style.
staging: rtl8192e: Rename AcmHw_ViqEn, AcmHw_VoqEn and ANAPAR_FOR_8192PciE
Rename constants AcmHw_ViqEn to ACM_HW_VIQ_EN and AcmHw_VoqEn to
ACM_HW_VOQ_EN and ANAPAR_FOR_8192PciE to ANAPAR_FOR_8192PCIE to avoid
CamelCase which is not accepted by checkpatch.
Martin Kaiser [Tue, 7 Feb 2023 19:23:18 +0000 (20:23 +0100)]
staging: r8188eu: simplify rtw_get_ff_hwaddr
On both occassions where rtw_get_ff_hwaddr is called, the result is used
as addr parameter for rtw_write_port. rtw_write_port only needs the info
if the high queue was used or not. Simplify rtw_get_ff_hwaddr accordingly
and remove the now unused queue defines.
Martin Kaiser [Tue, 7 Feb 2023 19:23:17 +0000 (20:23 +0100)]
staging: r8188eu: simplify xmit_buf flags
rtw_write_port stores a queue index in pxmitbuf->flags before submitting
an urb. The urb completion function reads the flags. All it needs is the
info if the high queue was used or not.
We can replace the flags with a boolean high_queue variable.
Martin Kaiser [Tue, 7 Feb 2023 19:23:14 +0000 (20:23 +0100)]
staging: r8188eu: simplify rtw_alloc_xmitframe
Make the rtw_alloc_xmitframe function a bit simpler.
The container_of() call never returns NULL. The if (pxframe) check is
false only if pfree_xmit_queue is empty. Handle this special case
explicitly and save one level of indentation.
Martin Kaiser [Mon, 6 Feb 2023 21:01:24 +0000 (22:01 +0100)]
staging: r8188eu: remove change_rfpwrstate
Remove the change_rfpwrstate component in struct pwrctrl_priv.
change_rfpwrstate is set to rf_off directly before each ips_enter call and
then checked in ips_enter. This makes no sense.
change_rfpwrstate might have been used to avoid conflicts between
suspend and resume operations. If a driver has to do this at all,
pwrpriv->ps_processing will do this job.
Martin Kaiser [Mon, 6 Feb 2023 20:18:00 +0000 (21:18 +0100)]
staging: r8188eu: remove intf_stop pointer
Remove the intf_stop pointer that points to a media-specific stop
function. The r8188eu driver supports only usb.
For usb drivers, intf_stop points to usb_intf_stop, which is only
two lines long. We can remove intf_stop and usb_intf_stop and call
the two cancel functions directly.
The rtl8188eu_inirp_init returns 0 for success or a negative error code.
Handle this return value in the two places where rtl8188eu_inirp_init is
called.
Suggested-by: Pavel Skripkin <paskripkin@gmail.com> Signed-off-by: Martin Kaiser <martin@kaiser.cx> Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150 Link: https://lore.kernel.org/r/20230206201800.139195-6-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Martin Kaiser [Mon, 6 Feb 2023 20:17:58 +0000 (21:17 +0100)]
staging: r8188eu: remove intf_start pointer
Remove the intf_start pointer that points to a media-specific start
function (pci, usb, sdio, ...). The r8188eu driver supports only usb.
We could call usb_intf_start directly instead of going through the
function pointer. usb_intf_start is just a call to rtl8188eu_inirp_init so
we can directly replace the intf_start pointer with rtl8188eu_inirp_init.
Martin Kaiser [Mon, 6 Feb 2023 20:17:57 +0000 (21:17 +0100)]
staging: r8188eu: use standard error codes in rtl8188eu_inirp_init
Replace the driver-specific _SUCCESS and _FAIL error codes in
rtl8188eu_inirp_init. Return 0 for success or a negative error
code as we do elsewhere in the kernel.
Martin Kaiser [Mon, 6 Feb 2023 20:17:56 +0000 (21:17 +0100)]
staging: r8188eu: use standard error codes in rtw_read_port
Replace the driver-specific _SUCCESS and _FAIL error codes in
rtw_read_port. Return 0 for success or a negative error code as
we do elsewhere in the kernel.
Michael Straube [Sun, 5 Feb 2023 08:05:59 +0000 (09:05 +0100)]
staging: r8188eu: correct error logic of _rtw_init_recv_priv()
Convert the function _rtw_init_recv_priv() away from returning _FAIL
and _SUCCESS, which uses inverted error logic. Return 0 for success
and negative values for failure instead.
Michael Straube [Sun, 5 Feb 2023 08:05:58 +0000 (09:05 +0100)]
staging: r8188eu: correct error logic of rtl8188eu_init_recv_priv()
Convert the function rtl8188eu_init_recv_priv() away from returning
_FAIL and _SUCCESS, which uses inverted error logic. Return 0 for
success and negative values for failure instead.
staging: pi433: fix memory leak with using debugfs_lookup()
When calling debugfs_lookup() the result must have dput() called on it,
otherwise the memory will leak over time. To make things simpler, just
call debugfs_lookup_and_remove() instead which handles all of the logic
at once. This requires saving off the root directory dentry to make
creation of individual device subdirectories easier.
Cc: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com> Cc: Dan Carpenter <error27@gmail.com> Cc: Sidong Yang <realwakka@gmail.com> Cc: Liu Shixin <liushixin2@huawei.com> Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230202141138.2291946-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Martin Kaiser [Tue, 31 Jan 2023 09:00:57 +0000 (10:00 +0100)]
staging: r8188eu: clean up NULL check for rcu pointer
Clean up the NULL check for padapter->pnetdev->rx_handler_data.
The current code calls rcu_dereference while it holds the rcu read lock
and checks the pointer after releasing the lock. An rcu pointer may only be
used between calls to rcu_read_lock and rcu_read_unlock.
Replace the check with rcu_access_pointer. My understanding is that this
function returns the value of the pointer and needs no locking. We can
then check the pointer but we must not dereference it.
Martin Kaiser [Mon, 30 Jan 2023 19:52:59 +0000 (20:52 +0100)]
staging: r8188eu: use kernel helper to iterate over a list
rtw_free_xmitframe_list iterates over the list of xmit_frames and frees
each entry. We can use list_for_each_entry_safe instead of coding this
manually. We need the _safe version as the current pxmitframe will be
removed from the list by rtw_free_xmitframe.
Martin Kaiser [Mon, 30 Jan 2023 19:52:58 +0000 (20:52 +0100)]
staging: r8188eu: make sta_pending a list_head
We can now change sta_pending in struct tx_servq from __queue to
list_head. The driver defines __queue as list_head + spinlock, the
spinlock is not used for sta_pending.
Philipp Hortmann [Sun, 29 Jan 2023 14:59:05 +0000 (15:59 +0100)]
staging: rtl8192e: Rename TPPoll_CQ, AcmHwCtrl and AcmHw_BeqEn
Rename variable TPPoll_CQ to TP_POLL_CQ and AcmHwCtrl to ACM_HW_CTRL and
AcmHw_BeqEn to ACM_HW_BEQ_EN to avoid CamelCase which is not accepted by
checkpatch.
Philipp Hortmann [Sun, 29 Jan 2023 14:58:57 +0000 (15:58 +0100)]
staging: rtl8192e: Rename _RTL8192Pci_HW, MXDMA2_NoLimit and TPPoll
Rename enum _RTL8192Pci_HW to _RTL8192PCI_HW and variable MXDMA2_NoLimit
to MXDMA2_NO_LIMIT and TPPoll to TP_POLL to avoid CamelCase which is not
accepted by checkpatch.
Philipp Hortmann [Sun, 29 Jan 2023 14:58:43 +0000 (15:58 +0100)]
staging: rtl8192e: Remove unused constants in _RTL8192Pci_HW
Remove unused constants in and after _RTL8192Pci_HW of r8192E_hw.h. A
part of the constants would need to be renamed because of CamelCase on
others spaces are missing before and after "<<".
Philipp Hortmann [Sun, 29 Jan 2023 14:58:36 +0000 (15:58 +0100)]
staging: rtl8192e: Remove unused constants at beginning of r8192E_hw.h
Remove unused constants at beginning of r8192E_hw.h. A part of the
constants would need to be renamed because of CamelCase on others spaces
are missing before and after "<<".
Philipp Hortmann [Sun, 29 Jan 2023 14:58:30 +0000 (15:58 +0100)]
staging: rtl8192e: Rename BaseBand_Config_PHY_REG and BaseBand_Config_AGC_TAB
Rename constants BaseBand_Config_PHY_REG to BB_CONFIG_PHY_REG and
BaseBand_Config_AGC_TAB to BB_CONFIG_AGC_TAB to avoid CamelCase which is
not accepted by checkpatch.
Philipp Hortmann [Sun, 29 Jan 2023 14:58:14 +0000 (15:58 +0100)]
staging: rtl8192e: Remove unused variable rxSNRdB
rxSNRdB is initialized and set but never read. Remove dead code. Local
variable rx_snrX is then of no use. Remove rx_snrX as well. Local
variable tmp_rxsnr is then of no use. Remove tmp_rxsnr as well.
Philipp Hortmann [Sun, 29 Jan 2023 14:58:07 +0000 (15:58 +0100)]
staging: rtl8192e: Rename sCrcLng
Rename constant sCrcLng to S_CRC_LEN to avoid CamelCase which is not
accepted by checkpatch. Use S_CRC_LEN instead of fix value with comment
to improve readability.
Philipp Hortmann [Sun, 29 Jan 2023 14:57:59 +0000 (15:57 +0100)]
staging: rtl8192e: Rename TxBBGainTab.., CCKTxBBGainTab.. and RT_CID_81..
Rename constant TxBBGainTableLength to TX_BB_GAIN_TABLE_LEN,
CCKTxBBGainTableLength to CCK_TX_BB_GAIN_TABLE_LEN and
RT_CID_819x_Netcore to RT_CID_819X_NETCORE to avoid CamelCase which is
not accepted by checkpatch. Added spaces before and after "-" to fix
checkpatch message.
Philipp Hortmann [Wed, 25 Jan 2023 20:08:59 +0000 (21:08 +0100)]
staging: rtl8192e: Remove unused variables num_proc.., recei.. and rxov..
num_process_phyinfo, received_bwtype and rxoverflow are initialized and
increased but never read. Remove dead code. As a result prxsc is unused
which in result makes rxsc_sgien_exflg unused. Remove prxsc and
rxsc_sgien_exflg as well.
Philipp Hortmann [Wed, 25 Jan 2023 20:08:47 +0000 (21:08 +0100)]
staging: rtl8192e: Remove unused variables numpacket.. and received_pre..
numpacket_toself, numpacket_matchbssid and received_preamble_GI are
initialized and increased but never read. Remove dead code. As a result
the local variable preamble_guardinterval is unused. Remove it also.
Stefan Wahren [Mon, 23 Jan 2023 19:16:29 +0000 (20:16 +0100)]
staging: vchiq_arm: Improve error log for vchiq_platform_init
During sending the base address of the slots to the VideoCore
firmware via mailbox property, issues could happened on the ARM
and on the VideoCore side. So better separate the error handling
in order to provide more details. This should help to narrow
down the possible cause.
Martin Kaiser [Mon, 23 Jan 2023 20:53:37 +0000 (21:53 +0100)]
staging: r8188eu: use lists for hwxmits
struct hw_xmit's sta_list points to one of vo, vi, be or bk_pending in
struct xmit_priv. All of these are defined as struct __queue, which is a
list plus a spinlock.
For these components, the spinlock is unused, we need only the list.
This patch converts sta_list and vo, vi, be and bk_pending to struct
list_head.
Martin Kaiser [Mon, 23 Jan 2023 20:53:35 +0000 (21:53 +0100)]
staging: r8188eu: use list_head for xmitframe list
The r8188eu driver defines a struct __queue that contains a list_head and
a spinlock.
struct tx_servq describes a station for which we have pending tx packets.
This struct contains a __queue for the pending packets (a __queue of
struct xmit_frame entries). In this particular case, the queue's spinlock
is not used, we need only the list_head.
rtw_dequeue_xframe uses a local variable for such an xmit_frame queue.
This patch replaces this variable with a list_head.
Martin Kaiser [Mon, 23 Jan 2023 20:53:33 +0000 (21:53 +0100)]
staging: r8188eu: decrement qcnt in rtw_dequeue_xframe
rtw_dequeue_xframe calls dequeue_one_xmitframe and passes a struct
tx_servq. The only use for this parameter is to decrement its qcnt if an
xmit_frame could be extracted.
It makes more sense to remove the struct tx_servq parameter from
dequeue_one_xmitframe and decrement qcnt in the calling function when
dequeue_one_xmitframe returns success, i.e. when an xmit_frame was
extracted.
Martin Kaiser [Mon, 23 Jan 2023 20:53:31 +0000 (21:53 +0100)]
staging: r8188eu: remove redundant parameter
The rtl8188eu_xmitframe_complete function takes two parameters: adapter
and xmit_priv. xmit_priv is part of struct adapter, this parameter can be
removed.
Martin Kaiser [Mon, 23 Jan 2023 20:53:20 +0000 (21:53 +0100)]
staging: r8188eu: we use a constant number of hw_xmit entries
struct xmit_priv contains a pointer to an array of struct hw_xmit entries.
xmit_priv's (ill-named) hwxmit_entry component stores the size of this
array, i.e. the number of hw_xmit entries that are used.
The array size is constant, it's initialised to HWXMIT_ENTRY and never
updated. Simplify the code accordingly. Remove hwxmit_entry, do not pass
the array size as a function parameter and use HWXMIT_ENTRY in the code
that handles the array.
Umang Jain [Fri, 20 Jan 2023 20:11:03 +0000 (01:41 +0530)]
staging: vc04_services: interface: Drop include Makefile directive
Drop the include directive. They can break the build, when one only
wants to build a subdirectory. Replace with "../" for the includes,
in the interface/ files instead.
Umang Jain [Fri, 20 Jan 2023 20:11:02 +0000 (01:41 +0530)]
staging: vc04_services: vchiq-mmal: Drop include Makefile directive
Drop the include directive. They can break the build, when one only
wants to build a subdirectory. Replace with "../" for the includes,
in the mmal-vchiq.c instead.
Umang Jain [Fri, 20 Jan 2023 20:11:01 +0000 (01:41 +0530)]
staging: vc04_services: bcm2835-camera: Drop include Makefile directive
Drop the include directive. They can break the build, when one only
wants to build a subdirectory. Replace with "../" for the includes,
in the bcm2835-camera files instead.
Umang Jain [Fri, 20 Jan 2023 20:11:00 +0000 (01:41 +0530)]
staging: vc04_services: bcm2835-audio: Drop include Makefile directive
Drop the include directive. They can break the build, when one only
wants to build a subdirectory. Replace with "../" for the includes,
in the bcm2835.h instead.
Umang Jain [Fri, 20 Jan 2023 20:10:59 +0000 (01:40 +0530)]
staging: vc04_services: Drop __VCCOREVER__ remnants
Commit 8ba5f91bab63 ("staging: vc04_services: remove __VCCOREVER__")
was meant to remove all of __VCCOREVER__ definitions but missed to
remove a few. Hence, drop them now.
Philipp Hortmann [Sat, 21 Jan 2023 21:45:11 +0000 (22:45 +0100)]
staging: rtl8192e: Rename btxpower_trackin.., Slide_Beaco.. and Slide_B..
Rename variable btxpower_trackingInit to tx_pwr_tracking_init,
Slide_Beacon_pwdb to slide_beacon_pwdb and Slide_Beacon_Total to
slide_beacon_total to avoid CamelCase which is not accepted by
checkpatch.
Philipp Hortmann [Sat, 21 Jan 2023 21:44:59 +0000 (22:44 +0100)]
staging: rtl8192e: Rename eeprom_CustomerID, SwChnlStage and SwChnlStep
Rename variable eeprom_CustomerID to eeprom_customer_id, SwChnlStage to
sw_chnl_stage and SwChnlStep to sw_chnl_step to avoid CamelCase which is
not accepted by checkpatch.