Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.


  Search this Thread
Old 06-20-2012, 01:50 AM   #1
LQ Newbie
Registered: Jun 2012
Posts: 1

Rep: Reputation: Disabled
Unable to read the updated buffer in kernel space from user space

Hello all,

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

read (fd,buf,size);
write (fd,buf,size);

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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to correctly mmap DMA buffer in user space. dkwan Linux - Kernel 10 07-11-2011 02:17 PM
Shared buffer between user and kernel space bala1486 Linux - General 1 05-04-2010 12:03 AM
Division of Logical Memory Space in to User Space and Kernel Space shreshtha Linux - Newbie 2 01-14-2010 09:59 AM
Accessing User Space Buffer directly in Kernel code akshaynm87 Linux - Kernel 2 06-29-2009 09:39 AM
Accessing a kernel buffer from user space jan_capri Linux - Kernel 2 05-21-2007 11:44 PM > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 12:23 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration