Thread (27 messages) flat view 27 messages, 5 authors, 2011-06-15
STALE5533d

[PATCH v2 2/5] net: ep93xx_eth: pass struct device to DMA API functions

From: H Hartley Sweeten <hidden>
Date: 2011-06-10 17:30:48
Also in: netdev

On Friday, June 10, 2011 9:56 AM, Mika Westerberg wrote:
On Thu, Jun 09, 2011 at 06:40:21PM -0500, H Hartley Sweeten wrote:
quoted
I just noticed this macro in include/linux/netdevice.h

/* Set the sysfs physical device reference for the network logical device
 * if set prior to registration will cause a symlink during initialization.
 */
#define SET_NETDEV_DEV(net, pdev)       ((net)->dev.parent = (pdev))

Is there anyway you could use that macro in the probe to save the platform_device
(with it's associated device) instead of introducing a new struct device * in the
private data?
Nice finding, thanks.

I'll look into that and send new version of the whole series soon.
It looks like after doing this in the probe:

	SET_NETDEV_DEV(dev, &pdev->dev);

You can then pass the required struct device pointer to the DMA API functions
like this:

static int ep93xx_rx(struct net_device *dev, int processed, int budget)
{
	...
	dma_sync_single_for_cpu(dev->dev.parent, ...

Regards,
Hartley
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help