/* In order to have some empty space for new keycodes, and knowing in advance that kmalloc allocates only power of two segments, it optimizes the allocated space to have some spare space for those new keycodes by using the maximum number of entries that will be effectively be allocated by kmalloc. In order to reduce the quantity of table resizes, it has a minimum table size of IR_TAB_MIN_SIZE.  */
int ir_roundup_tablesize(int n_elems)
/* In order to have some empty space for new keycodes, and knowing in advance that kmalloc allocates only power of two segments, it optimizes the allocated space to have some spare space for those new keycodes by using the maximum number of entries that will be effectively be allocated by kmalloc. In order to reduce the quantity of table resizes, it has a minimum table size of IR_TAB_MIN_SIZE.  */
int ir_roundup_tablesize(int n_elems)
{
	size_t size;
	if (n_elems < IR_TAB_MIN_SIZE)
		n_elems = IR_TAB_MIN_SIZE;
	size = roundup_pow_of_two(n_elems * sizeof(struct ir_scancode));
	n_elems = size / sizeof(struct ir_scancode);
	return n_elems;
}