linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 02/23] at91: Make Ethernet device common
Date: Thu, 28 Apr 2011 19:31:32 +0100	[thread overview]
Message-ID: <20110428183132.GH17290@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <0D753D10438DA54287A00B027084269764D26C44B4@AUSP01VMBX24.collaborationhost.net>

On Thu, Apr 28, 2011 at 12:57:45PM -0500, H Hartley Sweeten wrote:
> On Thursday, April 28, 2011 2:15 AM, Russell King wrote:
> > On Thu, Apr 21, 2011 at 06:19:37PM -0500, H Hartley Sweeten wrote:
> >> +static struct platform_device at91_eth_device = {
> >> +	.name		= "macb",
> >> +	.id		= -1,
> >> +	.dev		= {
> >> +		.dma_mask		= &at91_eth_device.dev.coherent_dma_mask,
> >> +		.coherent_dma_mask	= DMA_BIT_MASK(32),
> >> 
> >> That will get rid of the static u64 variable used for every dma
> >> capable device.
> >
> > I've never really liked that, because coherent_dma_mask is never changed,
> > but the value pointed to be dma_mask can be by drivers.  See dma_set_mask().
> >
> > So, calling dma_set_mask() on any device which does the above will also
> > (unexpectedly?) change the coherent mask too.
> >
> > It's a minor point as we don't have many platform drivers using
> > dma_set_mask().
> 
> So, if I understand this correctly...
> 
> 1) dev.coherent_dma_mask is a constant that defines the default dma mask of
> the device.

dev.coherent_dma_mask is used for dma_alloc_coherent() allocations.

> 2) dev.dma_mask is a pointer to the dma mask that is being used by the device.

dev.dma_mask is a pointer to the DMA mask being used by the dma_map_* API.

> 3) The static variable pointed to by dev.dma_mask holds the dma mask being
> used by the device.  The value can be modified by the driver.
> 
> Why couldn't a new field be added to struct device to replace the static
> variable?  The code that sets up the device could do something like:
> 
> 	dev.used_dma_mask = dev.coherent_dma_mask;
> 	dev.dma_mask = &dev.used_dma_mask;

There was talk a while ago about getting rid of the pointer-ness of
dma_mask, but I think there's a bit of historic baggage in there to do
with the pre-device model PCI bus support code which gets in the way.
Not too sure about that though.

  reply	other threads:[~2011-04-28 18:31 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-21  5:41 [PATCH v2 00/23] at91: Replace duplicate device initialisation code with Ryan Mallon
2011-04-21  5:41 ` [PATCH v2 01/23] at91: Add common devices framework Ryan Mallon
2011-04-21  5:41 ` [PATCH v2 02/23] at91: Make Ethernet device common Ryan Mallon
2011-04-21 23:02   ` H Hartley Sweeten
2011-04-25 20:16     ` Ryan Mallon
2011-04-26  4:35       ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-26  5:26         ` Ryan Mallon
2011-04-21 23:19   ` H Hartley Sweeten
2011-04-25 20:15     ` Ryan Mallon
2011-04-28  9:15     ` Russell King - ARM Linux
2011-04-28 17:57       ` H Hartley Sweeten
2011-04-28 18:31         ` Russell King - ARM Linux [this message]
2011-04-28 20:46           ` H Hartley Sweeten
2011-04-29 19:32           ` Uwe Kleine-König
2011-04-28 21:34       ` Ryan Mallon
2011-04-28 21:54         ` Russell King - ARM Linux
2011-04-21  5:41 ` [PATCH v2 03/23] at91: Make USB OHCI/EHCI devices common Ryan Mallon
2011-04-21  5:41 ` [PATCH v2 04/23] at91: Make UDC device common Ryan Mallon
2011-04-21  5:41 ` [PATCH v2 05/23] at91: Make MMC " Ryan Mallon
2011-04-21  5:41 ` [PATCH v2 06/23] at91: Make NAND " Ryan Mallon
2011-04-21  5:41 ` [PATCH v2 07/23] at91: Make TWI " Ryan Mallon
2011-04-21  5:42 ` [PATCH v2 08/23] at91: Make SPI " Ryan Mallon
2011-04-21  5:42 ` [PATCH v2 09/23] at91: Make TCB " Ryan Mallon
2011-04-21  5:42 ` [PATCH v2 10/23] at91: Make RTT " Ryan Mallon
2011-04-21  5:42 ` [PATCH v2 11/23] at91: Make watchdog " Ryan Mallon
2011-04-21  5:42 ` [PATCH v2 13/23] at91: Make PWM " Ryan Mallon
2011-04-21  5:42 ` [PATCH v2 14/23] at91: Make SSC " Ryan Mallon
2011-04-21  5:42 ` [PATCH v2 15/23] at91: Make AC97 " Ryan Mallon
2011-04-21  5:42 ` [PATCH v2 16/23] at91: Make LCD controller " Ryan Mallon
2011-04-21  7:02   ` Uwe Kleine-König
2011-04-21  7:13     ` Ryan Mallon
2011-04-21 12:43     ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-21  5:42 ` [PATCH v2 17/23] at91: Make touchscreen " Ryan Mallon
2011-04-21  5:42 ` [PATCH v2 18/23] at91: Make HDMAC " Ryan Mallon
2011-04-21  5:42 ` [PATCH v2 19/23] at91: Make RTC " Ryan Mallon
2011-04-21  5:42 ` [PATCH v2 20/23] at91: Make high speed USB gadget " Ryan Mallon
2011-04-21 21:21   ` H Hartley Sweeten
2011-04-21 21:28     ` Ryan Mallon
2011-04-21 21:53       ` H Hartley Sweeten
2011-04-21  5:42 ` [PATCH v2 21/23] at91: Make compact flash " Ryan Mallon
2011-04-21  5:42 ` [PATCH v2 22/23] at91: Move at91sam9263 CAN device to common devices Ryan Mallon
2011-04-21  5:42 ` [PATCH v2 23/23] at91: Remove mAgic and ISI device code Ryan Mallon
2011-04-21 17:33   ` H Hartley Sweeten
2011-04-21 20:12     ` Ryan Mallon
2011-04-26  4:39       ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-26  5:30         ` Ryan Mallon
2011-04-28  9:19       ` Russell King - ARM Linux
2011-04-28  9:23         ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-21  5:43 ` [PATCH v2 12/23] at91: Make UART devices common Ryan Mallon
2011-04-21 17:02 ` [PATCH v2 00/23] at91: Replace duplicate device initialisation code with H Hartley Sweeten

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=20110428183132.GH17290@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).