Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de5bbad6 authored by Akinobu Mita's avatar Akinobu Mita Committed by Chris Metcalf
Browse files

tile: replace some BUG_ON checks with BUILD_BUG_ON checks



Some BUG_ON checks can be detected at compile time rather than
at runtime.

Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatarChris Metcalf <cmetcalf@tilera.com>
parent 2bfc96a1
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -300,7 +300,7 @@ void __init __init_atomic_per_cpu(void)
#else /* ATOMIC_LOCKS_FOUND_VIA_TABLE() */
#else /* ATOMIC_LOCKS_FOUND_VIA_TABLE() */


	/* Validate power-of-two and "bigger than cpus" assumption */
	/* Validate power-of-two and "bigger than cpus" assumption */
	BUG_ON(ATOMIC_HASH_SIZE & (ATOMIC_HASH_SIZE-1));
	BUILD_BUG_ON(ATOMIC_HASH_SIZE & (ATOMIC_HASH_SIZE-1));
	BUG_ON(ATOMIC_HASH_SIZE < nr_cpu_ids);
	BUG_ON(ATOMIC_HASH_SIZE < nr_cpu_ids);


	/*
	/*
@@ -314,17 +314,17 @@ void __init __init_atomic_per_cpu(void)
	BUG_ON((unsigned long)atomic_locks % PAGE_SIZE != 0);
	BUG_ON((unsigned long)atomic_locks % PAGE_SIZE != 0);


	/* The locks must all fit on one page. */
	/* The locks must all fit on one page. */
	BUG_ON(ATOMIC_HASH_SIZE * sizeof(int) > PAGE_SIZE);
	BUILD_BUG_ON(ATOMIC_HASH_SIZE * sizeof(int) > PAGE_SIZE);


	/*
	/*
	 * We use the page offset of the atomic value's address as
	 * We use the page offset of the atomic value's address as
	 * an index into atomic_locks, excluding the low 3 bits.
	 * an index into atomic_locks, excluding the low 3 bits.
	 * That should not produce more indices than ATOMIC_HASH_SIZE.
	 * That should not produce more indices than ATOMIC_HASH_SIZE.
	 */
	 */
	BUG_ON((PAGE_SIZE >> 3) > ATOMIC_HASH_SIZE);
	BUILD_BUG_ON((PAGE_SIZE >> 3) > ATOMIC_HASH_SIZE);


#endif /* ATOMIC_LOCKS_FOUND_VIA_TABLE() */
#endif /* ATOMIC_LOCKS_FOUND_VIA_TABLE() */


	/* The futex code makes this assumption, so we validate it here. */
	/* The futex code makes this assumption, so we validate it here. */
	BUG_ON(sizeof(atomic_t) != sizeof(int));
	BUILD_BUG_ON(sizeof(atomic_t) != sizeof(int));
}
}