diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-10-16 04:27:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:09 -0400 |
commit | cb8fa61c2b8b29d422d7310f064d60022f18f89b (patch) | |
tree | f5c8ac78b109e6c76e05250d19fd75e28c47dc74 /arch/um/drivers/mmapper_kern.c | |
parent | 54ae36f24b103e521dd683f66fe72b0584ccb7e2 (diff) |
uml: arch/um/drivers formatting
Style fixes for the rest of the drivers. arch/um/drivers should be pretty
CodingStyle-compliant now.
Except for the ubd driver, which will have to be treated separately.
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/drivers/mmapper_kern.c')
-rw-r--r-- | arch/um/drivers/mmapper_kern.c | 64 |
1 files changed, 30 insertions, 34 deletions
diff --git a/arch/um/drivers/mmapper_kern.c b/arch/um/drivers/mmapper_kern.c index 867666a02339..67b2f55a602f 100644 --- a/arch/um/drivers/mmapper_kern.c +++ b/arch/um/drivers/mmapper_kern.c | |||
@@ -9,27 +9,29 @@ | |||
9 | * | 9 | * |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/init.h> | 12 | #include <linux/stddef.h> |
13 | #include <linux/module.h> | 13 | #include <linux/types.h> |
14 | #include <linux/mm.h> | ||
15 | #include <linux/fs.h> | 14 | #include <linux/fs.h> |
15 | #include <linux/init.h> | ||
16 | #include <linux/miscdevice.h> | 16 | #include <linux/miscdevice.h> |
17 | #include <linux/module.h> | ||
18 | #include <linux/mm.h> | ||
17 | #include <asm/uaccess.h> | 19 | #include <asm/uaccess.h> |
18 | #include "mem_user.h" | 20 | #include "mem_user.h" |
19 | 21 | ||
20 | /* These are set in mmapper_init, which is called at boot time */ | 22 | /* These are set in mmapper_init, which is called at boot time */ |
21 | static unsigned long mmapper_size; | 23 | static unsigned long mmapper_size; |
22 | static unsigned long p_buf = 0; | 24 | static unsigned long p_buf; |
23 | static char *v_buf = NULL; | 25 | static char *v_buf; |
24 | 26 | ||
25 | static ssize_t | 27 | static ssize_t mmapper_read(struct file *file, char __user *buf, size_t count, |
26 | mmapper_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | 28 | loff_t *ppos) |
27 | { | 29 | { |
28 | return simple_read_from_buffer(buf, count, ppos, v_buf, mmapper_size); | 30 | return simple_read_from_buffer(buf, count, ppos, v_buf, mmapper_size); |
29 | } | 31 | } |
30 | 32 | ||
31 | static ssize_t | 33 | static ssize_t mmapper_write(struct file *file, const char __user *buf, |
32 | mmapper_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | 34 | size_t count, loff_t *ppos) |
33 | { | 35 | { |
34 | if (*ppos > mmapper_size) | 36 | if (*ppos > mmapper_size) |
35 | return -EINVAL; | 37 | return -EINVAL; |
@@ -39,48 +41,46 @@ mmapper_write(struct file *file, const char __user *buf, size_t count, loff_t *p | |||
39 | 41 | ||
40 | if (copy_from_user(&v_buf[*ppos], buf, count)) | 42 | if (copy_from_user(&v_buf[*ppos], buf, count)) |
41 | return -EFAULT; | 43 | return -EFAULT; |
42 | 44 | ||
43 | return count; | 45 | return count; |
44 | } | 46 | } |
45 | 47 | ||
46 | static int | 48 | static int mmapper_ioctl(struct inode *inode, struct file *file, |
47 | mmapper_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 49 | unsigned int cmd, unsigned long arg) |
48 | unsigned long arg) | ||
49 | { | 50 | { |
50 | return(-ENOIOCTLCMD); | 51 | return -ENOIOCTLCMD; |
51 | } | 52 | } |
52 | 53 | ||
53 | static int | 54 | static int mmapper_mmap(struct file *file, struct vm_area_struct *vma) |
54 | mmapper_mmap(struct file *file, struct vm_area_struct * vma) | ||
55 | { | 55 | { |
56 | int ret = -EINVAL; | 56 | int ret = -EINVAL; |
57 | int size; | 57 | int size; |
58 | 58 | ||
59 | if (vma->vm_pgoff != 0) | 59 | if (vma->vm_pgoff != 0) |
60 | goto out; | 60 | goto out; |
61 | 61 | ||
62 | size = vma->vm_end - vma->vm_start; | 62 | size = vma->vm_end - vma->vm_start; |
63 | if(size > mmapper_size) return(-EFAULT); | 63 | if (size > mmapper_size) |
64 | return -EFAULT; | ||
64 | 65 | ||
65 | /* XXX A comment above remap_pfn_range says it should only be | 66 | /* |
67 | * XXX A comment above remap_pfn_range says it should only be | ||
66 | * called when the mm semaphore is held | 68 | * called when the mm semaphore is held |
67 | */ | 69 | */ |
68 | if (remap_pfn_range(vma, vma->vm_start, p_buf >> PAGE_SHIFT, size, | 70 | if (remap_pfn_range(vma, vma->vm_start, p_buf >> PAGE_SHIFT, size, |
69 | vma->vm_page_prot)) | 71 | vma->vm_page_prot)) |
70 | goto out; | 72 | goto out; |
71 | ret = 0; | 73 | ret = 0; |
72 | out: | 74 | out: |
73 | return ret; | 75 | return ret; |
74 | } | 76 | } |
75 | 77 | ||
76 | static int | 78 | static int mmapper_open(struct inode *inode, struct file *file) |
77 | mmapper_open(struct inode *inode, struct file *file) | ||
78 | { | 79 | { |
79 | return 0; | 80 | return 0; |
80 | } | 81 | } |
81 | 82 | ||
82 | static int | 83 | static int mmapper_release(struct inode *inode, struct file *file) |
83 | mmapper_release(struct inode *inode, struct file *file) | ||
84 | { | 84 | { |
85 | return 0; | 85 | return 0; |
86 | } | 86 | } |
@@ -95,7 +95,9 @@ static const struct file_operations mmapper_fops = { | |||
95 | .release = mmapper_release, | 95 | .release = mmapper_release, |
96 | }; | 96 | }; |
97 | 97 | ||
98 | /* No locking needed - only used (and modified) by below initcall and exitcall. */ | 98 | /* |
99 | * No locking needed - only used (and modified) by below initcall and exitcall. | ||
100 | */ | ||
99 | static struct miscdevice mmapper_dev = { | 101 | static struct miscdevice mmapper_dev = { |
100 | .minor = MISC_DYNAMIC_MINOR, | 102 | .minor = MISC_DYNAMIC_MINOR, |
101 | .name = "mmapper", | 103 | .name = "mmapper", |
@@ -109,13 +111,13 @@ static int __init mmapper_init(void) | |||
109 | printk(KERN_INFO "Mapper v0.1\n"); | 111 | printk(KERN_INFO "Mapper v0.1\n"); |
110 | 112 | ||
111 | v_buf = (char *) find_iomem("mmapper", &mmapper_size); | 113 | v_buf = (char *) find_iomem("mmapper", &mmapper_size); |
112 | if(mmapper_size == 0){ | 114 | if (mmapper_size == 0) { |
113 | printk(KERN_ERR "mmapper_init - find_iomem failed\n"); | 115 | printk(KERN_ERR "mmapper_init - find_iomem failed\n"); |
114 | goto out; | 116 | goto out; |
115 | } | 117 | } |
116 | 118 | ||
117 | err = misc_register(&mmapper_dev); | 119 | err = misc_register(&mmapper_dev); |
118 | if(err){ | 120 | if (err) { |
119 | printk(KERN_ERR "mmapper - misc_register failed, err = %d\n", | 121 | printk(KERN_ERR "mmapper - misc_register failed, err = %d\n", |
120 | err); | 122 | err); |
121 | goto out; | 123 | goto out; |
@@ -136,9 +138,3 @@ module_exit(mmapper_exit); | |||
136 | 138 | ||
137 | MODULE_AUTHOR("Greg Lonnon <glonnon@ridgerun.com>"); | 139 | MODULE_AUTHOR("Greg Lonnon <glonnon@ridgerun.com>"); |
138 | MODULE_DESCRIPTION("DSPLinux simulator mmapper driver"); | 140 | MODULE_DESCRIPTION("DSPLinux simulator mmapper driver"); |
139 | /* | ||
140 | * --------------------------------------------------------------------------- | ||
141 | * Local variables: | ||
142 | * c-file-style: "linux" | ||
143 | * End: | ||
144 | */ | ||