aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/device.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/device.h')
-rw-r--r--include/linux/device.h26
1 files changed, 16 insertions, 10 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index e8e53b9accc6..1e5f30da98bc 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -11,7 +11,6 @@
11#ifndef _DEVICE_H_ 11#ifndef _DEVICE_H_
12#define _DEVICE_H_ 12#define _DEVICE_H_
13 13
14#include <linux/config.h>
15#include <linux/ioport.h> 14#include <linux/ioport.h>
16#include <linux/kobject.h> 15#include <linux/kobject.h>
17#include <linux/klist.h> 16#include <linux/klist.h>
@@ -61,11 +60,6 @@ extern void bus_unregister(struct bus_type * bus);
61 60
62extern void bus_rescan_devices(struct bus_type * bus); 61extern void bus_rescan_devices(struct bus_type * bus);
63 62
64extern struct bus_type * get_bus(struct bus_type * bus);
65extern void put_bus(struct bus_type * bus);
66
67extern struct bus_type * find_bus(char * name);
68
69/* iterator helpers for buses */ 63/* iterator helpers for buses */
70 64
71int bus_for_each_dev(struct bus_type * bus, struct device * start, void * data, 65int bus_for_each_dev(struct bus_type * bus, struct device * start, void * data,
@@ -148,6 +142,7 @@ struct class {
148 142
149 struct subsystem subsys; 143 struct subsystem subsys;
150 struct list_head children; 144 struct list_head children;
145 struct list_head devices;
151 struct list_head interfaces; 146 struct list_head interfaces;
152 struct semaphore sem; /* locks both the children and interfaces lists */ 147 struct semaphore sem; /* locks both the children and interfaces lists */
153 148
@@ -164,9 +159,6 @@ struct class {
164extern int class_register(struct class *); 159extern int class_register(struct class *);
165extern void class_unregister(struct class *); 160extern void class_unregister(struct class *);
166 161
167extern struct class * class_get(struct class *);
168extern void class_put(struct class *);
169
170 162
171struct class_attribute { 163struct class_attribute {
172 struct attribute attr; 164 struct attribute attr;
@@ -314,6 +306,7 @@ struct device {
314 struct kobject kobj; 306 struct kobject kobj;
315 char bus_id[BUS_ID_SIZE]; /* position on parent bus */ 307 char bus_id[BUS_ID_SIZE]; /* position on parent bus */
316 struct device_attribute uevent_attr; 308 struct device_attribute uevent_attr;
309 struct device_attribute *devt_attr;
317 310
318 struct semaphore sem; /* semaphore to synchronize calls to 311 struct semaphore sem; /* semaphore to synchronize calls to
319 * its driver. 312 * its driver.
@@ -341,6 +334,11 @@ struct device {
341 struct dma_coherent_mem *dma_mem; /* internal for coherent mem 334 struct dma_coherent_mem *dma_mem; /* internal for coherent mem
342 override */ 335 override */
343 336
337 /* class_device migration path */
338 struct list_head node;
339 struct class *class; /* optional*/
340 dev_t devt; /* dev_t, creates the sysfs "dev" */
341
344 void (*release)(struct device * dev); 342 void (*release)(struct device * dev);
345}; 343};
346 344
@@ -382,6 +380,13 @@ extern int device_attach(struct device * dev);
382extern void driver_attach(struct device_driver * drv); 380extern void driver_attach(struct device_driver * drv);
383extern void device_reprobe(struct device *dev); 381extern void device_reprobe(struct device *dev);
384 382
383/*
384 * Easy functions for dynamically creating devices on the fly
385 */
386extern struct device *device_create(struct class *cls, struct device *parent,
387 dev_t devt, char *fmt, ...)
388 __attribute__((format(printf,4,5)));
389extern void device_destroy(struct class *cls, dev_t devt);
385 390
386/* 391/*
387 * Platform "fixup" functions - allow the platform to have their say 392 * Platform "fixup" functions - allow the platform to have their say
@@ -411,8 +416,9 @@ extern int firmware_register(struct subsystem *);
411extern void firmware_unregister(struct subsystem *); 416extern void firmware_unregister(struct subsystem *);
412 417
413/* debugging and troubleshooting/diagnostic helpers. */ 418/* debugging and troubleshooting/diagnostic helpers. */
419extern const char *dev_driver_string(struct device *dev);
414#define dev_printk(level, dev, format, arg...) \ 420#define dev_printk(level, dev, format, arg...) \
415 printk(level "%s %s: " format , (dev)->driver ? (dev)->driver->name : "" , (dev)->bus_id , ## arg) 421 printk(level "%s %s: " format , dev_driver_string(dev) , (dev)->bus_id , ## arg)
416 422
417#ifdef DEBUG 423#ifdef DEBUG
418#define dev_dbg(dev, format, arg...) \ 424#define dev_dbg(dev, format, arg...) \