diff options
author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2011-12-29 11:00:29 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-01-09 13:25:57 -0500 |
commit | d5de20a9a1c5ad68c07e017d11f6dbb5e289750c (patch) | |
tree | dd6b80205261e84e2043f169b199081208bfe47d /drivers/mtd | |
parent | 30fa98480b782999248ce8290136aa58f22536cf (diff) |
mtd: kill dev_to_mtd helper
... since it is not needed because the generic 'dev_get_drvdata()' can be
used instead.
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/mtdcore.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 376fbfdb09aa..8bea2d0fdb20 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c | |||
@@ -107,7 +107,8 @@ static LIST_HEAD(mtd_notifiers); | |||
107 | */ | 107 | */ |
108 | static void mtd_release(struct device *dev) | 108 | static void mtd_release(struct device *dev) |
109 | { | 109 | { |
110 | dev_t index = MTD_DEVT(dev_to_mtd(dev)->index); | 110 | struct mtd_info *mtd = dev_get_drvdata(dev); |
111 | dev_t index = MTD_DEVT(mtd->index); | ||
111 | 112 | ||
112 | /* remove /dev/mtdXro node if needed */ | 113 | /* remove /dev/mtdXro node if needed */ |
113 | if (index) | 114 | if (index) |
@@ -116,7 +117,7 @@ static void mtd_release(struct device *dev) | |||
116 | 117 | ||
117 | static int mtd_cls_suspend(struct device *dev, pm_message_t state) | 118 | static int mtd_cls_suspend(struct device *dev, pm_message_t state) |
118 | { | 119 | { |
119 | struct mtd_info *mtd = dev_to_mtd(dev); | 120 | struct mtd_info *mtd = dev_get_drvdata(dev); |
120 | 121 | ||
121 | if (mtd && mtd->suspend) | 122 | if (mtd && mtd->suspend) |
122 | return mtd_suspend(mtd); | 123 | return mtd_suspend(mtd); |
@@ -126,7 +127,7 @@ static int mtd_cls_suspend(struct device *dev, pm_message_t state) | |||
126 | 127 | ||
127 | static int mtd_cls_resume(struct device *dev) | 128 | static int mtd_cls_resume(struct device *dev) |
128 | { | 129 | { |
129 | struct mtd_info *mtd = dev_to_mtd(dev); | 130 | struct mtd_info *mtd = dev_get_drvdata(dev); |
130 | 131 | ||
131 | if (mtd && mtd->resume) | 132 | if (mtd && mtd->resume) |
132 | mtd_resume(mtd); | 133 | mtd_resume(mtd); |
@@ -136,7 +137,7 @@ static int mtd_cls_resume(struct device *dev) | |||
136 | static ssize_t mtd_type_show(struct device *dev, | 137 | static ssize_t mtd_type_show(struct device *dev, |
137 | struct device_attribute *attr, char *buf) | 138 | struct device_attribute *attr, char *buf) |
138 | { | 139 | { |
139 | struct mtd_info *mtd = dev_to_mtd(dev); | 140 | struct mtd_info *mtd = dev_get_drvdata(dev); |
140 | char *type; | 141 | char *type; |
141 | 142 | ||
142 | switch (mtd->type) { | 143 | switch (mtd->type) { |
@@ -172,7 +173,7 @@ static DEVICE_ATTR(type, S_IRUGO, mtd_type_show, NULL); | |||
172 | static ssize_t mtd_flags_show(struct device *dev, | 173 | static ssize_t mtd_flags_show(struct device *dev, |
173 | struct device_attribute *attr, char *buf) | 174 | struct device_attribute *attr, char *buf) |
174 | { | 175 | { |
175 | struct mtd_info *mtd = dev_to_mtd(dev); | 176 | struct mtd_info *mtd = dev_get_drvdata(dev); |
176 | 177 | ||
177 | return snprintf(buf, PAGE_SIZE, "0x%lx\n", (unsigned long)mtd->flags); | 178 | return snprintf(buf, PAGE_SIZE, "0x%lx\n", (unsigned long)mtd->flags); |
178 | 179 | ||
@@ -182,7 +183,7 @@ static DEVICE_ATTR(flags, S_IRUGO, mtd_flags_show, NULL); | |||
182 | static ssize_t mtd_size_show(struct device *dev, | 183 | static ssize_t mtd_size_show(struct device *dev, |
183 | struct device_attribute *attr, char *buf) | 184 | struct device_attribute *attr, char *buf) |
184 | { | 185 | { |
185 | struct mtd_info *mtd = dev_to_mtd(dev); | 186 | struct mtd_info *mtd = dev_get_drvdata(dev); |
186 | 187 | ||
187 | return snprintf(buf, PAGE_SIZE, "%llu\n", | 188 | return snprintf(buf, PAGE_SIZE, "%llu\n", |
188 | (unsigned long long)mtd->size); | 189 | (unsigned long long)mtd->size); |
@@ -193,7 +194,7 @@ static DEVICE_ATTR(size, S_IRUGO, mtd_size_show, NULL); | |||
193 | static ssize_t mtd_erasesize_show(struct device *dev, | 194 | static ssize_t mtd_erasesize_show(struct device *dev, |
194 | struct device_attribute *attr, char *buf) | 195 | struct device_attribute *attr, char *buf) |
195 | { | 196 | { |
196 | struct mtd_info *mtd = dev_to_mtd(dev); | 197 | struct mtd_info *mtd = dev_get_drvdata(dev); |
197 | 198 | ||
198 | return snprintf(buf, PAGE_SIZE, "%lu\n", (unsigned long)mtd->erasesize); | 199 | return snprintf(buf, PAGE_SIZE, "%lu\n", (unsigned long)mtd->erasesize); |
199 | 200 | ||
@@ -203,7 +204,7 @@ static DEVICE_ATTR(erasesize, S_IRUGO, mtd_erasesize_show, NULL); | |||
203 | static ssize_t mtd_writesize_show(struct device *dev, | 204 | static ssize_t mtd_writesize_show(struct device *dev, |
204 | struct device_attribute *attr, char *buf) | 205 | struct device_attribute *attr, char *buf) |
205 | { | 206 | { |
206 | struct mtd_info *mtd = dev_to_mtd(dev); | 207 | struct mtd_info *mtd = dev_get_drvdata(dev); |
207 | 208 | ||
208 | return snprintf(buf, PAGE_SIZE, "%lu\n", (unsigned long)mtd->writesize); | 209 | return snprintf(buf, PAGE_SIZE, "%lu\n", (unsigned long)mtd->writesize); |
209 | 210 | ||
@@ -213,7 +214,7 @@ static DEVICE_ATTR(writesize, S_IRUGO, mtd_writesize_show, NULL); | |||
213 | static ssize_t mtd_subpagesize_show(struct device *dev, | 214 | static ssize_t mtd_subpagesize_show(struct device *dev, |
214 | struct device_attribute *attr, char *buf) | 215 | struct device_attribute *attr, char *buf) |
215 | { | 216 | { |
216 | struct mtd_info *mtd = dev_to_mtd(dev); | 217 | struct mtd_info *mtd = dev_get_drvdata(dev); |
217 | unsigned int subpagesize = mtd->writesize >> mtd->subpage_sft; | 218 | unsigned int subpagesize = mtd->writesize >> mtd->subpage_sft; |
218 | 219 | ||
219 | return snprintf(buf, PAGE_SIZE, "%u\n", subpagesize); | 220 | return snprintf(buf, PAGE_SIZE, "%u\n", subpagesize); |
@@ -224,7 +225,7 @@ static DEVICE_ATTR(subpagesize, S_IRUGO, mtd_subpagesize_show, NULL); | |||
224 | static ssize_t mtd_oobsize_show(struct device *dev, | 225 | static ssize_t mtd_oobsize_show(struct device *dev, |
225 | struct device_attribute *attr, char *buf) | 226 | struct device_attribute *attr, char *buf) |
226 | { | 227 | { |
227 | struct mtd_info *mtd = dev_to_mtd(dev); | 228 | struct mtd_info *mtd = dev_get_drvdata(dev); |
228 | 229 | ||
229 | return snprintf(buf, PAGE_SIZE, "%lu\n", (unsigned long)mtd->oobsize); | 230 | return snprintf(buf, PAGE_SIZE, "%lu\n", (unsigned long)mtd->oobsize); |
230 | 231 | ||
@@ -234,7 +235,7 @@ static DEVICE_ATTR(oobsize, S_IRUGO, mtd_oobsize_show, NULL); | |||
234 | static ssize_t mtd_numeraseregions_show(struct device *dev, | 235 | static ssize_t mtd_numeraseregions_show(struct device *dev, |
235 | struct device_attribute *attr, char *buf) | 236 | struct device_attribute *attr, char *buf) |
236 | { | 237 | { |
237 | struct mtd_info *mtd = dev_to_mtd(dev); | 238 | struct mtd_info *mtd = dev_get_drvdata(dev); |
238 | 239 | ||
239 | return snprintf(buf, PAGE_SIZE, "%u\n", mtd->numeraseregions); | 240 | return snprintf(buf, PAGE_SIZE, "%u\n", mtd->numeraseregions); |
240 | 241 | ||
@@ -245,7 +246,7 @@ static DEVICE_ATTR(numeraseregions, S_IRUGO, mtd_numeraseregions_show, | |||
245 | static ssize_t mtd_name_show(struct device *dev, | 246 | static ssize_t mtd_name_show(struct device *dev, |
246 | struct device_attribute *attr, char *buf) | 247 | struct device_attribute *attr, char *buf) |
247 | { | 248 | { |
248 | struct mtd_info *mtd = dev_to_mtd(dev); | 249 | struct mtd_info *mtd = dev_get_drvdata(dev); |
249 | 250 | ||
250 | return snprintf(buf, PAGE_SIZE, "%s\n", mtd->name); | 251 | return snprintf(buf, PAGE_SIZE, "%s\n", mtd->name); |
251 | 252 | ||