how to call a function with return value in kernel question on programming

Hi,
I have to need call a f() function in my kernel K(), as below.
But cuda doensn’t support calling a function with return value other than “void”. what can I do? thanks!

char f()
{

return x;
}

global void K()
{

a = f();

use device :)