aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/platform_device.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/platform_device.h')
-rw-r--r--include/linux/platform_device.h62
1 files changed, 58 insertions, 4 deletions
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 5417944d3687..d7ecad0093bb 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -43,10 +43,64 @@ extern struct resource *platform_get_resource_byname(struct platform_device *, u
43extern int platform_get_irq_byname(struct platform_device *, const char *); 43extern int platform_get_irq_byname(struct platform_device *, const char *);
44extern int platform_add_devices(struct platform_device **, int); 44extern int platform_add_devices(struct platform_device **, int);
45 45
46extern struct platform_device *platform_device_register_simple(const char *, int id, 46extern struct platform_device *platform_device_register_resndata(
47 const struct resource *, unsigned int); 47 struct device *parent, const char *name, int id,
48extern struct platform_device *platform_device_register_data(struct device *, 48 const struct resource *res, unsigned int num,
49 const char *, int, const void *, size_t); 49 const void *data, size_t size);
50
51/**
52 * platform_device_register_simple - add a platform-level device and its resources
53 * @name: base name of the device we're adding
54 * @id: instance id
55 * @res: set of resources that needs to be allocated for the device
56 * @num: number of resources
57 *
58 * This function creates a simple platform device that requires minimal
59 * resource and memory management. Canned release function freeing memory
60 * allocated for the device allows drivers using such devices to be
61 * unloaded without waiting for the last reference to the device to be
62 * dropped.
63 *
64 * This interface is primarily intended for use with legacy drivers which
65 * probe hardware directly. Because such drivers create sysfs device nodes
66 * themselves, rather than letting system infrastructure handle such device
67 * enumeration tasks, they don't fully conform to the Linux driver model.
68 * In particular, when such drivers are built as modules, they can't be
69 * "hotplugged".
70 *
71 * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
72 */
73static inline struct platform_device *platform_device_register_simple(
74 const char *name, int id,
75 const struct resource *res, unsigned int num)
76{
77 return platform_device_register_resndata(NULL, name, id,
78 res, num, NULL, 0);
79}
80
81/**
82 * platform_device_register_data - add a platform-level device with platform-specific data
83 * @parent: parent device for the device we're adding
84 * @name: base name of the device we're adding
85 * @id: instance id
86 * @data: platform specific data for this platform device
87 * @size: size of platform specific data
88 *
89 * This function creates a simple platform device that requires minimal
90 * resource and memory management. Canned release function freeing memory
91 * allocated for the device allows drivers using such devices to be
92 * unloaded without waiting for the last reference to the device to be
93 * dropped.
94 *
95 * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
96 */
97static inline struct platform_device *platform_device_register_data(
98 struct device *parent, const char *name, int id,
99 const void *data, size_t size)
100{
101 return platform_device_register_resndata(parent, name, id,
102 NULL, 0, data, size);
103}
50 104
51extern struct platform_device *platform_device_alloc(const char *name, int id); 105extern struct platform_device *platform_device_alloc(const char *name, int id);
52extern int platform_device_add_resources(struct platform_device *pdev, 106extern int platform_device_add_resources(struct platform_device *pdev,