summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMagnus Damm <damm@igel.co.jp>2008-07-29 22:32:57 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-30 09:41:43 -0700
commit1a4e564b7db999fbe5d88318c96ac8747699d417 (patch)
tree6451a0bd33533f7a214faa205ad174978458781e /include
parente958d3ace7791f33518f0259cd3cf229408b135c (diff)
downloadop-kernel-dev-1a4e564b7db999fbe5d88318c96ac8747699d417.zip
op-kernel-dev-1a4e564b7db999fbe5d88318c96ac8747699d417.tar.gz
resource: add resource_size()
Avoid one-off errors by introducing a resource_size() function. Signed-off-by: Magnus Damm <damm@igel.co.jp> Cc: Ben Dooks <ben-linux@fluff.org> Cc: Jean Delvare <khali@linux-fr.org> Cc: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/ioport.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 2cd07cc..22d2115 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -118,6 +118,10 @@ extern int allocate_resource(struct resource *root, struct resource *new,
int adjust_resource(struct resource *res, resource_size_t start,
resource_size_t size);
resource_size_t resource_alignment(struct resource *res);
+static inline resource_size_t resource_size(struct resource *res)
+{
+ return res->end - res->start + 1;
+}
/* Convenience shorthand with allocation */
#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name))
OpenPOWER on IntegriCloud