1 Index: stblinux-2.6.12/drivers/mtd/mtd_blkdevs.c
2 ===================================================================
3 --- stblinux-2.6.12.orig/drivers/mtd/mtd_blkdevs.c 2007-07-26 00:55:00.000000000 +0200
4 +++ stblinux-2.6.12/drivers/mtd/mtd_blkdevs.c 2008-01-16 23:58:30.000000000 +0100
6 #include <linux/init.h>
7 #include <asm/semaphore.h>
8 #include <asm/uaccess.h>
9 +#include <linux/devfs_fs_kernel.h>
11 static LIST_HEAD(blktrans_majors);
14 snprintf(gd->disk_name, sizeof(gd->disk_name),
15 "%s%d", tr->name, new->devnum);
17 + snprintf(gd->devfs_name, sizeof(gd->devfs_name),
18 + "%s/%c", tr->name, (tr->part_bits?'a':'0') + new->devnum);
20 /* 2.5 has capacity in units of 512 bytes while still
21 having BLOCK_SIZE_BITS set to 10. Just to keep us amused. */
22 set_capacity(gd, (new->size * new->blksize) >> 9);
27 + devfs_mk_dir(tr->name);
29 INIT_LIST_HEAD(&tr->devs);
30 list_add(&tr->list, &blktrans_majors);
36 + devfs_remove(tr->name);
37 blk_cleanup_queue(tr->blkcore_priv->rq);
38 unregister_blkdev(tr->major, tr->name);
40 Index: stblinux-2.6.12/drivers/mtd/mtdchar.c
41 ===================================================================
42 --- stblinux-2.6.12.orig/drivers/mtd/mtdchar.c 2008-01-21 01:37:38.000000000 +0100
43 +++ stblinux-2.6.12/drivers/mtd/mtdchar.c 2008-01-21 01:37:40.000000000 +0100
46 static struct class *mtd_class;
48 +#include <linux/devfs_fs_kernel.h>
50 static void mtd_notify_add(struct mtd_info* mtd)
54 MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1),
55 NULL, "mtd%dro", mtd->index);
58 + devfs_mk_cdev(MKDEV(MTD_CHAR_MAJOR, mtd->index*2),
59 + S_IFCHR | S_IRUGO | S_IWUGO, "mtd/%d", mtd->index);
61 + devfs_mk_cdev(MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1),
62 + S_IFCHR | S_IRUGO, "mtd/%dro", mtd->index);
65 static void mtd_notify_remove(struct mtd_info* mtd)
68 class_device_destroy(mtd_class, MKDEV(MTD_CHAR_MAJOR, mtd->index*2));
69 class_device_destroy(mtd_class, MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1));
71 + devfs_remove("mtd/%d", mtd->index);
72 + devfs_remove("mtd/%dro", mtd->index);
75 static struct mtd_notifier notifier = {
77 .remove = mtd_notify_remove,
80 +static inline void mtdchar_devfs_init(void)
82 + devfs_mk_dir("mtd");
85 +static inline void mtdchar_devfs_exit(void)
87 + devfs_remove("mtd");
92 * We use file->private_data to store a pointer to the MTDdevice.
93 * Since alighment is at least 32 bits, we have 2 bits free for OTP
95 return PTR_ERR(mtd_class);
98 + mtdchar_devfs_init();
99 register_mtd_user(¬ifier);
104 unregister_mtd_user(¬ifier);
105 class_destroy(mtd_class);
106 + mtdchar_devfs_exit();
107 unregister_chrdev(MTD_CHAR_MAJOR, "mtd");