summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk.h3
-rw-r--r--block/disk-events.c23
-rw-r--r--block/genhd.c3
3 files changed, 10 insertions, 19 deletions
diff --git a/block/blk.h b/block/blk.h
index f8d726429906..4fcd7a032377 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -364,5 +364,8 @@ void disk_alloc_events(struct gendisk *disk);
void disk_add_events(struct gendisk *disk);
void disk_del_events(struct gendisk *disk);
void disk_release_events(struct gendisk *disk);
+extern struct device_attribute dev_attr_events;
+extern struct device_attribute dev_attr_events_async;
+extern struct device_attribute dev_attr_events_poll_msecs;
#endif /* BLK_INTERNAL_H */
diff --git a/block/disk-events.c b/block/disk-events.c
index 1bc5dcb75e4e..a75931ff5da4 100644
--- a/block/disk-events.c
+++ b/block/disk-events.c
@@ -368,18 +368,10 @@ static ssize_t disk_events_poll_msecs_store(struct device *dev,
return count;
}
-static const DEVICE_ATTR(events, 0444, disk_events_show, NULL);
-static const DEVICE_ATTR(events_async, 0444, disk_events_async_show, NULL);
-static const DEVICE_ATTR(events_poll_msecs, 0644,
- disk_events_poll_msecs_show,
- disk_events_poll_msecs_store);
-
-static const struct attribute *disk_events_attrs[] = {
- &dev_attr_events.attr,
- &dev_attr_events_async.attr,
- &dev_attr_events_poll_msecs.attr,
- NULL,
-};
+DEVICE_ATTR(events, 0444, disk_events_show, NULL);
+DEVICE_ATTR(events_async, 0444, disk_events_async_show, NULL);
+DEVICE_ATTR(events_poll_msecs, 0644, disk_events_poll_msecs_show,
+ disk_events_poll_msecs_store);
/*
* The default polling interval can be specified by the kernel
@@ -444,11 +436,6 @@ void disk_alloc_events(struct gendisk *disk)
void disk_add_events(struct gendisk *disk)
{
- /* FIXME: error handling */
- if (sysfs_create_files(&disk_to_dev(disk)->kobj, disk_events_attrs) < 0)
- pr_warn("%s: failed to create sysfs files for events\n",
- disk->disk_name);
-
if (!disk->ev)
return;
@@ -472,8 +459,6 @@ void disk_del_events(struct gendisk *disk)
list_del_init(&disk->ev->node);
mutex_unlock(&disk_events_mutex);
}
-
- sysfs_remove_files(&disk_to_dev(disk)->kobj, disk_events_attrs);
}
void disk_release_events(struct gendisk *disk)
diff --git a/block/genhd.c b/block/genhd.c
index 4f879deede9a..79aa40b4c39c 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1022,6 +1022,9 @@ static struct attribute *disk_attrs[] = {
&dev_attr_stat.attr,
&dev_attr_inflight.attr,
&dev_attr_badblocks.attr,
+ &dev_attr_events.attr,
+ &dev_attr_events_async.attr,
+ &dev_attr_events_poll_msecs.attr,
#ifdef CONFIG_FAIL_MAKE_REQUEST
&dev_attr_fail.attr,
#endif