Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[pandora-kernel.git] / drivers / mtd / mtdcore.c
1 /*
2  * Core registration and callback routines for MTD
3  * drivers and users.
4  *
5  * bdi bits are:
6  * Copyright © 2006 Red Hat, Inc. All Rights Reserved.
7  * Written by David Howells (dhowells@redhat.com)
8  */
9
10 #include <linux/module.h>
11 #include <linux/kernel.h>
12 #include <linux/ptrace.h>
13 #include <linux/string.h>
14 #include <linux/timer.h>
15 #include <linux/major.h>
16 #include <linux/fs.h>
17 #include <linux/err.h>
18 #include <linux/ioctl.h>
19 #include <linux/init.h>
20 #include <linux/mtd/compatmac.h>
21 #include <linux/proc_fs.h>
22 #include <linux/idr.h>
23 #include <linux/backing-dev.h>
24
25 #include <linux/mtd/mtd.h>
26
27 #include "mtdcore.h"
28 /*
29  * backing device capabilities for non-mappable devices (such as NAND flash)
30  * - permits private mappings, copies are taken of the data
31  */
32 struct backing_dev_info mtd_bdi_unmappable = {
33         .capabilities   = BDI_CAP_MAP_COPY,
34 };
35
36 /*
37  * backing device capabilities for R/O mappable devices (such as ROM)
38  * - permits private mappings, copies are taken of the data
39  * - permits non-writable shared mappings
40  */
41 struct backing_dev_info mtd_bdi_ro_mappable = {
42         .capabilities   = (BDI_CAP_MAP_COPY | BDI_CAP_MAP_DIRECT |
43                            BDI_CAP_EXEC_MAP | BDI_CAP_READ_MAP),
44 };
45
46 /*
47  * backing device capabilities for writable mappable devices (such as RAM)
48  * - permits private mappings, copies are taken of the data
49  * - permits non-writable shared mappings
50  */
51 struct backing_dev_info mtd_bdi_rw_mappable = {
52         .capabilities   = (BDI_CAP_MAP_COPY | BDI_CAP_MAP_DIRECT |
53                            BDI_CAP_EXEC_MAP | BDI_CAP_READ_MAP |
54                            BDI_CAP_WRITE_MAP),
55 };
56
57 static int mtd_cls_suspend(struct device *dev, pm_message_t state);
58 static int mtd_cls_resume(struct device *dev);
59
60 static struct class mtd_class = {
61         .name = "mtd",
62         .owner = THIS_MODULE,
63         .suspend = mtd_cls_suspend,
64         .resume = mtd_cls_resume,
65 };
66
67 static DEFINE_IDR(mtd_idr);
68
69 /* These are exported solely for the purpose of mtd_blkdevs.c. You
70    should not use them for _anything_ else */
71 DEFINE_MUTEX(mtd_table_mutex);
72 EXPORT_SYMBOL_GPL(mtd_table_mutex);
73
74 struct mtd_info *__mtd_next_device(int i)
75 {
76         return idr_get_next(&mtd_idr, &i);
77 }
78 EXPORT_SYMBOL_GPL(__mtd_next_device);
79
80 static LIST_HEAD(mtd_notifiers);
81
82
83 #if defined(CONFIG_MTD_CHAR) || defined(CONFIG_MTD_CHAR_MODULE)
84 #define MTD_DEVT(index) MKDEV(MTD_CHAR_MAJOR, (index)*2)
85 #else
86 #define MTD_DEVT(index) 0
87 #endif
88
89 /* REVISIT once MTD uses the driver model better, whoever allocates
90  * the mtd_info will probably want to use the release() hook...
91  */
92 static void mtd_release(struct device *dev)
93 {
94         dev_t index = MTD_DEVT(dev_to_mtd(dev)->index);
95
96         /* remove /dev/mtdXro node if needed */
97         if (index)
98                 device_destroy(&mtd_class, index + 1);
99 }
100
101 static int mtd_cls_suspend(struct device *dev, pm_message_t state)
102 {
103         struct mtd_info *mtd = dev_to_mtd(dev);
104
105         if (mtd && mtd->suspend)
106                 return mtd->suspend(mtd);
107         else
108                 return 0;
109 }
110
111 static int mtd_cls_resume(struct device *dev)
112 {
113         struct mtd_info *mtd = dev_to_mtd(dev);
114         
115         if (mtd && mtd->resume)
116                 mtd->resume(mtd);
117         return 0;
118 }
119
120 static ssize_t mtd_type_show(struct device *dev,
121                 struct device_attribute *attr, char *buf)
122 {
123         struct mtd_info *mtd = dev_to_mtd(dev);
124         char *type;
125
126         switch (mtd->type) {
127         case MTD_ABSENT:
128                 type = "absent";
129                 break;
130         case MTD_RAM:
131                 type = "ram";
132                 break;
133         case MTD_ROM:
134                 type = "rom";
135                 break;
136         case MTD_NORFLASH:
137                 type = "nor";
138                 break;
139         case MTD_NANDFLASH:
140                 type = "nand";
141                 break;
142         case MTD_DATAFLASH:
143                 type = "dataflash";
144                 break;
145         case MTD_UBIVOLUME:
146                 type = "ubi";
147                 break;
148         default:
149                 type = "unknown";
150         }
151
152         return snprintf(buf, PAGE_SIZE, "%s\n", type);
153 }
154 static DEVICE_ATTR(type, S_IRUGO, mtd_type_show, NULL);
155
156 static ssize_t mtd_flags_show(struct device *dev,
157                 struct device_attribute *attr, char *buf)
158 {
159         struct mtd_info *mtd = dev_to_mtd(dev);
160
161         return snprintf(buf, PAGE_SIZE, "0x%lx\n", (unsigned long)mtd->flags);
162
163 }
164 static DEVICE_ATTR(flags, S_IRUGO, mtd_flags_show, NULL);
165
166 static ssize_t mtd_size_show(struct device *dev,
167                 struct device_attribute *attr, char *buf)
168 {
169         struct mtd_info *mtd = dev_to_mtd(dev);
170
171         return snprintf(buf, PAGE_SIZE, "%llu\n",
172                 (unsigned long long)mtd->size);
173
174 }
175 static DEVICE_ATTR(size, S_IRUGO, mtd_size_show, NULL);
176
177 static ssize_t mtd_erasesize_show(struct device *dev,
178                 struct device_attribute *attr, char *buf)
179 {
180         struct mtd_info *mtd = dev_to_mtd(dev);
181
182         return snprintf(buf, PAGE_SIZE, "%lu\n", (unsigned long)mtd->erasesize);
183
184 }
185 static DEVICE_ATTR(erasesize, S_IRUGO, mtd_erasesize_show, NULL);
186
187 static ssize_t mtd_writesize_show(struct device *dev,
188                 struct device_attribute *attr, char *buf)
189 {
190         struct mtd_info *mtd = dev_to_mtd(dev);
191
192         return snprintf(buf, PAGE_SIZE, "%lu\n", (unsigned long)mtd->writesize);
193
194 }
195 static DEVICE_ATTR(writesize, S_IRUGO, mtd_writesize_show, NULL);
196
197 static ssize_t mtd_subpagesize_show(struct device *dev,
198                 struct device_attribute *attr, char *buf)
199 {
200         struct mtd_info *mtd = dev_to_mtd(dev);
201         unsigned int subpagesize = mtd->writesize >> mtd->subpage_sft;
202
203         return snprintf(buf, PAGE_SIZE, "%u\n", subpagesize);
204
205 }
206 static DEVICE_ATTR(subpagesize, S_IRUGO, mtd_subpagesize_show, NULL);
207
208 static ssize_t mtd_oobsize_show(struct device *dev,
209                 struct device_attribute *attr, char *buf)
210 {
211         struct mtd_info *mtd = dev_to_mtd(dev);
212
213         return snprintf(buf, PAGE_SIZE, "%lu\n", (unsigned long)mtd->oobsize);
214
215 }
216 static DEVICE_ATTR(oobsize, S_IRUGO, mtd_oobsize_show, NULL);
217
218 static ssize_t mtd_numeraseregions_show(struct device *dev,
219                 struct device_attribute *attr, char *buf)
220 {
221         struct mtd_info *mtd = dev_to_mtd(dev);
222
223         return snprintf(buf, PAGE_SIZE, "%u\n", mtd->numeraseregions);
224
225 }
226 static DEVICE_ATTR(numeraseregions, S_IRUGO, mtd_numeraseregions_show,
227         NULL);
228
229 static ssize_t mtd_name_show(struct device *dev,
230                 struct device_attribute *attr, char *buf)
231 {
232         struct mtd_info *mtd = dev_to_mtd(dev);
233
234         return snprintf(buf, PAGE_SIZE, "%s\n", mtd->name);
235
236 }
237 static DEVICE_ATTR(name, S_IRUGO, mtd_name_show, NULL);
238
239 static struct attribute *mtd_attrs[] = {
240         &dev_attr_type.attr,
241         &dev_attr_flags.attr,
242         &dev_attr_size.attr,
243         &dev_attr_erasesize.attr,
244         &dev_attr_writesize.attr,
245         &dev_attr_subpagesize.attr,
246         &dev_attr_oobsize.attr,
247         &dev_attr_numeraseregions.attr,
248         &dev_attr_name.attr,
249         NULL,
250 };
251
252 static struct attribute_group mtd_group = {
253         .attrs          = mtd_attrs,
254 };
255
256 static const struct attribute_group *mtd_groups[] = {
257         &mtd_group,
258         NULL,
259 };
260
261 static struct device_type mtd_devtype = {
262         .name           = "mtd",
263         .groups         = mtd_groups,
264         .release        = mtd_release,
265 };
266
267 /**
268  *      add_mtd_device - register an MTD device
269  *      @mtd: pointer to new MTD device info structure
270  *
271  *      Add a device to the list of MTD devices present in the system, and
272  *      notify each currently active MTD 'user' of its arrival. Returns
273  *      zero on success or 1 on failure, which currently will only happen
274  *      if there is insufficient memory or a sysfs error.
275  */
276
277 int add_mtd_device(struct mtd_info *mtd)
278 {
279         struct mtd_notifier *not;
280         int i, error;
281
282         if (!mtd->backing_dev_info) {
283                 switch (mtd->type) {
284                 case MTD_RAM:
285                         mtd->backing_dev_info = &mtd_bdi_rw_mappable;
286                         break;
287                 case MTD_ROM:
288                         mtd->backing_dev_info = &mtd_bdi_ro_mappable;
289                         break;
290                 default:
291                         mtd->backing_dev_info = &mtd_bdi_unmappable;
292                         break;
293                 }
294         }
295
296         BUG_ON(mtd->writesize == 0);
297         mutex_lock(&mtd_table_mutex);
298
299         do {
300                 if (!idr_pre_get(&mtd_idr, GFP_KERNEL))
301                         goto fail_locked;
302                 error = idr_get_new(&mtd_idr, mtd, &i);
303         } while (error == -EAGAIN);
304
305         if (error)
306                 goto fail_locked;
307
308         mtd->index = i;
309         mtd->usecount = 0;
310
311         if (is_power_of_2(mtd->erasesize))
312                 mtd->erasesize_shift = ffs(mtd->erasesize) - 1;
313         else
314                 mtd->erasesize_shift = 0;
315
316         if (is_power_of_2(mtd->writesize))
317                 mtd->writesize_shift = ffs(mtd->writesize) - 1;
318         else
319                 mtd->writesize_shift = 0;
320
321         mtd->erasesize_mask = (1 << mtd->erasesize_shift) - 1;
322         mtd->writesize_mask = (1 << mtd->writesize_shift) - 1;
323
324         /* Some chips always power up locked. Unlock them now */
325         if ((mtd->flags & MTD_WRITEABLE)
326             && (mtd->flags & MTD_POWERUP_LOCK) && mtd->unlock) {
327                 if (mtd->unlock(mtd, 0, mtd->size))
328                         printk(KERN_WARNING
329                                "%s: unlock failed, writes may not work\n",
330                                mtd->name);
331         }
332
333         /* Caller should have set dev.parent to match the
334          * physical device.
335          */
336         mtd->dev.type = &mtd_devtype;
337         mtd->dev.class = &mtd_class;
338         mtd->dev.devt = MTD_DEVT(i);
339         dev_set_name(&mtd->dev, "mtd%d", i);
340         dev_set_drvdata(&mtd->dev, mtd);
341         if (device_register(&mtd->dev) != 0)
342                 goto fail_added;
343
344         if (MTD_DEVT(i))
345                 device_create(&mtd_class, mtd->dev.parent,
346                               MTD_DEVT(i) + 1,
347                               NULL, "mtd%dro", i);
348
349         DEBUG(0, "mtd: Giving out device %d to %s\n", i, mtd->name);
350         /* No need to get a refcount on the module containing
351            the notifier, since we hold the mtd_table_mutex */
352         list_for_each_entry(not, &mtd_notifiers, list)
353                 not->add(mtd);
354
355         mutex_unlock(&mtd_table_mutex);
356         /* We _know_ we aren't being removed, because
357            our caller is still holding us here. So none
358            of this try_ nonsense, and no bitching about it
359            either. :) */
360         __module_get(THIS_MODULE);
361         return 0;
362
363 fail_added:
364         idr_remove(&mtd_idr, i);
365 fail_locked:
366         mutex_unlock(&mtd_table_mutex);
367         return 1;
368 }
369
370 /**
371  *      del_mtd_device - unregister an MTD device
372  *      @mtd: pointer to MTD device info structure
373  *
374  *      Remove a device from the list of MTD devices present in the system,
375  *      and notify each currently active MTD 'user' of its departure.
376  *      Returns zero on success or 1 on failure, which currently will happen
377  *      if the requested device does not appear to be present in the list.
378  */
379
380 int del_mtd_device (struct mtd_info *mtd)
381 {
382         int ret;
383         struct mtd_notifier *not;
384
385         mutex_lock(&mtd_table_mutex);
386
387         if (idr_find(&mtd_idr, mtd->index) != mtd) {
388                 ret = -ENODEV;
389                 goto out_error;
390         }
391
392         /* No need to get a refcount on the module containing
393                 the notifier, since we hold the mtd_table_mutex */
394         list_for_each_entry(not, &mtd_notifiers, list)
395                 not->remove(mtd);
396
397         if (mtd->usecount) {
398                 printk(KERN_NOTICE "Removing MTD device #%d (%s) with use count %d\n",
399                        mtd->index, mtd->name, mtd->usecount);
400                 ret = -EBUSY;
401         } else {
402                 device_unregister(&mtd->dev);
403
404                 idr_remove(&mtd_idr, mtd->index);
405
406                 module_put(THIS_MODULE);
407                 ret = 0;
408         }
409
410 out_error:
411         mutex_unlock(&mtd_table_mutex);
412         return ret;
413 }
414
415 /**
416  *      register_mtd_user - register a 'user' of MTD devices.
417  *      @new: pointer to notifier info structure
418  *
419  *      Registers a pair of callbacks function to be called upon addition
420  *      or removal of MTD devices. Causes the 'add' callback to be immediately
421  *      invoked for each MTD device currently present in the system.
422  */
423
424 void register_mtd_user (struct mtd_notifier *new)
425 {
426         struct mtd_info *mtd;
427
428         mutex_lock(&mtd_table_mutex);
429
430         list_add(&new->list, &mtd_notifiers);
431
432         __module_get(THIS_MODULE);
433
434         mtd_for_each_device(mtd)
435                 new->add(mtd);
436
437         mutex_unlock(&mtd_table_mutex);
438 }
439
440 /**
441  *      unregister_mtd_user - unregister a 'user' of MTD devices.
442  *      @old: pointer to notifier info structure
443  *
444  *      Removes a callback function pair from the list of 'users' to be
445  *      notified upon addition or removal of MTD devices. Causes the
446  *      'remove' callback to be immediately invoked for each MTD device
447  *      currently present in the system.
448  */
449
450 int unregister_mtd_user (struct mtd_notifier *old)
451 {
452         struct mtd_info *mtd;
453
454         mutex_lock(&mtd_table_mutex);
455
456         module_put(THIS_MODULE);
457
458         mtd_for_each_device(mtd)
459                 old->remove(mtd);
460
461         list_del(&old->list);
462         mutex_unlock(&mtd_table_mutex);
463         return 0;
464 }
465
466
467 /**
468  *      get_mtd_device - obtain a validated handle for an MTD device
469  *      @mtd: last known address of the required MTD device
470  *      @num: internal device number of the required MTD device
471  *
472  *      Given a number and NULL address, return the num'th entry in the device
473  *      table, if any.  Given an address and num == -1, search the device table
474  *      for a device with that address and return if it's still present. Given
475  *      both, return the num'th driver only if its address matches. Return
476  *      error code if not.
477  */
478
479 struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num)
480 {
481         struct mtd_info *ret = NULL, *other;
482         int err = -ENODEV;
483
484         mutex_lock(&mtd_table_mutex);
485
486         if (num == -1) {
487                 mtd_for_each_device(other) {
488                         if (other == mtd) {
489                                 ret = mtd;
490                                 break;
491                         }
492                 }
493         } else if (num >= 0) {
494                 ret = idr_find(&mtd_idr, num);
495                 if (mtd && mtd != ret)
496                         ret = NULL;
497         }
498
499         if (!ret) {
500                 ret = ERR_PTR(err);
501                 goto out;
502         }
503
504         err = __get_mtd_device(ret);
505         if (err)
506                 ret = ERR_PTR(err);
507 out:
508         mutex_unlock(&mtd_table_mutex);
509         return ret;
510 }
511
512
513 int __get_mtd_device(struct mtd_info *mtd)
514 {
515         int err;
516
517         if (!try_module_get(mtd->owner))
518                 return -ENODEV;
519
520         if (mtd->get_device) {
521
522                 err = mtd->get_device(mtd);
523
524                 if (err) {
525                         module_put(mtd->owner);
526                         return err;
527                 }
528         }
529         mtd->usecount++;
530         return 0;
531 }
532
533 /**
534  *      get_mtd_device_nm - obtain a validated handle for an MTD device by
535  *      device name
536  *      @name: MTD device name to open
537  *
538  *      This function returns MTD device description structure in case of
539  *      success and an error code in case of failure.
540  */
541
542 struct mtd_info *get_mtd_device_nm(const char *name)
543 {
544         int err = -ENODEV;
545         struct mtd_info *mtd = NULL, *other;
546
547         mutex_lock(&mtd_table_mutex);
548
549         mtd_for_each_device(other) {
550                 if (!strcmp(name, other->name)) {
551                         mtd = other;
552                         break;
553                 }
554         }
555
556         if (!mtd)
557                 goto out_unlock;
558
559         if (!try_module_get(mtd->owner))
560                 goto out_unlock;
561
562         if (mtd->get_device) {
563                 err = mtd->get_device(mtd);
564                 if (err)
565                         goto out_put;
566         }
567
568         mtd->usecount++;
569         mutex_unlock(&mtd_table_mutex);
570         return mtd;
571
572 out_put:
573         module_put(mtd->owner);
574 out_unlock:
575         mutex_unlock(&mtd_table_mutex);
576         return ERR_PTR(err);
577 }
578
579 void put_mtd_device(struct mtd_info *mtd)
580 {
581         mutex_lock(&mtd_table_mutex);
582         __put_mtd_device(mtd);
583         mutex_unlock(&mtd_table_mutex);
584
585 }
586
587 void __put_mtd_device(struct mtd_info *mtd)
588 {
589         --mtd->usecount;
590         BUG_ON(mtd->usecount < 0);
591
592         if (mtd->put_device)
593                 mtd->put_device(mtd);
594
595         module_put(mtd->owner);
596 }
597
598 /* default_mtd_writev - default mtd writev method for MTD devices that
599  *                      don't implement their own
600  */
601
602 int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
603                        unsigned long count, loff_t to, size_t *retlen)
604 {
605         unsigned long i;
606         size_t totlen = 0, thislen;
607         int ret = 0;
608
609         if(!mtd->write) {
610                 ret = -EROFS;
611         } else {
612                 for (i=0; i<count; i++) {
613                         if (!vecs[i].iov_len)
614                                 continue;
615                         ret = mtd->write(mtd, to, vecs[i].iov_len, &thislen, vecs[i].iov_base);
616                         totlen += thislen;
617                         if (ret || thislen != vecs[i].iov_len)
618                                 break;
619                         to += vecs[i].iov_len;
620                 }
621         }
622         if (retlen)
623                 *retlen = totlen;
624         return ret;
625 }
626
627 EXPORT_SYMBOL_GPL(add_mtd_device);
628 EXPORT_SYMBOL_GPL(del_mtd_device);
629 EXPORT_SYMBOL_GPL(get_mtd_device);
630 EXPORT_SYMBOL_GPL(get_mtd_device_nm);
631 EXPORT_SYMBOL_GPL(__get_mtd_device);
632 EXPORT_SYMBOL_GPL(put_mtd_device);
633 EXPORT_SYMBOL_GPL(__put_mtd_device);
634 EXPORT_SYMBOL_GPL(register_mtd_user);
635 EXPORT_SYMBOL_GPL(unregister_mtd_user);
636 EXPORT_SYMBOL_GPL(default_mtd_writev);
637
638 #ifdef CONFIG_PROC_FS
639
640 /*====================================================================*/
641 /* Support for /proc/mtd */
642
643 static struct proc_dir_entry *proc_mtd;
644
645 static inline int mtd_proc_info(char *buf, struct mtd_info *this)
646 {
647         return sprintf(buf, "mtd%d: %8.8llx %8.8x \"%s\"\n", this->index,
648                        (unsigned long long)this->size,
649                        this->erasesize, this->name);
650 }
651
652 static int mtd_read_proc (char *page, char **start, off_t off, int count,
653                           int *eof, void *data_unused)
654 {
655         struct mtd_info *mtd;
656         int len, l;
657         off_t   begin = 0;
658
659         mutex_lock(&mtd_table_mutex);
660
661         len = sprintf(page, "dev:    size   erasesize  name\n");
662         mtd_for_each_device(mtd) {
663                 l = mtd_proc_info(page + len, mtd);
664                 len += l;
665                 if (len+begin > off+count)
666                         goto done;
667                 if (len+begin < off) {
668                         begin += len;
669                         len = 0;
670                 }
671         }
672
673         *eof = 1;
674
675 done:
676         mutex_unlock(&mtd_table_mutex);
677         if (off >= len+begin)
678                 return 0;
679         *start = page + (off-begin);
680         return ((count < begin+len-off) ? count : begin+len-off);
681 }
682
683 #endif /* CONFIG_PROC_FS */
684
685 /*====================================================================*/
686 /* Init code */
687
688 static int __init mtd_bdi_init(struct backing_dev_info *bdi, const char *name)
689 {
690         int ret;
691
692         ret = bdi_init(bdi);
693         if (!ret)
694                 ret = bdi_register(bdi, NULL, name);
695
696         if (ret)
697                 bdi_destroy(bdi);
698
699         return ret;
700 }
701
702 static int __init init_mtd(void)
703 {
704         int ret;
705
706         ret = class_register(&mtd_class);
707         if (ret)
708                 goto err_reg;
709
710         ret = mtd_bdi_init(&mtd_bdi_unmappable, "mtd-unmap");
711         if (ret)
712                 goto err_bdi1;
713
714         ret = mtd_bdi_init(&mtd_bdi_ro_mappable, "mtd-romap");
715         if (ret)
716                 goto err_bdi2;
717
718         ret = mtd_bdi_init(&mtd_bdi_rw_mappable, "mtd-rwmap");
719         if (ret)
720                 goto err_bdi3;
721
722 #ifdef CONFIG_PROC_FS
723         if ((proc_mtd = create_proc_entry( "mtd", 0, NULL )))
724                 proc_mtd->read_proc = mtd_read_proc;
725 #endif /* CONFIG_PROC_FS */
726         return 0;
727
728 err_bdi3:
729         bdi_destroy(&mtd_bdi_ro_mappable);
730 err_bdi2:
731         bdi_destroy(&mtd_bdi_unmappable);
732 err_bdi1:
733         class_unregister(&mtd_class);
734 err_reg:
735         pr_err("Error registering mtd class or bdi: %d\n", ret);
736         return ret;
737 }
738
739 static void __exit cleanup_mtd(void)
740 {
741 #ifdef CONFIG_PROC_FS
742         if (proc_mtd)
743                 remove_proc_entry( "mtd", NULL);
744 #endif /* CONFIG_PROC_FS */
745         class_unregister(&mtd_class);
746         bdi_destroy(&mtd_bdi_unmappable);
747         bdi_destroy(&mtd_bdi_ro_mappable);
748         bdi_destroy(&mtd_bdi_rw_mappable);
749 }
750
751 module_init(init_mtd);
752 module_exit(cleanup_mtd);
753
754 MODULE_LICENSE("GPL");
755 MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
756 MODULE_DESCRIPTION("Core MTD registration and access routines");