summaryrefslogtreecommitdiff
path: root/arch/powerpc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/sysdev/msi_bitmap.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/arch/powerpc/sysdev/msi_bitmap.c b/arch/powerpc/sysdev/msi_bitmap.c
index 0c75214b6f92..8155d93dee1d 100644
--- a/arch/powerpc/sysdev/msi_bitmap.c
+++ b/arch/powerpc/sysdev/msi_bitmap.c
@@ -151,7 +151,7 @@ void msi_bitmap_free(struct msi_bitmap *bmp)
static void __init test_basics(void)
{
struct msi_bitmap bmp;
- int i, size = 512;
+ int rc, i, size = 512;
/* Can't allocate a bitmap of 0 irqs */
check(msi_bitmap_alloc(&bmp, 0, NULL) != 0);
@@ -185,14 +185,24 @@ static void __init test_basics(void)
msi_bitmap_free_hwirqs(&bmp, size / 2, 1);
check(msi_bitmap_alloc_hwirqs(&bmp, 1) == size / 2);
+ /* Free most of them for the alignment tests */
+ msi_bitmap_free_hwirqs(&bmp, 3, size - 3);
+
/* Check we get a naturally aligned offset */
- check(msi_bitmap_alloc_hwirqs(&bmp, 2) % 2 == 0);
- check(msi_bitmap_alloc_hwirqs(&bmp, 4) % 4 == 0);
- check(msi_bitmap_alloc_hwirqs(&bmp, 8) % 8 == 0);
- check(msi_bitmap_alloc_hwirqs(&bmp, 9) % 16 == 0);
- check(msi_bitmap_alloc_hwirqs(&bmp, 3) % 4 == 0);
- check(msi_bitmap_alloc_hwirqs(&bmp, 7) % 8 == 0);
- check(msi_bitmap_alloc_hwirqs(&bmp, 121) % 128 == 0);
+ rc = msi_bitmap_alloc_hwirqs(&bmp, 2);
+ check(rc >= 0 && rc % 2 == 0);
+ rc = msi_bitmap_alloc_hwirqs(&bmp, 4);
+ check(rc >= 0 && rc % 4 == 0);
+ rc = msi_bitmap_alloc_hwirqs(&bmp, 8);
+ check(rc >= 0 && rc % 8 == 0);
+ rc = msi_bitmap_alloc_hwirqs(&bmp, 9);
+ check(rc >= 0 && rc % 16 == 0);
+ rc = msi_bitmap_alloc_hwirqs(&bmp, 3);
+ check(rc >= 0 && rc % 4 == 0);
+ rc = msi_bitmap_alloc_hwirqs(&bmp, 7);
+ check(rc >= 0 && rc % 8 == 0);
+ rc = msi_bitmap_alloc_hwirqs(&bmp, 121);
+ check(rc >= 0 && rc % 128 == 0);
msi_bitmap_free(&bmp);