diff options
author | Paul Mundt <lethal@linux-sh.org> | 2009-12-21 15:44:34 +0900 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-12-21 15:44:34 +0900 |
commit | 4b4f887fb2780e39383c1f202b72f5a2780b2d4c (patch) | |
tree | e790d89c2612d2464ac00063dac677653f4ac9cb /arch/um/drivers | |
parent | 6424db52e24e8cdf89917fa3c10395116440160e (diff) | |
parent | 76e7461a21dfe13565b2a323b53c8cc963541126 (diff) | |
download | op-kernel-dev-4b4f887fb2780e39383c1f202b72f5a2780b2d4c.zip op-kernel-dev-4b4f887fb2780e39383c1f202b72f5a2780b2d4c.tar.gz |
Merge branch 'master' into sh/hw-breakpoints
Diffstat (limited to 'arch/um/drivers')
-rw-r--r-- | arch/um/drivers/mconsole_kern.c | 30 | ||||
-rw-r--r-- | arch/um/drivers/mmapper_kern.c | 11 | ||||
-rw-r--r-- | arch/um/drivers/random.c | 3 | ||||
-rw-r--r-- | arch/um/drivers/ubd_kern.c | 36 |
4 files changed, 37 insertions, 43 deletions
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c index e14629c..5106924 100644 --- a/arch/um/drivers/mconsole_kern.c +++ b/arch/um/drivers/mconsole_kern.c @@ -6,6 +6,7 @@ #include <linux/console.h> #include <linux/ctype.h> +#include <linux/string.h> #include <linux/interrupt.h> #include <linux/list.h> #include <linux/mm.h> @@ -131,7 +132,7 @@ void mconsole_proc(struct mc_request *req) char *ptr = req->request.data, *buf; ptr += strlen("proc"); - while (isspace(*ptr)) ptr++; + ptr = skip_spaces(ptr); proc = get_fs_type("proc"); if (proc == NULL) { @@ -212,8 +213,7 @@ void mconsole_proc(struct mc_request *req) char *ptr = req->request.data; ptr += strlen("proc"); - while (isspace(*ptr)) - ptr++; + ptr = skip_spaces(ptr); snprintf(path, sizeof(path), "/proc/%s", ptr); fd = sys_open(path, 0, 0); @@ -560,8 +560,7 @@ void mconsole_config(struct mc_request *req) int err; ptr += strlen("config"); - while (isspace(*ptr)) - ptr++; + ptr = skip_spaces(ptr); dev = mconsole_find_dev(ptr); if (dev == NULL) { mconsole_reply(req, "Bad configuration option", 1, 0); @@ -588,7 +587,7 @@ void mconsole_remove(struct mc_request *req) int err, start, end, n; ptr += strlen("remove"); - while (isspace(*ptr)) ptr++; + ptr = skip_spaces(ptr); dev = mconsole_find_dev(ptr); if (dev == NULL) { mconsole_reply(req, "Bad remove option", 1, 0); @@ -712,7 +711,7 @@ void mconsole_sysrq(struct mc_request *req) char *ptr = req->request.data; ptr += strlen("sysrq"); - while (isspace(*ptr)) ptr++; + ptr = skip_spaces(ptr); /* * With 'b', the system will shut down without a chance to reply, @@ -757,8 +756,7 @@ void mconsole_stack(struct mc_request *req) */ ptr += strlen("stack"); - while (isspace(*ptr)) - ptr++; + ptr = skip_spaces(ptr); /* * Should really check for multiple pids or reject bad args here @@ -833,8 +831,8 @@ static int __init mconsole_init(void) __initcall(mconsole_init); -static int write_proc_mconsole(struct file *file, const char __user *buffer, - unsigned long count, void *data) +static ssize_t mconsole_proc_write(struct file *file, + const char __user *buffer, size_t count, loff_t *pos) { char *buf; @@ -855,6 +853,11 @@ static int write_proc_mconsole(struct file *file, const char __user *buffer, return count; } +static const struct file_operations mconsole_proc_fops = { + .owner = THIS_MODULE, + .write = mconsole_proc_write, +}; + static int create_proc_mconsole(void) { struct proc_dir_entry *ent; @@ -862,15 +865,12 @@ static int create_proc_mconsole(void) if (notify_socket == NULL) return 0; - ent = create_proc_entry("mconsole", S_IFREG | 0200, NULL); + ent = proc_create("mconsole", 0200, NULL, &mconsole_proc_fops); if (ent == NULL) { printk(KERN_INFO "create_proc_mconsole : create_proc_entry " "failed\n"); return 0; } - - ent->read_proc = NULL; - ent->write_proc = write_proc_mconsole; return 0; } diff --git a/arch/um/drivers/mmapper_kern.c b/arch/um/drivers/mmapper_kern.c index eb24032..d22f9e5 100644 --- a/arch/um/drivers/mmapper_kern.c +++ b/arch/um/drivers/mmapper_kern.c @@ -16,7 +16,7 @@ #include <linux/miscdevice.h> #include <linux/module.h> #include <linux/mm.h> -#include <linux/smp_lock.h> + #include <asm/uaccess.h> #include "mem_user.h" @@ -78,7 +78,6 @@ out: static int mmapper_open(struct inode *inode, struct file *file) { - cycle_kernel_lock(); return 0; } @@ -115,18 +114,16 @@ static int __init mmapper_init(void) v_buf = (char *) find_iomem("mmapper", &mmapper_size); if (mmapper_size == 0) { printk(KERN_ERR "mmapper_init - find_iomem failed\n"); - goto out; + return -ENODEV; } + p_buf = __pa(v_buf); err = misc_register(&mmapper_dev); if (err) { printk(KERN_ERR "mmapper - misc_register failed, err = %d\n", err); - goto out; + return err;; } - - p_buf = __pa(v_buf); -out: return 0; } diff --git a/arch/um/drivers/random.c b/arch/um/drivers/random.c index 6eabb70..4949044 100644 --- a/arch/um/drivers/random.c +++ b/arch/um/drivers/random.c @@ -7,7 +7,6 @@ * of the GNU General Public License, incorporated herein by reference. */ #include <linux/sched.h> -#include <linux/smp_lock.h> #include <linux/module.h> #include <linux/fs.h> #include <linux/interrupt.h> @@ -34,8 +33,6 @@ static DECLARE_WAIT_QUEUE_HEAD(host_read_wait); static int rng_dev_open (struct inode *inode, struct file *filp) { - cycle_kernel_lock(); - /* enforce read-only access to this chrdev */ if ((filp->f_mode & FMODE_READ) == 0) return -EINVAL; diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 635d16d..5ff5546 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c @@ -27,6 +27,7 @@ #include "linux/init.h" #include "linux/cdrom.h" #include "linux/proc_fs.h" +#include "linux/seq_file.h" #include "linux/ctype.h" #include "linux/capability.h" #include "linux/mm.h" @@ -200,23 +201,25 @@ static void make_proc_ide(void) proc_ide = proc_mkdir("ide0", proc_ide_root); } -static int proc_ide_read_media(char *page, char **start, off_t off, int count, - int *eof, void *data) +static int fake_ide_media_proc_show(struct seq_file *m, void *v) { - int len; - - strcpy(page, "disk\n"); - len = strlen("disk\n"); - len -= off; - if (len < count){ - *eof = 1; - if (len <= 0) return 0; - } - else len = count; - *start = page + off; - return len; + seq_puts(m, "disk\n"); + return 0; +} + +static int fake_ide_media_proc_open(struct inode *inode, struct file *file) +{ + return single_open(file, fake_ide_media_proc_show, NULL); } +static const struct file_operations fake_ide_media_proc_fops = { + .owner = THIS_MODULE, + .open = fake_ide_media_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + static void make_ide_entries(const char *dev_name) { struct proc_dir_entry *dir, *ent; @@ -227,11 +230,8 @@ static void make_ide_entries(const char *dev_name) dir = proc_mkdir(dev_name, proc_ide); if(!dir) return; - ent = create_proc_entry("media", S_IFREG|S_IRUGO, dir); + ent = proc_create("media", S_IRUGO, dir, &fake_ide_media_proc_fops); if(!ent) return; - ent->data = NULL; - ent->read_proc = proc_ide_read_media; - ent->write_proc = NULL; snprintf(name, sizeof(name), "ide0/%s", dev_name); proc_symlink(dev_name, proc_ide_root, name); } |