# printf in kernel



## PaoloRoberti (Jun 6, 2009)

I am using the printf function in the kernel.  When I use it in the load module event function it works as expected with data going to the log and the console.  However when I use it in the open/close functions of the device driver, printf behave like a null function: no action and no message anywhere to be seen.  

When I use uprintf in open/close it works as expected but I would like to use printf across the board so that any tracing/debugging goes to one place only.

Does anybody knows why printf does not work in the open/close functions?

Thanks in advance for any help


----------



## PaoloRoberti (Jun 7, 2009)

Found the problem.  The printf is embedded in a macro and the wrap around if statement within the macro was skipping the printf when executing in the open/close function.  Fixed the macro and everything working as expected.

I am new to this environment as you can probably tell....


----------

