Skip to contentSkip to conversation

resource_size doesn't change the resource

PATCH Jean Delvare 2 participants 2 messages Nov 11, 2009

lore
Share & tools
lore
#0 lore raw

The resource_size function doesn't change the resource it operates on, so the res parameter can be marked const. Same for the resource_type function.

---
 include/linux/ioport.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/ioport.h +2 -2
@@ -126,11 +126,11 @@ extern int allocate_resource(struct reso
 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)
+static inline resource_size_t resource_size(const struct resource *res)
 {
 	return res->end - res->start + 1;
 }
-static inline unsigned long resource_type(struct resource *res)
+static inline unsigned long resource_type(const struct resource *res)
 {
 	return res->flags & IORESOURCE_TYPE_BITS;
 }
Signature · 1 line
Jean Delvare
Reviewed-by
#1 lore raw
Quoted 5 lines · Jean Delvare

The resource_size function doesn't change the resource it operates on, so the res parameter can be marked const. Same for the resource_type function.

Quoted 29 lines

---
include/linux/ioport.h | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/ioport.h +2 -2
@@ -126,11 +126,11 @@ extern int allocate_resource(struct reso
 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)
+static inline resource_size_t resource_size(const struct resource *res)
 {
 	return res->end - res->start + 1;
 }
-static inline unsigned long resource_type(struct resource *res)
+static inline unsigned long resource_type(const struct resource *res)
 {
 	return res->flags & IORESOURCE_TYPE_BITS;
 }
Signature · 7 lines
-- 
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Signature · 1 line
Live like a child, think like the god.