From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
Arnd Bergmann <arnd@arndb.de>,
Naresh Kamboju <naresh.kamboju@linaro.org>,
Nathan Chancellor <nathan@kernel.org>,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
Stanley Chu <stanley.chu@mediatek.com>,
Avri Altman <avri.altman@wdc.com>, Bean Huo <beanhuo@micron.com>,
Asutosh Das <quic_asutoshd@quicinc.com>,
"Bao D. Nguyen" <quic_nguyenb@quicinc.com>,
Arthur Simchaev <Arthur.Simchaev@wdc.com>,
Can Guo <quic_cang@quicinc.com>
Subject: [PATCH v2] scsi: ufs: Fix the build for gcc 9 and before
Date: Tue, 1 Aug 2023 16:21:50 -0700 [thread overview]
Message-ID: <20230801232204.1481902-1-bvanassche@acm.org> (raw)
gcc compilers before version 10 cannot do constant-folding for sub-byte
bitfields. This makes the compiler layout tests fail. Hence skip the
layout checks for gcc 9 and before.
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Naresh Kamboju <naresh.kamboju@linaro.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/ufs/core/ufshcd.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 23335aaa6a66..4f5174735a4c 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -10564,6 +10564,14 @@ static const struct dev_pm_ops ufshcd_wl_pm_ops = {
static void ufshcd_check_header_layout(void)
{
+ /*
+ * gcc compilers before version 10 cannot do constant-folding for
+ * sub-byte bitfields. Hence skip the layout checks for gcc 9 and
+ * before.
+ */
+ if (IS_ENABLED(CONFIG_CC_IS_GCC) && CONFIG_GCC_VERSION < 100000)
+ return;
+
BUILD_BUG_ON(((u8 *)&(struct request_desc_header){
.cci = 3})[0] != 3);
next reply other threads:[~2023-08-01 23:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-01 23:21 Bart Van Assche [this message]
2023-08-02 6:47 ` [PATCH v2] scsi: ufs: Fix the build for gcc 9 and before Arnd Bergmann
2023-08-02 7:22 ` Naresh Kamboju
2023-08-08 1:12 ` Martin K. Petersen
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=20230801232204.1481902-1-bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=Arthur.Simchaev@wdc.com \
--cc=arnd@arndb.de \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=jejb@linux.ibm.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=naresh.kamboju@linaro.org \
--cc=nathan@kernel.org \
--cc=quic_asutoshd@quicinc.com \
--cc=quic_cang@quicinc.com \
--cc=quic_nguyenb@quicinc.com \
--cc=stanley.chu@mediatek.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