From: Shawn Guo Date: Mon, 29 Jul 2013 03:47:05 +0000 (+0800) Subject: ENGR00240988: gpu: fix deprecated idr calls on 3.10 kernel X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e77c35f90b5e2039a6b3d021f548992842f8689c;p=karo-tx-linux.git ENGR00240988: gpu: fix deprecated idr calls on 3.10 kernel 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 --- diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c index f82fe4be2cca..f21651660395 100644 --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c @@ -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; }