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>
{
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)
{
{
return gcvSTATUS_OUT_OF_RESOURCES;
}
+#endif
return gcvSTATUS_OK;
}