summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPatrick Mochel <mochel@osdl.org>2002-10-29 23:15:24 -0800
committerPatrick Mochel <mochel@osdl.org>2002-10-29 23:15:24 -0800
commit77057f5a28c94d8ed1779b829d9ef0ad0a95db44 (patch)
tree8c67b95e4df549c874512e9979540eb79d806345 /include
parentb835de74036753cf1f2e83f7938d90502213b9cd (diff)
driver model: convert devices to use kobjects and sysfs.
- Define a device subsystem and register it on startup. - Fill it in with fields converted from driverfs-style fields. - Convert device_{create,remove}_file() to create files in sysfs. - Add default device attributes to device subsystem. - Make sure devices get proper kobject familial pointers and that the kobjects are registered.
Diffstat (limited to 'include')
-rw-r--r--include/linux/device.h2
-rw-r--r--include/linux/driverfs_fs.h7
-rw-r--r--include/linux/kobject.h4
-rw-r--r--include/linux/sysfs.h12
4 files changed, 12 insertions, 13 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index 2e0948e96d68..ca7bf83886ed 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -29,6 +29,7 @@
#include <linux/list.h>
#include <linux/sched.h>
#include <linux/driverfs_fs.h>
+#include <linux/kobject.h>
#define DEVICE_NAME_SIZE 80
#define DEVICE_ID_SIZE 32
@@ -275,6 +276,7 @@ struct device {
struct list_head intf_list;
struct device * parent;
+ struct kobject kobj;
char name[DEVICE_NAME_SIZE]; /* descriptive ascii string */
char bus_id[BUS_ID_SIZE]; /* position on parent bus */
diff --git a/include/linux/driverfs_fs.h b/include/linux/driverfs_fs.h
index b4270e947a1e..af7dc715855d 100644
--- a/include/linux/driverfs_fs.h
+++ b/include/linux/driverfs_fs.h
@@ -26,6 +26,8 @@
#ifndef _DRIVER_FS_H_
#define _DRIVER_FS_H_
+#include <linux/sysfs.h>
+
struct driver_dir_entry;
struct attribute;
@@ -43,11 +45,6 @@ struct driver_dir_entry {
struct driverfs_ops * ops;
};
-struct attribute {
- char * name;
- mode_t mode;
-};
-
extern int
driverfs_create_dir(struct driver_dir_entry *, struct driver_dir_entry *);
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index d2f0629a6189..40de16d0a227 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -12,8 +12,10 @@
#include <linux/rwsem.h>
#include <asm/atomic.h>
+#define KOBJ_NAME_LEN 16
+
struct kobject {
- char name[16];
+ char name[KOBJ_NAME_LEN];
atomic_t refcount;
struct list_head entry;
struct kobject * parent;
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 7a46c9f0c308..29c3eb8d2c9e 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -9,20 +9,18 @@
#ifndef _SYSFS_H_
#define _SYSFS_H_
-struct driver_dir_entry;
-struct attribute;
struct kobject;
-struct sysfs_ops {
- ssize_t (*show)(struct kobject *, struct attribute *,char *, size_t, loff_t);
- ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t, loff_t);
-};
-
struct attribute {
char * name;
mode_t mode;
};
+struct sysfs_ops {
+ ssize_t (*show)(struct kobject *, struct attribute *,char *, size_t, loff_t);
+ ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t, loff_t);
+};
+
extern int
sysfs_create_dir(struct kobject *);