Skip to content

Commit

Permalink
[SPARC] cpwatchdog: implement ->compat_ioctl
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Christoph Hellwig authored and David S. Miller committed Nov 7, 2005
1 parent 1d5d00b commit b66621f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
3 changes: 0 additions & 3 deletions arch/sparc64/kernel/ioctl32.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,9 +496,6 @@ COMPATIBLE_IOCTL(DRM_IOCTL_LOCK)
COMPATIBLE_IOCTL(DRM_IOCTL_UNLOCK)
COMPATIBLE_IOCTL(DRM_IOCTL_FINISH)
#endif /* DRM */
COMPATIBLE_IOCTL(WIOCSTART)
COMPATIBLE_IOCTL(WIOCSTOP)
COMPATIBLE_IOCTL(WIOCGSTAT)
/* And these ioctls need translation */
/* Note SIOCRTMSG is no longer, so this is safe and * the user would have seen just an -EINVAL anyways. */
HANDLE_IOCTL(FBIOPUTCMAP32, fbiogetputcmap)
Expand Down
24 changes: 24 additions & 0 deletions drivers/sbus/char/cpwatchdog.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/timer.h>
#include <linux/smp_lock.h>
#include <asm/irq.h>
#include <asm/ebus.h>
#include <asm/oplib.h>
Expand Down Expand Up @@ -394,6 +395,28 @@ static int wd_ioctl(struct inode *inode, struct file *file,
return(0);
}

static long wd_compat_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
int rval = -ENOIOCTLCMD;

switch (cmd) {
/* solaris ioctls are specific to this driver */
case WIOCSTART:
case WIOCSTOP:
case WIOCGSTAT:
lock_kernel();
rval = wd_ioctl(file->f_dentry->d_inode, file, cmd, arg);
lock_kernel();
break;
/* everything else is handled by the generic compat layer */
default:
break;
}

return rval;
}

static ssize_t wd_write(struct file *file,
const char __user *buf,
size_t count,
Expand Down Expand Up @@ -441,6 +464,7 @@ static irqreturn_t wd_interrupt(int irq, void *dev_id, struct pt_regs *regs)
static struct file_operations wd_fops = {
.owner = THIS_MODULE,
.ioctl = wd_ioctl,
.compat_ioctl = wd_compat_ioctl,
.open = wd_open,
.write = wd_write,
.read = wd_read,
Expand Down

0 comments on commit b66621f

Please sign in to comment.