mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: btintel_pcie: fix 32-bit warning
@ 2025-02-27 13:21 Arnd Bergmann
  2025-02-27 15:01 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2025-02-27 13:21 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz, Kiran K, Vijay Satija
  Cc: Arnd Bergmann, Devegowda Chandrashekar, Tedd Ho-Jeong An,
	Philipp Stanner, linux-bluetooth, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The open-coded upper_32_bits() produces a warning when building
for 32-bit targets:

drivers/bluetooth/btintel_pcie.c: In function 'btintel_pcie_setup_dbgc':
drivers/bluetooth/btintel_pcie.c:142:72: error: right shift count >= width of type [-Werror=shift-count-overflow]
  142 |                 db_frag.bufs[i].buf_addr_msb = (u32)((buf->data_p_addr >> 32) & 0xffffffff);
      |                                                                        ^~

Use the provided upper/lower helpers instead.

Fixes: 3104ae5ad1b7 ("Bluetooth: btintel_pcie: Setup buffers for firmware traces")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/bluetooth/btintel_pcie.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index cecb926bce1c..e8307eeb971f 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -138,8 +138,8 @@ static int btintel_pcie_setup_dbgc(struct btintel_pcie_data *data)
 		buf = &data->dbgc.bufs[i];
 		buf->data_p_addr = data->dbgc.buf_p_addr + i * BTINTEL_PCIE_DBGC_BUFFER_SIZE;
 		buf->data = data->dbgc.buf_v_addr + i * BTINTEL_PCIE_DBGC_BUFFER_SIZE;
-		db_frag.bufs[i].buf_addr_lsb = (u32)(buf->data_p_addr & 0xffffffff);
-		db_frag.bufs[i].buf_addr_msb = (u32)((buf->data_p_addr >> 32) & 0xffffffff);
+		db_frag.bufs[i].buf_addr_lsb = lower_32_bits(buf->data_p_addr);
+		db_frag.bufs[i].buf_addr_msb = upper_32_bits(buf->data_p_addr);
 		db_frag.bufs[i].buf_size = BTINTEL_PCIE_DBGC_BUFFER_SIZE;
 	}
 
-- 
2.39.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Bluetooth: btintel_pcie: fix 32-bit warning
  2025-02-27 13:21 [PATCH] Bluetooth: btintel_pcie: fix 32-bit warning Arnd Bergmann
@ 2025-02-27 15:01 ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2025-02-27 15:01 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Marcel Holtmann, Kiran K, Vijay Satija, Arnd Bergmann,
	Devegowda Chandrashekar, Tedd Ho-Jeong An, Philipp Stanner,
	linux-bluetooth, linux-kernel

Hi Arnd,

On Thu, Feb 27, 2025 at 8:21 AM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> The open-coded upper_32_bits() produces a warning when building
> for 32-bit targets:
>
> drivers/bluetooth/btintel_pcie.c: In function 'btintel_pcie_setup_dbgc':
> drivers/bluetooth/btintel_pcie.c:142:72: error: right shift count >= width of type [-Werror=shift-count-overflow]
>   142 |                 db_frag.bufs[i].buf_addr_msb = (u32)((buf->data_p_addr >> 32) & 0xffffffff);
>       |                                                                        ^~
>
> Use the provided upper/lower helpers instead.
>
> Fixes: 3104ae5ad1b7 ("Bluetooth: btintel_pcie: Setup buffers for firmware traces")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/bluetooth/btintel_pcie.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
> index cecb926bce1c..e8307eeb971f 100644
> --- a/drivers/bluetooth/btintel_pcie.c
> +++ b/drivers/bluetooth/btintel_pcie.c
> @@ -138,8 +138,8 @@ static int btintel_pcie_setup_dbgc(struct btintel_pcie_data *data)
>                 buf = &data->dbgc.bufs[i];
>                 buf->data_p_addr = data->dbgc.buf_p_addr + i * BTINTEL_PCIE_DBGC_BUFFER_SIZE;
>                 buf->data = data->dbgc.buf_v_addr + i * BTINTEL_PCIE_DBGC_BUFFER_SIZE;
> -               db_frag.bufs[i].buf_addr_lsb = (u32)(buf->data_p_addr & 0xffffffff);
> -               db_frag.bufs[i].buf_addr_msb = (u32)((buf->data_p_addr >> 32) & 0xffffffff);
> +               db_frag.bufs[i].buf_addr_lsb = lower_32_bits(buf->data_p_addr);
> +               db_frag.bufs[i].buf_addr_msb = upper_32_bits(buf->data_p_addr);

Great, I was going to ask Kiran to fix these, btw we might just amend
the original change but I will keep your Signed-off-by.

>                 db_frag.bufs[i].buf_size = BTINTEL_PCIE_DBGC_BUFFER_SIZE;
>         }
>
> --
> 2.39.5
>


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-02-27 15:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-27 13:21 [PATCH] Bluetooth: btintel_pcie: fix 32-bit warning Arnd Bergmann
2025-02-27 15:01 ` Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®