From: Christoph Hellwig <hch@infradead.org>
To: Zong Li <zong@andestech.com>
Cc: palmer@sifive.com, aou@eecs.berkeley.edu,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
greentime@adnestech.com
Subject: Re: [PATCH 5/5] RISC-V: Use fixed width integer types for 32-bit compatible
Date: Wed, 20 Jun 2018 23:43:22 -0700 [thread overview]
Message-ID: <20180621064322.GE19319@infradead.org> (raw)
In-Reply-To: <37a6523947397cd72320676030b96926e373d05a.1529506497.git.zong@andestech.com>
On Thu, Jun 21, 2018 at 09:41:46AM +0800, Zong Li wrote:
> Use fixed width integer types for print format on 32/64 bit
> to fix warning about format compatible.
>
> Like inttypes.h, but more simpler for RISC-V usage.
>
> Signed-off-by: Zong Li <zong@andestech.com>
> ---
> arch/riscv/include/asm/format.h | 20 ++++++++++++++++++++
> arch/riscv/kernel/module.c | 13 +++++++------
> 2 files changed, 27 insertions(+), 6 deletions(-)
> create mode 100644 arch/riscv/include/asm/format.h
>
> diff --git a/arch/riscv/include/asm/format.h b/arch/riscv/include/asm/format.h
> new file mode 100644
> index 000000000000..9b68ca7fac46
> --- /dev/null
> +++ b/arch/riscv/include/asm/format.h
> @@ -0,0 +1,20 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/* Copyright (C) 2018 Andes Technology Corporation */
> +
> +#ifndef _ASM_RISCV_FORMAT_H
> +#define _ASM_RISCV_FORMAT_H
> +
> +#if __riscv_xlen == 64
> +#define __PRI_PREFIX "ll"
> +#else
> +#define __PRI_PREFIX
> +#endif
> +
> +#define PRIdX __PRI_PREFIX "d"
> +#define PRIiX __PRI_PREFIX "i"
> +#define PRIuX __PRI_PREFIX "u"
> +#define PRIoX __PRI_PREFIX "o"
> +#define PRIxX __PRI_PREFIX "x"
> +#define PRIXX __PRI_PREFIX "X"
> +
> +#endif /* _ASM_RISCV_FORMAT_H */
If you want these prefixed submit them to the core kernel, not
under asm/ for RISC-V.
>
> static int apply_r_riscv_32_rela(struct module *me, u32 *location, Elf_Addr v)
> {
> if (v != (u32)v) {
> - pr_err("%s: value %016llx out of range for 32-bit field\n",
> + pr_err("%s: value %016" PRIxX "out of range for 32-bit field\n",
> me->name, v);
> return -EINVAL;
But in general Linux uXX and sXX values are always the same underlying
fundamental C type. What is the mismatch here?
next prev parent reply other threads:[~2018-06-21 6:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-21 1:41 [PATCH 0/5] Building for 32-bit RISC-V kernel Zong Li
2018-06-21 1:41 ` [PATCH 1/5] RISC-V: Add conditional macro for zone of DMA32 Zong Li
2018-06-21 6:40 ` Christoph Hellwig
2018-06-21 7:06 ` Zong Li
2018-06-21 1:41 ` [PATCH] RISC-V: Add conditional marco for boot_sec_cpu Zong Li
2018-06-21 1:41 ` [PATCH 2/5] RISC-V: Select GENERIC_UCMPDI2 on RV32I Zong Li
2018-06-21 1:41 ` [PATCH 3/5] RISC-V: Add definiion of extract symbol's index and type for 32-bit Zong Li
2018-06-21 1:41 ` [PATCH 4/5] RISC-V: Change variable type for 32-bit compatible Zong Li
2018-06-21 6:41 ` Christoph Hellwig
2018-06-21 7:12 ` Zong Li
2018-06-21 15:19 ` Zong Li
2018-06-21 1:41 ` [PATCH 5/5] RISC-V: Use fixed width integer types " Zong Li
2018-06-21 6:43 ` Christoph Hellwig [this message]
2018-06-21 10:13 ` Zong Li
2018-06-21 10:21 ` Andreas Schwab
2018-06-21 14:53 ` Christoph Hellwig
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=20180621064322.GE19319@infradead.org \
--to=hch@infradead.org \
--cc=aou@eecs.berkeley.edu \
--cc=greentime@adnestech.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@sifive.com \
--cc=zong@andestech.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