problem using hrtimer struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am working on writing a module which uses the hrtimre struct to find the resolution of the kernel. Here is the module:

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/time.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <linux/hrtimer.h>
#include <linux/fs.h>
#include <linux/posix-timers.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/time.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <linux/hrtimer.h>
#include <linux/fs.h>
#include <linux/posix-timers.h>


static int begin_func(void *data);
static int begin_func(void *data)
{
        int i,sum;
        sum = 0;
        for(i = 0; i < 10; i++)
        {
                sum = sum + i*i + i*i;
        }
        return sum;
}
static int __init calib_init(void)
{
       
        struct hrtimer *timer;
        void *temp;
        ktime_t starts = ktime_set(1,0); /* one second, zero nsecs */
        timer->function = begin_func;
        timer->data = "" *)temp;
        hrtimer_start(timer, starts, HRTIMER_REL);
        printk(KERN_INFO "Hello, world \n");
      
        return 0;
}

static void __exit calib_exit(void)
{
        printk(KERN_INFO "Goodbye, world\n");
}
module_init(calib_init);
module_exit(calib_exit);

extern int hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode);
extern int hrtimer_cancel(struct hrtimer *timer);*/

static int begin_func(void *data);
static int begin_func(void *data)
{
        int i,sum;
        sum = 0;
        for(i = 0; i < 10; i++)
        {
                sum = sum + i*i + i*i;
        }
        return sum;
}
static int __init calib_init(void)
{
        struct hrtimer *timer;
        void *temp;
     
     
        ktime_t starts = ktime_set(1,0); /* one second, zero nsecs */
        timer->function = begin_func;
        timer->data = "" *)temp;
        hrtimer_start(timer, starts, HRTIMER_REL);
        printk(KERN_INFO "Hello, world \n");
        return 0;
}

static void __exit calib_exit(void)
{
        printk(KERN_INFO "Goodbye, world\n");
}
module_init(calib_init);
module_exit(calib_exit);


When I compile the above module, HERE is the output:


-bash-2.05b$ make
make -C /lib/modules/2.6.15-rt16-groupsched-dski-skas3-v8.2y/build M=/users/dheeraj/EECS750/umk/calibrate modules
make[1]: Entering directory `/home/dheeraj/svn/groupsched-dski/2.6.15-rt16-groupsched-dski_skas'
make[2]: Warning: File `/users/dheeraj/EECS750/umk/calibrate/calibrate.c' has modification time 3.5e+02 s in the future
  CC [M]  /users/dheeraj/EECS750/umk/calibrate/calibrate.o
/users/dheeraj/EECS750/umk/calibrate/calibrate.c: In function `calib_init':
/users/dheeraj/EECS750/umk/calibrate/calibrate.c:36: warning: `timer' might be used uninitialized in this function --------------------------------------------1
/users/dheeraj/EECS750/umk/calibrate/calibrate.c:37: warning: `temp' might be used uninitialized in this function ---------------------------------------------2
make[2]: warning:  Clock skew detected.  Your build may be incomplete.
  Building modules, stage 2.
make[2]: Warning: File `/users/dheeraj/EECS750/umk/calibrate/calibrate.o' has modification time 3.7e+02 s in the future
  MODPOST
*** Warning: "hrtimer_start" [/users/dheeraj/EECS750/umk/calibrate/calibrate.ko] undefined!
  CC      /users/dheeraj/EECS750/umk/calibrate/calibrate.mod.o
  LD [M]  /users/dheeraj/EECS750/umk/calibrate/calibrate.ko
make[2]: warning:  Clock skew detected.  Your build may be incomplete.
make[1]: Leaving directory `/home/dheeraj/svn/groupsched-dski/2.6.15-rt16-groupsched-dski_skas'

------------------------------------------------------------------------------------------------------------------------------------------------------------

How can I correct the warning of eq.s 1,2? the hrtimer struct belongs to hrtimer.c

Thanks,
Jack


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux