1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef _LINUX_RESOURCE_EXT_H
15#define _LINUX_RESOURCE_EXT_H
16#include <linux/types.h>
17#include <linux/list.h>
18#include <linux/ioport.h>
19#include <linux/slab.h>
20
21
22struct resource_win {
23 struct resource res;
24 resource_size_t offset;
25};
26
27
28
29
30
31struct resource_entry {
32 struct list_head node;
33 struct resource *res;
34 resource_size_t offset;
35 struct resource __res;
36};
37
38extern struct resource_entry *
39resource_list_create_entry(struct resource *res, size_t extra_size);
40extern void resource_list_free(struct list_head *head);
41
42static inline void resource_list_add(struct resource_entry *entry,
43 struct list_head *head)
44{
45 list_add(&entry->node, head);
46}
47
48static inline void resource_list_add_tail(struct resource_entry *entry,
49 struct list_head *head)
50{
51 list_add_tail(&entry->node, head);
52}
53
54static inline void resource_list_del(struct resource_entry *entry)
55{
56 list_del(&entry->node);
57}
58
59static inline void resource_list_free_entry(struct resource_entry *entry)
60{
61 kfree(entry);
62}
63
64static inline void
65resource_list_destroy_entry(struct resource_entry *entry)
66{
67 resource_list_del(entry);
68 resource_list_free_entry(entry);
69}
70
71#define resource_list_for_each_entry(entry, list) \
72 list_for_each_entry((entry), (list), node)
73
74#define resource_list_for_each_entry_safe(entry, tmp, list) \
75 list_for_each_entry_safe((entry), (tmp), (list), node)
76
77#endif
78