aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/ioport.h4
-rw-r--r--kernel/resource.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 2cd07cc29687..22d2115458c6 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,
118int adjust_resource(struct resource *res, resource_size_t start, 118int adjust_resource(struct resource *res, resource_size_t start,
119 resource_size_t size); 119 resource_size_t size);
120resource_size_t resource_alignment(struct resource *res); 120resource_size_t resource_alignment(struct resource *res);
121static inline resource_size_t resource_size(struct resource *res)
122{
123 return res->end - res->start + 1;
124}
121 125
122/* Convenience shorthand with allocation */ 126/* Convenience shorthand with allocation */
123#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name)) 127#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name))
diff --git a/kernel/resource.c b/kernel/resource.c
index 74af2d7cb5a1..f5b518eabefe 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -490,7 +490,7 @@ resource_size_t resource_alignment(struct resource *res)
490{ 490{
491 switch (res->flags & (IORESOURCE_SIZEALIGN | IORESOURCE_STARTALIGN)) { 491 switch (res->flags & (IORESOURCE_SIZEALIGN | IORESOURCE_STARTALIGN)) {
492 case IORESOURCE_SIZEALIGN: 492 case IORESOURCE_SIZEALIGN:
493 return res->end - res->start + 1; 493 return resource_size(res);
494 case IORESOURCE_STARTALIGN: 494 case IORESOURCE_STARTALIGN:
495 return res->start; 495 return res->start;
496 default: 496 default: