mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Ungerer <gerg@linux-m68k.org>
To: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
	kernel test robot <lkp@intel.com>,
	Henning Colliander <henning.colliander@evidente.se>,
	kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Jimmy Assarsson <extja@kvaser.com>,
	Christer Beskow <chbe@kvaser.com>
Subject: Re: drivers/net/can/kvaser_pciefd.c:801:17: sparse: sparse: cast removes address space '<asn:2>' of expression
Date: Sat, 13 Jun 2020 12:19:47 +1000	[thread overview]
Message-ID: <27273ebc-1240-8615-798e-b68878b80494@linux-m68k.org> (raw)
In-Reply-To: <20200612163509.6ieqxm4peqcfgd7o@ltop.local>


On 13/6/20 2:35 am, Luc Van Oostenryck wrote:
> On Sat, Jun 13, 2020 at 01:33:16AM +1000, Greg Ungerer wrote:
>> On 12/6/20 5:48 pm, Marc Kleine-Budde wrote:
>> I think this one is due to not forcing the volatile cast in __raw_write().
>> So this change will fix that:
>>
>> diff --git a/arch/m68k/include/asm/io_no.h b/arch/m68k/include/asm/io_no.h
>> index 0498192e1d98..1bc739f1f1ad 100644
>> --- a/arch/m68k/include/asm/io_no.h
>> +++ b/arch/m68k/include/asm/io_no.h
>> @@ -14,15 +14,15 @@
>>    * that behavior here first before we include asm-generic/io.h.
>>    */
>>   #define __raw_readb(addr) \
>> -    ({ unsigned char __v = (*(volatile unsigned char *) (addr)); __v; })
>> +    ({ u8 __v = (*(__force volatile u8 *) (addr)); __v; })
>>   #define __raw_readw(addr) \
>> -    ({ unsigned short __v = (*(volatile unsigned short *) (addr)); __v; })
>> +    ({ u16 __v = (*(__force volatile u16 *) (addr)); __v; })
>>   #define __raw_readl(addr) \
>> -    ({ unsigned int __v = (*(volatile unsigned int *) (addr)); __v; })
>> +    ({ u32 __v = (*(__force volatile u32 *) (addr)); __v; })
>> -#define __raw_writeb(b, addr) (void)((*(volatile unsigned char *) (addr)) = (b))
>> -#define __raw_writew(b, addr) (void)((*(volatile unsigned short *) (addr)) = (b))
>> -#define __raw_writel(b, addr) (void)((*(volatile unsigned int *) (addr)) = (b))
>> +#define __raw_writeb(b, addr) (void)((*(__force volatile u8 *) (addr)) = (b))
>> +#define __raw_writew(b, addr) (void)((*(__force volatile u16 *) (addr)) = (b))
>> +#define __raw_writel(b, addr) (void)((*(__force volatile u32 *) (addr)) = (b))
> 
> Look good to me but isn't easier to leave them undefined and include
> asm-generic/io.h?

Not so simple at the moment. Although juggling a few things around within
io_no.h will let you use the asm-generic functions it will now throw up
a _lot_ of warnings in many of the architecture files that pass int constant
addresses to the raw_* functions. That is on my todo list.

Regards
Greg


  reply	other threads:[~2020-06-13  2:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-12  5:28 kernel test robot
2020-06-12  7:48 ` Marc Kleine-Budde
2020-06-12 15:33   ` Greg Ungerer
2020-06-12 16:35     ` Luc Van Oostenryck
2020-06-13  2:19       ` Greg Ungerer [this message]
2020-06-15  7:07       ` Greg Ungerer

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=27273ebc-1240-8615-798e-b68878b80494@linux-m68k.org \
    --to=gerg@linux-m68k.org \
    --cc=chbe@kvaser.com \
    --cc=extja@kvaser.com \
    --cc=henning.colliander@evidente.se \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=luc.vanoostenryck@gmail.com \
    --cc=mkl@pengutronix.de \
    /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

all inboxes | Powered by JetHome®