/* The board info passed can safely be __initdata ... but be careful of any embedded pointers (platform_data, etc), they're copied as-is.  */
int __init spi_register_board_info(struct spi_board_info const *info, unsigned n)
/* The board info passed can safely be __initdata ... but be careful of any embedded pointers (platform_data, etc), they're copied as-is.  */
int __init spi_register_board_info(struct spi_board_info const *info, unsigned n)
{
	struct boardinfo	*bi;
	bi = kmalloc(sizeof(*bi) + n * sizeof *info, GFP_KERNEL);
	if (!bi)
		return -ENOMEM;
	bi->n_board_info = n;
	memcpy(bi->board_info, info, n * sizeof *info);
	mutex_lock(&board_lock);
	list_add_tail(&bi->list, &board_list);
	mutex_unlock(&board_lock);
	return 0;
}