Linux 4.13.16
[linux/fpc-iii.git] / include / linux / resource_ext.h
blobe2bf63d881d4f77d1bae466e257ea1af6953c905
1 /*
2 * Copyright (C) 2015, Intel Corporation
3 * Author: Jiang Liu <jiang.liu@linux.intel.com>
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
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>
21 /* Represent resource window for bridge devices */
22 struct resource_win {
23 struct resource res; /* In master (CPU) address space */
24 resource_size_t offset; /* Translation offset for bridge */
28 * Common resource list management data structure and interfaces to support
29 * ACPI, PNP and PCI host bridge etc.
31 struct resource_entry {
32 struct list_head node;
33 struct resource *res; /* In master (CPU) address space */
34 resource_size_t offset; /* Translation offset for bridge */
35 struct resource __res; /* Default storage for res */
38 extern struct resource_entry *
39 resource_list_create_entry(struct resource *res, size_t extra_size);
40 extern void resource_list_free(struct list_head *head);
42 static inline void resource_list_add(struct resource_entry *entry,
43 struct list_head *head)
45 list_add(&entry->node, head);
48 static inline void resource_list_add_tail(struct resource_entry *entry,
49 struct list_head *head)
51 list_add_tail(&entry->node, head);
54 static inline void resource_list_del(struct resource_entry *entry)
56 list_del(&entry->node);
59 static inline void resource_list_free_entry(struct resource_entry *entry)
61 kfree(entry);
64 static inline void
65 resource_list_destroy_entry(struct resource_entry *entry)
67 resource_list_del(entry);
68 resource_list_free_entry(entry);
71 #define resource_list_for_each_entry(entry, list) \
72 list_for_each_entry((entry), (list), node)
74 #define resource_list_for_each_entry_safe(entry, tmp, list) \
75 list_for_each_entry_safe((entry), (tmp), (list), node)
77 #endif /* _LINUX_RESOURCE_EXT_H */