summaryrefslogtreecommitdiffstats
path: root/arch/sandbox/board/devices.c
blob: dba0d5d89372989f98abbd454e859c747d6cfac3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
 * Copyright (c) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
 *
 * Under GPLv2 only
 */

#include <common.h>
#include <driver.h>
#include <init.h>

static LIST_HEAD(sandbox_device_list);

int sandbox_add_device(struct device_d *dev)
{
	list_add(&dev->list, &sandbox_device_list);

	return 0;
}

static int sandbox_device_init(void)
{
	struct device_d *dev, *tmp;

	list_for_each_entry_safe(dev, tmp, &sandbox_device_list, list) {
		/* reset the list_head before registering for real */
		dev->list.prev = NULL;
		dev->list.next = NULL;
		register_device(dev);
	}

	return 0;
}
postcore_initcall(sandbox_device_init);