From: Kalle Valo <kvalo@codeaurora.org>
To: Tony Chuang <yhchuang@realtek.com>
Cc: Brian Norris <briannorris@chromium.org>,
"johannes\@sipsolutions.net" <johannes@sipsolutions.net>,
"Larry.Finger\@lwfinger.net" <Larry.Finger@lwfinger.net>,
Pkshih <pkshih@realtek.com>, Andy Huang <tehuang@realtek.com>,
"sgruszka\@redhat.com" <sgruszka@redhat.com>,
"linux-wireless\@vger.kernel.org"
<linux-wireless@vger.kernel.org>
Subject: Re: [PATCH v4 09/13] rtw88: chip files
Date: Thu, 31 Jan 2019 13:52:28 +0200 [thread overview]
Message-ID: <87ef8tjb7n.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <F7CD281DE3E379468C6D07993EA72F84D179ABC2@RTITMBSVM04.realtek.com.tw> (Tony Chuang's message of "Thu, 31 Jan 2019 11:36:35 +0000")
Tony Chuang <yhchuang@realtek.com> writes:
>> From: Brian Norris [mailto:briannorris@chromium.org]
>>
>> > +static inline void
>> > +rtw_write32s_mask(struct rtw_dev *rtwdev, u32 addr, u32 mask, u32 data)
>> > +{
>> > + BUILD_BUG_ON(addr < 0xC00 || addr >= 0xD00);
>>
>> This seems to be a non-traditional use of BUILD_BUG_ON(). Normally, I
>> see this used for stuff that's guaranteed to be known at compile time --
>> structure offsets, constants, etc. This is usually (always?) a constant,
>> but it passes through a function parameter, so I'm not sure if that's
>> really guaranteed.
>>
>> Anyway...this is failing confusingly for me when I try to build:
>>
>> drivers/net/wireless/realtek/rtw88/rtw8822b.c: In function
>> ‘rtw_write32s_mask’:
>> drivers/net/wireless/realtek/rtw88/rtw8822b.c:230:176: error: call to
>> ‘__compiletime_assert_230’ declared with attribute error: BUILD_BUG_ON
>> failed: addr < 0xC00 || addr >= 0xD00
>> BUILD_BUG_ON(addr < 0xC00 || addr >= 0xD00);
>>
>> ^
>>
>> I tried to pinpoint which call yielded this, and I think once I deleted
>> enough calls to rtw_write32s_mask() it came down to this one:
>>
>> rtw_write32s_mask(rtwdev, REG_RFEINV, BIT(11) | BIT(10) | 0x3f,
>> 0x0);
>>
>> which doesn't really make sense, as that's a value of 0xcbc.
>>
>> What I really think it comes down to is that you can't guarantee
>> rtw_write32s_mask() will get inlined, and so BUILD_BUG_ON() may not know
>> what to do with it.
>
> Yeah, you're right. I think we should turn it into macro.
Does this really need to be a build time check? Like Brian said, this is
not really common use of BUILD_BUG_ON(). I would just change it to
WARN_ON_ONCE() or a ratelimited warning message so that we don't to have
an ugly macro.
--
Kalle Valo
next prev parent reply other threads:[~2019-01-31 11:52 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-30 4:02 [PATCH v4 00/13] rtw88: mac80211 driver for Realtek 802.11ac wireless network chips yhchuang
2019-01-30 4:02 ` [PATCH v4 01/13] rtw88: main files yhchuang
2019-01-30 16:21 ` Larry Finger
2019-01-31 2:54 ` Tony Chuang
2019-01-30 4:02 ` [PATCH v4 02/13] rtw88: core files yhchuang
2019-01-30 4:02 ` [PATCH v4 03/13] rtw88: hci files yhchuang
2019-01-31 22:36 ` Brian Norris
2019-02-12 6:18 ` Tony Chuang
2019-02-12 22:04 ` Brian Norris
2019-02-13 8:08 ` Tony Chuang
2019-02-13 11:08 ` Tony Chuang
2019-02-13 19:21 ` Brian Norris
2019-02-14 23:05 ` Grant Grundler
2019-02-20 11:19 ` Tony Chuang
2019-03-22 14:36 ` Brian Norris
2019-02-08 22:28 ` Brian Norris
2019-02-11 6:15 ` Tony Chuang
2019-02-09 2:14 ` Brian Norris
2019-02-11 5:48 ` Tony Chuang
2019-02-11 17:56 ` Brian Norris
2019-01-30 4:02 ` [PATCH v4 04/13] rtw88: trx files yhchuang
2019-01-30 4:02 ` [PATCH v4 05/13] rtw88: mac files yhchuang
2019-01-30 4:02 ` [PATCH v4 06/13] rtw88: fw and efuse files yhchuang
2019-01-31 22:58 ` Brian Norris
2019-02-12 9:14 ` Tony Chuang
2019-01-30 4:02 ` [PATCH v4 07/13] rtw88: phy files yhchuang
2019-01-30 4:02 ` [PATCH v4 08/13] rtw88: debug files yhchuang
2019-02-01 19:49 ` Brian Norris
2019-02-11 5:41 ` Tony Chuang
2019-01-30 4:02 ` [PATCH v4 09/13] rtw88: chip files yhchuang
2019-01-30 19:44 ` Brian Norris
2019-01-31 11:36 ` Tony Chuang
2019-01-31 11:52 ` Kalle Valo [this message]
2019-01-31 11:55 ` Johannes Berg
2019-01-31 13:40 ` Kalle Valo
2019-01-30 4:02 ` [PATCH v4 10/13] rtw88: 8822B init table yhchuang
2019-01-30 4:02 ` [PATCH v4 11/13] rtw88: 8822C " yhchuang
2019-01-30 4:02 ` [PATCH v4 12/13] rtw88: Kconfig & Makefile yhchuang
2019-01-30 4:02 ` [PATCH v4 13/13] rtw88: add MAINTAINERS entry yhchuang
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=87ef8tjb7n.fsf@kamboji.qca.qualcomm.com \
--to=kvalo@codeaurora.org \
--cc=Larry.Finger@lwfinger.net \
--cc=briannorris@chromium.org \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=pkshih@realtek.com \
--cc=sgruszka@redhat.com \
--cc=tehuang@realtek.com \
--cc=yhchuang@realtek.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).