]> err.no Git - linux-2.6/blobdiff - include/linux/sysdev.h
m68k: remove unused adb.h
[linux-2.6] / include / linux / sysdev.h
index 635db1df656f3442c07023df76b6c5bc3f180a54..389ccf858d378013f7cc86f94e51db5df46f9991 100644 (file)
@@ -22,6 +22,7 @@
 #define _SYSDEV_H_
 
 #include <linux/kobject.h>
+#include <linux/pm.h>
 
 
 struct sys_device;
@@ -31,16 +32,32 @@ struct sysdev_class {
 
        /* Default operations for these types of devices */
        int     (*shutdown)(struct sys_device *);
-       int     (*suspend)(struct sys_device *, u32 state);
+       int     (*suspend)(struct sys_device *, pm_message_t state);
        int     (*resume)(struct sys_device *);
        struct kset             kset;
 };
 
+struct sysdev_class_attribute {
+       struct attribute attr;
+       ssize_t (*show)(struct sysdev_class *, char *);
+       ssize_t (*store)(struct sysdev_class *, const char *, size_t);
+};
+
+#define SYSDEV_CLASS_ATTR(_name,_mode,_show,_store)            \
+struct sysdev_class_attribute attr_##_name = {                         \
+       .attr = {.name = __stringify(_name), .mode = _mode },   \
+       .show   = _show,                                        \
+       .store  = _store,                                       \
+};
+
 
 extern int sysdev_class_register(struct sysdev_class *);
 extern void sysdev_class_unregister(struct sysdev_class *);
 
-
+extern int sysdev_class_create_file(struct sysdev_class *,
+       struct sysdev_class_attribute *);
+extern void sysdev_class_remove_file(struct sysdev_class *,
+       struct sysdev_class_attribute *);
 /**
  * Auxillary system device drivers.
  */
@@ -50,7 +67,7 @@ struct sysdev_driver {
        int     (*add)(struct sys_device *);
        int     (*remove)(struct sys_device *);
        int     (*shutdown)(struct sys_device *);
-       int     (*suspend)(struct sys_device *, u32 state);
+       int     (*suspend)(struct sys_device *, pm_message_t state);
        int     (*resume)(struct sys_device *);
 };
 
@@ -81,12 +98,16 @@ struct sysdev_attribute {
 };
 
 
-#define SYSDEV_ATTR(_name,_mode,_show,_store)          \
-struct sysdev_attribute attr_##_name = {                       \
-       .attr = {.name = __stringify(_name), .mode = _mode },   \
+#define _SYSDEV_ATTR(_name,_mode,_show,_store)                 \
+{                                                              \
+       .attr = { .name = __stringify(_name), .mode = _mode,    \
+                .owner = THIS_MODULE },                        \
        .show   = _show,                                        \
        .store  = _store,                                       \
-};
+}
+
+#define SYSDEV_ATTR(_name,_mode,_show,_store)          \
+struct sysdev_attribute attr_##_name = _SYSDEV_ATTR(_name,_mode,_show,_store);
 
 extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *);
 extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *);