aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/device.h39
-rw-r--r--include/linux/kernel.h8
-rw-r--r--include/linux/klist.h2
-rw-r--r--include/linux/mtd/concat.h2
-rw-r--r--include/linux/pci.h1
-rw-r--r--include/linux/platform_device.h1
-rw-r--r--include/linux/pm.h88
-rw-r--r--include/linux/uio_driver.h30
8 files changed, 89 insertions, 82 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index 1a3686d15f98..7d9da4b4993f 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -28,6 +28,7 @@
28#define BUS_ID_SIZE 20 28#define BUS_ID_SIZE 20
29 29
30struct device; 30struct device;
31struct device_private;
31struct device_driver; 32struct device_driver;
32struct driver_private; 33struct driver_private;
33struct class; 34struct class;
@@ -65,7 +66,7 @@ struct bus_type {
65 int (*resume_early)(struct device *dev); 66 int (*resume_early)(struct device *dev);
66 int (*resume)(struct device *dev); 67 int (*resume)(struct device *dev);
67 68
68 struct pm_ext_ops *pm; 69 struct dev_pm_ops *pm;
69 70
70 struct bus_type_private *p; 71 struct bus_type_private *p;
71}; 72};
@@ -133,7 +134,7 @@ struct device_driver {
133 int (*resume) (struct device *dev); 134 int (*resume) (struct device *dev);
134 struct attribute_group **groups; 135 struct attribute_group **groups;
135 136
136 struct pm_ops *pm; 137 struct dev_pm_ops *pm;
137 138
138 struct driver_private *p; 139 struct driver_private *p;
139}; 140};
@@ -198,7 +199,7 @@ struct class {
198 int (*suspend)(struct device *dev, pm_message_t state); 199 int (*suspend)(struct device *dev, pm_message_t state);
199 int (*resume)(struct device *dev); 200 int (*resume)(struct device *dev);
200 201
201 struct pm_ops *pm; 202 struct dev_pm_ops *pm;
202 struct class_private *p; 203 struct class_private *p;
203}; 204};
204 205
@@ -291,7 +292,7 @@ struct device_type {
291 int (*suspend)(struct device *dev, pm_message_t state); 292 int (*suspend)(struct device *dev, pm_message_t state);
292 int (*resume)(struct device *dev); 293 int (*resume)(struct device *dev);
293 294
294 struct pm_ops *pm; 295 struct dev_pm_ops *pm;
295}; 296};
296 297
297/* interface for exporting device attributes */ 298/* interface for exporting device attributes */
@@ -365,17 +366,15 @@ struct device_dma_parameters {
365}; 366};
366 367
367struct device { 368struct device {
368 struct klist klist_children;
369 struct klist_node knode_parent; /* node in sibling list */
370 struct klist_node knode_driver;
371 struct klist_node knode_bus;
372 struct device *parent; 369 struct device *parent;
373 370
371 struct device_private *p;
372
374 struct kobject kobj; 373 struct kobject kobj;
375 char bus_id[BUS_ID_SIZE]; /* position on parent bus */ 374 char bus_id[BUS_ID_SIZE]; /* position on parent bus */
375 unsigned uevent_suppress:1;
376 const char *init_name; /* initial name of the device */ 376 const char *init_name; /* initial name of the device */
377 struct device_type *type; 377 struct device_type *type;
378 unsigned uevent_suppress:1;
379 378
380 struct semaphore sem; /* semaphore to synchronize calls to 379 struct semaphore sem; /* semaphore to synchronize calls to
381 * its driver. 380 * its driver.
@@ -408,12 +407,13 @@ struct device {
408 /* arch specific additions */ 407 /* arch specific additions */
409 struct dev_archdata archdata; 408 struct dev_archdata archdata;
410 409
410 dev_t devt; /* dev_t, creates the sysfs "dev" */
411
411 spinlock_t devres_lock; 412 spinlock_t devres_lock;
412 struct list_head devres_head; 413 struct list_head devres_head;
413 414
414 struct klist_node knode_class; 415 struct klist_node knode_class;
415 struct class *class; 416 struct class *class;
416 dev_t devt; /* dev_t, creates the sysfs "dev" */
417 struct attribute_group **groups; /* optional groups */ 417 struct attribute_group **groups; /* optional groups */
418 418
419 void (*release)(struct device *dev); 419 void (*release)(struct device *dev);
@@ -483,6 +483,17 @@ extern int device_rename(struct device *dev, char *new_name);
483extern int device_move(struct device *dev, struct device *new_parent); 483extern int device_move(struct device *dev, struct device *new_parent);
484 484
485/* 485/*
486 * Root device objects for grouping under /sys/devices
487 */
488extern struct device *__root_device_register(const char *name,
489 struct module *owner);
490static inline struct device *root_device_register(const char *name)
491{
492 return __root_device_register(name, THIS_MODULE);
493}
494extern void root_device_unregister(struct device *root);
495
496/*
486 * Manual binding of a device to driver. See drivers/base/bus.c 497 * Manual binding of a device to driver. See drivers/base/bus.c
487 * for information on use. 498 * for information on use.
488 */ 499 */
@@ -553,13 +564,13 @@ extern const char *dev_driver_string(const struct device *dev);
553#define dev_info(dev, format, arg...) \ 564#define dev_info(dev, format, arg...) \
554 dev_printk(KERN_INFO , dev , format , ## arg) 565 dev_printk(KERN_INFO , dev , format , ## arg)
555 566
556#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG) 567#if defined(DEBUG)
568#define dev_dbg(dev, format, arg...) \
569 dev_printk(KERN_DEBUG , dev , format , ## arg)
570#elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
557#define dev_dbg(dev, format, ...) do { \ 571#define dev_dbg(dev, format, ...) do { \
558 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ 572 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
559 } while (0) 573 } while (0)
560#elif defined(DEBUG)
561#define dev_dbg(dev, format, arg...) \
562 dev_printk(KERN_DEBUG , dev , format , ## arg)
563#else 574#else
564#define dev_dbg(dev, format, arg...) \ 575#define dev_dbg(dev, format, arg...) \
565 ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; }) 576 ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 721984844c94..6b8e2027165e 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -355,13 +355,13 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
355 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) 355 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
356 356
357/* If you are writing a driver, please use dev_dbg instead */ 357/* If you are writing a driver, please use dev_dbg instead */
358#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG) 358#if defined(DEBUG)
359#define pr_debug(fmt, ...) \
360 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
361#elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
359#define pr_debug(fmt, ...) do { \ 362#define pr_debug(fmt, ...) do { \
360 dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \ 363 dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \
361 } while (0) 364 } while (0)
362#elif defined(DEBUG)
363#define pr_debug(fmt, ...) \
364 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
365#else 365#else
366#define pr_debug(fmt, ...) \ 366#define pr_debug(fmt, ...) \
367 ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; }) 367 ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
diff --git a/include/linux/klist.h b/include/linux/klist.h
index 8ea98db223e5..d5a27af9dba5 100644
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -13,7 +13,6 @@
13#define _LINUX_KLIST_H 13#define _LINUX_KLIST_H
14 14
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16#include <linux/completion.h>
17#include <linux/kref.h> 16#include <linux/kref.h>
18#include <linux/list.h> 17#include <linux/list.h>
19 18
@@ -41,7 +40,6 @@ struct klist_node {
41 void *n_klist; /* never access directly */ 40 void *n_klist; /* never access directly */
42 struct list_head n_node; 41 struct list_head n_node;
43 struct kref n_ref; 42 struct kref n_ref;
44 struct completion n_removed;
45}; 43};
46 44
47extern void klist_add_tail(struct klist_node *n, struct klist *k); 45extern void klist_add_tail(struct klist_node *n, struct klist *k);
diff --git a/include/linux/mtd/concat.h b/include/linux/mtd/concat.h
index c02f3d264ecf..e80c674daeb3 100644
--- a/include/linux/mtd/concat.h
+++ b/include/linux/mtd/concat.h
@@ -13,7 +13,7 @@
13struct mtd_info *mtd_concat_create( 13struct mtd_info *mtd_concat_create(
14 struct mtd_info *subdev[], /* subdevices to concatenate */ 14 struct mtd_info *subdev[], /* subdevices to concatenate */
15 int num_devs, /* number of subdevices */ 15 int num_devs, /* number of subdevices */
16 char *name); /* name for the new device */ 16 const char *name); /* name for the new device */
17 17
18void mtd_concat_destroy(struct mtd_info *mtd); 18void mtd_concat_destroy(struct mtd_info *mtd);
19 19
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 03b0b8c3c81b..4bb156ba854a 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -421,7 +421,6 @@ struct pci_driver {
421 int (*resume_early) (struct pci_dev *dev); 421 int (*resume_early) (struct pci_dev *dev);
422 int (*resume) (struct pci_dev *dev); /* Device woken up */ 422 int (*resume) (struct pci_dev *dev); /* Device woken up */
423 void (*shutdown) (struct pci_dev *dev); 423 void (*shutdown) (struct pci_dev *dev);
424 struct pm_ext_ops *pm;
425 struct pci_error_handlers *err_handler; 424 struct pci_error_handlers *err_handler;
426 struct device_driver driver; 425 struct device_driver driver;
427 struct pci_dynids dynids; 426 struct pci_dynids dynids;
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 4b8cc6a32479..9a342699c607 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -55,7 +55,6 @@ struct platform_driver {
55 int (*suspend_late)(struct platform_device *, pm_message_t state); 55 int (*suspend_late)(struct platform_device *, pm_message_t state);
56 int (*resume_early)(struct platform_device *); 56 int (*resume_early)(struct platform_device *);
57 int (*resume)(struct platform_device *); 57 int (*resume)(struct platform_device *);
58 struct pm_ext_ops *pm;
59 struct device_driver driver; 58 struct device_driver driver;
60}; 59};
61 60
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 42de4003c4ee..de2e0a8f6728 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -41,7 +41,7 @@ typedef struct pm_message {
41} pm_message_t; 41} pm_message_t;
42 42
43/** 43/**
44 * struct pm_ops - device PM callbacks 44 * struct dev_pm_ops - device PM callbacks
45 * 45 *
46 * Several driver power state transitions are externally visible, affecting 46 * Several driver power state transitions are externally visible, affecting
47 * the state of pending I/O queues and (for drivers that touch hardware) 47 * the state of pending I/O queues and (for drivers that touch hardware)
@@ -126,46 +126,6 @@ typedef struct pm_message {
126 * On most platforms, there are no restrictions on availability of 126 * On most platforms, there are no restrictions on availability of
127 * resources like clocks during @restore(). 127 * resources like clocks during @restore().
128 * 128 *
129 * All of the above callbacks, except for @complete(), return error codes.
130 * However, the error codes returned by the resume operations, @resume(),
131 * @thaw(), and @restore(), do not cause the PM core to abort the resume
132 * transition during which they are returned. The error codes returned in
133 * that cases are only printed by the PM core to the system logs for debugging
134 * purposes. Still, it is recommended that drivers only return error codes
135 * from their resume methods in case of an unrecoverable failure (i.e. when the
136 * device being handled refuses to resume and becomes unusable) to allow us to
137 * modify the PM core in the future, so that it can avoid attempting to handle
138 * devices that failed to resume and their children.
139 *
140 * It is allowed to unregister devices while the above callbacks are being
141 * executed. However, it is not allowed to unregister a device from within any
142 * of its own callbacks.
143 */
144
145struct pm_ops {
146 int (*prepare)(struct device *dev);
147 void (*complete)(struct device *dev);
148 int (*suspend)(struct device *dev);
149 int (*resume)(struct device *dev);
150 int (*freeze)(struct device *dev);
151 int (*thaw)(struct device *dev);
152 int (*poweroff)(struct device *dev);
153 int (*restore)(struct device *dev);
154};
155
156/**
157 * struct pm_ext_ops - extended device PM callbacks
158 *
159 * Some devices require certain operations related to suspend and hibernation
160 * to be carried out with interrupts disabled. Thus, 'struct pm_ext_ops' below
161 * is defined, adding callbacks to be executed with interrupts disabled to
162 * 'struct pm_ops'.
163 *
164 * The following callbacks included in 'struct pm_ext_ops' are executed with
165 * the nonboot CPUs switched off and with interrupts disabled on the only
166 * functional CPU. They also are executed with the PM core list of devices
167 * locked, so they must NOT unregister any devices.
168 *
169 * @suspend_noirq: Complete the operations of ->suspend() by carrying out any 129 * @suspend_noirq: Complete the operations of ->suspend() by carrying out any
170 * actions required for suspending the device that need interrupts to be 130 * actions required for suspending the device that need interrupts to be
171 * disabled 131 * disabled
@@ -190,18 +150,32 @@ struct pm_ops {
190 * actions required for restoring the operations of the device that need 150 * actions required for restoring the operations of the device that need
191 * interrupts to be disabled 151 * interrupts to be disabled
192 * 152 *
193 * All of the above callbacks return error codes, but the error codes returned 153 * All of the above callbacks, except for @complete(), return error codes.
194 * by the resume operations, @resume_noirq(), @thaw_noirq(), and 154 * However, the error codes returned by the resume operations, @resume(),
195 * @restore_noirq(), do not cause the PM core to abort the resume transition 155 * @thaw(), @restore(), @resume_noirq(), @thaw_noirq(), and @restore_noirq() do
196 * during which they are returned. The error codes returned in that cases are 156 * not cause the PM core to abort the resume transition during which they are
197 * only printed by the PM core to the system logs for debugging purposes. 157 * returned. The error codes returned in that cases are only printed by the PM
198 * Still, as stated above, it is recommended that drivers only return error 158 * core to the system logs for debugging purposes. Still, it is recommended
199 * codes from their resume methods if the device being handled fails to resume 159 * that drivers only return error codes from their resume methods in case of an
200 * and is not usable any more. 160 * unrecoverable failure (i.e. when the device being handled refuses to resume
161 * and becomes unusable) to allow us to modify the PM core in the future, so
162 * that it can avoid attempting to handle devices that failed to resume and
163 * their children.
164 *
165 * It is allowed to unregister devices while the above callbacks are being
166 * executed. However, it is not allowed to unregister a device from within any
167 * of its own callbacks.
201 */ 168 */
202 169
203struct pm_ext_ops { 170struct dev_pm_ops {
204 struct pm_ops base; 171 int (*prepare)(struct device *dev);
172 void (*complete)(struct device *dev);
173 int (*suspend)(struct device *dev);
174 int (*resume)(struct device *dev);
175 int (*freeze)(struct device *dev);
176 int (*thaw)(struct device *dev);
177 int (*poweroff)(struct device *dev);
178 int (*restore)(struct device *dev);
205 int (*suspend_noirq)(struct device *dev); 179 int (*suspend_noirq)(struct device *dev);
206 int (*resume_noirq)(struct device *dev); 180 int (*resume_noirq)(struct device *dev);
207 int (*freeze_noirq)(struct device *dev); 181 int (*freeze_noirq)(struct device *dev);
@@ -278,7 +252,7 @@ struct pm_ext_ops {
278#define PM_EVENT_SLEEP (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE) 252#define PM_EVENT_SLEEP (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE)
279#define PM_EVENT_USER_SUSPEND (PM_EVENT_USER | PM_EVENT_SUSPEND) 253#define PM_EVENT_USER_SUSPEND (PM_EVENT_USER | PM_EVENT_SUSPEND)
280#define PM_EVENT_USER_RESUME (PM_EVENT_USER | PM_EVENT_RESUME) 254#define PM_EVENT_USER_RESUME (PM_EVENT_USER | PM_EVENT_RESUME)
281#define PM_EVENT_REMOTE_WAKEUP (PM_EVENT_REMOTE | PM_EVENT_RESUME) 255#define PM_EVENT_REMOTE_RESUME (PM_EVENT_REMOTE | PM_EVENT_RESUME)
282#define PM_EVENT_AUTO_SUSPEND (PM_EVENT_AUTO | PM_EVENT_SUSPEND) 256#define PM_EVENT_AUTO_SUSPEND (PM_EVENT_AUTO | PM_EVENT_SUSPEND)
283#define PM_EVENT_AUTO_RESUME (PM_EVENT_AUTO | PM_EVENT_RESUME) 257#define PM_EVENT_AUTO_RESUME (PM_EVENT_AUTO | PM_EVENT_RESUME)
284 258
@@ -291,15 +265,15 @@ struct pm_ext_ops {
291#define PMSG_THAW ((struct pm_message){ .event = PM_EVENT_THAW, }) 265#define PMSG_THAW ((struct pm_message){ .event = PM_EVENT_THAW, })
292#define PMSG_RESTORE ((struct pm_message){ .event = PM_EVENT_RESTORE, }) 266#define PMSG_RESTORE ((struct pm_message){ .event = PM_EVENT_RESTORE, })
293#define PMSG_RECOVER ((struct pm_message){ .event = PM_EVENT_RECOVER, }) 267#define PMSG_RECOVER ((struct pm_message){ .event = PM_EVENT_RECOVER, })
294#define PMSG_USER_SUSPEND ((struct pm_messge) \ 268#define PMSG_USER_SUSPEND ((struct pm_message) \
295 { .event = PM_EVENT_USER_SUSPEND, }) 269 { .event = PM_EVENT_USER_SUSPEND, })
296#define PMSG_USER_RESUME ((struct pm_messge) \ 270#define PMSG_USER_RESUME ((struct pm_message) \
297 { .event = PM_EVENT_USER_RESUME, }) 271 { .event = PM_EVENT_USER_RESUME, })
298#define PMSG_REMOTE_RESUME ((struct pm_messge) \ 272#define PMSG_REMOTE_RESUME ((struct pm_message) \
299 { .event = PM_EVENT_REMOTE_RESUME, }) 273 { .event = PM_EVENT_REMOTE_RESUME, })
300#define PMSG_AUTO_SUSPEND ((struct pm_messge) \ 274#define PMSG_AUTO_SUSPEND ((struct pm_message) \
301 { .event = PM_EVENT_AUTO_SUSPEND, }) 275 { .event = PM_EVENT_AUTO_SUSPEND, })
302#define PMSG_AUTO_RESUME ((struct pm_messge) \ 276#define PMSG_AUTO_RESUME ((struct pm_message) \
303 { .event = PM_EVENT_AUTO_RESUME, }) 277 { .event = PM_EVENT_AUTO_RESUME, })
304 278
305/** 279/**
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index cdf338d94b7f..a0bb6bd2e5c1 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -38,6 +38,24 @@ struct uio_mem {
38 38
39#define MAX_UIO_MAPS 5 39#define MAX_UIO_MAPS 5
40 40
41struct uio_portio;
42
43/**
44 * struct uio_port - description of a UIO port region
45 * @start: start of port region
46 * @size: size of port region
47 * @porttype: type of port (see UIO_PORT_* below)
48 * @portio: for use by the UIO core only.
49 */
50struct uio_port {
51 unsigned long start;
52 unsigned long size;
53 int porttype;
54 struct uio_portio *portio;
55};
56
57#define MAX_UIO_PORT_REGIONS 5
58
41struct uio_device; 59struct uio_device;
42 60
43/** 61/**
@@ -46,6 +64,7 @@ struct uio_device;
46 * @name: device name 64 * @name: device name
47 * @version: device driver version 65 * @version: device driver version
48 * @mem: list of mappable memory regions, size==0 for end of list 66 * @mem: list of mappable memory regions, size==0 for end of list
67 * @port: list of port regions, size==0 for end of list
49 * @irq: interrupt number or UIO_IRQ_CUSTOM 68 * @irq: interrupt number or UIO_IRQ_CUSTOM
50 * @irq_flags: flags for request_irq() 69 * @irq_flags: flags for request_irq()
51 * @priv: optional private data 70 * @priv: optional private data
@@ -57,9 +76,10 @@ struct uio_device;
57 */ 76 */
58struct uio_info { 77struct uio_info {
59 struct uio_device *uio_dev; 78 struct uio_device *uio_dev;
60 char *name; 79 const char *name;
61 char *version; 80 const char *version;
62 struct uio_mem mem[MAX_UIO_MAPS]; 81 struct uio_mem mem[MAX_UIO_MAPS];
82 struct uio_port port[MAX_UIO_PORT_REGIONS];
63 long irq; 83 long irq;
64 unsigned long irq_flags; 84 unsigned long irq_flags;
65 void *priv; 85 void *priv;
@@ -92,4 +112,10 @@ extern void uio_event_notify(struct uio_info *info);
92#define UIO_MEM_LOGICAL 2 112#define UIO_MEM_LOGICAL 2
93#define UIO_MEM_VIRTUAL 3 113#define UIO_MEM_VIRTUAL 3
94 114
115/* defines for uio_port->porttype */
116#define UIO_PORT_NONE 0
117#define UIO_PORT_X86 1
118#define UIO_PORT_GPIO 2
119#define UIO_PORT_OTHER 3
120
95#endif /* _LINUX_UIO_DRIVER_H_ */ 121#endif /* _LINUX_UIO_DRIVER_H_ */