kernel driver reading ok from user space, but writing back is always 0
So I'm working my way through kernel driver programming, and currently I'm trying to build a simple data transfer between application and kernel driver. I am using simple character device as a link between these two, and I have succeeded to transfer data to driver, but I can't get meaningful data back to user space. Kernel driver looks like this: #include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> /* printk() */ #include <linux/errno.h> /* error codes */ #include <linux/types.h> /* size_t */ #include <linux/proc_fs.h> #include <asm/uaccess.h> /* copy_from/to_user */