From 8ca2bdc7a98b9584ac5f640761501405154171c7 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 9 Nov 2005 12:07:18 -0800 Subject: [PATCH] [SPARC] sbus rtc: implement ->compat_ioctl Signed-off-by: Christoph Hellwig Signed-off-by: David S. Miller --- arch/sparc64/kernel/ioctl32.c | 2 -- drivers/sbus/char/rtc.c | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/arch/sparc64/kernel/ioctl32.c b/arch/sparc64/kernel/ioctl32.c index c2e96daa5ab3..e62214354bb5 100644 --- a/arch/sparc64/kernel/ioctl32.c +++ b/arch/sparc64/kernel/ioctl32.c @@ -114,8 +114,6 @@ COMPATIBLE_IOCTL(FBIOGCURPOS) COMPATIBLE_IOCTL(FBIOGCURMAX) /* Little k */ /* Little v, the video4linux ioctls */ -COMPATIBLE_IOCTL(_IOR('p', 20, int[7])) /* RTCGET */ -COMPATIBLE_IOCTL(_IOW('p', 21, int[7])) /* RTCSET */ /* 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) diff --git a/drivers/sbus/char/rtc.c b/drivers/sbus/char/rtc.c index 9b988baf0b51..5774bdd0e26f 100644 --- a/drivers/sbus/char/rtc.c +++ b/drivers/sbus/char/rtc.c @@ -210,6 +210,27 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, } } +static long rtc_compat_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) +{ + int rval = -ENOIOCTLCMD; + + switch (cmd) { + /* + * These two are specific to this driver, the generic rtc ioctls + * are hanlded elsewhere. + */ + case RTCGET: + case RTCSET: + lock_kernel(); + rval = rtc_ioctl(file->f_dentry->d_inode, file, cmd, arg); + unlock_kernel(); + break; + } + + return rval; +} + static int rtc_open(struct inode *inode, struct file *file) { int ret; @@ -237,6 +258,7 @@ static struct file_operations rtc_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .ioctl = rtc_ioctl, + .compat_ioctl = rtc_compat_ioctl, .open = rtc_open, .release = rtc_release, }; -- 2.20.1