aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2005-11-07 17:13:01 -0500
committerDavid S. Miller <davem@davemloft.net>2005-11-07 17:13:01 -0500
commit1d5d00bd9c44ab4730d353ee6ba0c8ebbff295c7 (patch)
treece0a4fb5876fcaa2f1a783cf221f8e8fc8b3687d /drivers
parentb31023fc24e5c39d246e9c6fc75dba1a2902c1d6 (diff)
[SPARC] display7seg: implement ->unlocked_ioctl and ->compat_ioctl
all ioctls are 32bit compat clean, so the driver can use ->compat_ioctl and ->unlocked_ioctl easily. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/sbus/char/display7seg.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c
index 24ed5893b4f0..39f54213a6d5 100644
--- a/drivers/sbus/char/display7seg.c
+++ b/drivers/sbus/char/display7seg.c
@@ -15,6 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/miscdevice.h> 16#include <linux/miscdevice.h>
17#include <linux/ioport.h> /* request_region */ 17#include <linux/ioport.h> /* request_region */
18#include <linux/smp_lock.h>
18#include <asm/atomic.h> 19#include <asm/atomic.h>
19#include <asm/ebus.h> /* EBus device */ 20#include <asm/ebus.h> /* EBus device */
20#include <asm/oplib.h> /* OpenProm Library */ 21#include <asm/oplib.h> /* OpenProm Library */
@@ -114,22 +115,25 @@ static int d7s_release(struct inode *inode, struct file *f)
114 return 0; 115 return 0;
115} 116}
116 117
117static int d7s_ioctl(struct inode *inode, struct file *f, 118static long d7s_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
118 unsigned int cmd, unsigned long arg)
119{ 119{
120 __u8 regs = readb(d7s_regs); 120 __u8 regs = readb(d7s_regs);
121 __u8 ireg = 0; 121 __u8 ireg = 0;
122 int error = 0
122 123
123 if (D7S_MINOR != iminor(inode)) 124 if (D7S_MINOR != iminor(file->f_dentry->d_inode))
124 return -ENODEV; 125 return -ENODEV;
125 126
127 lock_kernel();
126 switch (cmd) { 128 switch (cmd) {
127 case D7SIOCWR: 129 case D7SIOCWR:
128 /* assign device register values 130 /* assign device register values
129 * we mask-out D7S_FLIP if in sol_compat mode 131 * we mask-out D7S_FLIP if in sol_compat mode
130 */ 132 */
131 if (get_user(ireg, (int __user *) arg)) 133 if (get_user(ireg, (int __user *) arg)) {
132 return -EFAULT; 134 error = -EFAULT;
135 break;
136 }
133 if (0 != sol_compat) { 137 if (0 != sol_compat) {
134 (regs & D7S_FLIP) ? 138 (regs & D7S_FLIP) ?
135 (ireg |= D7S_FLIP) : (ireg &= ~D7S_FLIP); 139 (ireg |= D7S_FLIP) : (ireg &= ~D7S_FLIP);
@@ -144,8 +148,10 @@ static int d7s_ioctl(struct inode *inode, struct file *f,
144 * This driver will not misinform you about the state 148 * This driver will not misinform you about the state
145 * of your hardware while in sol_compat mode 149 * of your hardware while in sol_compat mode
146 */ 150 */
147 if (put_user(regs, (int __user *) arg)) 151 if (put_user(regs, (int __user *) arg)) {
148 return -EFAULT; 152 error = -EFAULT;
153 break;
154 }
149 break; 155 break;
150 156
151 case D7SIOCTM: 157 case D7SIOCTM:
@@ -155,15 +161,17 @@ static int d7s_ioctl(struct inode *inode, struct file *f,
155 writeb(regs, d7s_regs); 161 writeb(regs, d7s_regs);
156 break; 162 break;
157 }; 163 };
164 lock_kernel();
158 165
159 return 0; 166 return error;
160} 167}
161 168
162static struct file_operations d7s_fops = { 169static struct file_operations d7s_fops = {
163 .owner = THIS_MODULE, 170 .owner = THIS_MODULE,
164 .ioctl = d7s_ioctl, 171 .unlocked_ioctl = d7s_ioctl,
165 .open = d7s_open, 172 .compat_ioctl = d7s_ioctl,
166 .release = d7s_release, 173 .open = d7s_open,
174 .release = d7s_release,
167}; 175};
168 176
169static struct miscdevice d7s_miscdev = { D7S_MINOR, D7S_DEVNAME, &d7s_fops }; 177static struct miscdevice d7s_miscdev = { D7S_MINOR, D7S_DEVNAME, &d7s_fops };