Search Linux Wireless

Re: [PATCH v5 4/6] wifi: rtlwifi: Move code from rtl8192de to rtl8192d-common

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

 



On 18/04/2024 03:42, Ping-Ke Shih wrote:
> Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> wrote:
>>
>> On 17/04/2024 07:04, Ping-Ke Shih wrote:
>>> Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> 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?
> 

Yes, the order is the same.




[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