return ret;
 }
 
+#ifdef CONFIG_COMPAT
+static long
+capi_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+       int ret;
+
+       if (cmd == CAPI_MANUFACTURER_CMD) {
+               struct {
+                       compat_ulong_t cmd;
+                       compat_uptr_t data;
+               } mcmd32;
+
+               if (!capable(CAP_SYS_ADMIN))
+                       return -EPERM;
+               if (copy_from_user(&mcmd32, compat_ptr(arg), sizeof(mcmd32)))
+                       return -EFAULT;
+
+               mutex_lock(&capi_mutex);
+               ret = capi20_manufacturer(mcmd32.cmd, compat_ptr(mcmd32.data));
+               mutex_unlock(&capi_mutex);
+
+               return ret;
+       }
+
+       return capi_unlocked_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
+}
+#endif
+
 static int capi_open(struct inode *inode, struct file *file)
 {
        struct capidev *cdev;
        .write          = capi_write,
        .poll           = capi_poll,
        .unlocked_ioctl = capi_unlocked_ioctl,
+#ifdef CONFIG_COMPAT
+       .compat_ioctl   = capi_compat_ioctl,
+#endif
        .open           = capi_open,
        .release        = capi_release,
 };
 
 #include <net/bluetooth/hci_sock.h>
 #include <net/bluetooth/rfcomm.h>
 
-#include <linux/capi.h>
-#include <linux/gigaset_dev.h>
-
 #ifdef CONFIG_BLOCK
 #include <linux/cdrom.h>
 #include <linux/fd.h>
 COMPATIBLE_IOCTL(RFCOMMGETDEVLIST)
 COMPATIBLE_IOCTL(RFCOMMGETDEVINFO)
 COMPATIBLE_IOCTL(RFCOMMSTEALDLC)
-/* CAPI */
-COMPATIBLE_IOCTL(CAPI_REGISTER)
-COMPATIBLE_IOCTL(CAPI_GET_MANUFACTURER)
-COMPATIBLE_IOCTL(CAPI_GET_VERSION)
-COMPATIBLE_IOCTL(CAPI_GET_SERIAL)
-COMPATIBLE_IOCTL(CAPI_GET_PROFILE)
-COMPATIBLE_IOCTL(CAPI_MANUFACTURER_CMD)
-COMPATIBLE_IOCTL(CAPI_GET_ERRCODE)
-COMPATIBLE_IOCTL(CAPI_INSTALLED)
-COMPATIBLE_IOCTL(CAPI_GET_FLAGS)
-COMPATIBLE_IOCTL(CAPI_SET_FLAGS)
-COMPATIBLE_IOCTL(CAPI_CLR_FLAGS)
-COMPATIBLE_IOCTL(CAPI_NCCI_OPENCOUNT)
-COMPATIBLE_IOCTL(CAPI_NCCI_GETUNIT)
 /* Misc. */
 COMPATIBLE_IOCTL(PCIIOC_CONTROLLER)
 COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO)