提交 1d5d00bd 编写于 作者: C Christoph Hellwig 提交者: David S. Miller

[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: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 b31023fc
...@@ -474,9 +474,6 @@ COMPATIBLE_IOCTL(FBIOGCURMAX) ...@@ -474,9 +474,6 @@ COMPATIBLE_IOCTL(FBIOGCURMAX)
/* Little v, the video4linux ioctls */ /* Little v, the video4linux ioctls */
COMPATIBLE_IOCTL(_IOR('p', 20, int[7])) /* RTCGET */ COMPATIBLE_IOCTL(_IOR('p', 20, int[7])) /* RTCGET */
COMPATIBLE_IOCTL(_IOW('p', 21, int[7])) /* RTCSET */ COMPATIBLE_IOCTL(_IOW('p', 21, int[7])) /* RTCSET */
/* COMPATIBLE_IOCTL(D7SIOCRD) same value as ENVCTRL_RD_VOLTAGE_STATUS */
COMPATIBLE_IOCTL(D7SIOCWR)
COMPATIBLE_IOCTL(D7SIOCTM)
/* Big A */ /* Big A */
#if defined(CONFIG_DRM) || defined(CONFIG_DRM_MODULE) #if defined(CONFIG_DRM) || defined(CONFIG_DRM_MODULE)
COMPATIBLE_IOCTL(DRM_IOCTL_GET_MAGIC) COMPATIBLE_IOCTL(DRM_IOCTL_GET_MAGIC)
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/ioport.h> /* request_region */ #include <linux/ioport.h> /* request_region */
#include <linux/smp_lock.h>
#include <asm/atomic.h> #include <asm/atomic.h>
#include <asm/ebus.h> /* EBus device */ #include <asm/ebus.h> /* EBus device */
#include <asm/oplib.h> /* OpenProm Library */ #include <asm/oplib.h> /* OpenProm Library */
...@@ -114,22 +115,25 @@ static int d7s_release(struct inode *inode, struct file *f) ...@@ -114,22 +115,25 @@ static int d7s_release(struct inode *inode, struct file *f)
return 0; return 0;
} }
static int d7s_ioctl(struct inode *inode, struct file *f, static long d7s_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
__u8 regs = readb(d7s_regs); __u8 regs = readb(d7s_regs);
__u8 ireg = 0; __u8 ireg = 0;
int error = 0
if (D7S_MINOR != iminor(inode)) if (D7S_MINOR != iminor(file->f_dentry->d_inode))
return -ENODEV; return -ENODEV;
lock_kernel();
switch (cmd) { switch (cmd) {
case D7SIOCWR: case D7SIOCWR:
/* assign device register values /* assign device register values
* we mask-out D7S_FLIP if in sol_compat mode * we mask-out D7S_FLIP if in sol_compat mode
*/ */
if (get_user(ireg, (int __user *) arg)) if (get_user(ireg, (int __user *) arg)) {
return -EFAULT; error = -EFAULT;
break;
}
if (0 != sol_compat) { if (0 != sol_compat) {
(regs & D7S_FLIP) ? (regs & D7S_FLIP) ?
(ireg |= D7S_FLIP) : (ireg &= ~D7S_FLIP); (ireg |= D7S_FLIP) : (ireg &= ~D7S_FLIP);
...@@ -144,8 +148,10 @@ static int d7s_ioctl(struct inode *inode, struct file *f, ...@@ -144,8 +148,10 @@ static int d7s_ioctl(struct inode *inode, struct file *f,
* This driver will not misinform you about the state * This driver will not misinform you about the state
* of your hardware while in sol_compat mode * of your hardware while in sol_compat mode
*/ */
if (put_user(regs, (int __user *) arg)) if (put_user(regs, (int __user *) arg)) {
return -EFAULT; error = -EFAULT;
break;
}
break; break;
case D7SIOCTM: case D7SIOCTM:
...@@ -155,13 +161,15 @@ static int d7s_ioctl(struct inode *inode, struct file *f, ...@@ -155,13 +161,15 @@ static int d7s_ioctl(struct inode *inode, struct file *f,
writeb(regs, d7s_regs); writeb(regs, d7s_regs);
break; break;
}; };
lock_kernel();
return 0; return error;
} }
static struct file_operations d7s_fops = { static struct file_operations d7s_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.ioctl = d7s_ioctl, .unlocked_ioctl = d7s_ioctl,
.compat_ioctl = d7s_ioctl,
.open = d7s_open, .open = d7s_open,
.release = d7s_release, .release = d7s_release,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册