menu

arrow_back How to fix these errors when you compile?

by
1 vote
Good afternoon comrades!

Trying to compile the driver according to the instructions. Fails with the following error:
/home/ignn/DX910-SW-99002-r9p0-01rel0/driver/src/devicedrv/mali/linux/mali_osk_timers.c: In function ‘_mali_osk_timer_init’:
/home/ignn/DX910-SW-99002-r9p0-01rel0/driver/src/devicedrv/mali/linux/mali_osk_timers.c:30:17: error: implicit declaration of function ‘init_timer’; did you mean ‘init_timers’? [-Werror=implicit-function-declaration]
if (NULL != t) init_timer(&t->timer);
^~~~~~~~~~
init_timers
/home/ignn/DX910-SW-99002-r9p0-01rel0/driver/src/devicedrv/mali/linux/mali_osk_timers.c: In function ‘_mali_osk_timer_setcallback’:
/home/ignn/DX910-SW-99002-r9p0-01rel0/driver/src/devicedrv/mali/linux/mali_osk_timers.c:68:12: error: ‘struct timer_list’ has no member named ‘data’
tim->timer.data = (unsigned long)data;
^
/home/ignn/DX910-SW-99002-r9p0-01rel0/driver/src/devicedrv/mali/linux/mali_osk_timers.c:69:22: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
tim->timer.function = (timer_timeout_function_t)callback;
^
cc1: some warnings being treated as errors
scripts/Makefile.build:291: recipe for target '/home/ignn/DX910-SW-99002-r9p0-01rel0/driver/src/devicedrv/mali/linux/mali_osk_timers.o' failed
make[2]: *** [/home/ignn/DX910-SW-99002-r9p0-01rel0/driver/src/devicedrv/mali/linux/mali_osk_timers.o] Error 1
Makefile:1563: recipe for target '_module_/home/ignn/DX910-SW-99002-r9p0-01rel0/driver/src/devicedrv/mali' failed
make[1]: *** [_module_/home/ignn/DX910-SW-99002-r9p0-01rel0/driver/src/devicedrv/mali] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.20.2-sunxi64'
Makefile:207: recipe for target 'all' failed
make: *** [all] Error 2

Не очень понимаю в этих скриптах.. Есть идеи товарищи?

Содержимое mali_osk_timers.cGNU nano 2.9.3 /home/ignn/DX910-SW-99002-r9p0-01rel0/driver/src/devicedrv/mali/linux/mali_osk_timers.c

{
_mali_osk_timer_t *t = (_mali_osk_timer_t *)kmalloc(sizeof(_mali_osk_timer_t), GFP_KERNEL);
if (NULL != t) init_timer(&t->timer);
return t;
}

void _mali_osk_timer_add(_mali_osk_timer_t *tim, unsigned long ticks_to_expire)
{
MALI_DEBUG_ASSERT_POINTER(tim);
tim->timer.expires = jiffies + ticks_to_expire;
add_timer(&(tim->timer));
}

void _mali_osk_timer_mod(_mali_osk_timer_t *tim, unsigned long ticks_to_expire)
{
MALI_DEBUG_ASSERT_POINTER(tim);
mod_timer(&(tim->timer), jiffies + ticks_to_expire);
}

void _mali_osk_timer_del(_mali_osk_timer_t *tim)
{
MALI_DEBUG_ASSERT_POINTER(tim);
del_timer_sync(&(tim->timer));
}

void _mali_osk_timer_del_async(_mali_osk_timer_t *tim)
{
MALI_DEBUG_ASSERT_POINTER(tim);
del_timer(&(tim->timer));
}

mali_bool _mali_osk_timer_pending(_mali_osk_timer_t *tim)
{
MALI_DEBUG_ASSERT_POINTER(tim);
return 1 == timer_pending(&(tim->timer));
}

void _mali_osk_timer_setcallback(_mali_osk_timer_t *tim, _mali_osk_timer_callback_t callback, void *data)
{
MALI_DEBUG_ASSERT_POINTER(tim);
tim->timer.data = (unsigned long)data;
tim->timer.function = (timer_timeout_function_t)callback;
}

void _mali_osk_timer_term(_mali_osk_timer_t *tim)
{
MALI_DEBUG_ASSERT_POINTER(tim);
kfree(tim);
}

1 Answer

by
0 votes
Is.

Not enough library or header file, where the first will be described the function init_timer(), and secondly declared a timer_list structure. In addition, the last error means assigning a wrong type in a number or string write pointer, for example.