// SPDX-License-Identifier: GPL-2.0-only1/*2* HSI clients registration interface3*4* Copyright (C) 2010 Nokia Corporation. All rights reserved.5*6* Contact: Carlos Chinea <[email protected]>7*/8#include <linux/hsi/hsi.h>9#include <linux/list.h>10#include <linux/slab.h>11#include "hsi_core.h"1213/*14* hsi_board_list is only used internally by the HSI framework.15* No one else is allowed to make use of it.16*/17LIST_HEAD(hsi_board_list);18EXPORT_SYMBOL_GPL(hsi_board_list);1920/**21* hsi_register_board_info - Register HSI clients information22* @info: Array of HSI clients on the board23* @len: Length of the array24*25* HSI clients are statically declared and registered on board files.26*27* HSI clients will be automatically registered to the HSI bus once the28* controller and the port where the clients wishes to attach are registered29* to it.30*31* Return -errno on failure, 0 on success.32*/33int __init hsi_register_board_info(struct hsi_board_info const *info,34unsigned int len)35{36struct hsi_cl_info *cl_info;3738cl_info = kcalloc(len, sizeof(*cl_info), GFP_KERNEL);39if (!cl_info)40return -ENOMEM;4142for (; len; len--, info++, cl_info++) {43cl_info->info = *info;44list_add_tail(&cl_info->list, &hsi_board_list);45}4647return 0;48}495051