Hello,
I've a problem with a really simple write function in my first char driver.
The function is as follows:
Code:
...
static char hello_world[]="Hello World\n";
...
static ssize_t driver_write (struct file *instanz, const char *user, size_t count,
loff_t *offset ) {
int nc = 0;
if (count > strlen(hello_world)+1) return strlen(hello_world)+1-count;
return copy_from_user(hello_world,user,count);
}
If I try wo write on the associated Device, the write call works but it seems that is produces an infinite loop.
So the write function seems to be call infinite times.
By the printk in the write function i can see that behavior.
The failure goes from a simple echo > /dev/device to an C program using fwrite.
I'm grateful for each hint.
Thanks,
Johannes S.