2008-02-04 13:58:39 bfin_spi_adc.c and copy_from_user()
murti iki (GERMANY)
Message: 50644 hello all,
I would like to ask the reason why there is not a copy_from_user() function in the write function of file operations.
The read function has the copy_to_user() but as far as I see the write() function directly dereferences the buffer
from the kernel space.
I would be most happy if somebody can explain me the idea behind this.
thanks alot
tos
QuoteReplyEditDelete
2008-02-04 16:54:41 Re: bfin_spi_adc.c and copy_from_user()
Michael Hennerich (GERMANY)
Message: 50653
I guess this is just bad code, which tends to work on noMMU.
From an efficiency point of view it’s not a bad idea, however it violates various security aspects.
In case you’re a system designer – and know what you are doing…
However we are going to remove this driver soon, please use the spidev interface for user space access.
-Michael
QuoteReplyEditDelete
2008-02-05 05:49:29 Re: bfin_spi_adc.c and copy_from_user()
murti iki (GERMANY)
Message: 50674 Hello Michael,
Thank you for your answer. Actually I am a little bit confused about the spi documentation.
I would appreciate if you can also help me with the below questions of mine.
1) http://docs.blackfin.uclinux.org/doku.php?id=adsp-spiadc_documentation
tells that there are 2 spi drivers namely linux-2.6.x/drivers/char/spi.c (interrupt driven)
and linux-2.6.x/drivers/char/adsp-spiadc.c (dma driven)
however in the linux-2.6.x/drivers/char/ folder there is only bfin_spi_adc.c
I have double checked but couldn't find them, I have found one driver named spi.c but it's
located in linux-2.6.x/drivers/spi/spi.c (also it doesn't have any ioctl commands)
Where can I find these two drivers? ***
I also cannot find the /linux-2.6.x/documentation/spi/spidev file.
2) I have tried to go through the source files to understand the relation between these source codes to little success. Can you please explain me the connection between below files.
linux-2.6.x/drivers/spi/spi_bfin5xx.c
linux-2.6.x/drivers/spi/spi.c
(Probably I am wrong but) To me these files tend to provide kernel functions so that higher layer drivers can utilize them. In my opinion bfin_spi_adc.c is a higher layer driver than these two however it doesn't seem to utilize them. Maybe these two drivers that I couldn't find utilizes them in a way that a linux-uClinux newbie like me can see it easily.
Mit freundlichen Grüssen
tos
*** I have only downloaded the uClinux-dist-2007R1.1-RC3.
QuoteReplyEditDelete
2008-02-05 06:16:16 Re: bfin_spi_adc.c and copy_from_user()
Michael Hennerich (GERMANY)
Message: 50676 Tos,
the ADSP-SPIADC was obsoleted and removed some time ago, while we introduced the generic SPI bus driver.
It does not longer exist - I therefore removed the documentation o the wiki.
The spidev driver will be in our next release coming soon.
You can check out the 2008R1release using svn.
Gruss,
-Michael
QuoteReplyEditDelete
2008-02-05 14:21:22 Re: bfin_spi_adc.c and copy_from_user()
murti iki (GERMANY)
Message: 50711 Thanks Michael.
Maybe it's a stupid question but can you also tell me how to find this spidev driver in the svn.
I have searched for some time looked under these places
/branches/2008R1
/tags/2008R1-RC1
but couldn't find it.
QuoteReplyEditDelete
2008-02-06 10:35:20 Re: bfin_spi_adc.c and copy_from_user()
Myrick Monroe (UNITED STATES)
Message: 50765
I just looked also and I have the same question...
Myrick
QuoteReplyEditDelete
2008-02-12 04:27:59 Re: bfin_spi_adc.c and copy_from_user()
murti iki (GERMANY)
Message: 50921 After having some time off with other subjects.
I have looked into this svn issue. As a user new to linux, I have found out that you need the subversion software to access this
trunk. There is an online book in the "svn references" section to the left. It has a good deal of information.
Anyway probably, use of this svn is already mentioned in the wiki but for careless readers like me, maybe a bigger typed notice would help