All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhao Liu <zhao1.liu@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, tanishdesai37@gmail.com,
	stefanha@redhat.com, berrange@redhat.com, mads@ynddal.dk
Subject: Re: [PATCH 01/14] treewide: write "unsigned long int" instead of "long unsigned int"
Date: Mon, 25 Aug 2025 15:24:01 +0800	[thread overview]
Message-ID: <aKwPkXzi67+UGAnP@intel.com> (raw)
In-Reply-To: <20250822122655.1353197-2-pbonzini@redhat.com>

On Fri, Aug 22, 2025 at 02:26:42PM +0200, Paolo Bonzini wrote:
> Date: Fri, 22 Aug 2025 14:26:42 +0200
> From: Paolo Bonzini <pbonzini@redhat.com>
> Subject: [PATCH 01/14] treewide: write "unsigned long int" instead of "long
>  unsigned int"
> X-Mailer: git-send-email 2.50.1
> 
> Putting "unsigned" in anything but the first position is weird.

I think one reason may be gcc uses something like ‘long unsigned int *‘
by default?

../hw/misc/imx7_src.c: In function ‘imx7_src_write’:
../hw/misc/imx7_src.c:218:42: error: passing argument 2 of ‘clear_bit’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  218 |             clear_bit(R_CORE1_RST_SHIFT, &change_mask);
      |                                          ^~~~~~~~~~~~
      |                                          |
      |                                          uint32_t * {aka unsigned int *}
In file included from /media/liuzhao/data/qemu-cook/include/qemu/bitmap.h:16,
                 from /media/liuzhao/data/qemu-cook/include/hw/qdev-core.h:6,
                 from /media/liuzhao/data/qemu-cook/include/hw/sysbus.h:6,
                 from /media/liuzhao/data/qemu-cook/include/hw/misc/imx7_src.h:13,
                 from ../hw/misc/imx7_src.c:12:
/qemu/include/qemu/bitops.h:93:54: note: expected ‘long unsigned int *’ but argument is of type ‘uint32_t *’ {aka ‘unsigned int *’}
   93 | static inline void clear_bit(long nr, unsigned long *addr)
      |                                       ~~~~~~~~~~~~~~~^~~~
cc1: all warnings being treated as errors

> As such,
> tracetool's Rust type conversion will not support it.  Remove it from
> the whole of QEMU's source code, not just trace-events.

But I also agree it's a good idea to clean this up.

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  crypto/pbkdf-gcrypt.c        | 2 +-
>  crypto/pbkdf-gnutls.c        | 2 +-
>  crypto/pbkdf-nettle.c        | 2 +-
>  hw/display/exynos4210_fimd.c | 2 +-
>  hw/misc/imx7_src.c           | 4 ++--
>  hw/net/can/can_sja1000.c     | 4 ++--
>  hw/xen/trace-events          | 4 ++--
>  7 files changed, 10 insertions(+), 10 deletions(-)

...

> diff --git a/hw/misc/imx7_src.c b/hw/misc/imx7_src.c
> index df0b0a69057..817c95bf65b 100644
> --- a/hw/misc/imx7_src.c
> +++ b/hw/misc/imx7_src.c
> @@ -169,7 +169,7 @@ static void imx7_src_write(void *opaque, hwaddr offset, uint64_t value,
>  {
>      IMX7SRCState *s = (IMX7SRCState *)opaque;
>      uint32_t index = offset >> 2;
> -    long unsigned int change_mask;
> +    uint32_t change_mask;

We needs "unsigned long", otherwise, there'll be the error as I listed
above.

>      uint32_t current_value = value;
>  
>      if (index >= SRC_MAX) {

...

> diff --git a/hw/net/can/can_sja1000.c b/hw/net/can/can_sja1000.c
> index 5b6ba9df6c4..545c520c3b4 100644
> --- a/hw/net/can/can_sja1000.c
> +++ b/hw/net/can/can_sja1000.c
> @@ -750,8 +750,8 @@ uint64_t can_sja_mem_read(CanSJA1000State *s, hwaddr addr, unsigned size)
>              break;
>          }
>      }
> -    DPRINTF("read addr 0x%02x, %d bytes, content 0x%02lx\n",
> -            (int)addr, size, (long unsigned int)temp);

tmep is "uint64_t", so there's no need to convert its type?

We can just drop `(long unsigned int)` directly.

> +    DPRINTF("read addr 0x%02x, %d bytes, content 0x%02x\n",
> +            (int)addr, size, (unsigned)temp);
>      return temp;
>  }

