Commit 4cc4587f authored by Andreas Schwab's avatar Andreas Schwab Committed by Benjamin Herrenschmidt

via-pmu: Add compat_pmu_ioctl

The ioctls are actually compatible, but due to historical mistake the
numbers differ between 32bit and 64bit.
Signed-off-by: default avatarAndreas Schwab <schwab@linux-m68k.org>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent bcc30d37
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <linux/syscalls.h> #include <linux/syscalls.h>
#include <linux/suspend.h> #include <linux/suspend.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/compat.h>
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -2349,11 +2350,52 @@ static long pmu_unlocked_ioctl(struct file *filp, ...@@ -2349,11 +2350,52 @@ static long pmu_unlocked_ioctl(struct file *filp,
return ret; return ret;
} }
#ifdef CONFIG_COMPAT
#define PMU_IOC_GET_BACKLIGHT32 _IOR('B', 1, compat_size_t)
#define PMU_IOC_SET_BACKLIGHT32 _IOW('B', 2, compat_size_t)
#define PMU_IOC_GET_MODEL32 _IOR('B', 3, compat_size_t)
#define PMU_IOC_HAS_ADB32 _IOR('B', 4, compat_size_t)
#define PMU_IOC_CAN_SLEEP32 _IOR('B', 5, compat_size_t)
#define PMU_IOC_GRAB_BACKLIGHT32 _IOR('B', 6, compat_size_t)
static long compat_pmu_ioctl (struct file *filp, u_int cmd, u_long arg)
{
switch (cmd) {
case PMU_IOC_SLEEP:
break;
case PMU_IOC_GET_BACKLIGHT32:
cmd = PMU_IOC_GET_BACKLIGHT;
break;
case PMU_IOC_SET_BACKLIGHT32:
cmd = PMU_IOC_SET_BACKLIGHT;
break;
case PMU_IOC_GET_MODEL32:
cmd = PMU_IOC_GET_MODEL;
break;
case PMU_IOC_HAS_ADB32:
cmd = PMU_IOC_HAS_ADB;
break;
case PMU_IOC_CAN_SLEEP32:
cmd = PMU_IOC_CAN_SLEEP;
break;
case PMU_IOC_GRAB_BACKLIGHT32:
cmd = PMU_IOC_GRAB_BACKLIGHT;
break;
default:
return -ENOIOCTLCMD;
}
return pmu_unlocked_ioctl(filp, cmd, (unsigned long)compat_ptr(arg));
}
#endif
static const struct file_operations pmu_device_fops = { static const struct file_operations pmu_device_fops = {
.read = pmu_read, .read = pmu_read,
.write = pmu_write, .write = pmu_write,
.poll = pmu_fpoll, .poll = pmu_fpoll,
.unlocked_ioctl = pmu_unlocked_ioctl, .unlocked_ioctl = pmu_unlocked_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = compat_pmu_ioctl,
#endif
.open = pmu_open, .open = pmu_open,
.release = pmu_release, .release = pmu_release,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment