Search Linux Wireless

Re: [PATCH v9 04/14] rtw88: trx files

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

 



On 4/30/19 7:45 AM, Kalle Valo wrote:
I'm not really fond of these "byte macros" or whatever they should be
called, you use these a lot in rtw88 but I have seen the same usage also
other drivers. The upstream way of doing this is to create a struct,
which also acts as a documentation, and you can pass it around different
functions. And the GENMASK()s are defined close the struct.

Also you could change these defines to static inline functions, which
take the struct as a pointer, and that you get type checking from the
compiler. And that way you would get rid of that ugly casting as well.

Kalle,

I have never been a fan of those complicated macros dating back to the day that I had to make them endian correct. Without Sparse, I never would have made it.

I understand your comment about making them be static inline functions, but I am intrigued be the struct method. Is there something other than bit field constructions that could accomplish this? If not, then this method would be very difficult to implement. My basis is an E-mail by Linus that said it was almost impossible to get this type of construct to be endian correct. If he thinks it is difficult, then I know not to tackle it. :)

Larry







[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