diff options
Diffstat (limited to 'arch/sparc/kernel/apc.c')
-rw-r--r-- | arch/sparc/kernel/apc.c | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/arch/sparc/kernel/apc.c b/arch/sparc/kernel/apc.c index 9c115823c4b5..71ec90b9e316 100644 --- a/arch/sparc/kernel/apc.c +++ b/arch/sparc/kernel/apc.c | |||
@@ -10,7 +10,6 @@ | |||
10 | #include <linux/errno.h> | 10 | #include <linux/errno.h> |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/miscdevice.h> | 12 | #include <linux/miscdevice.h> |
13 | #include <linux/smp_lock.h> | ||
14 | #include <linux/pm.h> | 13 | #include <linux/pm.h> |
15 | #include <linux/of.h> | 14 | #include <linux/of.h> |
16 | #include <linux/of_device.h> | 15 | #include <linux/of_device.h> |
@@ -76,7 +75,6 @@ static inline void apc_free(struct of_device *op) | |||
76 | 75 | ||
77 | static int apc_open(struct inode *inode, struct file *f) | 76 | static int apc_open(struct inode *inode, struct file *f) |
78 | { | 77 | { |
79 | cycle_kernel_lock(); | ||
80 | return 0; | 78 | return 0; |
81 | } | 79 | } |
82 | 80 | ||
@@ -87,61 +85,46 @@ static int apc_release(struct inode *inode, struct file *f) | |||
87 | 85 | ||
88 | static long apc_ioctl(struct file *f, unsigned int cmd, unsigned long __arg) | 86 | static long apc_ioctl(struct file *f, unsigned int cmd, unsigned long __arg) |
89 | { | 87 | { |
90 | __u8 inarg, __user *arg; | 88 | __u8 inarg, __user *arg = (__u8 __user *) __arg; |
91 | |||
92 | arg = (__u8 __user *) __arg; | ||
93 | |||
94 | lock_kernel(); | ||
95 | 89 | ||
96 | switch (cmd) { | 90 | switch (cmd) { |
97 | case APCIOCGFANCTL: | 91 | case APCIOCGFANCTL: |
98 | if (put_user(apc_readb(APC_FANCTL_REG) & APC_REGMASK, arg)) { | 92 | if (put_user(apc_readb(APC_FANCTL_REG) & APC_REGMASK, arg)) |
99 | unlock_kernel(); | ||
100 | return -EFAULT; | 93 | return -EFAULT; |
101 | } | ||
102 | break; | 94 | break; |
103 | 95 | ||
104 | case APCIOCGCPWR: | 96 | case APCIOCGCPWR: |
105 | if (put_user(apc_readb(APC_CPOWER_REG) & APC_REGMASK, arg)) { | 97 | if (put_user(apc_readb(APC_CPOWER_REG) & APC_REGMASK, arg)) |
106 | unlock_kernel(); | ||
107 | return -EFAULT; | 98 | return -EFAULT; |
108 | } | ||
109 | break; | 99 | break; |
110 | 100 | ||
111 | case APCIOCGBPORT: | 101 | case APCIOCGBPORT: |
112 | if (put_user(apc_readb(APC_BPORT_REG) & APC_BPMASK, arg)) { | 102 | if (put_user(apc_readb(APC_BPORT_REG) & APC_BPMASK, arg)) |
113 | unlock_kernel(); | ||
114 | return -EFAULT; | 103 | return -EFAULT; |
115 | } | ||
116 | break; | 104 | break; |
117 | 105 | ||
118 | case APCIOCSFANCTL: | 106 | case APCIOCSFANCTL: |
119 | if (get_user(inarg, arg)) { | 107 | if (get_user(inarg, arg)) |
120 | unlock_kernel(); | ||
121 | return -EFAULT; | 108 | return -EFAULT; |
122 | } | ||
123 | apc_writeb(inarg & APC_REGMASK, APC_FANCTL_REG); | 109 | apc_writeb(inarg & APC_REGMASK, APC_FANCTL_REG); |
124 | break; | 110 | break; |
111 | |||
125 | case APCIOCSCPWR: | 112 | case APCIOCSCPWR: |
126 | if (get_user(inarg, arg)) { | 113 | if (get_user(inarg, arg)) |
127 | unlock_kernel(); | ||
128 | return -EFAULT; | 114 | return -EFAULT; |
129 | } | ||
130 | apc_writeb(inarg & APC_REGMASK, APC_CPOWER_REG); | 115 | apc_writeb(inarg & APC_REGMASK, APC_CPOWER_REG); |
131 | break; | 116 | break; |
117 | |||
132 | case APCIOCSBPORT: | 118 | case APCIOCSBPORT: |
133 | if (get_user(inarg, arg)) { | 119 | if (get_user(inarg, arg)) |
134 | unlock_kernel(); | ||
135 | return -EFAULT; | 120 | return -EFAULT; |
136 | } | ||
137 | apc_writeb(inarg & APC_BPMASK, APC_BPORT_REG); | 121 | apc_writeb(inarg & APC_BPMASK, APC_BPORT_REG); |
138 | break; | 122 | break; |
123 | |||
139 | default: | 124 | default: |
140 | unlock_kernel(); | ||
141 | return -EINVAL; | 125 | return -EINVAL; |
142 | }; | 126 | }; |
143 | 127 | ||
144 | unlock_kernel(); | ||
145 | return 0; | 128 | return 0; |
146 | } | 129 | } |
147 | 130 | ||