Skip to contentSkip to conversation

how to link to hrtimers in the kernel

DISCUSSION NAK George Nychis 4 participants 5 messages Oct 6, 2008 – Oct 7, 2008

lore
Share & tools
lore
#0 lore raw

Hi all,

I have modified drivers/usb/core/devio.c to use hrtimer_nanosleep(), and have included linux/hrtimer.h with it.

But now I am having trouble linking, I get:
ERROR: "hrtimer_nanosleep" [drivers/usb/core/usbcore.ko] undefined!

How do I properly link to the hrtimer library?

Thanks!
George

#1 lore raw
Quoted 9 lines · George Nychis

Hi all,

I have modified drivers/usb/core/devio.c to use hrtimer_nanosleep(), and have included linux/hrtimer.h with it.

But now I am having trouble linking, I get:
ERROR: "hrtimer_nanosleep" [drivers/usb/core/usbcore.ko] undefined!

How do I properly link to the hrtimer library?

Hi,
That function needs to be exported in its source file. Patch below should fix it for you.

From: Randy Dunlap <[email protected]>

Export hrtimer_nanosleep() for module use.

---
 kernel/hrtimer.c |    1 +
 1 file changed, 1 insertion(+)
kernel/hrtimer.c +1 -0
@@ -1559,6 +1559,7 @@ out:
 	destroy_hrtimer_on_stack(&t.timer);
 	return ret;
 }
+EXPORT_SYMBOL_GPL(hrtimer_nanosleep);
 
 asmlinkage long
 sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp)
#2 lore raw
Quoted 6 lines · Randy.Dunlap
Quoted 4 lines · George Nychis

Hi all,

I have modified drivers/usb/core/devio.c to use hrtimer_nanosleep(), and have included linux/hrtimer.h with it.

Please do not use hrtimer_nanosleep() in drivers. That's wrong.

What do you want to achieve ?

Quoted 1 line

Export hrtimer_nanosleep() for module use.

NAK, hrtimer_nanosleep is part of the user space interfaces.

Quoted 16 lines
---
 kernel/hrtimer.c |    1 +
 1 file changed, 1 insertion(+)
kernel/hrtimer.c +1 -0
@@ -1559,6 +1559,7 @@ out:
 	destroy_hrtimer_on_stack(&t.timer);
 	return ret;
 }
+EXPORT_SYMBOL_GPL(hrtimer_nanosleep);
 
 asmlinkage long
 sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp)
#3 lore raw
Quoted 5 lines · Thomas Gleixner
Quoted 4 lines · Randy.Dunlap
Quoted 2 lines · George Nychis

Hi all,

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

I have modified drivers/usb/core/devio.c to use hrtimer_nanosleep(), and have included linux/hrtimer.h with it.

Please do not use hrtimer_nanosleep() in drivers. That's wrong.

What do you want to achieve ?

I am trying to sleep at the microsecond level, which ssleep and msleep cannot provide. I couldn't find any other nanosleep method in the kernel.

I found information by searching the net on using jiffies to accomplish sleep periods, but that is not high enough in resolution.

I'd greatly appreciate any feedback.

Thanks!
George

#4 lore raw
Quoted 9 lines · George Nychis

I am trying to sleep at the microsecond level, which ssleep and msleep cannot provide. I couldn't find any other nanosleep method in the kernel.

I found information by searching the net on using jiffies to accomplish sleep periods, but that is not high enough in resolution.

I'd greatly appreciate any feedback.

Is there any reason you can't use udelay()/ndelay()?

BAPper