Search Linux Wireless

Re: [PATCH v3 03/12] wifi: rtlwifi: Adjust rtl8192d-common for USB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2024-03-20 at 21:35 +0200, Bitterblue Smith wrote:
> 
> A few of the shared functions need small changes for the USB driver.
> 
> Also, add a few macros to wifi.h and initialise rtlhal.interfaceindex
> for USB devices.
> 
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx>
> ---
> v3:
>  - Silence sparse warnings about locks in phy_common.c by using helper
>    functions _rtl92d_pci_lock() and _rtl92d_pci_unlock().

checkpatch.pl warns this, so please move them to phy_common.h.

WARNING: externs should be avoided in .c files
#243: FILE: drivers/net/wireless/realtek/rtlwifi/rtl8192d/phy_common.c:100:
+void _rtl92d_pci_unlock(struct rtl_priv *rtlpriv);


> @@ -858,7 +876,7 @@ static void rtl92de_update_hal_rate_mask(struct ieee80211_hw *hw,
>                                                         1 : 0;
>         enum wireless_mode wirelessmode = 0;
>         bool shortgi = false;
> -       u32 value[2];
> +       struct rtl92d_rate_mask_h2c rate_mask;

Keep reverse X'mas as possible as you can. 
I mean don't need to touch others, but still keep this new declaration in 
reverse X'mas order.

>         u8 macid = 0;
>         u8 mimo_ps = IEEE80211_SMPS_OFF;
> 
> @@ -966,12 +984,20 @@ static void rtl92de_update_hal_rate_mask(struct ieee80211_hw *hw,
>                 break;
>         }
> 
> -       value[0] = (ratr_bitmap & 0x0fffffff) | (ratr_index << 28);
> -       value[1] = macid | (shortgi ? 0x20 : 0x00) | 0x80;
> +       le32p_replace_bits(&rate_mask.rate_mask_and_raid, ratr_bitmap, RATE_MASK_MASK);
> +       le32p_replace_bits(&rate_mask.rate_mask_and_raid, ratr_index, RAID_MASK);
> +       u8p_replace_bits(&rate_mask.macid_and_short_gi, macid, MACID_MASK);
> +       u8p_replace_bits(&rate_mask.macid_and_short_gi, shortgi, SHORT_GI_MASK);
> +       u8p_replace_bits(&rate_mask.macid_and_short_gi, 1, BIT(7));

Good, that looks much beautiful. :)


> diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192d/phy_common.c
> b/drivers/net/wireless/realtek/rtlwifi/rtl8192d/phy_common.c
> index f7265712b9c2..e0e4917f8e1e 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192d/phy_common.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192d/phy_common.c
> @@ -81,6 +81,24 @@ static void _rtl92d_phy_rf_serial_write(struct ieee80211_hw *hw,
>                 rfpath, pphyreg->rf3wire_offset, data_and_addr);
>  }
> 
> +/* Without these helpers and the declarations sparse warns about
> + * context imbalance.
> + */
> +static inline void _rtl92d_pci_lock(struct rtl_priv *rtlpriv)
> +{
> +       if (rtlpriv->rtlhal.interface == INTF_PCI)
> +               spin_lock(&rtlpriv->locks.rf_lock);
> +}
> +
> +static inline void _rtl92d_pci_unlock(struct rtl_priv *rtlpriv)
> +{
> +       if (rtlpriv->rtlhal.interface == INTF_PCI)
> +               spin_unlock(&rtlpriv->locks.rf_lock);
> +}
> +
> +void _rtl92d_pci_lock(struct rtl_priv *rtlpriv);
> +void _rtl92d_pci_unlock(struct rtl_priv *rtlpriv);

As mentioned above, please move these to .h file.






[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux