All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [next:master 8896/9415] drivers/mtd/nand/hisi504_nand.c:375:26: sparse: cast removes address space of expression
       [not found] <201502111555.q8V9IcSN%fengguang.wu@intel.com>
@ 2015-02-12 21:36 ` Brian Norris
  2015-02-28  5:57   ` Zhou Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Brian Norris @ 2015-02-12 21:36 UTC (permalink / raw)
  To: kbuild test robot, Zhou Wang; +Cc: Zhou Wang, linux-mtd, kbuild-all

+ linux-mtd

Hi,

On Wed, Feb 11, 2015 at 03:49:56PM +0800, kbuild test robot wrote:
> tree:   git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   5721f7f0f14b682d2e86e9a4aa9025acaf69399d
> commit: 54f531f6e332875bd8a604871532f7f1174adc0e [8896/9415] mtd: hisilicon: add a new NAND controller driver for hisilicon hip04 Soc
> reproduce:
>   # apt-get install sparse
>   git checkout 54f531f6e332875bd8a604871532f7f1174adc0e
>   make ARCH=x86_64 allmodconfig
>   make C=1 CF=-D__CHECK_ENDIAN__
> 
> 
> sparse warnings: (new ones prefixed by >>)
> 
> >> drivers/mtd/nand/hisi504_nand.c:375:26: sparse: cast removes address space of expression
> >> drivers/mtd/nand/hisi504_nand.c:380:26: sparse: cast removes address space of expression
>    drivers/mtd/nand/hisi504_nand.c:490:28: sparse: incorrect type in argument 1 (different address spaces)
>    drivers/mtd/nand/hisi504_nand.c:490:28:    expected void *s
>    drivers/mtd/nand/hisi504_nand.c:490:28:    got void [noderef] <asn:2>*mmio
>    drivers/mtd/nand/hisi504_nand.c:502:28: sparse: incorrect type in argument 1 (different address spaces)
>    drivers/mtd/nand/hisi504_nand.c:502:28:    expected void *s
>    drivers/mtd/nand/hisi504_nand.c:502:28:    got void [noderef] <asn:2>*mmio
>    drivers/mtd/nand/hisi504_nand.c:625:20: sparse: incorrect type in argument 1 (different address spaces)
>    drivers/mtd/nand/hisi504_nand.c:625:20:    expected void *s
>    drivers/mtd/nand/hisi504_nand.c:625:20:    got void [noderef] <asn:2>*mmio
>    drivers/mtd/nand/hisi504_nand.c:890:1: sparse: symbol '__UNIQUE_ID_author__COUNTER__' has multiple initializers (originally initialized at drivers/mtd/nand/hisi504_nand.c:889)
> 
> vim +375 drivers/mtd/nand/hisi504_nand.c
> 
>    369	static uint8_t hisi_nfc_read_byte(struct mtd_info *mtd)
>    370	{
>    371		struct nand_chip *chip = mtd->priv;
>    372		struct hinfc_host *host = chip->priv;
>    373	
>    374		if (host->command == NAND_CMD_STATUS)
>  > 375			return *(uint8_t *)(host->mmio);

Yeah, this probably should be readb() or __raw_readb().

Zhou, why did you change this, again? I believe you made this change
somewhere in the several revisions of your driver. I'm inclined to patch
this before sending a pullreq to Linus.

>    376	
>    377		host->offset++;
>    378	
>    379		if (host->command == NAND_CMD_READID)
>  > 380			return *(uint8_t *)(host->mmio + host->offset - 1);

Same here.

>    381	
>    382		return *(uint8_t *)(host->buffer + host->offset - 1);
>    383	}
> 

Brian

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [next:master 8896/9415] drivers/mtd/nand/hisi504_nand.c:375:26: sparse: cast removes address space of expression
  2015-02-12 21:36 ` [next:master 8896/9415] drivers/mtd/nand/hisi504_nand.c:375:26: sparse: cast removes address space of expression Brian Norris
@ 2015-02-28  5:57   ` Zhou Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Zhou Wang @ 2015-02-28  5:57 UTC (permalink / raw)
  To: Brian Norris; +Cc: kbuild test robot, linux-mtd, kbuild-all

