[PATCH 1/5] device: introduce resource structure to simplify resource delaration

Sascha Hauer s.hauer at pengutronix.de
Sat Nov 20 08:40:17 EST 2010


On Fri, Nov 19, 2010 at 12:30:09PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 09:00 Fri 19 Nov     , Sascha Hauer wrote:
> > Hi J,
> > 
> > On Fri, Nov 12, 2010 at 07:18:54PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > introdude also some helper to manager them
> > > 
> > > and add multi resource per device support
> > > 
> > > ram device: use resource structure instead of memory_platform_data
> > > 
> > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
> > 
> > 
> > You shouldn't use a resource_size_t type to access registers. This will
> > lead to problems when we start to support 64bit resource sizes
> no as resource_size_t is 64 bit aware

And exactly this is the problem. void * is usually only 32bit on arm.
This will lead to compiler warnings and sparse isn't happy about
unsigned long in readl/writel anyway.

> >. Instead we should introduce a
> > 
> > #define resource_size_to_iomem(size) (void __force __iomem *)(size)
> > 
> > macro which does the conversion to a void __iomem * type. In a more
> > advanced version this could also spit a warning when the resource start
> > is bigger than a pointer type. As an additional plus we'll get rid of
> > some sparse warnings where map_base is used for readl/writel.
> we do not do in the kernel and do see the advantage here for the ressource
> in mind it's in the drivers we need to do it
> if necessary

resource_size_t is never passed to readl/writel in the kernel.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list