Re: Can this be a invalid memory access? (was: Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers)

2015-02-02 Thread Geert Uytterhoeven
Hi Ricardo, On Mon, Feb 2, 2015 at 3:05 PM, Ricardo Ribalda Delgado wrote: > On Mon, Feb 2, 2015 at 2:04 PM, Geert Uytterhoeven > wrote: >>> void * pvar=varB; >> >> ... = >> >>> *pvar = ioread8(valid_memory); >>> >>> Depending if ioread8 returns a u8 or a unsigned int, aren't we also >>>

Re: Can this be a invalid memory access? (was: Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers)

2015-02-02 Thread Ricardo Ribalda Delgado
Hello Geert On Mon, Feb 2, 2015 at 2:04 PM, Geert Uytterhoeven wrote: >> void * pvar=varB; > > ... = > >> *pvar = ioread8(valid_memory); >> >> Depending if ioread8 returns a u8 or a unsigned int, aren't we also >> accessing varC? >> >> Could not this be a problem? > > Please try to compile the

Re: Can this be a invalid memory access? (was: Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers)

2015-02-02 Thread Geert Uytterhoeven
Hi Ricardo, On Mon, Feb 2, 2015 at 1:49 PM, Ricardo Ribalda Delgado wrote: > Regarding ioread8 et al. > > On include/asm-generic/io.h is defined as: > extern unsigned int ioread8(void __iomem *); > > On include/asm-generic/io.h: > static inline u8 ioread8(const volatile void __iomem *addr) > >

Can this be a invalid memory access? (was: Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers)

2015-02-02 Thread Ricardo Ribalda Delgado
Hello Regarding ioread8 et al. On include/asm-generic/io.h is defined as: extern unsigned int ioread8(void __iomem *); On include/asm-generic/io.h: static inline u8 ioread8(const volatile void __iomem *addr) Please ignore the qualifiers right now. The first function returns an unsigned

Re: Can this be a invalid memory access? (was: Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers)

2015-02-02 Thread Geert Uytterhoeven
Hi Ricardo, On Mon, Feb 2, 2015 at 3:05 PM, Ricardo Ribalda Delgado ricardo.riba...@gmail.com wrote: On Mon, Feb 2, 2015 at 2:04 PM, Geert Uytterhoeven ge...@linux-m68k.org wrote: void * pvar=varB; ... = varB; *pvar = ioread8(valid_memory); Depending if ioread8 returns a u8 or a

Re: Can this be a invalid memory access? (was: Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers)

2015-02-02 Thread Ricardo Ribalda Delgado
Hello Geert On Mon, Feb 2, 2015 at 2:04 PM, Geert Uytterhoeven ge...@linux-m68k.org wrote: void * pvar=varB; ... = varB; *pvar = ioread8(valid_memory); Depending if ioread8 returns a u8 or a unsigned int, aren't we also accessing varC? Could not this be a problem? Please try to

Can this be a invalid memory access? (was: Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers)

2015-02-02 Thread Ricardo Ribalda Delgado
Hello Regarding ioread8 et al. On include/asm-generic/io.h is defined as: extern unsigned int ioread8(void __iomem *); On include/asm-generic/io.h: static inline u8 ioread8(const volatile void __iomem *addr) Please ignore the qualifiers right now. The first function returns an unsigned

Re: Can this be a invalid memory access? (was: Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers)