On 2015/2/13 5:36, Brian Norris wrote:
> + linux-mtd
> 
> Hi,
> 
> On Wed, Feb 11, 2015 at 03:49:56PM +0800, kbuild test robot wrote:
>> tree:   git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
>> head:   5721f7f0f14b682d2e86e9a4aa9025acaf69399d
>> commit: 54f531f6e332875bd8a604871532f7f1174adc0e [8896/9415] mtd: hisilicon: add a new NAND controller driver for hisilicon hip04 Soc
>> reproduce:
>>   # apt-get install sparse
>>   git checkout 54f531f6e332875bd8a604871532f7f1174adc0e
>>   make ARCH=x86_64 allmodconfig
>>   make C=1 CF=-D__CHECK_ENDIAN__
>>
>>
>> sparse warnings: (new ones prefixed by >>)
>>
>>>> drivers/mtd/nand/hisi504_nand.c:375:26: sparse: cast removes address space of expression
>>>> drivers/mtd/nand/hisi504_nand.c:380:26: sparse: cast removes address space of expression
>>    drivers/mtd/nand/hisi504_nand.c:490:28: sparse: incorrect type in argument 1 (different address spaces)
>>    drivers/mtd/nand/hisi504_nand.c:490:28:    expected void *s
>>    drivers/mtd/nand/hisi504_nand.c:490:28:    got void [noderef] <asn:2>*mmio
>>    drivers/mtd/nand/hisi504_nand.c:502:28: sparse: incorrect type in argument 1 (different address spaces)
>>    drivers/mtd/nand/hisi504_nand.c:502:28:    expected void *s
>>    drivers/mtd/nand/hisi504_nand.c:502:28:    got void [noderef] <asn:2>*mmio
>>    drivers/mtd/nand/hisi504_nand.c:625:20: sparse: incorrect type in argument 1 (different address spaces)
>>    drivers/mtd/nand/hisi504_nand.c:625:20:    expected void *s
>>    drivers/mtd/nand/hisi504_nand.c:625:20:    got void [noderef] <asn:2>*mmio
>>    drivers/mtd/nand/hisi504_nand.c:890:1: sparse: symbol '__UNIQUE_ID_author__COUNTER__' has multiple initializers (originally initialized at drivers/mtd/nand/hisi504_nand.c:889)
>>
>> vim +375 drivers/mtd/nand/hisi504_nand.c
>>
>>    369	static uint8_t hisi_nfc_read_byte(struct mtd_info *mtd)
>>    370	{
>>    371		struct nand_chip *chip = mtd->priv;
>>    372		struct hinfc_host *host = chip->priv;
>>    373	
>>    374		if (host->command == NAND_CMD_STATUS)
>>  > 375			return *(uint8_t *)(host->mmio);
> 
> Yeah, this probably should be readb() or __raw_readb().
> 
> Zhou, why did you change this, again? I believe you made this change
> somewhere in the several revisions of your driver. I'm inclined to patch
> this before sending a pullreq to Linus.

Hi Brian,

Very sorry for late.

host->mmio there refers to the NAND controller hardware buffer which is mapped
to a chunk of RAM. For simple, I just used the way above. I do not know if it
is better to use readb() or __raw_readb() there. Do you mean that: it should use
readb() or __raw_readb() for host->mmio, and for host->buffer which is a chunk of
memory allocated by kernel it can directly get the value by
"*(uint8_t *)(host->buffer + host->offset - 1)"?

For the sparse warnings, there misses "__iomem". Am I right?

Thanks,
Zhou Wang

> 
>>    376	
>>    377		host->offset++;
>>    378	
>>    379		if (host->command == NAND_CMD_READID)
>>  > 380			return *(uint8_t *)(host->mmio + host->offset - 1);
> 
> Same here.
> 
>>    381	
>>    382		return *(uint8_t *)(host->buffer + host->offset - 1);
>>    383	}
>>
> 
> Brian
> 
> .
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-28  5:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <201502111555.q8V9IcSN%fengguang.wu@intel.com>
2015-02-12 21:36 ` [next:master 8896/9415] drivers/mtd/nand/hisi504_nand.c:375:26: sparse: cast removes address space of expression Brian Norris
2015-02-28  5:57   ` Zhou Wang

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.