public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: Arnd Bergmann <arnd@arndb.de>, <linux-arch@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] asm-generic/io.h: suppress endianness warnings for readq() and writeq()
Date: Tue, 4 Apr 2023 16:35:13 +0100	[thread overview]
Message-ID: <20230404163513.00003b9f@huawei.com> (raw)
In-Reply-To: <20230109131153.991322-1-vladimir.oltean@nxp.com>

On Mon,  9 Jan 2023 15:11:52 +0200
Vladimir Oltean <vladimir.oltean@nxp.com> wrote:

> Commit c1d55d50139b ("asm-generic/io.h: Fix sparse warnings on
> big-endian architectures") missed fixing the 64-bit accessors.
> 
> Arnd explains in the attached link why the casts are necessary, even if
> __raw_readq() and __raw_writeq() do not take endian-specific types.
> 
> Link: https://lore.kernel.org/lkml/9105d6fc-880b-4734-857d-e3d30b87ccf6@app.fastmail.com/
> Suggested-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Found this when about to send an equivalent patch. Not seeing this in linux-next yet
and would be good to clean the resulting warnings up.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
>  include/asm-generic/io.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
> index 4c44a29b5e8e..d78c3056c98f 100644
> --- a/include/asm-generic/io.h
> +++ b/include/asm-generic/io.h
> @@ -236,7 +236,7 @@ static inline u64 readq(const volatile void __iomem *addr)
>  
>  	log_read_mmio(64, addr, _THIS_IP_, _RET_IP_);
>  	__io_br();
> -	val = __le64_to_cpu(__raw_readq(addr));
> +	val = __le64_to_cpu((__le64 __force)__raw_readq(addr));
>  	__io_ar(val);
>  	log_post_read_mmio(val, 64, addr, _THIS_IP_, _RET_IP_);
>  	return val;
> @@ -287,7 +287,7 @@ static inline void writeq(u64 value, volatile void __iomem *addr)
>  {
>  	log_write_mmio(value, 64, addr, _THIS_IP_, _RET_IP_);
>  	__io_bw();
> -	__raw_writeq(__cpu_to_le64(value), addr);
> +	__raw_writeq((u64 __force)__cpu_to_le64(value), addr);
>  	__io_aw();
>  	log_post_write_mmio(value, 64, addr, _THIS_IP_, _RET_IP_);
>  }


      parent reply	other threads:[~2023-04-04 15:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-09 13:11 [PATCH 1/2] asm-generic/io.h: suppress endianness warnings for readq() and writeq() Vladimir Oltean
2023-01-09 13:11 ` [PATCH 2/2] asm-generic/io.h: suppress endianness warnings for relaxed accessors Vladimir Oltean
2023-03-10  9:30 ` [PATCH 1/2] asm-generic/io.h: suppress endianness warnings for readq() and writeq() Vladimir Oltean
2023-04-04 16:00   ` Arnd Bergmann
2023-04-04 15:35 ` Jonathan Cameron [this message]

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=20230404163513.00003b9f@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=arnd@arndb.de \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vladimir.oltean@nxp.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