All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rosen Penev <rosenp@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Dinh Nguyen <dinguyen@kernel.org>
Subject: [PATCH 1/2] firmware: stratix10-rsu: fix 32-bit compilation
Date: Mon, 10 Nov 2025 13:23:59 -0800	[thread overview]
Message-ID: <20251110212400.282952-2-rosenp@gmail.com> (raw)
In-Reply-To: <20251110212400.282952-1-rosenp@gmail.com>

The code uses long which is changes depending on CONFIG settings.
However, these longs should really be 64-bit. Fixes at least the
following errors:

drivers/firmware/stratix10-rsu.c: In function ‘rsu_get_spt_callback’:
drivers/firmware/stratix10-rsu.c:285:28: error: left shift count >=
width of type [-Werror=shift-count-overflow]
  285 |         priv->spt0_address <<= 32;
      |                            ^~~
drivers/firmware/stratix10-rsu.c:289:28: error: left shift count >=
width of type [-Werror=shift-count-overflow]
  289 |         priv->spt1_address <<= 32;
      |                            ^~~
In file included from <command-line>:
drivers/firmware/stratix10-rsu.c: In function ‘rsu_status_callback’:
././include/linux/compiler_types.h:597:45: error: call to
‘__compiletime_assert_377’ declared with attribute error: FIELD_GET:
type of reg too small for mask
  597 |         _compiletime_assert(condition, msg,
__compiletime_assert_, __COUNTER__)
      |                                             ^
././include/linux/compiler_types.h:578:25: note: in definition of
macro ‘__compiletime_assert’
  578 |                         prefix ## suffix();
         \
      |                         ^~~~~~
././include/linux/compiler_types.h:597:9: note: in expansion of macro
‘_compiletime_assert’
  597 |         _compiletime_assert(condition, msg,
__compiletime_assert_, __COUNTER__)
      |         ^~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:39:37: note: in expansion of macro
‘compiletime_assert’
   39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
      |                                     ^~~~~~~~~~~~~~~~~~
./include/linux/bitfield.h:72:17: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
   72 |                 BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask,
_mask) >     \
      |                 ^~~~~~~~~~~~~~~~
./include/linux/bitfield.h:155:17: note: in expansion of macro
‘__BF_FIELD_CHECK’
  155 |                 __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET:
");       \
      |                 ^~~~~~~~~~~~~~~~
drivers/firmware/stratix10-rsu.c:122:40: note: in expansion of macro ‘FIELD_GET’
  122 |                 priv->status.version = FIELD_GET(RSU_VERSION_MASK,
      |                                        ^~~~~~~~~

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/firmware/stratix10-rsu.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/firmware/stratix10-rsu.c b/drivers/firmware/stratix10-rsu.c
index 1ea39a0a76c7..2b8ad04679f7 100644
--- a/drivers/firmware/stratix10-rsu.c
+++ b/drivers/firmware/stratix10-rsu.c
@@ -97,8 +97,8 @@ struct stratix10_rsu_priv {
 	unsigned int retry_counter;
 	unsigned int max_retry;
 
-	unsigned long spt0_address;
-	unsigned long spt1_address;
+	u64	     spt0_address;
+	u64	     spt1_address;
 
 	unsigned int *get_spt_response_buf;
 };
@@ -120,14 +120,14 @@ static void rsu_status_callback(struct stratix10_svc_client *client,
 
 	if (data->status == BIT(SVC_STATUS_OK)) {
 		priv->status.version = FIELD_GET(RSU_VERSION_MASK,
-						 res->a2);
+						 (u64) res->a2);
 		priv->status.state = FIELD_GET(RSU_STATE_MASK, res->a2);
 		priv->status.fail_image = res->a1;
 		priv->status.current_image = res->a0;
 		priv->status.error_location =
 			FIELD_GET(RSU_ERROR_LOCATION_MASK, res->a3);
 		priv->status.error_details =
-			FIELD_GET(RSU_ERROR_DETAIL_MASK, res->a3);
+			FIELD_GET(RSU_ERROR_DETAIL_MASK, (u64) res->a3);
 	} else {
 		dev_err(client->dev, "COMMAND_RSU_STATUS returned 0x%lX\n",
 			res->a0);
@@ -632,7 +632,7 @@ static ssize_t spt0_address_show(struct device *dev,
 	if (priv->spt0_address == INVALID_SPT_ADDRESS)
 		return -EIO;
 
-	return scnprintf(buf, PAGE_SIZE, "0x%08lx\n", priv->spt0_address);
+	return scnprintf(buf, PAGE_SIZE, "0x%08llx\n", priv->spt0_address);
 }
 
 static ssize_t spt1_address_show(struct device *dev,
@@ -646,7 +646,7 @@ static ssize_t spt1_address_show(struct device *dev,
 	if (priv->spt1_address == INVALID_SPT_ADDRESS)
 		return -EIO;
 
-	return scnprintf(buf, PAGE_SIZE, "0x%08lx\n", priv->spt1_address);
+	return scnprintf(buf, PAGE_SIZE, "0x%08llx\n", priv->spt1_address);
 }
 
 static DEVICE_ATTR_RO(current_image);
-- 
2.51.2


  reply	other threads:[~2025-11-10 21:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-10 21:23 [PATCH 0/2] firmware: stratix10-rsu: add COMPILE_TEST support Rosen Penev
2025-11-10 21:23 ` Rosen Penev [this message]
2025-11-10 21:24 ` [PATCH 2/2] " Rosen Penev
2025-11-12  3:44   ` Dinh Nguyen
2025-11-12  6:20     ` Rosen Penev

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=20251110212400.282952-2-rosenp@gmail.com \
    --to=rosenp@gmail.com \
    --cc=dinguyen@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.