diff options
author | Alan Tull <atull@kernel.org> | 2017-11-15 15:20:21 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-11-28 10:30:38 -0500 |
commit | 59460a9305458ac3e7f2415b602dbaa6cfcb8a3b (patch) | |
tree | eecf8b6625b2543db973642cefedccc8e28dd99f | |
parent | c8898eda81e0b949ca214e1a45ce1b56677eb849 (diff) |
fpga: region: add fpga-region.h header
* Create fpga-region.h.
* Export fpga_region_program_fpga.
* Move struct fpga_region and other things to the header.
This is a step in separating FPGA region common code
from Device Tree support.
Signed-off-by: Alan Tull <atull@kernel.org>
Acked-by: Moritz Fischer <mdf@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/fpga/fpga-region.c | 24 | ||||
-rw-r--r-- | include/linux/fpga/fpga-region.h | 28 |
2 files changed, 32 insertions, 20 deletions
diff --git a/drivers/fpga/fpga-region.c b/drivers/fpga/fpga-region.c index 2a8621db5f5b..402d0b68b97a 100644 --- a/drivers/fpga/fpga-region.c +++ b/drivers/fpga/fpga-region.c | |||
@@ -18,6 +18,7 @@ | |||
18 | 18 | ||
19 | #include <linux/fpga/fpga-bridge.h> | 19 | #include <linux/fpga/fpga-bridge.h> |
20 | #include <linux/fpga/fpga-mgr.h> | 20 | #include <linux/fpga/fpga-mgr.h> |
21 | #include <linux/fpga/fpga-region.h> | ||
21 | #include <linux/idr.h> | 22 | #include <linux/idr.h> |
22 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
23 | #include <linux/list.h> | 24 | #include <linux/list.h> |
@@ -26,24 +27,6 @@ | |||
26 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
27 | #include <linux/spinlock.h> | 28 | #include <linux/spinlock.h> |
28 | 29 | ||
29 | /** | ||
30 | * struct fpga_region - FPGA Region structure | ||
31 | * @dev: FPGA Region device | ||
32 | * @mutex: enforces exclusive reference to region | ||
33 | * @bridge_list: list of FPGA bridges specified in region | ||
34 | * @mgr: FPGA manager | ||
35 | * @info: fpga image specific information | ||
36 | */ | ||
37 | struct fpga_region { | ||
38 | struct device dev; | ||
39 | struct mutex mutex; /* for exclusive reference to region */ | ||
40 | struct list_head bridge_list; | ||
41 | struct fpga_manager *mgr; | ||
42 | struct fpga_image_info *info; | ||
43 | }; | ||
44 | |||
45 | #define to_fpga_region(d) container_of(d, struct fpga_region, dev) | ||
46 | |||
47 | static DEFINE_IDA(fpga_region_ida); | 30 | static DEFINE_IDA(fpga_region_ida); |
48 | static struct class *fpga_region_class; | 31 | static struct class *fpga_region_class; |
49 | 32 | ||
@@ -226,7 +209,7 @@ static int fpga_region_get_bridges(struct fpga_region *region, | |||
226 | * Program an FPGA using fpga image info (region->info). | 209 | * Program an FPGA using fpga image info (region->info). |
227 | * Return 0 for success or negative error code. | 210 | * Return 0 for success or negative error code. |
228 | */ | 211 | */ |
229 | static int fpga_region_program_fpga(struct fpga_region *region) | 212 | int fpga_region_program_fpga(struct fpga_region *region) |
230 | { | 213 | { |
231 | struct device *dev = ®ion->dev; | 214 | struct device *dev = ®ion->dev; |
232 | struct fpga_image_info *info = region->info; | 215 | struct fpga_image_info *info = region->info; |
@@ -282,6 +265,7 @@ err_put_region: | |||
282 | 265 | ||
283 | return ret; | 266 | return ret; |
284 | } | 267 | } |
268 | EXPORT_SYMBOL_GPL(fpga_region_program_fpga); | ||
285 | 269 | ||
286 | /** | 270 | /** |
287 | * child_regions_with_firmware | 271 | * child_regions_with_firmware |
@@ -667,5 +651,5 @@ subsys_initcall(fpga_region_init); | |||
667 | module_exit(fpga_region_exit); | 651 | module_exit(fpga_region_exit); |
668 | 652 | ||
669 | MODULE_DESCRIPTION("FPGA Region"); | 653 | MODULE_DESCRIPTION("FPGA Region"); |
670 | MODULE_AUTHOR("Alan Tull <atull@opensource.altera.com>"); | 654 | MODULE_AUTHOR("Alan Tull <atull@kernel.org>"); |
671 | MODULE_LICENSE("GPL v2"); | 655 | MODULE_LICENSE("GPL v2"); |
diff --git a/include/linux/fpga/fpga-region.h b/include/linux/fpga/fpga-region.h new file mode 100644 index 000000000000..8a355171406b --- /dev/null +++ b/include/linux/fpga/fpga-region.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #ifndef _FPGA_REGION_H | ||
2 | #define _FPGA_REGION_H | ||
3 | |||
4 | #include <linux/device.h> | ||
5 | #include <linux/fpga/fpga-mgr.h> | ||
6 | #include <linux/fpga/fpga-bridge.h> | ||
7 | |||
8 | /** | ||
9 | * struct fpga_region - FPGA Region structure | ||
10 | * @dev: FPGA Region device | ||
11 | * @mutex: enforces exclusive reference to region | ||
12 | * @bridge_list: list of FPGA bridges specified in region | ||
13 | * @mgr: FPGA manager | ||
14 | * @info: FPGA image info | ||
15 | */ | ||
16 | struct fpga_region { | ||
17 | struct device dev; | ||
18 | struct mutex mutex; /* for exclusive reference to region */ | ||
19 | struct list_head bridge_list; | ||
20 | struct fpga_manager *mgr; | ||
21 | struct fpga_image_info *info; | ||
22 | }; | ||
23 | |||
24 | #define to_fpga_region(d) container_of(d, struct fpga_region, dev) | ||
25 | |||
26 | int fpga_region_program_fpga(struct fpga_region *region); | ||
27 | |||
28 | #endif /* _FPGA_REGION_H */ | ||