Thread (12 messages) flat view 12 messages, 6 authors, 2014-07-03

Re: [PATCH RFC V2 2/2] net: qualcomm: new Ethernet over SPI driver for QCA7000

From: Mark Rutland <hidden>
Date: 2014-07-01 18:16:01
Also in: linux-devicetree

On Tue, Jul 01, 2014 at 06:57:45PM +0100, Joe Perches wrote:
On Tue, 2014-07-01 at 18:46 +0100, Mark Rutland wrote:
quoted
On Tue, Jul 01, 2014 at 05:36:49PM +0100, Stefan Wahren wrote:
quoted
This patch adds the Ethernet over SPI driver for the
Qualcomm QCA7000 HomePlug GreenPHY.
[]
quoted
quoted
+               memcpy(qca->net_dev->dev_addr, mac, ETH_ALEN);
I believe that it is preferred to write:

	ether_addr_copy(qca->net_dev->dev_addr, mac);

I believe checkpatch has a warning for this.
True, but you have to make sure that both args are
at least __aligned(2) and afaics there's no
guarantee that's true for mac.
In this case I think there is, though I deleted the context that would
make that clearer. Sorry about that.

We acquired mac with:

	mac = of_get_mac_address(spi_device->dev.of_node);

Where of_get_mac_address returns a property::value pointer.

As far as I can tell, when we unflatten the DT each property::value is
pointed at the original data in the DTB. Each data stream immediately
follows a naturally aligned 32-bit FDT_PROP token in the DTB, so all
value pointers should be aligned to at least 4 bytes.

That all said I'm happy to just use memcpy if we're not happy to rely on
the DTB format, it's not exactly going to be a bottleneck.

Cheers,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help