public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Wool <vwool@dev.rtsoft.ru>
To: Russell King <rmk+lkml@arm.linux.org.uk>
Cc: Arjan van de Ven <arjan@infradead.org>, linux-kernel@vger.kernel.org
Subject: Re: [RFC] SPI core -- revisited
Date: Mon, 27 Jun 2005 14:20:26 +0400	[thread overview]
Message-ID: <42BFD2EA.5060808@dev.rtsoft.ru> (raw)
In-Reply-To: <20050627102047.B10822@flint.arm.linux.org.uk>

Russell King wrote:

>On Mon, Jun 27, 2005 at 01:13:44PM +0400, Vitaly Wool wrote:
>  
>
>>Arjan van de Ven wrote:
>>    
>>
>>>how is that??
>>>      
>>>
>>These functions are not exactly *wrappers*, there's some little 
>>additional logic inside.
>>spi-pnx0105_atmel.c uses spi_pnx_msg_buff_t structure to embed physical 
>>and virtual address and length of the memory area allocated by 
>>consistent_alloc, so if we just get rid of the alloc/free functions, 
>>we'll copy wrong data from the userspace and nothing'll work.
>>
>>Let's look at it from another point. When a read request comes from the 
>>userspace to spi-dev, spi-dev should allocate  memory and copy the user 
>>data in there. The problem is it is not (and shouldn't be) aware whether 
>>the transfer is gonna be DMA or not so spi-dev can't choose 
>>theappropriate method of memory allocation. Therefore it's reasonable to 
>>let algorithm provide routines to do that.
>>    
>>
>
>Sorry, this isn't making sense.  Are you implying that you want to use
>DMA to copy data from user to kernel space?  Or something else?
>
>In any case, I do hope that you are aware that copy_to_user/copy_from_user
>have rather important side effects other than just copying data?  They
>cause page faults which ensure that the user space pages are paged in
>and/or copied if written to as appropriate.
>  
>
Looks like you've misunderstood me. I was talking only about mem-to-dev 
and dev-to-mem DMA transfers, where dev is actually an SPI device. The 
thing I was talking about was that the 'wrappers' are necessary to call 
*real* copy_from_user/copy_to_user with the appropriate parameters. I 
hope this can also be derived by looking in the code.

>In another post, you mention that this patch was not provided for review.
>However, it _is_ effectively provided for review because it's an
>illustration of _how_ the interfaces are used - and we're reviewing
>the interfaces provided by the SPI core.
>
>  
>
Ok, readily agreeing to that.
But -- does the interfaces review imply checking wthether the figure 
brackets are complying to K&R? ;)


  reply	other threads:[~2005-06-27 10:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-26 19:36 [RFC] SPI core -- revisited dpervushin
2005-06-26 20:49 ` Alexey Dobriyan
2005-06-26 20:59   ` Arjan van de Ven
2005-06-27  3:37     ` Vitaly Wool
2005-06-27  8:28       ` Arjan van de Ven
2005-06-27  9:13         ` Vitaly Wool
2005-06-27  9:20           ` Russell King
2005-06-27 10:20             ` Vitaly Wool [this message]
2005-06-28 16:49               ` Greg KH
2005-06-27  3:39   ` Vitaly Wool
  -- strict thread matches above, loose matches on Subject: below --
2005-06-23 12:18 dmitry pervushin
2005-06-23 15:50 ` Jamey Hicks
2005-06-23 16:43   ` Russell King
2005-06-24 12:56     ` Jamey Hicks
2005-06-23 21:59 ` Jean Delvare
2005-06-24  0:35 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42BFD2EA.5060808@dev.rtsoft.ru \
    --to=vwool@dev.rtsoft.ru \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk+lkml@arm.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox