diff options
author | Andreas Schwab <schwab@linux-m68k.org> | 2010-08-22 02:23:17 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-08-24 01:28:28 -0400 |
commit | 4cc4587fb14bb04fbc68096cc3780b4e6aa88fe7 (patch) | |
tree | 8ce2fc11b71dda7786b0978337fcdaca3d18e01c /drivers | |
parent | bcc30d37582b3822ae24712e894379ccd8298e8f (diff) |
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: Andreas Schwab <schwab@linux-m68k.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/macintosh/via-pmu.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index 35bc2737412f..2d17e76066bd 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/syscalls.h> | 45 | #include <linux/syscalls.h> |
46 | #include <linux/suspend.h> | 46 | #include <linux/suspend.h> |
47 | #include <linux/cpu.h> | 47 | #include <linux/cpu.h> |
48 | #include <linux/compat.h> | ||
48 | #include <asm/prom.h> | 49 | #include <asm/prom.h> |
49 | #include <asm/machdep.h> | 50 | #include <asm/machdep.h> |
50 | #include <asm/io.h> | 51 | #include <asm/io.h> |
@@ -2349,11 +2350,52 @@ static long pmu_unlocked_ioctl(struct file *filp, | |||
2349 | return ret; | 2350 | return ret; |
2350 | } | 2351 | } |
2351 | 2352 | ||
2353 | #ifdef CONFIG_COMPAT | ||
2354 | #define PMU_IOC_GET_BACKLIGHT32 _IOR('B', 1, compat_size_t) | ||
2355 | #define PMU_IOC_SET_BACKLIGHT32 _IOW('B', 2, compat_size_t) | ||
2356 | #define PMU_IOC_GET_MODEL32 _IOR('B', 3, compat_size_t) | ||
2357 | #define PMU_IOC_HAS_ADB32 _IOR('B', 4, compat_size_t) | ||
2358 | #define PMU_IOC_CAN_SLEEP32 _IOR('B', 5, compat_size_t) | ||
2359 | #define PMU_IOC_GRAB_BACKLIGHT32 _IOR('B', 6, compat_size_t) | ||
2360 | |||
2361 | static long compat_pmu_ioctl (struct file *filp, u_int cmd, u_long arg) | ||
2362 | { | ||
2363 | switch (cmd) { | ||
2364 | case PMU_IOC_SLEEP: | ||
2365 | break; | ||
2366 | case PMU_IOC_GET_BACKLIGHT32: | ||
2367 | cmd = PMU_IOC_GET_BACKLIGHT; | ||
2368 | break; | ||
2369 | case PMU_IOC_SET_BACKLIGHT32: | ||
2370 | cmd = PMU_IOC_SET_BACKLIGHT; | ||
2371 | break; | ||
2372 | case PMU_IOC_GET_MODEL32: | ||
2373 | cmd = PMU_IOC_GET_MODEL; | ||
2374 | break; | ||
2375 | case PMU_IOC_HAS_ADB32: | ||
2376 | cmd = PMU_IOC_HAS_ADB; | ||
2377 | break; | ||
2378 | case PMU_IOC_CAN_SLEEP32: | ||
2379 | cmd = PMU_IOC_CAN_SLEEP; | ||
2380 | break; | ||
2381 | case PMU_IOC_GRAB_BACKLIGHT32: | ||
2382 | cmd = PMU_IOC_GRAB_BACKLIGHT; | ||
2383 | break; | ||
2384 | default: | ||
2385 | return -ENOIOCTLCMD; | ||
2386 | } | ||
2387 | return pmu_unlocked_ioctl(filp, cmd, (unsigned long)compat_ptr(arg)); | ||
2388 | } | ||
2389 | #endif | ||
2390 | |||
2352 | static const struct file_operations pmu_device_fops = { | 2391 | static const struct file_operations pmu_device_fops = { |
2353 | .read = pmu_read, | 2392 | .read = pmu_read, |
2354 | .write = pmu_write, | 2393 | .write = pmu_write, |
2355 | .poll = pmu_fpoll, | 2394 | .poll = pmu_fpoll, |
2356 | .unlocked_ioctl = pmu_unlocked_ioctl, | 2395 | .unlocked_ioctl = pmu_unlocked_ioctl, |
2396 | #ifdef CONFIG_COMPAT | ||
2397 | .compat_ioctl = compat_pmu_ioctl, | ||
2398 | #endif | ||
2357 | .open = pmu_open, | 2399 | .open = pmu_open, |
2358 | .release = pmu_release, | 2400 | .release = pmu_release, |
2359 | }; | 2401 | }; |