WhispThe
WhispThe

Reputation: 41

BUG: sleeping function called from invalid context - vibrator driver in Linux kernel

everyone. I was porting 3.0.x kernel for my Galaxy Mini 2, I've been able to solve most of the problems myself, but one thing in vibrator driver. I am new to working in Linux kernel, so I am not able to solve it myself. Whenever the vibrator gets enabled, this comes up in logs: https://gist.github.com/TheWhisp/6133946

This is the source code of the vibrator driver: https://github.com/TheWhisp/android_kernel_samsung_msm7x27a/blob/jb-3.0/arch/arm/mach-msm/msm_vibrator_samsung.c

If I am correct, I've narrowed it down to the function that starts on line 176

Thanks, any help would be appreciated. :)

Upvotes: 1

Views: 2535

Answers (1)

tian_yufeng
tian_yufeng

Reputation: 1826

I can't agree with rakib on the solution he suggested although his analysis make sense.

The msm_vibrator_power() is called in hrtimer handler. And hrtimer is running in software irq context.

The OOPS information complains that msm_vibrator_power() calls _regulator_get() which uses mutex inside it.

The solution to this issue is: avoid to use any blocking/sleeping functions inside the hrtimer handler. That means to re-design the hrtimer handler, avoid to call mutex() kinds of blocking/sleeping functions.

Upvotes: 3

Related Questions