aboutsummaryrefslogtreecommitdiffstats
path: root/fs/compat_ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/compat_ioctl.c')
-rw-r--r--fs/compat_ioctl.c122
1 files changed, 0 insertions, 122 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index d27b326d96f4..a545deeeaff5 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -53,8 +53,6 @@
53#include <linux/if_tun.h> 53#include <linux/if_tun.h>
54#include <linux/ctype.h> 54#include <linux/ctype.h>
55#include <linux/syscalls.h> 55#include <linux/syscalls.h>
56#include <linux/i2c.h>
57#include <linux/i2c-dev.h>
58#include <linux/atalk.h> 56#include <linux/atalk.h>
59#include <linux/gfp.h> 57#include <linux/gfp.h>
60#include <linux/cec.h> 58#include <linux/cec.h>
@@ -136,22 +134,6 @@ static int do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
136 return vfs_ioctl(file, cmd, arg); 134 return vfs_ioctl(file, cmd, arg);
137} 135}
138 136
139static int w_long(struct file *file,
140 unsigned int cmd, compat_ulong_t __user *argp)
141{
142 int err;
143 unsigned long __user *valp = compat_alloc_user_space(sizeof(*valp));
144
145 if (valp == NULL)
146 return -EFAULT;
147 err = do_ioctl(file, cmd, (unsigned long)valp);
148 if (err)
149 return err;
150 if (convert_in_user(valp, argp))
151 return -EFAULT;
152 return 0;
153}
154
155struct compat_video_event { 137struct compat_video_event {
156 int32_t type; 138 int32_t type;
157 compat_time_t timestamp; 139 compat_time_t timestamp;
@@ -670,96 +652,6 @@ static int serial_struct_ioctl(struct file *file,
670 return err; 652 return err;
671} 653}
672 654
673/*
674 * I2C layer ioctls
675 */
676
677struct i2c_msg32 {
678 u16 addr;
679 u16 flags;
680 u16 len;
681 compat_caddr_t buf;
682};
683
684struct i2c_rdwr_ioctl_data32 {
685 compat_caddr_t msgs; /* struct i2c_msg __user *msgs */
686 u32 nmsgs;
687};
688
689struct i2c_smbus_ioctl_data32 {
690 u8 read_write;
691 u8 command;
692 u32 size;
693 compat_caddr_t data; /* union i2c_smbus_data *data */
694};
695
696struct i2c_rdwr_aligned {
697 struct i2c_rdwr_ioctl_data cmd;
698 struct i2c_msg msgs[0];
699};
700
701static int do_i2c_rdwr_ioctl(struct file *file,
702 unsigned int cmd, struct i2c_rdwr_ioctl_data32 __user *udata)
703{
704 struct i2c_rdwr_aligned __user *tdata;
705 struct i2c_msg __user *tmsgs;
706 struct i2c_msg32 __user *umsgs;
707 compat_caddr_t datap;
708 u32 nmsgs;
709 int i;
710
711 if (get_user(nmsgs, &udata->nmsgs))
712 return -EFAULT;
713 if (nmsgs > I2C_RDWR_IOCTL_MAX_MSGS)
714 return -EINVAL;
715
716 if (get_user(datap, &udata->msgs))
717 return -EFAULT;
718 umsgs = compat_ptr(datap);
719
720 tdata = compat_alloc_user_space(sizeof(*tdata) +
721 nmsgs * sizeof(struct i2c_msg));
722 tmsgs = &tdata->msgs[0];
723
724 if (put_user(nmsgs, &tdata->cmd.nmsgs) ||
725 put_user(tmsgs, &tdata->cmd.msgs))
726 return -EFAULT;
727
728 for (i = 0; i < nmsgs; i++) {
729 if (copy_in_user(&tmsgs[i].addr, &umsgs[i].addr, 3*sizeof(u16)))
730 return -EFAULT;
731 if (get_user(datap, &umsgs[i].buf) ||
732 put_user(compat_ptr(datap), &tmsgs[i].buf))
733 return -EFAULT;
734 }
735 return do_ioctl(file, cmd, (unsigned long)tdata);
736}
737
738static int do_i2c_smbus_ioctl(struct file *file,
739 unsigned int cmd, struct i2c_smbus_ioctl_data32 __user *udata)
740{
741 struct i2c_smbus_ioctl_data __user *tdata;
742 union {
743 /* beginnings of those have identical layouts */
744 struct i2c_smbus_ioctl_data32 data32;
745 struct i2c_smbus_ioctl_data data;
746 } v;
747
748 tdata = compat_alloc_user_space(sizeof(*tdata));
749 if (tdata == NULL)
750 return -ENOMEM;
751
752 memset(&v, 0, sizeof(v));
753 if (copy_from_user(&v.data32, udata, sizeof(v.data32)))
754 return -EFAULT;
755 v.data.data = compat_ptr(v.data32.data);
756
757 if (copy_to_user(tdata, &v.data, sizeof(v.data)))
758 return -EFAULT;
759
760 return do_ioctl(file, cmd, (unsigned long)tdata);
761}
762
763#define RTC_IRQP_READ32 _IOR('p', 0x0b, compat_ulong_t) 655#define RTC_IRQP_READ32 _IOR('p', 0x0b, compat_ulong_t)
764#define RTC_IRQP_SET32 _IOW('p', 0x0c, compat_ulong_t) 656#define RTC_IRQP_SET32 _IOW('p', 0x0c, compat_ulong_t)
765#define RTC_EPOCH_READ32 _IOR('p', 0x0d, compat_ulong_t) 657#define RTC_EPOCH_READ32 _IOR('p', 0x0d, compat_ulong_t)
@@ -1282,13 +1174,6 @@ COMPATIBLE_IOCTL(PCIIOC_CONTROLLER)
1282COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO) 1174COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO)
1283COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_MEM) 1175COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_MEM)
1284COMPATIBLE_IOCTL(PCIIOC_WRITE_COMBINE) 1176COMPATIBLE_IOCTL(PCIIOC_WRITE_COMBINE)
1285/* i2c */
1286COMPATIBLE_IOCTL(I2C_SLAVE)
1287COMPATIBLE_IOCTL(I2C_SLAVE_FORCE)
1288COMPATIBLE_IOCTL(I2C_TENBIT)
1289COMPATIBLE_IOCTL(I2C_PEC)
1290COMPATIBLE_IOCTL(I2C_RETRIES)
1291COMPATIBLE_IOCTL(I2C_TIMEOUT)
1292/* hiddev */ 1177/* hiddev */
1293COMPATIBLE_IOCTL(HIDIOCGVERSION) 1178COMPATIBLE_IOCTL(HIDIOCGVERSION)
1294COMPATIBLE_IOCTL(HIDIOCAPPLICATION) 1179COMPATIBLE_IOCTL(HIDIOCAPPLICATION)
@@ -1463,13 +1348,6 @@ static long do_ioctl_trans(unsigned int cmd,
1463 case TIOCGSERIAL: 1348 case TIOCGSERIAL:
1464 case TIOCSSERIAL: 1349 case TIOCSSERIAL:
1465 return serial_struct_ioctl(file, cmd, argp); 1350 return serial_struct_ioctl(file, cmd, argp);
1466 /* i2c */
1467 case I2C_FUNCS:
1468 return w_long(file, cmd, argp);
1469 case I2C_RDWR:
1470 return do_i2c_rdwr_ioctl(file, cmd, argp);
1471 case I2C_SMBUS:
1472 return do_i2c_smbus_ioctl(file, cmd, argp);
1473 /* Not implemented in the native kernel */ 1351 /* Not implemented in the native kernel */
1474 case RTC_IRQP_READ32: 1352 case RTC_IRQP_READ32:
1475 case RTC_IRQP_SET32: 1353 case RTC_IRQP_SET32: