Unable to read the updated buffer in kernel space from user space
I am using serial flash driver m25p80.c.It has the following functions to read & write respectively.
static int m25p80_read(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char *buf)
static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, const u_char *buf)
I am using mtd_debug utility to write and read the data from serial flash.
The read and write functions calls are as below in the mtd_debug.c
where fd is my file descriptor pointing mtd device,buf is the buffer into which either data is written or read from it and size is the size of the buffer.
when I am calling write function ,inturn m25p80_write() function in driver is being called and data pointed to by buf pointer is written into flash.
When i am calling the read function after that ,inturn m25p80_read() function is being called and the buffer pointed by the buf(which is a argument to m25p80_read()) is getting updated with red values from the flash.
But when I am trying to print the values of the buffer pointed by buf (which is the argument in my read call)in the mtd_debug.c i am not seeing any updated values that I am seeing in my driver read function.
I am unable to understand the reason that in case of write I am able to pass the data from user space to kernel space but in case of read it is not happening.
I tried a lot to get the reason but could not.
Please help me in solving this issue.