aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel
diff options
context:
space:
mode:
authorStoyan Gaydarov <stoyboyker@gmail.com>2008-07-15 01:12:29 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-18 00:56:16 -0400
commitab772027ca42a06f7e480077182434a2a30a8037 (patch)
treeb0ebe6c76f552aeffd2c46a25b0d8a6f6abff891 /arch/sparc/kernel
parentf5e706ad886b6a5eb59637830110b09ccebf01c5 (diff)
sparc: arch/sparc/kernel/apc.c to unlocked_ioctl
This changes arch/sparc/kernel/apc.c to use unlocked_ioctl Signed-off-by: Stoyan Gaydarov <stoyboyker@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel')
-rw-r--r--arch/sparc/kernel/apc.c40
1 files changed, 28 insertions, 12 deletions
diff --git a/arch/sparc/kernel/apc.c b/arch/sparc/kernel/apc.c
index 54f7ccd7455f..5267d48fb2c6 100644
--- a/arch/sparc/kernel/apc.c
+++ b/arch/sparc/kernel/apc.c
@@ -85,54 +85,70 @@ static int apc_release(struct inode *inode, struct file *f)
85 return 0; 85 return 0;
86} 86}
87 87
88static int apc_ioctl(struct inode *inode, struct file *f, 88static long apc_ioctl(struct file *f, unsigned int cmd, unsigned long __arg)
89 unsigned int cmd, unsigned long __arg)
90{ 89{
91 __u8 inarg, __user *arg; 90 __u8 inarg, __user *arg;
92 91
93 arg = (__u8 __user *) __arg; 92 arg = (__u8 __user *) __arg;
93
94 lock_kernel();
95
94 switch (cmd) { 96 switch (cmd) {
95 case APCIOCGFANCTL: 97 case APCIOCGFANCTL:
96 if (put_user(apc_readb(APC_FANCTL_REG) & APC_REGMASK, arg)) 98 if (put_user(apc_readb(APC_FANCTL_REG) & APC_REGMASK, arg)) {
97 return -EFAULT; 99 unlock_kernel();
100 return -EFAULT;
101 }
98 break; 102 break;
99 103
100 case APCIOCGCPWR: 104 case APCIOCGCPWR:
101 if (put_user(apc_readb(APC_CPOWER_REG) & APC_REGMASK, arg)) 105 if (put_user(apc_readb(APC_CPOWER_REG) & APC_REGMASK, arg)) {
106 unlock_kernel();
102 return -EFAULT; 107 return -EFAULT;
108 }
103 break; 109 break;
104 110
105 case APCIOCGBPORT: 111 case APCIOCGBPORT:
106 if (put_user(apc_readb(APC_BPORT_REG) & APC_BPMASK, arg)) 112 if (put_user(apc_readb(APC_BPORT_REG) & APC_BPMASK, arg)) {
113 unlock_kernel();
107 return -EFAULT; 114 return -EFAULT;
115 }
108 break; 116 break;
109 117
110 case APCIOCSFANCTL: 118 case APCIOCSFANCTL:
111 if (get_user(inarg, arg)) 119 if (get_user(inarg, arg)) {
120 unlock_kernel();
112 return -EFAULT; 121 return -EFAULT;
122 }
113 apc_writeb(inarg & APC_REGMASK, APC_FANCTL_REG); 123 apc_writeb(inarg & APC_REGMASK, APC_FANCTL_REG);
114 break; 124 break;
115 case APCIOCSCPWR: 125 case APCIOCSCPWR:
116 if (get_user(inarg, arg)) 126 if (get_user(inarg, arg)) {
127 unlock_kernel();
117 return -EFAULT; 128 return -EFAULT;
129 }
118 apc_writeb(inarg & APC_REGMASK, APC_CPOWER_REG); 130 apc_writeb(inarg & APC_REGMASK, APC_CPOWER_REG);
119 break; 131 break;
120 case APCIOCSBPORT: 132 case APCIOCSBPORT:
121 if (get_user(inarg, arg)) 133 if (get_user(inarg, arg)) {
134 unlock_kernel();
122 return -EFAULT; 135 return -EFAULT;
136 }
123 apc_writeb(inarg & APC_BPMASK, APC_BPORT_REG); 137 apc_writeb(inarg & APC_BPMASK, APC_BPORT_REG);
124 break; 138 break;
125 default: 139 default:
140 unlock_kernel();
126 return -EINVAL; 141 return -EINVAL;
127 }; 142 };
128 143
144 unlock_kernel();
129 return 0; 145 return 0;
130} 146}
131 147
132static const struct file_operations apc_fops = { 148static const struct file_operations apc_fops = {
133 .ioctl = apc_ioctl, 149 .unlocked_ioctl = apc_ioctl,
134 .open = apc_open, 150 .open = apc_open,
135 .release = apc_release, 151 .release = apc_release,
136}; 152};
137 153
138static struct miscdevice apc_miscdev = { APC_MINOR, APC_DEVNAME, &apc_fops }; 154static struct miscdevice apc_miscdev = { APC_MINOR, APC_DEVNAME, &apc_fops };