* Reading temperature from another Kernel modules
@ 2010-10-26 9:01 Matthias Dunda
2010-10-28 14:35 ` Clemens Ladisch
0 siblings, 1 reply; 2+ messages in thread
From: Matthias Dunda @ 2010-10-26 9:01 UTC (permalink / raw)
To: linux-kernel
Hi everybody,
I need to read out the current system temperature from inside my custom kernel module.
My system works with the jc42.c driver and I can read the temperature perfectly via the proc filesystem in user space.
How do I query the temperature from another kernel driver?
First of all I added a new function and exported the symbol
int jc42_get_temperature()
{
int temp;
// TODO get the correct temp
temp = jc42_read_value(my_local_client, JC42_REG_TEMP);
return temp;
}
EXPORT_SYMBOL(jc42_get_temperature);
BUT: how do I get the temp? Most of the internal functions require a struct device or a struct i2c_client, which - I assume - are perfectly provided by the kernel when going the way over the proc file system.
I tried to statically save such a struct during the probing process (this is the above my_local_client), but this works neither. When I use the saved struct to call jc42_read_value, I always get a temperature value which is not correct at all.
Kernel is 2.6.29.6-rt24 (yes, jc42 is originally not included there - we ported it from a newer kernel release.)
Thanks for any help!
Matthias
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Reading temperature from another Kernel modules
2010-10-26 9:01 Reading temperature from another Kernel modules Matthias Dunda
@ 2010-10-28 14:35 ` Clemens Ladisch
0 siblings, 0 replies; 2+ messages in thread
From: Clemens Ladisch @ 2010-10-28 14:35 UTC (permalink / raw)
To: Matthias Dunda; +Cc: linux-kernel
Matthias Dunda wrote:
> BUT: how do I get the temp? Most of the internal functions require a
> struct device or a struct i2c_client, which - I assume - are perfectly
> provided by the kernel when going the way over the proc file system.
>
> I tried to statically save such a struct during the probing process
> (this is the above my_local_client), but this works neither. When I
> use the saved struct to call jc42_read_value, I always get a
> temperature value which is not correct at all.
Is that saved pointer actually the same? (Put printk()s in both your
function and some sysfs-called function.)
Regards,
Clemens
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-28 14:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-26 9:01 Reading temperature from another Kernel modules Matthias Dunda
2010-10-28 14:35 ` Clemens Ladisch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox