From: Palmer Dabbelt <palmer@rivosinc.com>
To: linux-riscv@lists.infradead.org
Cc: ogabbay@kernel.org, Arnd Bergmann <arnd@arndb.de>,
Greg KH <gregkh@linuxfoundation.org>,
ynudelman@habana.ai, obitton@habana.ai, fkassabri@habana.ai,
daniel.vetter@ffwll.ch, ttayar@habana.ai, sozeri@habana.ai,
bjauhari@habana.ai, linux-kernel@vger.kernel.org,
Palmer Dabbelt <palmer@rivosinc.com>
Subject: [PATCH] habanalabs: Elide a warning on 32-bit targets
Date: Fri, 1 Apr 2022 09:39:09 -0700 [thread overview]
Message-ID: <20220401163909.20343-1-palmer@rivosinc.com> (raw)
From: Palmer Dabbelt <palmer@rivosinc.com>
This double-cast pattern looks a bit awkward, but it already exists
elsewhere in the driver. Without this patch I get
drivers/misc/habanalabs/common/memory.c: In function ‘alloc_device_memory’:
drivers/misc/habanalabs/common/memory.c:153:49: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
153 | (u64) gen_pool_dma_alloc_align(vm->dram_pg_pool,
| ^
which ends up promoted to a build error in my test setup.
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
---
I don't know anything about this driver, I'm just pattern-matching the
warning away.
---
drivers/misc/habanalabs/common/memory.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/misc/habanalabs/common/memory.c b/drivers/misc/habanalabs/common/memory.c
index e008d82e4ba3..f1fc79c1fc10 100644
--- a/drivers/misc/habanalabs/common/memory.c
+++ b/drivers/misc/habanalabs/common/memory.c
@@ -150,12 +150,12 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args,
for (i = 0 ; i < num_pgs ; i++) {
if (is_power_of_2(page_size))
phys_pg_pack->pages[i] =
- (u64) gen_pool_dma_alloc_align(vm->dram_pg_pool,
- page_size, NULL,
- page_size);
+ (u64) (uintptr_t) gen_pool_dma_alloc_align(vm->dram_pg_pool,
+ page_size, NULL,
+ page_size);
else
- phys_pg_pack->pages[i] = (u64) gen_pool_alloc(vm->dram_pg_pool,
- page_size);
+ phys_pg_pack->pages[i] = (u64) (uintptr_t) gen_pool_alloc(vm->dram_pg_pool,
+ page_size);
if (!phys_pg_pack->pages[i]) {
dev_err(hdev->dev,
"Failed to allocate device memory (out of memory)\n");
--
2.34.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next reply other threads:[~2022-04-01 16:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-01 16:39 Palmer Dabbelt [this message]
2022-04-01 18:13 ` [PATCH] habanalabs: Elide a warning on 32-bit targets Oded Gabbay
2022-04-01 18:36 ` Palmer Dabbelt
2022-04-04 15:02 ` Greg KH
2022-04-05 0:43 ` Palmer Dabbelt
2022-04-05 5:03 ` Greg KH
2022-04-02 7:49 ` Greg KH
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=20220401163909.20343-1-palmer@rivosinc.com \
--to=palmer@rivosinc.com \
--cc=arnd@arndb.de \
--cc=bjauhari@habana.ai \
--cc=daniel.vetter@ffwll.ch \
--cc=fkassabri@habana.ai \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=obitton@habana.ai \
--cc=ogabbay@kernel.org \
--cc=sozeri@habana.ai \
--cc=ttayar@habana.ai \
--cc=ynudelman@habana.ai \
/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