linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
To: Ping-Ke Shih <pkshih@realtek.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: "Larry.Finger@lwfinger.net" <Larry.Finger@lwfinger.net>,
	"s.l-h@gmx.de" <s.l-h@gmx.de>,
	"chewitt@libreelec.tv" <chewitt@libreelec.tv>
Subject: Re: [PATCH v3 02/12] wifi: rtlwifi: Move code from rtl8192de to rtl8192d-common
Date: Tue, 26 Mar 2024 15:02:08 +0200	[thread overview]
Message-ID: <cf330e75-8b5e-492e-a54a-5a7bbce687e2@gmail.com> (raw)
In-Reply-To: <04c3ea92c4456641f5dd7198db4906428f2610e3.camel@realtek.com>

On 22/03/2024 04:14, Ping-Ke Shih wrote:
[...]
>> +
>> +void rtl92d_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
>> +{
>> +       struct rtl_priv *rtlpriv = rtl_priv(hw);
>> +       struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
>> +
>> +       switch (variable) {
>> +       case HW_VAR_RF_STATE:
>> +               *((enum rf_pwrstate *)(val)) = ppsc->rfpwr_state;
> 
> The casting of these set/get_hw_reg looks not good. If you have good ideas
> to avoid them, welcome to adjust them afterward 
> 

My idea is more of a dream: to replace the get_hw_reg and set_hw_reg
functions with many small functions, one for each HW_VAR. Most of the
drivers have very similar code in these, so they could share.

> 
>> +               break;
>> +       case HW_VAR_FWLPS_RF_ON:{
>> +               enum rf_pwrstate rfstate;
>> +               u32 val_rcr;
>> +
>> +               rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RF_STATE,
>> +                                             (u8 *)(&rfstate));
>> +               if (rfstate == ERFOFF) {
>> +                       *((bool *)(val)) = true;
>> +               } else {
>> +                       val_rcr = rtl_read_dword(rtlpriv, REG_RCR);
>> +                       val_rcr &= 0x00070000;
>> +                       if (val_rcr)
>> +                               *((bool *)(val)) = false;
>> +                       else
>> +                               *((bool *)(val)) = true;
>> +               }
>> +               break;
>> +       }
>>
> 

  reply	other threads:[~2024-03-26 13:02 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 19:32 [PATCH v3 00/12] wifi: rtlwifi: Add new rtl8192du driver Bitterblue Smith
2024-03-20 19:33 ` [PATCH v3 01/12] wifi: rtlwifi: rtl8192de: Fix 5 GHz TX power Bitterblue Smith
2024-03-22  1:25   ` Ping-Ke Shih
2024-03-20 19:34 ` [PATCH v3 02/12] wifi: rtlwifi: Move code from rtl8192de to rtl8192d-common Bitterblue Smith
2024-03-22  2:14   ` Ping-Ke Shih
2024-03-26 13:02     ` Bitterblue Smith [this message]
2024-03-20 19:35 ` [PATCH v3 03/12] wifi: rtlwifi: Adjust rtl8192d-common for USB Bitterblue Smith
2024-03-22  3:41   ` Ping-Ke Shih
2024-03-20 19:36 ` [PATCH v3 04/12] wifi: rtlwifi: Add rtl8192du/table.{c,h} Bitterblue Smith
2024-03-22  3:46   ` Ping-Ke Shih
2024-03-26 17:30     ` Bitterblue Smith
2024-03-27  9:18       ` Kalle Valo
2024-03-27  9:30         ` Ping-Ke Shih
2024-03-27 12:36           ` Bitterblue Smith
2024-03-27 12:42             ` Ping-Ke Shih
2024-03-27 12:53             ` Kalle Valo
2024-03-27 16:34           ` Jeff Johnson
2024-03-20 19:37 ` [PATCH v3 05/12] wifi: rtlwifi: Add rtl8192du/hw.{c,h} Bitterblue Smith
2024-03-22  4:02   ` Ping-Ke Shih
2024-03-20 19:38 ` [PATCH v3 06/12] wifi: rtlwifi: Add rtl8192du/phy.{c,h} Bitterblue Smith
2024-03-22  5:22   ` Ping-Ke Shih
2024-03-26 22:13     ` Bitterblue Smith
2024-03-27  1:19       ` Ping-Ke Shih
2024-03-20 19:39 ` [PATCH v3 07/12] wifi: rtlwifi: Add rtl8192du/trx.{c,h} Bitterblue Smith
2024-03-22  5:32   ` Ping-Ke Shih
2024-03-20 19:40 ` [PATCH v3 08/12] wifi: rtlwifi: Add rtl8192du/rf.{c,h} Bitterblue Smith
2024-03-22  5:35   ` Ping-Ke Shih
2024-03-20 19:41 ` [PATCH v3 09/12] wifi: rtlwifi: Add rtl8192du/fw.{c,h} and rtl8192du/led.{c,h} Bitterblue Smith
2024-03-22  5:42   ` Ping-Ke Shih
2024-03-20 19:42 ` [PATCH v3 10/12] wifi: rtlwifi: Add rtl8192du/dm.{c,h} Bitterblue Smith
2024-03-22  5:48   ` Ping-Ke Shih
2024-03-20 19:43 ` [PATCH v3 11/12] wifi: rtlwifi: Add rtl8192du/sw.{c,h} Bitterblue Smith
2024-03-22  6:04   ` Ping-Ke Shih
2024-03-27 14:07     ` Bitterblue Smith
2024-03-27 18:48       ` Kalle Valo
2024-03-27 22:53         ` Bitterblue Smith
2024-03-28  1:46           ` Ping-Ke Shih
2024-03-28 13:31             ` Bitterblue Smith
2024-03-29  0:34               ` Ping-Ke Shih
2024-03-31 18:48                 ` Bitterblue Smith
2024-04-01  1:21                   ` Ping-Ke Shih
2024-04-07 12:03                     ` Bitterblue Smith
2024-04-08  2:45                       ` Ping-Ke Shih
2024-04-08  9:01                         ` Bitterblue Smith
2024-04-09  0:27                           ` Ping-Ke Shih
2024-04-09 11:16                             ` Bitterblue Smith
2024-03-28  1:49       ` Ping-Ke Shih
2024-03-20 19:44 ` [PATCH v3 12/12] wifi: rtlwifi: Enable the new rtl8192du driver Bitterblue Smith
2024-03-22  6:06   ` Ping-Ke Shih
2024-03-21  1:10 ` [PATCH v3 00/12] wifi: rtlwifi: Add " Stefan Lippers-Hollmann
2024-03-22  6:13 ` [PATCH v3 01/12] wifi: rtlwifi: rtl8192de: Fix 5 GHz TX power Ping-Ke Shih

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cf330e75-8b5e-492e-a54a-5a7bbce687e2@gmail.com \
    --to=rtl8821cerfe2@gmail.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=chewitt@libreelec.tv \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pkshih@realtek.com \
    --cc=s.l-h@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).