diff options
Diffstat (limited to 'arch/um/drivers/mmapper_kern.c')
-rw-r--r-- | arch/um/drivers/mmapper_kern.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/arch/um/drivers/mmapper_kern.c b/arch/um/drivers/mmapper_kern.c index a63231dffe05..a37a5ac13c22 100644 --- a/arch/um/drivers/mmapper_kern.c +++ b/arch/um/drivers/mmapper_kern.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/smp_lock.h> | 20 | #include <linux/smp_lock.h> |
21 | #include <linux/miscdevice.h> | ||
21 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
22 | #include <asm/irq.h> | 23 | #include <asm/irq.h> |
23 | #include <asm/pgtable.h> | 24 | #include <asm/pgtable.h> |
@@ -117,24 +118,39 @@ static struct file_operations mmapper_fops = { | |||
117 | .release = mmapper_release, | 118 | .release = mmapper_release, |
118 | }; | 119 | }; |
119 | 120 | ||
121 | static struct miscdevice mmapper_dev = { | ||
122 | .minor = MISC_DYNAMIC_MINOR, | ||
123 | .name = "mmapper", | ||
124 | .fops = &mmapper_fops | ||
125 | }; | ||
126 | |||
120 | static int __init mmapper_init(void) | 127 | static int __init mmapper_init(void) |
121 | { | 128 | { |
129 | int err; | ||
130 | |||
122 | printk(KERN_INFO "Mapper v0.1\n"); | 131 | printk(KERN_INFO "Mapper v0.1\n"); |
123 | 132 | ||
124 | v_buf = (char *) find_iomem("mmapper", &mmapper_size); | 133 | v_buf = (char *) find_iomem("mmapper", &mmapper_size); |
125 | if(mmapper_size == 0){ | 134 | if(mmapper_size == 0){ |
126 | printk(KERN_ERR "mmapper_init - find_iomem failed\n"); | 135 | printk(KERN_ERR "mmapper_init - find_iomem failed\n"); |
127 | return(0); | 136 | goto out; |
128 | } | 137 | } |
129 | 138 | ||
130 | p_buf = __pa(v_buf); | 139 | err = misc_register(&mmapper_dev); |
140 | if(err){ | ||
141 | printk(KERN_ERR "mmapper - misc_register failed, err = %d\n", | ||
142 | err); | ||
143 | goto out; | ||
144 | } | ||
131 | 145 | ||
132 | devfs_mk_cdev(MKDEV(30, 0), S_IFCHR|S_IRUGO|S_IWUGO, "mmapper"); | 146 | p_buf = __pa(v_buf); |
133 | return(0); | 147 | out: |
148 | return 0; | ||
134 | } | 149 | } |
135 | 150 | ||
136 | static void mmapper_exit(void) | 151 | static void mmapper_exit(void) |
137 | { | 152 | { |
153 | misc_deregister(&mmapper_dev); | ||
138 | } | 154 | } |
139 | 155 | ||
140 | module_init(mmapper_init); | 156 | module_init(mmapper_init); |