/src/barebox/arch/sandbox/board/devices.c
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> |
3 | | * |
4 | | * Under GPLv2 only |
5 | | */ |
6 | | |
7 | | #include <common.h> |
8 | | #include <driver.h> |
9 | | #include <init.h> |
10 | | #include <mach/linux.h> |
11 | | #include <asm/io.h> |
12 | | |
13 | | static LIST_HEAD(sandbox_device_list); |
14 | | |
15 | | int sandbox_add_device(struct device *dev) |
16 | 32 | { |
17 | 32 | list_add(&dev->list, &sandbox_device_list); |
18 | | |
19 | 32 | return 0; |
20 | 32 | } |
21 | | |
22 | | static int sandbox_device_init(void) |
23 | 32 | { |
24 | 32 | struct device *dev, *tmp; |
25 | | |
26 | 32 | list_for_each_entry_safe(dev, tmp, &sandbox_device_list, list) { |
27 | | /* reset the list_head before registering for real */ |
28 | 32 | dev->list.prev = NULL; |
29 | 32 | dev->list.next = NULL; |
30 | 32 | platform_device_register(dev); |
31 | 32 | } |
32 | | |
33 | 32 | return 0; |
34 | 32 | } |
35 | | postcore_initcall(sandbox_device_init); |