2015-02-02 Thread Geert Uytterhoeven
Hi Ricardo, On Mon, Feb 2, 2015 at 1:49 PM, Ricardo Ribalda Delgado ricardo.riba...@gmail.com wrote: Regarding ioread8 et al. On include/asm-generic/io.h is defined as: extern unsigned int ioread8(void __iomem *); On include/asm-generic/io.h: static inline u8 ioread8(const volatile void

Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers

2015-01-29 Thread Arnd Bergmann
On Thursday 29 January 2015 23:14:46 Ricardo Ribalda Delgado wrote: > What about the different return type? u8 vs int Too many drivers use all sorts of different types, I've given up hope of changing drivers to agree on the same type here. Basically you can think of 'void __iomem *' as the magic

Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers

2015-01-29 Thread Ricardo Ribalda Delgado
Hello Arnd On Thu, Jan 29, 2015 at 11:11 PM, Arnd Bergmann wrote: >> > I think the definitions in include/asm-generic/iomap.h are actually wrong, >> > as they lack a const: >> > >> > extern unsigned int ioread8(void __iomem *); >> > extern unsigned int ioread16(void __iomem *); >> >

Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers

2015-01-29 Thread Arnd Bergmann
On Thursday 29 January 2015 17:39:08 Ricardo Ribalda Delgado wrote: > > I think the definitions in include/asm-generic/iomap.h are actually wrong, > > as they lack a const: > > > > extern unsigned int ioread8(void __iomem *); > > extern unsigned int ioread16(void __iomem *); > > extern

Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers

2015-01-29 Thread Ricardo Ribalda Delgado
Hello Arnd On Thu, Jan 29, 2015 at 5:04 PM, Arnd Bergmann wrote: > Casting the type of a function you call seems rather dangerous. Why not > add an inline function in this driver as a wrapper? > > Arnd Agree, please ignore this patch. Sorry for the noise -- Ricardo Ribalda -- To

Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers

2015-01-29 Thread Ricardo Ribalda Delgado
Hello Geert On Thu, Jan 29, 2015 at 4:56 PM, Geert Uytterhoeven wrote: > On Thu, Jan 29, 2015 at 3:51 PM, Ricardo Ribalda Delgado > wrote: >> IO functions prototypes may have different argument qualifiers >> on different architectures. >> >> This patch cast the assignment of the function, to

Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers

2015-01-29 Thread Arnd Bergmann
On Thursday 29 January 2015 15:51:13 Ricardo Ribalda Delgado wrote: > * Setup little endian helper functions first and try to use them > * and check if bit was correctly setup or not. > */ > - xspi->read_fn = ioread32; > - xspi->write_fn = iowrite32; > +

Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers

2015-01-29 Thread Geert Uytterhoeven
On Thu, Jan 29, 2015 at 3:51 PM, Ricardo Ribalda Delgado wrote: > IO functions prototypes may have different argument qualifiers > on different architectures. > > This patch cast the assignment of the function, to match the one defined > at iomap.h. Adding casts is (usually) not the solution to

[PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers

2015-01-29 Thread Ricardo Ribalda Delgado
IO functions prototypes may have different argument qualifiers on different architectures. This patch cast the assignment of the function, to match the one defined at iomap.h. Fixes: 99082eab63449f9d spi/xilinx: Remove iowrite/ioread wrappers Reported-by: kbuild test robot Signed-off-by:

Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers

2015-01-29 Thread Ricardo Ribalda Delgado
Hello Arnd On Thu, Jan 29, 2015 at 5:04 PM, Arnd Bergmann a...@arndb.de wrote: Casting the type of a function you call seems rather dangerous. Why not add an inline function in this driver as a wrapper? Arnd Agree, please ignore this patch. Sorry for the noise -- Ricardo Ribalda

Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers

2015-01-29 Thread Ricardo Ribalda Delgado
Hello Geert On Thu, Jan 29, 2015 at 4:56 PM, Geert Uytterhoeven ge...@linux-m68k.org wrote: On Thu, Jan 29, 2015 at 3:51 PM, Ricardo Ribalda Delgado ricardo.riba...@gmail.com wrote: IO functions prototypes may have different argument qualifiers on different architectures. This patch cast

[PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers

2015-01-29 Thread Ricardo Ribalda Delgado
IO functions prototypes may have different argument qualifiers on different architectures. This patch cast the assignment of the function, to match the one defined at iomap.h. Fixes: 99082eab63449f9d spi/xilinx: Remove iowrite/ioread wrappers Reported-by: kbuild test robot fengguang...@intel.com

Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers

2015-01-29 Thread Arnd Bergmann
On Thursday 29 January 2015 15:51:13 Ricardo Ribalda Delgado wrote: * Setup little endian helper functions first and try to use them * and check if bit was correctly setup or not. */ - xspi-read_fn = ioread32; - xspi-write_fn = iowrite32; +

Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers

2015-01-29 Thread Geert Uytterhoeven
On Thu, Jan 29, 2015 at 3:51 PM, Ricardo Ribalda Delgado ricardo.riba...@gmail.com wrote: IO functions prototypes may have different argument qualifiers on different architectures. This patch cast the assignment of the function, to match the one defined at iomap.h. Adding casts is (usually)

Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers

2015-01-29 Thread Ricardo Ribalda Delgado
Hello Arnd On Thu, Jan 29, 2015 at 11:11 PM, Arnd Bergmann a...@arndb.de wrote: I think the definitions in include/asm-generic/iomap.h are actually wrong, as they lack a const: extern unsigned int ioread8(void __iomem *); extern unsigned int ioread16(void __iomem *);

Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers

2015-01-29 Thread Arnd Bergmann
On Thursday 29 January 2015 17:39:08 Ricardo Ribalda Delgado wrote: I think the definitions in include/asm-generic/iomap.h are actually wrong, as they lack a const: extern unsigned int ioread8(void __iomem *); extern unsigned int ioread16(void __iomem *); extern unsigned

Re: [PATCH] spi/xilinx: Cast ioread32/iowrite32 function pointers

2015-01-29 Thread Arnd Bergmann
On Thursday 29 January 2015 23:14:46 Ricardo Ribalda Delgado wrote: What about the different return type? u8 vs int Too many drivers use all sorts of different types, I've given up hope of changing drivers to agree on the same type here. Basically you can think of 'void __iomem *' as the magic