aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/resource.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/kernel/resource.c b/kernel/resource.c
index 82aea814d409..cee12cc47cab 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -486,6 +486,24 @@ int adjust_resource(struct resource *res, resource_size_t start, resource_size_t
486 486
487EXPORT_SYMBOL(adjust_resource); 487EXPORT_SYMBOL(adjust_resource);
488 488
489/**
490 * resource_alignment - calculate resource's alignment
491 * @res: resource pointer
492 *
493 * Returns alignment on success, 0 (invalid alignment) on failure.
494 */
495resource_size_t resource_alignment(struct resource *res)
496{
497 switch (res->flags & (IORESOURCE_SIZEALIGN | IORESOURCE_STARTALIGN)) {
498 case IORESOURCE_SIZEALIGN:
499 return res->end - res->start + 1;
500 case IORESOURCE_STARTALIGN:
501 return res->start;
502 default:
503 return 0;
504 }
505}
506
489/* 507/*
490 * This is compatibility stuff for IO resources. 508 * This is compatibility stuff for IO resources.
491 * 509 *