]> err.no Git - linux-2.6/blobdiff - include/linux/sysdev.h
Pull bugzilla-7570 into release branch
[linux-2.6] / include / linux / sysdev.h
index 2a4b432e117645cf749782a218afc8c32fdf7262..389ccf858d378013f7cc86f94e51db5df46f9991 100644 (file)
@@ -37,11 +37,27 @@ struct sysdev_class {
        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.
  */
@@ -82,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 *);