diff options
| -rw-r--r-- | block/genhd.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/block/genhd.c b/block/genhd.c index 510aac1486cb..9a2d01abfa3b 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
| @@ -1060,8 +1060,19 @@ static struct attribute *disk_attrs[] = { | |||
| 1060 | NULL | 1060 | NULL |
| 1061 | }; | 1061 | }; |
| 1062 | 1062 | ||
| 1063 | static umode_t disk_visible(struct kobject *kobj, struct attribute *a, int n) | ||
| 1064 | { | ||
| 1065 | struct device *dev = container_of(kobj, typeof(*dev), kobj); | ||
| 1066 | struct gendisk *disk = dev_to_disk(dev); | ||
| 1067 | |||
| 1068 | if (a == &dev_attr_badblocks.attr && !disk->bb) | ||
| 1069 | return 0; | ||
| 1070 | return a->mode; | ||
| 1071 | } | ||
| 1072 | |||
| 1063 | static struct attribute_group disk_attr_group = { | 1073 | static struct attribute_group disk_attr_group = { |
| 1064 | .attrs = disk_attrs, | 1074 | .attrs = disk_attrs, |
| 1075 | .is_visible = disk_visible, | ||
| 1065 | }; | 1076 | }; |
| 1066 | 1077 | ||
| 1067 | static const struct attribute_group *disk_attr_groups[] = { | 1078 | static const struct attribute_group *disk_attr_groups[] = { |
