[rfc patch] swiotlb: consolidate swiotlb_sync_sg_* implementations

From: John W. Linville (linville_at_tuxdriver.com)
Date: 08/30/05

  • Next message: Mws: "Re: Second "CPU" of 1-core HyperThreading CPU not found in 2.6.13"
    Date:	Tue, 30 Aug 2005 14:40:06 -0400
    To: linux-kernel@vger.kernel.org
    
    

    On Tue, Aug 30, 2005 at 02:33:39PM -0400, John W. Linville wrote:
    > On Tue, Aug 30, 2005 at 02:09:14PM -0400, John W. Linville wrote:
    > > On Tue, Aug 30, 2005 at 11:03:35AM -0700, Luck, Tony wrote:
    > > >
    > > > >+swiotlb_sync_single_range_for_cpu(struct device *hwdev,
    > > > >+swiotlb_sync_single_range_for_device(struct device *hwdev,
    > > >
    > > > Huh? These look identical ... same args, same code, just a
    > > > different name.
    > >
    > > Have you looked at the implementations for swiotlb_sync_single_for_cpu
    > > and swiotlb_sync_single_for_device? Those are already identical.
    >
    > How about a patch like this? Just for comment...I'll repost if people
    > want it...

    Probably should include the swiotlb_sync_sg_* variations too...

    Whaddya think? Again, I'll repost if this is viewed favorably.

    John

    --- linux-8_29_2005/arch/ia64/lib/swiotlb.c.orig 2005-08-30 14:35:35.000000000 -0400
    +++ linux-8_29_2005/arch/ia64/lib/swiotlb.c 2005-08-30 14:37:05.000000000 -0400
    @@ -612,9 +612,9 @@ swiotlb_unmap_sg(struct device *hwdev, s
      * The same as swiotlb_sync_single_* but for a scatter-gather list, same rules
      * and usage.
      */
    -void
    -swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg,
    - int nelems, int dir)
    +static inline void
    +swiotlb_sync_sg(struct device *hwdev, struct scatterlist *sg,
    + int nelems, int dir)
     {
             int i;
     
    @@ -628,18 +628,17 @@ swiotlb_sync_sg_for_cpu(struct device *h
     }
     
     void
    +swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg,
    + int nelems, int dir)
    +{
    + swiotlb_sync_sg(hwdev, sg, nelems, dir);
    +}
    +
    +void
     swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
                                int nelems, int dir)
     {
    - int i;
    -
    - if (dir == DMA_NONE)
    - BUG();
    -
    - for (i = 0; i < nelems; i++, sg++)
    - if (sg->dma_address != SG_ENT_PHYS_ADDRESS(sg))
    - sync_single(hwdev, (void *) sg->dma_address,
    - sg->dma_length, dir);
    + swiotlb_sync_sg(hwdev, sg, nelems, dir);
     }
     
     int

    -- 
    John W. Linville
    linville@tuxdriver.com
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: Mws: "Re: Second "CPU" of 1-core HyperThreading CPU not found in 2.6.13"

    Relevant Pages

    • RE: I have fixed ASP.NET check it out
      ... John, I've just had a look on two topics created by you (this and about ... Just go back your lovely VB and ASP technologies and stop making ... > void PageMethod() { ... > string HTML{ ...
      (microsoft.public.dotnet.framework.aspnet)
    • Re: from void * to types
      ... john wrote: ... > I have a simple program with a function that takes a void * parameter. ... > Unfortuneately the conditionals do not adequately filter the the types ... of every expression must be known at compile time. ...
      (comp.lang.c)
    • [rfc patch] swiotlb: consolidate swiotlb_sync_single_* implementations
      ... This is meant to apply on top of my previous swiotlb patch... ... +static inline void ... John W. Linville ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: linked list help please.
      ... My name is john. ... Studying C++ in Sweden. ... but i want to explain it to myselfe too. ... void list::insert ...
      (alt.comp.lang.learn.c-cpp)
    • Re: 821206 - using DEBUG_NEW
      ... > void main ... > i'm using visual studio .net ... And how could the compiler know that the delete you expect ...
      (comp.lang.cpp)