summaryrefslogtreecommitdiff
path: root/include/linux/device.h
diff options
context:
space:
mode:
authorPatrick Mochel <mochel@osdl.org>2002-08-01 22:18:12 -0700
committerPatrick Mochel <mochel@osdl.org>2002-08-01 22:18:12 -0700
commit9eba2d84e3b815a668cfe421ee86bf51c3793e70 (patch)
treed86f50c5acec2d4dd14397dac067540fbd4410e0 /include/linux/device.h
parent2b553d802fe33fb2276853d1a0c63bb86806dbea (diff)
driverfs: Add ability to create and remove files for bus drivers
These behave identically to device attribute files, but with different types. We get struct bus_attribute, and a macro, BUS_ATTR for declaring attributes. It takes the same parameters as DEVICE_ATTR, though the callbacks for bus attributes take a struct bus_type as the first parameter.
Diffstat (limited to 'include/linux/device.h')
-rw-r--r--include/linux/device.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index 5dfa05c2dd3a..9707eca4331f 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -85,6 +85,24 @@ extern int bus_for_each_drv(struct bus_type * bus, void * data,
int (*callback)(struct device_driver * drv, void * data));
+/* driverfs interface for exporting bus attributes */
+
+struct bus_attribute {
+ struct attribute attr;
+ ssize_t (*show)(struct bus_type *, char * buf, size_t count, loff_t off);
+ ssize_t (*store)(struct bus_type *, const char * buf, size_t count, loff_t off);
+};
+
+#define BUS_ATTR(_name,_str,_mode,_show,_store) \
+struct bus_attribute bus_attr_##_name = { \
+ .attr = {.name = _str, .mode = _mode }, \
+ .show = _show, \
+ .store = _store, \
+};
+
+extern int bus_create_file(struct bus_type *, struct bus_attribute *);
+extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
+
struct device_driver {
char * name;
struct bus_type * bus;