aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/device.h15
-rw-r--r--include/linux/platform_device.h62
-rw-r--r--include/linux/sysfs.h12
3 files changed, 69 insertions, 20 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index 6a8276f683b6..516fecacf27b 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -84,9 +84,8 @@ struct device *bus_find_device_by_name(struct bus_type *bus,
84 struct device *start, 84 struct device *start,
85 const char *name); 85 const char *name);
86 86
87int __must_check bus_for_each_drv(struct bus_type *bus, 87int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
88 struct device_driver *start, void *data, 88 void *data, int (*fn)(struct device_driver *, void *));
89 int (*fn)(struct device_driver *, void *));
90 89
91void bus_sort_breadthfirst(struct bus_type *bus, 90void bus_sort_breadthfirst(struct bus_type *bus,
92 int (*compare)(const struct device *a, 91 int (*compare)(const struct device *a,
@@ -110,10 +109,12 @@ extern int bus_unregister_notifier(struct bus_type *bus,
110 */ 109 */
111#define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */ 110#define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */
112#define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */ 111#define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */
113#define BUS_NOTIFY_BOUND_DRIVER 0x00000003 /* driver bound to device */ 112#define BUS_NOTIFY_BIND_DRIVER 0x00000003 /* driver about to be
114#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be 113 bound */
114#define BUS_NOTIFY_BOUND_DRIVER 0x00000004 /* driver bound to device */
115#define BUS_NOTIFY_UNBIND_DRIVER 0x00000005 /* driver about to be
115 unbound */ 116 unbound */
116#define BUS_NOTIFY_UNBOUND_DRIVER 0x00000005 /* driver is unbound 117#define BUS_NOTIFY_UNBOUND_DRIVER 0x00000006 /* driver is unbound
117 from the device */ 118 from the device */
118 119
119extern struct kset *bus_get_kset(struct bus_type *bus); 120extern struct kset *bus_get_kset(struct bus_type *bus);
@@ -551,7 +552,7 @@ extern int device_for_each_child(struct device *dev, void *data,
551 int (*fn)(struct device *dev, void *data)); 552 int (*fn)(struct device *dev, void *data));
552extern struct device *device_find_child(struct device *dev, void *data, 553extern struct device *device_find_child(struct device *dev, void *data,
553 int (*match)(struct device *dev, void *data)); 554 int (*match)(struct device *dev, void *data));
554extern int device_rename(struct device *dev, char *new_name); 555extern int device_rename(struct device *dev, const char *new_name);
555extern int device_move(struct device *dev, struct device *new_parent, 556extern int device_move(struct device *dev, struct device *new_parent,
556 enum dpm_order dpm_order); 557 enum dpm_order dpm_order);
557extern const char *device_get_devnode(struct device *dev, 558extern const char *device_get_devnode(struct device *dev,
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,
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index f2694eb4dd3d..3c92121ba9af 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -22,14 +22,8 @@ struct kobject;
22struct module; 22struct module;
23enum kobj_ns_type; 23enum kobj_ns_type;
24 24
25/* FIXME
26 * The *owner field is no longer used.
27 * x86 tree has been cleaned up. The owner
28 * attribute is still left for other arches.
29 */
30struct attribute { 25struct attribute {
31 const char *name; 26 const char *name;
32 struct module *owner;
33 mode_t mode; 27 mode_t mode;
34#ifdef CONFIG_DEBUG_LOCK_ALLOC 28#ifdef CONFIG_DEBUG_LOCK_ALLOC
35 struct lock_class_key *key; 29 struct lock_class_key *key;
@@ -136,8 +130,8 @@ int __must_check sysfs_create_file(struct kobject *kobj,
136 const struct attribute *attr); 130 const struct attribute *attr);
137int __must_check sysfs_create_files(struct kobject *kobj, 131int __must_check sysfs_create_files(struct kobject *kobj,
138 const struct attribute **attr); 132 const struct attribute **attr);
139int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, 133int __must_check sysfs_chmod_file(struct kobject *kobj,
140 mode_t mode); 134 const struct attribute *attr, mode_t mode);
141void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); 135void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr);
142void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr); 136void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr);
143 137
@@ -225,7 +219,7 @@ static inline int sysfs_create_files(struct kobject *kobj,
225} 219}
226 220
227static inline int sysfs_chmod_file(struct kobject *kobj, 221static inline int sysfs_chmod_file(struct kobject *kobj,
228 struct attribute *attr, mode_t mode) 222 const struct attribute *attr, mode_t mode)
229{ 223{
230 return 0; 224 return 0;
231} 225}