lkml.org 
[lkml]   [2014]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 2/2] staging: rtl8723au:core
Date
Joe Perches <joe@perches.com> writes:
> On Mon, 2014-10-27 at 06:45 +0100, Jes Sorensen wrote:
>> Joe Perches <joe@perches.com> writes:
>> > On Sun, 2014-10-26 at 16:18 +0000, Paul McQuade wrote:
>> >> ERROR: spaces required around that ':' (ctx:VxE)
> []
>> >> diff --git a/drivers/staging/rtl8723au/core/rtw_ieee80211.c
>> >> b/drivers/staging/rtl8723au/core/rtw_ieee80211.c
> []
>> >> @@ -794,28 +794,28 @@ u16 rtw_mcs_rate23a(u8 rf_type, u8 bw_40MHz, u8 short_GI_20, u8 short_GI_40,
>> >>
>> >> if (rf_type == RF_1T1R) {
>> >> if (mcs->rx_mask[0] & BIT(7))
>> >> - max_rate = (bw_40MHz) ? ((short_GI_40)?1500:1350):
>> >> + max_rate = (bw_40MHz) ? ((short_GI_40)?1500:1350) :
> []
>> >
>> > A macro could help intelligibility here - maybe something like:
>> >
>> > #define get_max_rate(r1, r2, r3, r4) \
>> > (bw_40MHz ? (short_GI_40 ? r1 : r2) : (short_GI_20 ? r3 : r4))
>> > and:
>> > if (mcs->rx_mask[0] & BIT(7))
>> > max_rate = get_max_rate(1500, 1350, 722, 650);
>>
>> Hiding a parameter to a macro like that is bad coding practice, so don't
>> do that please!
>
> Yes and no.
>
> Adding the other 3 arguments to the macro doesn't help legibility.
>
> Keeping the macro definition local to the place that it's used
> can help avoid typos.

It's wrong, so just don't do it here!

Thank you,
Jes


\
 
 \ /
  Last update: 2014-10-27 07:41    [W:0.063 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site