]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ENGR00240988: gpu: fix deprecated idr calls on 3.10 kernel
authorShawn Guo <shawn.guo@freescale.com>
Mon, 29 Jul 2013 03:47:05 +0000 (11:47 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Wed, 20 Aug 2014 08:06:08 +0000 (10:06 +0200)
The idr calls idr_pre_get() and idr_get_new_above() are deprecated on
3.10 kernel and cause the following build issues.  Replace the calls
with the new idr_alloc() to fix the issue.

  CC      drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.o
drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c: In function ‘_AllocateIntegerId’:
drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c:776:5: error: ‘idr_pre_get’ is deprecated (declared at include/linux/idr.h:151) [-Werror=deprecated-declarations]
drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c:784:5: error: ‘idr_get_new_above’ is deprecated (declared at include/linux/idr.h:166) [-Werror=deprecated-declarations]

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c

index f82fe4be2cca18b49b647f4f037d1e3bcb994446..f21651660395a88ee15bbcbb61a10632a93e8c84 100644 (file)
@@ -772,6 +772,18 @@ _AllocateIntegerId(
 {
     int result;
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+       spin_lock(&Database->lock);
+       /* Try to get a id greater than 0. */
+       result = idr_alloc(&Database->idr, KernelPointer, 1, 0,
+                          GFP_KERNEL | gcdNOWARN);
+       spin_unlock(&Database->lock);
+
+       if (result < 0)
+           return gcvSTATUS_OUT_OF_RESOURCES;
+
+       *Id = result;
+#else
 again:
     if (idr_pre_get(&Database->idr, GFP_KERNEL | gcdNOWARN) == 0)
     {
@@ -794,6 +806,7 @@ again:
     {
         return gcvSTATUS_OUT_OF_RESOURCES;
     }
+#endif
 
     return gcvSTATUS_OK;
 }