Revert "MLK-15356-2:[i.MX8MQ/Hantro] Add support for android platform"
authorOctavian Purdila <octavian.purdila@nxp.com>
Tue, 11 Jul 2017 09:36:26 +0000 (12:36 +0300)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:33:32 +0000 (15:33 -0500)
This reverts commit b5d7e2af70d25568835a813a95032998194bc262 as it
breaks the build on imx6/7.

Signed-off-by: Octavian Purdila <octavian.purdila@nxp.com>
drivers/mxc/hantro/hantrodec.c
drivers/staging/android/ion/mxc/mxc_ion.c [changed mode: 0755->0644]
include/uapi/linux/hantrodec.h

index 481170b..420f7bc 100755 (executable)
@@ -980,8 +980,8 @@ static long hantrodec_ioctl(struct file *filp, unsigned int cmd,
   mod_timer(&timer, jiffies + 10*HZ); /*the interval is 10s*/
 #endif
 
-  switch (_IOC_NR(cmd)) {
-  case _IOC_NR(HANTRODEC_IOC_CLI):
+  switch (cmd) {
+  case HANTRODEC_IOC_CLI:
        {
          __u32 id; 
       __get_user(id, (__u32*)arg);
@@ -992,7 +992,7 @@ static long hantrodec_ioctl(struct file *filp, unsigned int cmd,
       disable_irq(hantrodec_data.irq[id]);
       break;
        }
-  case _IOC_NR(HANTRODEC_IOC_STI):
+  case HANTRODEC_IOC_STI:
        {
          __u32 id; 
       __get_user(id, (__u32*)arg);
@@ -1003,7 +1003,7 @@ static long hantrodec_ioctl(struct file *filp, unsigned int cmd,
       enable_irq(hantrodec_data.irq[id]);
       break;
        }
-  case _IOC_NR(HANTRODEC_IOCGHWOFFSET):
+  case HANTRODEC_IOCGHWOFFSET:
        {
       __u32 id; 
       __get_user(id, (__u32*)arg);
@@ -1015,7 +1015,7 @@ static long hantrodec_ioctl(struct file *filp, unsigned int cmd,
       __put_user(multicorebase[id], (unsigned long *) arg);
       break;
        }
-  case _IOC_NR(HANTRODEC_IOCGHWIOSIZE):
+  case HANTRODEC_IOCGHWIOSIZE:
        {
       __u32 id;
       __u32 io_size;
@@ -1029,7 +1029,7 @@ static long hantrodec_ioctl(struct file *filp, unsigned int cmd,
 
          return 0;
        }
-  case _IOC_NR(HANTRODEC_IOC_MC_OFFSETS): {
+  case HANTRODEC_IOC_MC_OFFSETS: {
     tmp = copy_to_user((u64 *) arg, multicorebase, sizeof(multicorebase));
     if (err) {
       PDEBUG("copy_to_user failed, returned %li\n", tmp);
@@ -1037,11 +1037,11 @@ static long hantrodec_ioctl(struct file *filp, unsigned int cmd,
     }
     break;
   }
-  case _IOC_NR(HANTRODEC_IOC_MC_CORES):
+  case HANTRODEC_IOC_MC_CORES:
     __put_user(hantrodec_data.cores, (unsigned int *) arg);
        PDEBUG("hantrodec_data.cores=%d\n", hantrodec_data.cores);
     break;
-  case _IOC_NR(HANTRODEC_IOCS_DEC_PUSH_REG): {
+  case HANTRODEC_IOCS_DEC_PUSH_REG: {
     struct core_desc Core;
 
     /* get registers from user space*/
@@ -1054,7 +1054,7 @@ static long hantrodec_ioctl(struct file *filp, unsigned int cmd,
     DecFlushRegs(&hantrodec_data, &Core);
     break;
   }
-  case _IOC_NR(HANTRODEC_IOCS_PP_PUSH_REG): {
+  case HANTRODEC_IOCS_PP_PUSH_REG: {
     struct core_desc Core;
 
     /* get registers from user space*/
@@ -1067,7 +1067,7 @@ static long hantrodec_ioctl(struct file *filp, unsigned int cmd,
     PPFlushRegs(&hantrodec_data, &Core);
     break;
   }
-  case _IOC_NR(HANTRODEC_IOCS_DEC_PULL_REG): {
+  case HANTRODEC_IOCS_DEC_PULL_REG: {
     struct core_desc Core;
 
     /* get registers from user space*/
@@ -1079,7 +1079,7 @@ static long hantrodec_ioctl(struct file *filp, unsigned int cmd,
 
     return DecRefreshRegs(&hantrodec_data, &Core);
   }
-  case _IOC_NR(HANTRODEC_IOCS_PP_PULL_REG): {
+  case HANTRODEC_IOCS_PP_PULL_REG: {
     struct core_desc Core;
 
     /* get registers from user space*/
@@ -1091,11 +1091,11 @@ static long hantrodec_ioctl(struct file *filp, unsigned int cmd,
 
     return PPRefreshRegs(&hantrodec_data, &Core);
   }
-  case _IOC_NR(HANTRODEC_IOCH_DEC_RESERVE): {
+  case HANTRODEC_IOCH_DEC_RESERVE: {
     PDEBUG("Reserve DEC Core, format = %li\n", arg);
     return ReserveDecoder(&hantrodec_data, filp, arg);
   }
-  case _IOC_NR(HANTRODEC_IOCT_DEC_RELEASE): {
+  case HANTRODEC_IOCT_DEC_RELEASE: {
     if(arg >= hantrodec_data.cores || dec_owner[arg] != filp) {
       PDEBUG("bogus DEC release, Core = %li\n", arg);
       return -EFAULT;
@@ -1107,9 +1107,9 @@ static long hantrodec_ioctl(struct file *filp, unsigned int cmd,
 
     break;
   }
-  case _IOC_NR(HANTRODEC_IOCQ_PP_RESERVE):
+  case HANTRODEC_IOCQ_PP_RESERVE:
     return ReservePostProcessor(&hantrodec_data, filp);
-  case _IOC_NR(HANTRODEC_IOCT_PP_RELEASE): {
+  case HANTRODEC_IOCT_PP_RELEASE: {
     if(arg != 0 || pp_owner[arg] != filp) {
       PDEBUG("bogus PP release %li\n", arg);
       return -EFAULT;
@@ -1119,7 +1119,7 @@ static long hantrodec_ioctl(struct file *filp, unsigned int cmd,
 
     break;
   }
-  case _IOC_NR(HANTRODEC_IOCX_DEC_WAIT): {
+  case HANTRODEC_IOCX_DEC_WAIT: {
     struct core_desc Core;
 
     /* get registers from user space */
@@ -1131,7 +1131,7 @@ static long hantrodec_ioctl(struct file *filp, unsigned int cmd,
 
     return WaitDecReadyAndRefreshRegs(&hantrodec_data, &Core);
   }
-  case _IOC_NR(HANTRODEC_IOCX_PP_WAIT): {
+  case HANTRODEC_IOCX_PP_WAIT: {
     struct core_desc Core;
 
     /* get registers from user space */
@@ -1143,13 +1143,13 @@ static long hantrodec_ioctl(struct file *filp, unsigned int cmd,
 
     return WaitPPReadyAndRefreshRegs(&hantrodec_data, &Core);
   }
-  case _IOC_NR(HANTRODEC_IOCG_CORE_WAIT): {
+  case HANTRODEC_IOCG_CORE_WAIT: {
     int id;
     tmp = WaitCoreReady(&hantrodec_data, filp, &id);
     __put_user(id, (int *) arg);
     return tmp;
   }
-  case _IOC_NR(HANTRODEC_IOX_ASIC_ID): {
+  case HANTRODEC_IOX_ASIC_ID: {
     u32 id;
     __get_user(id, (u32*)arg);
 
@@ -1160,11 +1160,11 @@ static long hantrodec_ioctl(struct file *filp, unsigned int cmd,
     __put_user(id, (u32 *) arg);
        return 0;
   }
-  case _IOC_NR(HANTRODEC_IOCG_CORE_ID): {
+  case HANTRODEC_IOCG_CORE_ID: {
     PDEBUG("Get DEC Core_id, format = %li\n", arg);
        return GetDecCoreID(&hantrodec_data, filp, arg);
   }
-  case _IOC_NR(HANTRODEC_DEBUG_STATUS): {
+  case HANTRODEC_DEBUG_STATUS: {
     printk(KERN_INFO "hantrodec: dec_irq     = 0x%08x \n", dec_irq);
     printk(KERN_INFO "hantrodec: pp_irq      = 0x%08x \n", pp_irq);
 
@@ -1184,92 +1184,6 @@ static long hantrodec_ioctl(struct file *filp, unsigned int cmd,
 
   return 0;
 }
-#ifdef CONFIG_COMPAT
-struct core_desc_32 {
-  __u32 id; /* id of the Core */
-  compat_caddr_t regs; /* pointer to user registers */
-  __u32 size; /* size of register space */
-};
-
-static int get_hantro_core_desc32(struct core_desc *kp, struct core_desc_32 __user *up)
-{
-    u32 tmp;
-    if (!access_ok(VERIFY_READ, up, sizeof(struct core_desc_32)) ||
-        get_user(kp->id, &up->id) ||
-        get_user(kp->size, &up->size) || 
-        get_user(tmp, &up->regs)){
-            return -EFAULT;
-    }
-    kp->regs = (__force u32 *)compat_ptr(tmp);
-    return 0;
-}
-
-static int put_hantro_core_desc32(struct core_desc *kp, struct core_desc_32 __user *up)
-{
-    u32 tmp = (u32)((unsigned long)kp->regs);
-    if (!access_ok(VERIFY_WRITE, up, sizeof(struct core_desc_32)) ||
-        put_user(kp->id, &up->id) ||
-        put_user(kp->size, &up->size) || 
-        put_user(tmp, &up->regs)){
-            return -EFAULT;
-    }
-    return 0;
-}
-static long hantrodec_ioctl32(struct file *filp, unsigned int cmd,unsigned long arg)
-{
-#define HANTRO_IOCTL32(err,filp,cmd, arg) {\
-      mm_segment_t old_fs = get_fs(); \
-      set_fs(KERNEL_DS); \
-      err = hantrodec_ioctl(filp, cmd, arg);\
-      if(err) return err;\
-      set_fs(old_fs);\
-}
-    union {
-        struct core_desc kcore;
-        unsigned long kux;
-        unsigned int kui;
-    } karg;
-    void __user *up = compat_ptr(arg);
-    long err = 0;
-
-    switch(_IOC_NR(cmd)){
-        case _IOC_NR(HANTRODEC_IOCGHWOFFSET):
-        case _IOC_NR(HANTRODEC_IOC_MC_OFFSETS):
-            err = get_user(karg.kux, (s32 __user *)up);
-            if(err) return err;
-            HANTRO_IOCTL32(err,filp,cmd, (unsigned long)&karg);
-            err = put_user(((s32)karg.kux), (s32 __user *)up);
-            break;
-        case _IOC_NR(HANTRODEC_IOCGHWIOSIZE):
-        case _IOC_NR(HANTRODEC_IOC_MC_CORES):
-        case _IOC_NR(HANTRODEC_IOCG_CORE_WAIT):
-        case _IOC_NR(HANTRODEC_IOX_ASIC_ID):
-            err = get_user(karg.kui, (s32 __user *)up);
-            if(err) return err;
-            HANTRO_IOCTL32(err,filp,cmd, (unsigned long)&karg);
-            err = put_user(((s32)karg.kui), (s32 __user *)up);
-            break;
-        case _IOC_NR(HANTRODEC_IOCS_DEC_PUSH_REG):
-        case _IOC_NR(HANTRODEC_IOCS_PP_PUSH_REG):
-        case _IOC_NR(HANTRODEC_IOCX_DEC_WAIT):
-        case _IOC_NR(HANTRODEC_IOCX_PP_WAIT):
-        case _IOC_NR(HANTRODEC_IOCS_DEC_PULL_REG):
-        case _IOC_NR(HANTRODEC_IOCS_PP_PULL_REG):
-            err = get_hantro_core_desc32(&karg.kcore, up);
-            if(err) return err;
-            HANTRO_IOCTL32(err,filp,cmd, (unsigned long)&karg);
-            err = put_hantro_core_desc32(&karg.kcore, up);
-            break;
-        default:
-            err = hantrodec_ioctl(filp, cmd, (unsigned long)up);  
-            break;
-    }
-
-    return err;
-}
-
-#endif //ifdef CONFIG_COMPAT
 
 /*------------------------------------------------------------------------------
  Function name   : hantrodec_open
@@ -1367,9 +1281,6 @@ static struct file_operations hantrodec_fops = {
   .unlocked_ioctl = hantrodec_ioctl,
   .fasync = NULL,
   .mmap = hantro_mmap,
-#ifdef CONFIG_COMPAT
-  .compat_ioctl = hantrodec_ioctl32,
-#endif
 };
 
 /*------------------------------------------------------------------------------
old mode 100755 (executable)
new mode 100644 (file)
index 406e3d3..2364118
@@ -28,7 +28,6 @@
 #include <linux/dma-buf.h>
 
 #include "../ion_priv.h"
-#include <linux/compat.h>
 
 static struct ion_device *idev;
 static int num_heaps = 1;
@@ -75,112 +74,9 @@ mxc_ion_parse_of(struct platform_device *pdev)
        return pdata;
 }
 
-struct ion_phys_data32 {
-    __s32 handle; //ion_user_handle_t
-    compat_long_t phys;
-};
-
-struct ion_phys_dma_data32 {
-    compat_long_t phys;
-    __u32 size;
-    __u32 dmafd;
-};
-
-struct ion_phys_virt_data32 {
-    compat_long_t virt;
-    compat_long_t phys;
-    __u32 size;
-};
-
-#define ION_IOC_PHYS32             _IOWR(ION_IOC_MAGIC, _IOC_NR(ION_IOC_PHYS), struct ion_phys_data32)
-#define ION_IOC_PHYS_DMA32         _IOWR(ION_IOC_MAGIC, _IOC_NR(ION_IOC_PHYS_DMA), struct ion_phys_dma_data32)
-#define ION_IOC_PHYS_VIRT32        _IOWR(ION_IOC_MAGIC, _IOC_NR(ION_IOC_PHYS_VIRT), struct ion_phys_virt_data32)
-
-static int get_ion_phys_data32(struct ion_phys_data *kp, struct ion_phys_data32 __user *up)
-{
-    void __user *up_pln;
-    compat_long_t p;
-
-    if (!access_ok(VERIFY_READ, up, sizeof(struct ion_phys_data32)) ||
-        get_user(kp->handle, &up->handle) ||
-        get_user(p, &up->phys))
-            return -EFAULT;
-    up_pln = compat_ptr(p);
-    put_user((unsigned long)up_pln, &kp->phys);
-    return 0;
-}
-
-static int put_ion_phys_data32(struct ion_phys_data *kp, struct ion_phys_data32 __user *up)
-{
-    u32 tmp = (u32)((unsigned long)kp->phys);
-    if (!access_ok(VERIFY_WRITE, up, sizeof(struct ion_phys_data32)) ||
-        put_user((s32)kp->handle, &up->handle) ||
-        put_user(tmp, &up->phys))
-            return -EFAULT;
-    return 0;
-}
-
-static int get_ion_phys_dma_data32(struct ion_phys_dma_data *kp, struct ion_phys_dma_data32 __user *up)
-{
-    void __user *up_pln;
-    compat_long_t p;
-
-    if (!access_ok(VERIFY_READ, up, sizeof(struct ion_phys_dma_data32)) ||
-        get_user(kp->size, &up->size) ||
-        get_user(kp->dmafd, &up->dmafd) ||
-        get_user(p, &up->phys))
-            return -EFAULT;
-    up_pln = compat_ptr(p);
-    put_user((unsigned long)up_pln, &kp->phys);
-    return 0;
-}
-
-static int put_ion_phys_dma_data32(struct ion_phys_dma_data *kp, struct ion_phys_dma_data32 __user *up)
-{
-    u32 tmp = (u32)((unsigned long)kp->phys);
-    if (!access_ok(VERIFY_WRITE, up, sizeof(struct ion_phys_dma_data32)) ||
-        put_user((s32)kp->size, &up->size) ||
-        put_user((s32)kp->dmafd, &up->dmafd) ||
-        put_user(tmp, &up->phys))
-            return -EFAULT;
-    return 0;
-}
-
-static int get_ion_phys_virt_data32(struct ion_phys_virt_data *kp, struct ion_phys_virt_data32 __user *up)
-{
-    void __user *up_pln;
-    void __user *up_pln2;
-    compat_long_t p;
-    compat_long_t p2;
-
-    if (!access_ok(VERIFY_READ, up, sizeof(struct ion_phys_virt_data32)) ||
-        get_user(kp->size, &up->size) ||
-        get_user(p, &up->phys) ||
-        get_user(p2, &up->virt))
-            return -EFAULT;
-    up_pln = compat_ptr(p);
-    up_pln2 = compat_ptr(p2);
-    put_user((unsigned long)up_pln, &kp->phys);
-    put_user((unsigned long)up_pln2, &kp->virt);
-    return 0;
-}
-
-static int put_ion_phys_virt_data32(struct ion_phys_virt_data *kp, struct ion_phys_virt_data32 __user *up)
-{
-    u32 tmp = (u32)((unsigned long)kp->phys);
-    u32 tmp2 = (u32)((unsigned long)kp->virt);
-    if (!access_ok(VERIFY_WRITE, up, sizeof(struct ion_phys_virt_data32)) ||
-        put_user((u32)kp->size, &up->size) ||
-        put_user(tmp, &up->phys) ||
-        put_user(tmp2, &up->virt))
-            return -EFAULT;
-    return 0;
-}
-
 static long
 mxc_custom_ioctl(struct ion_client *client, unsigned int cmd, unsigned long arg)
 {
-
        switch (cmd) {
        case ION_IOC_PHYS:
                {
@@ -311,51 +207,7 @@ err1:
 
        return 0;
 }
-static long
-mxc_custom_compat_ioctl(struct ion_client *client, unsigned int cmd, unsigned long arg)
-{
-#define MXC_CUSTOM_IOCTL32(err,client,cmd,arg) {\
-        mm_segment_t old_fs = get_fs();\
-        set_fs(KERNEL_DS);\
-        err = mxc_custom_ioctl(client, cmd, arg);\
-        if(err) return err;\
-        set_fs(old_fs);\
-}
-    union {
-        struct ion_phys_data kdata;
-        struct ion_phys_dma_data kdmadata;
-        struct ion_phys_virt_data  kvirtdata;
-    } karg;
-
-    void __user *up = compat_ptr(arg);
-    long err = 0;
-
-    switch(cmd){
-        case ION_IOC_PHYS32:
-            err = get_ion_phys_data32(&karg.kdata, up);
-            if(err) return err;
-            MXC_CUSTOM_IOCTL32(err,client,ION_IOC_PHYS,(unsigned long)&karg);
-            err = put_ion_phys_data32(&karg.kdata, up);
-            break;
-        case ION_IOC_PHYS_DMA32:
-            err = get_ion_phys_dma_data32(&karg.kdmadata, up);
-            if(err) return err;
-            MXC_CUSTOM_IOCTL32(err,client,ION_IOC_PHYS_DMA,(unsigned long)&karg);
-            err = put_ion_phys_dma_data32(&karg.kdmadata, up);
-            break;
-        case ION_IOC_PHYS_VIRT32:
-            err = get_ion_phys_virt_data32(&karg.kvirtdata, up);
-            if(err) return err;
-            MXC_CUSTOM_IOCTL32(err,client,ION_IOC_PHYS_VIRT,(unsigned long)&karg);
-            err = put_ion_phys_virt_data32(&karg.kvirtdata, up);
-            break;
-        default:
-            err = mxc_custom_ioctl(client, cmd, (unsigned long)arg);
-            break;
-    }
-
-    return err;
-}
+
 int
 mxc_ion_probe(struct platform_device *pdev)
 {
@@ -378,7 +230,7 @@ mxc_ion_probe(struct platform_device *pdev)
 
        heaps = kzalloc(sizeof(struct ion_heap *) * pdata->nr, GFP_KERNEL);
 
-       idev = ion_device_create(mxc_custom_compat_ioctl);
+       idev = ion_device_create(mxc_custom_ioctl);
        if (IS_ERR_OR_NULL(idev)) {
                err = PTR_ERR(idev);
                goto err;
index e14fad2..408b7b9 100755 (executable)
@@ -84,7 +84,7 @@ struct core_desc {
 
 #define HANTRODEC_IOX_ASIC_ID        _IOWR(HANTRODEC_IOC_MAGIC, 20, __u32 *)
 
-#define HANTRODEC_IOCG_CORE_ID       _IO(HANTRODEC_IOC_MAGIC, 21)
+#define HANTRODEC_IOCG_CORE_ID       _IOR(HANTRODEC_IOC_MAGIC, 21, int *)
 
 #define HANTRODEC_DEBUG_STATUS       _IO(HANTRODEC_IOC_MAGIC, 29)