spi: use class iteration api
[deliverable/linux.git] / include / linux / device.h
index 2e15822fe40931cb88eb627971f1a5db41f9c892..cdaf57bf4d1992d2602ec3ee32e43544372c4283 100644 (file)
 
 struct device;
 struct device_driver;
+struct driver_private;
 struct class;
 struct class_device;
 struct bus_type;
+struct bus_type_private;
 
 struct bus_attribute {
        struct attribute        attr;
@@ -51,16 +53,6 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
 
 struct bus_type {
        const char              * name;
-       struct module           * owner;
-
-       struct kset             subsys;
-       struct kset             drivers;
-       struct kset             devices;
-       struct klist            klist_devices;
-       struct klist            klist_drivers;
-
-       struct blocking_notifier_head bus_notifier;
-
        struct bus_attribute    * bus_attrs;
        struct device_attribute * dev_attrs;
        struct driver_attribute * drv_attrs;
@@ -76,7 +68,7 @@ struct bus_type {
        int (*resume_early)(struct device * dev);
        int (*resume)(struct device * dev);
 
-       unsigned int drivers_autoprobe:1;
+       struct bus_type_private *p;
 };
 
 extern int __must_check bus_register(struct bus_type * bus);
@@ -118,23 +110,24 @@ extern int bus_unregister_notifier(struct bus_type *bus,
 #define BUS_NOTIFY_UNBIND_DRIVER       0x00000004 /* driver about to be
                                                      unbound */
 
+extern struct kset *bus_get_kset(struct bus_type *bus);
+extern struct klist *bus_get_device_klist(struct bus_type *bus);
+
 struct device_driver {
-       const char              * name;
-       struct bus_type         * bus;
+       const char              *name;
+       struct bus_type         *bus;
 
-       struct kobject          kobj;
-       struct klist            klist_devices;
-       struct klist_node       knode_bus;
-
-       struct module           * owner;
-       const char              * mod_name;     /* used for built-in modules */
-       struct module_kobject   * mkobj;
+       struct module           *owner;
+       const char              *mod_name;      /* used for built-in modules */
 
        int     (*probe)        (struct device * dev);
        int     (*remove)       (struct device * dev);
        void    (*shutdown)     (struct device * dev);
        int     (*suspend)      (struct device * dev, pm_message_t state);
        int     (*resume)       (struct device * dev);
+       struct attribute_group **groups;
+
+       struct driver_private *p;
 };
 
 
@@ -161,6 +154,10 @@ extern int __must_check driver_create_file(struct device_driver *,
                                        struct driver_attribute *);
 extern void driver_remove_file(struct device_driver *, struct driver_attribute *);
 
+extern int __must_check driver_add_kobj(struct device_driver *drv,
+                                       struct kobject *kobj,
+                                       const char *fmt, ...);
+
 extern int __must_check driver_for_each_device(struct device_driver * drv,
                struct device *start, void *data,
                int (*fn)(struct device *, void *));
@@ -180,8 +177,7 @@ struct class {
        struct list_head        devices;
        struct list_head        interfaces;
        struct kset             class_dirs;
-       struct semaphore        sem;    /* locks both the children and interfaces lists */
-
+       struct semaphore        sem; /* locks children, devices, interfaces */
        struct class_attribute          * class_attrs;
        struct class_device_attribute   * class_dev_attrs;
        struct device_attribute         * dev_attrs;
@@ -199,6 +195,12 @@ struct class {
 
 extern int __must_check class_register(struct class *);
 extern void class_unregister(struct class *);
+extern int class_for_each_device(struct class *class, void *data,
+                                int (*fn)(struct device *dev, void *data));
+extern struct device *class_find_device(struct class *class, void *data,
+                                       int (*match)(struct device *, void *));
+extern struct class_device *class_find_child(struct class *class, void *data,
+                                  int (*match)(struct class_device *, void *));
 
 
 struct class_attribute {
@@ -521,6 +523,14 @@ extern struct device *device_create(struct class *cls, struct device *parent,
                                    dev_t devt, const char *fmt, ...)
                                    __attribute__((format(printf,4,5)));
 extern void device_destroy(struct class *cls, dev_t devt);
+#ifdef CONFIG_PM_SLEEP
+extern void destroy_suspended_device(struct class *cls, dev_t devt);
+#else /* !CONFIG_PM_SLEEP */
+static inline void destroy_suspended_device(struct class *cls, dev_t devt)
+{
+       device_destroy(cls, devt);
+}
+#endif /* !CONFIG_PM_SLEEP */
 
 /*
  * Platform "fixup" functions - allow the platform to have their say
@@ -547,16 +557,26 @@ extern void device_shutdown(void);
 /* drivers/base/sys.c */
 extern void sysdev_shutdown(void);
 
-
-/* drivers/base/firmware.c */
-extern int __must_check firmware_register(struct kset *);
-extern void firmware_unregister(struct kset *);
-
 /* debugging and troubleshooting/diagnostic helpers. */
 extern const char *dev_driver_string(struct device *dev);
 #define dev_printk(level, dev, format, arg...) \
        printk(level "%s %s: " format , dev_driver_string(dev) , (dev)->bus_id , ## arg)
 
+#define dev_emerg(dev, format, arg...)         \
+       dev_printk(KERN_EMERG , dev , format , ## arg)
+#define dev_alert(dev, format, arg...)         \
+       dev_printk(KERN_ALERT , dev , format , ## arg)
+#define dev_crit(dev, format, arg...)          \
+       dev_printk(KERN_CRIT , dev , format , ## arg)
+#define dev_err(dev, format, arg...)           \
+       dev_printk(KERN_ERR , dev , format , ## arg)
+#define dev_warn(dev, format, arg...)          \
+       dev_printk(KERN_WARNING , dev , format , ## arg)
+#define dev_notice(dev, format, arg...)                \
+       dev_printk(KERN_NOTICE , dev , format , ## arg)
+#define dev_info(dev, format, arg...)          \
+       dev_printk(KERN_INFO , dev , format , ## arg)
+
 #ifdef DEBUG
 #define dev_dbg(dev, format, arg...)           \
        dev_printk(KERN_DEBUG , dev , format , ## arg)
@@ -578,15 +598,6 @@ dev_vdbg(struct device * dev, const char * fmt, ...)
 }
 #endif
 
-#define dev_err(dev, format, arg...)           \
-       dev_printk(KERN_ERR , dev , format , ## arg)
-#define dev_info(dev, format, arg...)          \
-       dev_printk(KERN_INFO , dev , format , ## arg)
-#define dev_warn(dev, format, arg...)          \
-       dev_printk(KERN_WARNING , dev , format , ## arg)
-#define dev_notice(dev, format, arg...)                \
-       dev_printk(KERN_NOTICE , dev , format , ## arg)
-
 /* Create alias, so I can be autoloaded. */
 #define MODULE_ALIAS_CHARDEV(major,minor) \
        MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
This page took 0.029196 seconds and 5 git commands to generate.