how to implement mmap for sysfs device driver

anish singh anish198519851985 at gmail.com
Fri Sep 20 05:01:59 EDT 2013


On Sep 20, 2013 2:25 PM, "Niroj Pokhrel" <nirojpokhrel at gmail.com> wrote:
>
> Hi all,
> I want to implement a device driver with mmap operations. However, I am
not using ioctl call.
> My approach:
> i. I have created a sysfs bin files (because it support mmap)
Why you want to implement mmap for sysfs file?
What are you trying to mmap?Do you unserstand the reason why we do mmap?
Please answer these questions and once you find out the answers to this
question i think you will understand where you are going wrong.
> ii. Now, I have implemented my mmap in my driver and assign
this attribute to the sysfs file I have created.
> However, I am facing the problem. The mmap is being called properly,
however mmap_fault my implementation is not being called as a result of
which the memory is not mapped. So, when I try to access this file I get
segmentation fault.
>
> Can you please suggest what I should modify or is there anyother way to
do it other than this ??
> Thanking you in advance.
>
> Thanks and Regards,
> Niroj Pokhrel
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130920/d0c32f77/attachment.html 


More information about the Kernelnewbies mailing list