mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:46:16 +00:00
2b27bdcc20
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not write to the free software foundation inc 51 franklin st fifth floor boston ma 02110 1301 usa extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 246 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Alexios Zavras <alexios.zavras@intel.com> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190530000436.674189849@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
50 lines
1.2 KiB
C
50 lines
1.2 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* HSI clients registration interface
|
|
*
|
|
* Copyright (C) 2010 Nokia Corporation. All rights reserved.
|
|
*
|
|
* Contact: Carlos Chinea <carlos.chinea@nokia.com>
|
|
*/
|
|
#include <linux/hsi/hsi.h>
|
|
#include <linux/list.h>
|
|
#include <linux/slab.h>
|
|
#include "hsi_core.h"
|
|
|
|
/*
|
|
* hsi_board_list is only used internally by the HSI framework.
|
|
* No one else is allowed to make use of it.
|
|
*/
|
|
LIST_HEAD(hsi_board_list);
|
|
EXPORT_SYMBOL_GPL(hsi_board_list);
|
|
|
|
/**
|
|
* hsi_register_board_info - Register HSI clients information
|
|
* @info: Array of HSI clients on the board
|
|
* @len: Length of the array
|
|
*
|
|
* HSI clients are statically declared and registered on board files.
|
|
*
|
|
* HSI clients will be automatically registered to the HSI bus once the
|
|
* controller and the port where the clients wishes to attach are registered
|
|
* to it.
|
|
*
|
|
* Return -errno on failure, 0 on success.
|
|
*/
|
|
int __init hsi_register_board_info(struct hsi_board_info const *info,
|
|
unsigned int len)
|
|
{
|
|
struct hsi_cl_info *cl_info;
|
|
|
|
cl_info = kcalloc(len, sizeof(*cl_info), GFP_KERNEL);
|
|
if (!cl_info)
|
|
return -ENOMEM;
|
|
|
|
for (; len; len--, info++, cl_info++) {
|
|
cl_info->info = *info;
|
|
list_add_tail(&cl_info->list, &hsi_board_list);
|
|
}
|
|
|
|
return 0;
|
|
}
|