of: MSI: Simplify irqdomain lookup
[linux/fpc-iii.git] / drivers / hsi / hsi_boardinfo.c
blobe56bc6da5f98653ac4b2863f1e0297eefb2046d7
1 /*
2 * HSI clients registration interface
4 * Copyright (C) 2010 Nokia Corporation. All rights reserved.
6 * Contact: Carlos Chinea <carlos.chinea@nokia.com>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
22 #include <linux/hsi/hsi.h>
23 #include <linux/list.h>
24 #include <linux/slab.h>
25 #include "hsi_core.h"
28 * hsi_board_list is only used internally by the HSI framework.
29 * No one else is allowed to make use of it.
31 LIST_HEAD(hsi_board_list);
32 EXPORT_SYMBOL_GPL(hsi_board_list);
34 /**
35 * hsi_register_board_info - Register HSI clients information
36 * @info: Array of HSI clients on the board
37 * @len: Length of the array
39 * HSI clients are statically declared and registered on board files.
41 * HSI clients will be automatically registered to the HSI bus once the
42 * controller and the port where the clients wishes to attach are registered
43 * to it.
45 * Return -errno on failure, 0 on success.
47 int __init hsi_register_board_info(struct hsi_board_info const *info,
48 unsigned int len)
50 struct hsi_cl_info *cl_info;
52 cl_info = kzalloc(sizeof(*cl_info) * len, GFP_KERNEL);
53 if (!cl_info)
54 return -ENOMEM;
56 for (; len; len--, info++, cl_info++) {
57 cl_info->info = *info;
58 list_add_tail(&cl_info->list, &hsi_board_list);
61 return 0;