Re: [PATCH] staging: fieldbus: anybuss: force address space conversion

2019-05-21 Thread Sven Van Asbroeck
On Tue, May 21, 2019 at 12:53 PM Sven Van Asbroeck wrote: > > On Tue, May 21, 2019 at 12:24 PM Greg KH wrote: > > > > what is so odd about this code that makes you have to jump through > > strange hoops that no other driver has to? > > > > Basically because it creates a regmap which accesses

Re: [PATCH] staging: fieldbus: anybuss: force address space conversion

2019-05-21 Thread Sven Van Asbroeck
On Tue, May 21, 2019 at 12:24 PM Greg KH wrote: > > what is so odd about this code that makes you have to jump through > strange hoops that no other driver has to? > Basically because it creates a regmap which accesses __iomem memory, instead of i2c/spi. This was done because future hardware in

Re: [PATCH] staging: fieldbus: anybuss: force address space conversion

2019-05-21 Thread Greg KH
On Tue, May 21, 2019 at 11:53:15AM -0400, Sven Van Asbroeck wrote: > On Tue, May 21, 2019 at 11:42 AM Greg KH wrote: > > > > Ick, if you are using __force, almost always something is wrong. > > > > What if I create a separate structure for the regmap context ? > > struct anybus_regmap_context {

Re: [PATCH] staging: fieldbus: anybuss: force address space conversion

2019-05-21 Thread Sven Van Asbroeck
On Tue, May 21, 2019 at 11:42 AM Greg KH wrote: > > Ick, if you are using __force, almost always something is wrong. > What if I create a separate structure for the regmap context ? struct anybus_regmap_context { void __iomem *base; }; Then just store the base pointer inside the

Re: [PATCH] staging: fieldbus: anybuss: force address space conversion

2019-05-21 Thread Greg KH
On Tue, May 21, 2019 at 11:19:59AM -0400, Sven Van Asbroeck wrote: > On Tue, May 21, 2019 at 11:13 AM Dan Carpenter > wrote: > > > > There is no need to use __force. Just: > > > > void __iomem *base = (void __iomem *)context; > > > > For the rest as well. > > Yes, that appears to work

Re: [PATCH] staging: fieldbus: anybuss: force address space conversion

2019-05-21 Thread Sven Van Asbroeck
On Tue, May 21, 2019 at 11:13 AM Dan Carpenter wrote: > > There is no need to use __force. Just: > > void __iomem *base = (void __iomem *)context; > > For the rest as well. Yes, that appears to work for 'void *' -> __iomem, but not the other way around: + return

Re: [PATCH] staging: fieldbus: anybuss: force address space conversion

2019-05-21 Thread Dan Carpenter
On Tue, May 21, 2019 at 10:51:16AM -0400, Sven Van Asbroeck wrote: > The regmap's context (stored as 'void *') consists of a pointer to > __iomem. Mixing __iomem and non-__iomem addresses generates > sparse warnings. > > Fix by using __force when converting to/from 'void __iomem *' and > the

[PATCH] staging: fieldbus: anybuss: force address space conversion

2019-05-21 Thread Sven Van Asbroeck
The regmap's context (stored as 'void *') consists of a pointer to __iomem. Mixing __iomem and non-__iomem addresses generates sparse warnings. Fix by using __force when converting to/from 'void __iomem *' and the regmap's context. Signed-off-by: Sven Van Asbroeck ---