diff options
Diffstat (limited to 'drivers/mtd/mtdcore.c')
-rw-r--r-- | drivers/mtd/mtdcore.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index fdd6ae859397..bccb4b1ffc46 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c | |||
@@ -48,11 +48,11 @@ static LIST_HEAD(mtd_notifiers); | |||
48 | */ | 48 | */ |
49 | static void mtd_release(struct device *dev) | 49 | static void mtd_release(struct device *dev) |
50 | { | 50 | { |
51 | struct mtd_info *mtd = dev_to_mtd(dev); | 51 | dev_t index = MTD_DEVT(dev_to_mtd(dev)->index); |
52 | 52 | ||
53 | /* remove /dev/mtdXro node if needed */ | 53 | /* remove /dev/mtdXro node if needed */ |
54 | if (MTD_DEVT(mtd->index)) | 54 | if (index) |
55 | device_destroy(mtd_class, MTD_DEVT(mtd->index) + 1); | 55 | device_destroy(mtd_class, index + 1); |
56 | } | 56 | } |
57 | 57 | ||
58 | static ssize_t mtd_type_show(struct device *dev, | 58 | static ssize_t mtd_type_show(struct device *dev, |
@@ -132,6 +132,17 @@ static ssize_t mtd_writesize_show(struct device *dev, | |||
132 | } | 132 | } |
133 | static DEVICE_ATTR(writesize, S_IRUGO, mtd_writesize_show, NULL); | 133 | static DEVICE_ATTR(writesize, S_IRUGO, mtd_writesize_show, NULL); |
134 | 134 | ||
135 | static ssize_t mtd_subpagesize_show(struct device *dev, | ||
136 | struct device_attribute *attr, char *buf) | ||
137 | { | ||
138 | struct mtd_info *mtd = dev_to_mtd(dev); | ||
139 | unsigned int subpagesize = mtd->writesize >> mtd->subpage_sft; | ||
140 | |||
141 | return snprintf(buf, PAGE_SIZE, "%u\n", subpagesize); | ||
142 | |||
143 | } | ||
144 | static DEVICE_ATTR(subpagesize, S_IRUGO, mtd_subpagesize_show, NULL); | ||
145 | |||
135 | static ssize_t mtd_oobsize_show(struct device *dev, | 146 | static ssize_t mtd_oobsize_show(struct device *dev, |
136 | struct device_attribute *attr, char *buf) | 147 | struct device_attribute *attr, char *buf) |
137 | { | 148 | { |
@@ -169,6 +180,7 @@ static struct attribute *mtd_attrs[] = { | |||
169 | &dev_attr_size.attr, | 180 | &dev_attr_size.attr, |
170 | &dev_attr_erasesize.attr, | 181 | &dev_attr_erasesize.attr, |
171 | &dev_attr_writesize.attr, | 182 | &dev_attr_writesize.attr, |
183 | &dev_attr_subpagesize.attr, | ||
172 | &dev_attr_oobsize.attr, | 184 | &dev_attr_oobsize.attr, |
173 | &dev_attr_numeraseregions.attr, | 185 | &dev_attr_numeraseregions.attr, |
174 | &dev_attr_name.attr, | 186 | &dev_attr_name.attr, |