This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

about copy_to_user

Is it possible to change from 32-bit to 16-bit access the "copyt_to_user"?

I'm developing a Linux driver that read/write to fpga.
(fpga has been connected by a 16-bit bus.fpga is 16-bit bus)
Using the copy_to_user function in this driver, the data that is read from fpga is a mistake.
However, read is successful when I copy by 2byte(16-bit).

I thought copy_to_user is 32-bit access only.

  • copy_to_user does not have any defined access type; like memcpy, it can use whatever transfers it likes.

    If your hardware supports only 16-bit accesses, then you must copy the data to your own buffer in 'real' memory with explicit 16-bit accesses, and call copy_to_user on that.