T
T
TechNOIR2019-02-01 10:56:54
linux
TechNOIR, 2019-02-01 10:56:54

How to fix these compilation errors?

Good afternoon comrades!
I'm trying to compile the driver according to the instructions. Gives the following errors:

/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

I don't really understand these scripts.. Any ideas comrades?
Content of mali_osk_timers.c
GNU 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);
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
CityCat4, 2019-02-01
@CityCat4

There is.
There is not enough library or header file, where firstly the init_timer() function will be described, and secondly the timer_list structure will be declared. In addition, the last error means assigning an incorrect type - you write a pointer to a number or a string, for example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question