Search Linux Wireless

Re: [PATCH 10/12] wifi: mwifiex: Use max() to improve code

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

 



在 2025/7/9 13:42, Jeff Chen 写道:
-     if (adapter->max_sta_conn > adapter->max_p2p_conn)
-             wiphy->max_ap_assoc_sta = adapter->max_sta_conn;
-     else
-             wiphy->max_ap_assoc_sta = adapter->max_p2p_conn;
+     wiphy->max_ap_assoc_sta = max(adapter->max_sta_conn,
+                                   adapter->max_p2p_conn);
adapter->max_sta_conn and adapter->max_p2p_conn are u8, and wiphy->max_ap_assoc_sta is u16.
To ensure type safety and maintainability, I recommend using max_t() with typeof():
wiphy->max_ap_assoc_sta = max_t(typeof(wiphy->max_ap_assoc_sta),
                                 adapter->max_sta_conn,
                                 adapter->max_p2p_conn);

Thanks for taking the time to reply.
I will try to do this in the next version.

Best regards,
Qianfeng





[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