diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2012-05-24 08:52:22 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-07-01 08:18:53 +0200 |
commit | 5f03074ea98b64b55c133b35ee144fdc909e6d69 (patch) | |
tree | 1a61fd84a5a44d98297014486eca663221ff4cbc /include | |
parent | 20addb80f65076b3a81c7d778f7b93d445a96841 (diff) | |
download | barebox-5f03074ea98b64b55c133b35ee144fdc909e6d69.tar.gz barebox-5f03074ea98b64b55c133b35ee144fdc909e6d69.tar.xz |
resource: store 'end' instead of 'size' in struct resource
Storing the size instead of the resource end in struct resource was
a mistake. 'size' ranges from 0 to UINT[32|64]_MAX + 1 which obviously
leads to problems. 'end' on the other hand will never exceed
UINT[32|64]_MAX. Also this way we can express a iomem region covering
the whole address space.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ioport.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 3f95dddf4e..6d6cd68de6 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -17,7 +17,7 @@ */ struct resource { resource_size_t start; - resource_size_t size; + resource_size_t end; const char *name; unsigned long flags; struct resource *parent; @@ -113,7 +113,7 @@ struct resource { static inline resource_size_t resource_size(const struct resource *res) { - return res->size; + return res->end - res->start + 1; } static inline unsigned long resource_type(const struct resource *res) { @@ -121,10 +121,10 @@ static inline unsigned long resource_type(const struct resource *res) } struct resource *request_iomem_region(const char *name, - resource_size_t start, resource_size_t size); + resource_size_t start, resource_size_t end); struct resource *request_region(struct resource *parent, - const char *name, resource_size_t start, + const char *name, resource_size_t end, resource_size_t size); int release_region(struct resource *res); |