Others look fine to me. With the nits fixed,

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>



  parent reply	other threads:[~2025-08-25  7:03 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-22 12:26 [RFC PATCH 00/14] tracetool: add Rust support Paolo Bonzini
2025-08-22 12:26 ` [PATCH 01/14] treewide: write "unsigned long int" instead of "long unsigned int" Paolo Bonzini
2025-08-25  6:40   ` Manos Pitsidianakis
2025-08-25  9:18     ` Paolo Bonzini
2025-08-25  7:24   ` Zhao Liu [this message]
2025-08-26 11:15     ` Daniel P. Berrangé
2025-08-26 11:33       ` Peter Maydell
2025-08-22 12:26 ` [PATCH 02/14] rust: move dependencies to rust/Cargo.toml Paolo Bonzini
2025-08-25  7:04   ` Manos Pitsidianakis
2025-08-25  7:24   ` Zhao Liu
2025-08-27 19:12   ` Stefan Hajnoczi
2025-08-22 12:26 ` [PATCH 03/14] trace/ftrace: move snprintf+write from tracepoints to ftrace.c Paolo Bonzini
2025-08-25  7:09   ` Manos Pitsidianakis
2025-08-25  9:00   ` Zhao Liu
2025-08-26 11:40   ` Daniel P. Berrangé
2025-08-26 11:45     ` Peter Maydell
2025-08-26 11:58       ` Daniel P. Berrangé
2025-08-27 19:12   ` Stefan Hajnoczi
2025-08-22 12:26 ` [PATCH 04/14] tracetool: add CHECK_TRACE_EVENT_GET_STATE Paolo Bonzini
2025-08-26 11:44   ` Daniel P. Berrangé
2025-08-27 19:13   ` Stefan Hajnoczi
2025-08-22 12:26 ` [PATCH 05/14] tracetool/backend: remove redundant trace event checks Paolo Bonzini
2025-08-26 11:44   ` Daniel P. Berrangé
2025-08-27 19:15   ` Stefan Hajnoczi
2025-08-22 12:26 ` [PATCH 06/14] tracetool: Add Rust format support Paolo Bonzini
2025-08-25  7:03   ` Manos Pitsidianakis
2025-08-25  9:42     ` Paolo Bonzini
2025-08-25  7:22   ` Manos Pitsidianakis
2025-08-26 11:49   ` Daniel P. Berrangé
2025-08-22 12:26 ` [PATCH 07/14] rust: add trace crate Paolo Bonzini
2025-08-25  7:18   ` Manos Pitsidianakis
2025-08-25  9:54   ` Zhao Liu
2025-08-22 12:26 ` [PATCH 08/14] rust: qdev: add minimal clock bindings Paolo Bonzini
2025-08-25  7:50   ` Zhao Liu
2025-08-25  7:32     ` Manos Pitsidianakis
2025-08-25  9:58       ` Paolo Bonzini
2025-08-22 12:26 ` [PATCH 09/14] rust: pl011: add tracepoints Paolo Bonzini
2025-08-22 12:26 ` [PATCH 10/14] tracetool/simple: add Rust support Paolo Bonzini
2025-08-26 11:53   ` Daniel P. Berrangé
2025-09-19 10:51     ` Paolo Bonzini
2025-08-22 12:26 ` [PATCH 11/14] log: change qemu_loglevel to unsigned Paolo Bonzini
2025-08-25  7:07   ` Manos Pitsidianakis
2025-08-25  7:56   ` Zhao Liu
2025-08-26 13:52   ` Philippe Mathieu-Daudé
2025-08-22 12:26 ` [PATCH 12/14] tracetool/log: add Rust support Paolo Bonzini
2025-08-22 12:26 ` [PATCH 13/14] tracetool/ftrace: " Paolo Bonzini
2025-08-22 12:26 ` [PATCH 14/14] tracetool/syslog: " Paolo Bonzini

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=aKwPkXzi67+UGAnP@intel.com \
    --to=zhao1.liu@intel.com \
    --cc=berrange@redhat.com \
    --cc=mads@ynddal.dk \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=tanishdesai37@gmail.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 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.