diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2011-08-25 05:16:00 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-08-26 14:31:09 -0400 |
commit | 01dcc60a7cb8cd5193676554b94a90d349bdfd15 (patch) | |
tree | b2081df8c0f1b47fa43076522a1fb42de67f1178 /include/linux/platform_device.h | |
parent | b7565fa3a4b84460ce1765cc468700a6bfd82746 (diff) |
new helper to create platform devices with dma mask
compared to the most powerful and already existing helper (namely
platform_device_register_resndata) this allows to specify a dma_mask.
To make eventual extensions later more easy, a struct holding the used
information is created instead of passing the information by function
parameters.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/platform_device.h')
-rw-r--r-- | include/linux/platform_device.h | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 27bb05aae70d..651a066686ac 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h | |||
@@ -49,10 +49,54 @@ extern struct resource *platform_get_resource_byname(struct platform_device *, u | |||
49 | extern int platform_get_irq_byname(struct platform_device *, const char *); | 49 | extern int platform_get_irq_byname(struct platform_device *, const char *); |
50 | extern int platform_add_devices(struct platform_device **, int); | 50 | extern int platform_add_devices(struct platform_device **, int); |
51 | 51 | ||
52 | extern struct platform_device *platform_device_register_resndata( | 52 | struct platform_device_info { |
53 | struct device *parent; | ||
54 | |||
55 | const char *name; | ||
56 | int id; | ||
57 | |||
58 | const struct resource *res; | ||
59 | unsigned int num_res; | ||
60 | |||
61 | const void *data; | ||
62 | size_t size_data; | ||
63 | u64 dma_mask; | ||
64 | }; | ||
65 | extern struct platform_device *platform_device_register_full( | ||
66 | struct platform_device_info *pdevinfo); | ||
67 | |||
68 | /** | ||
69 | * platform_device_register_resndata - add a platform-level device with | ||
70 | * resources and platform-specific data | ||
71 | * | ||
72 | * @parent: parent device for the device we're adding | ||
73 | * @name: base name of the device we're adding | ||
74 | * @id: instance id | ||
75 | * @res: set of resources that needs to be allocated for the device | ||
76 | * @num: number of resources | ||
77 | * @data: platform specific data for this platform device | ||
78 | * @size: size of platform specific data | ||
79 | * | ||
80 | * Returns &struct platform_device pointer on success, or ERR_PTR() on error. | ||
81 | */ | ||
82 | static inline struct platform_device *platform_device_register_resndata( | ||
53 | struct device *parent, const char *name, int id, | 83 | struct device *parent, const char *name, int id, |
54 | const struct resource *res, unsigned int num, | 84 | const struct resource *res, unsigned int num, |
55 | const void *data, size_t size); | 85 | const void *data, size_t size) { |
86 | |||
87 | struct platform_device_info pdevinfo = { | ||
88 | .parent = parent, | ||
89 | .name = name, | ||
90 | .id = id, | ||
91 | .res = res, | ||
92 | .num_res = num, | ||
93 | .data = data, | ||
94 | .size_data = size, | ||
95 | .dma_mask = 0, | ||
96 | }; | ||
97 | |||
98 | return platform_device_register_full(&pdevinfo); | ||
99 | } | ||
56 | 100 | ||
57 | /** | 101 | /** |
58 | * platform_device_register_simple - add a platform-level device and its resources | 102 | * platform_device_register_simple - add a platform-level device and its resources |