All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <michael@ellerman.id.au>
To: Becky Bruce <beckyb@kernel.crashing.org>
Cc: Christoph Hellwig <hch@lst.de>, linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] powerpc: Change archdata dma_data type to dma_addr_t
Date: Thu, 27 Aug 2009 10:24:56 +1000	[thread overview]
Message-ID: <1251332696.5914.6.camel@concordia> (raw)
In-Reply-To: <E3F20841-FB04-44EF-8DAA-91F51873C0A6@kernel.crashing.org>

[-- Attachment #1: Type: text/plain, Size: 1998 bytes --]

On Wed, 2009-08-26 at 15:20 -0500, Becky Bruce wrote:
> On Aug 26, 2009, at 9:08 AM, Michael Ellerman wrote:
> 
> > On Wed, 2009-08-26 at 22:29 +1000, Benjamin Herrenschmidt wrote:
> >> On Mon, 2009-08-24 at 21:48 +0200, Christoph Hellwig wrote:
> >>> On Mon, Aug 24, 2009 at 11:17:14AM -0500, Becky Bruce wrote:
> >>>> Previously, this was specified as a void *, but that's not
> >>>> large enough on 32-bit systems with 36-bit physical
> >>>> addressing support.  Change the type to dma_addr_t so it
> >>>> will scale based on the size of a dma address.
> >>>
> >>> This looks extreml ugly to me.  It seems like the typical use is to
> >>> store a pointer to a structure.  So what about making the direct
> >>> dma case follow that general scheme instead?
> >>>
> >>> E.g. declare a
> >>>
> >>> struct direct_dma_data {
> >>> 	dma_addr_t	direct_dma_offset;
> >>> };
> >>>
> >>> and have one normal instace of it, and one per weird cell device.
> >>
> >> Right, but we want to avoid a structure for the classic case of 32- 
> >> bit
> >> systems with no iommu...
> >>
> >> I wouldn't mind doing a union here.
> >
> > That might be best, the patch as it stands is a horrible mess of  
> > casts.
> 
> Let's be fair - the code before was a horrible mess of casts, I've  
> just moved them :)

Yeah true. Though I think we end up with more casts because there were
more call sites using it as a pointer originally. But yeah it's not
pretty either way.

> > Stashing a dma_addr_t into a void * is sort of gross, but storing a
> > pointer to some struct (a void *) in a dma_addr_t is _really_ gross :)
> 
> Both are revolting (and storing a dma_addr_t into a void * is really  
> gross when the void * is smaller than the dma_addr_t!!).  A union  
> might not be a bad idea, though.  I'll look at doing that instead.

Cool. That is how we're using it, sometimes it points to something
sometimes it's a dma_addr_t, so I think a union will work.

cheers

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

      reply	other threads:[~2009-08-27  0:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-24 16:17 [PATCH] powerpc: Change archdata dma_data type to dma_addr_t Becky Bruce
2009-08-24 19:48 ` Christoph Hellwig
2009-08-26 12:29   ` Benjamin Herrenschmidt
2009-08-26 14:08     ` Michael Ellerman
2009-08-26 20:20       ` Becky Bruce
2009-08-27  0:24         ` Michael Ellerman [this message]

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=1251332696.5914.6.camel@concordia \
    --to=michael@ellerman.id.au \
    --cc=beckyb@kernel.crashing.org \
    --cc=hch@lst.de \
    --cc=linuxppc-dev@ozlabs.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.