All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Bitterblue Smith <rtl8821cerfe2@gmail.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
	Stefan Lippers-Hollmann <s.l-h@gmx.de>,
	Christian Hewitt <chewitt@libreelec.tv>
Subject: RE: [PATCH v5 4/6] wifi: rtlwifi: Move code from rtl8192de to rtl8192d-common
Date: Thu, 18 Apr 2024 00:42:58 +0000	[thread overview]
Message-ID: <36d691bf126d41fbbec3278918cd0498@realtek.com> (raw)
In-Reply-To: <c7015899-da29-4357-9bab-6d1f68e43420@gmail.com>

Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> 
> On 17/04/2024 07:04, Ping-Ke Shih wrote:
> > Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> >>
> 
> [...]
> 
> >> +static void _rtl92de_read_adapter_info(struct ieee80211_hw *hw)
> >> +{
> >> +       struct rtl_priv *rtlpriv = rtl_priv(hw);
> >> +       struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
> >> +       struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
> >> +       int params[] = {RTL8190_EEPROM_ID, EEPROM_VID, EEPROM_DID,
> >> +                       EEPROM_SVID, EEPROM_SMID, EEPROM_MAC_ADDR_MAC0_92D,
> >> +                       EEPROM_CHANNEL_PLAN, EEPROM_VERSION, EEPROM_CUSTOMER_ID,
> >> +                       COUNTRY_CODE_WORLD_WIDE_13};
> >> +       int i;
> >> +       u16 usvalue;
> >> +       u8 *hwinfo;
> >> +
> >> +       hwinfo = kzalloc(HWSET_MAX_SIZE, GFP_KERNEL);
> >> +       if (!hwinfo)
> >> +               return;
> >> +
> >> +       if (rtl_get_hwinfo(hw, rtlpriv, HWSET_MAX_SIZE, hwinfo, params))
> >> +               goto exit;
> >> +
> >> +       _rtl92de_efuse_update_chip_version(hw);
> >> +       _rtl92de_read_macphymode_and_bandtype(hw, hwinfo);
> >> +
> >> +       /* Read Permanent MAC address for 2nd interface */
> >> +       if (rtlhal->interfaceindex != 0) {
> >> +               for (i = 0; i < 6; i += 2) {
> >> +                       usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR_MAC1_92D + i];
> >> +                       *((u16 *)(&rtlefuse->dev_addr[i])) = usvalue;
> >
> > Copying u16 looks weird. I guess it would like to swap bytes (endian problem).
> > At least it should be '__le16' or '__be16' because hwinfo[] is from efuse.
> >
> 
> It is weird. rtl_get_hwinfo() in efuse.c does the same thing.
> 
> I don't think this code is swapping the bytes. What reason can
> it have to swap them anyway?
> 
> Maybe it's a (questionable) optimisation, only three copies
> instead of six.
> 

If that just want to copy address, we can use ether_addr_copy() instead.
I was afraid the order of efuse is different from dev_addr[], but look again.
The byte order seems the same, right?



  reply	other threads:[~2024-04-18  0:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-15 20:23 [PATCH v5 0/6] wifi: rtlwifi: Move common code from rtl8192de to rtl8192d-common Bitterblue Smith
2024-04-15 20:24 ` [PATCH v5 1/6] wifi: rtlwifi: rtl8192de: Fix 5 GHz TX power Bitterblue Smith
2024-04-15 20:24 ` [PATCH v5 2/6] wifi: rtlwifi: rtl8192de: Fix low speed with WPA3-SAE Bitterblue Smith
2024-04-15 20:26 ` [PATCH v5 3/6] wifi: rtlwifi: rtl8192de: Fix endianness issue in RX path Bitterblue Smith
2024-04-17  2:30   ` Ping-Ke Shih
2024-04-15 20:27 ` [PATCH v5 4/6] wifi: rtlwifi: Move code from rtl8192de to rtl8192d-common Bitterblue Smith
2024-04-17  4:04   ` Ping-Ke Shih
2024-04-17 16:43     ` Bitterblue Smith
2024-04-18  0:42       ` Ping-Ke Shih [this message]
2024-04-18 11:40         ` Bitterblue Smith
2024-04-15 20:29 ` [PATCH v5 5/6] wifi: rtlwifi: Clean up rtl8192d-common a bit Bitterblue Smith
2024-04-17  6:48   ` Ping-Ke Shih
2024-04-17 17:13     ` Bitterblue Smith
2024-04-18  0:49       ` Ping-Ke Shih
2024-04-18 12:22         ` Bitterblue Smith
2024-04-15 20:29 ` [PATCH v5 6/6] wifi: rtlwifi: Adjust rtl8192d-common for USB Bitterblue Smith
2024-04-17  7:33   ` Ping-Ke Shih
2024-04-17 17:29     ` Bitterblue Smith

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=36d691bf126d41fbbec3278918cd0498@realtek.com \
    --to=pkshih@realtek.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=chewitt@libreelec.tv \
    --cc=linux-wireless@vger.kernel.org \
    --cc=rtl8821cerfe2@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.