Skip to contentSkip to conversation

staging: vt6656: Use ether_addr_copy() on vnt_private members.

PATCH In review Krzysztof Adamski 2 participants 6 messages Dec 22, 2014 – Jan 13, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: vt6656: Use ether_addr_copy() on vnt_private members.

This patch fixes checkpatch.pl warning:
WARNING: Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)

current_net_addr and permanent_net_addr members of vnt_private alignment is changed to at last 16 bits so that ether_addr_copy can be safely used on them.

buf->data is of type ieee80211_cts which is already properly aligned.

---

drivers/staging/vt6656/device.h   |    4 ++--
drivers/staging/vt6656/main_usb.c |    3 ++-
drivers/staging/vt6656/rxtx.c     |    4 ++--
3 files changed, 6 insertions(+), 5 deletions(-)
drivers/staging/vt6656/device.h +0 -0
index 5a7ca52..4dcc67d 100644
@@ -307,8 +307,8 @@ struct vnt_private {
 
	struct vnt_cmd_card_init init_command;
	struct vnt_rsp_card_init init_response;

- u8 current_net_addr[ETH_ALEN];
- u8 permanent_net_addr[ETH_ALEN];
+ u8 current_net_addr[ETH_ALEN] __aligned(2);
+ u8 permanent_net_addr[ETH_ALEN] __aligned(2);

	u8 exist_sw_net_addr;
drivers/staging/vt6656/main_usb.c +0 -0
index b95d5b1..71adc1f 100644
@@ -34,6 +34,7 @@
 */

#undef __NO_VERSION__

+#include <linux/etherdevice.h>
#include <linux/file.h>
#include "device.h"
#include "card.h"
@@ -319,7 +320,7 @@ static int vnt_init_registers(struct vnt_private *priv)

	/* get permanent network address */
	memcpy(priv->permanent_net_addr, init_rsp->net_addr, 6);

- memcpy(priv->current_net_addr, priv->permanent_net_addr, ETH_ALEN);
+ ether_addr_copy(priv->current_net_addr, priv->permanent_net_addr);

	/* if exist SW network address, use it */
	dev_dbg(&priv->usb->dev, "Network address = %pM\n",
drivers/staging/vt6656/rxtx.c +0 -0
index ea5140a..3eb24b8 100644
@@ -552,7 +552,7 @@ static u16 vnt_fill_cts_head(struct vnt_usb_send_context *tx_context,
		buf->data.frame_control =
			cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS);

- memcpy(buf->data.ra, priv->current_net_addr, ETH_ALEN);
+ ether_addr_copy(buf->data.ra, priv->current_net_addr);

		return vnt_rxtx_datahead_g_fb(tx_context, &buf->data_head);
	} else {
@@ -570,7 +570,7 @@ static u16 vnt_fill_cts_head(struct vnt_usb_send_context *tx_context,
		buf->data.frame_control =
			cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS);

- memcpy(buf->data.ra, priv->current_net_addr, ETH_ALEN);
+ ether_addr_copy(buf->data.ra, priv->current_net_addr);

		return vnt_rxtx_datahead_g(tx_context, &buf->data_head);
	}
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 8 lines · Krzysztof Adamski

This patch fixes checkpatch.pl warning:
WARNING: Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)

current_net_addr and permanent_net_addr members of vnt_private alignment is changed to at last 16 bits so that ether_addr_copy can be safely used on them.

Quoted 8 lines

buf->data is of type ieee80211_cts which is already properly aligned.

---

drivers/staging/vt6656/device.h   |    4 ++--
drivers/staging/vt6656/main_usb.c |    3 ++-
drivers/staging/vt6656/rxtx.c     |    4 ++--
3 files changed, 6 insertions(+), 5 deletions(-)

Doesn't apply to my tree :(

#2 lore raw
Quoted 11 lines · Greg Kroah-Hartman
Quoted 10 lines · Krzysztof Adamski

This patch fixes checkpatch.pl warning:
WARNING: Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)

current_net_addr and permanent_net_addr members of vnt_private alignment is changed to at last 16 bits so that ether_addr_copy can be safely used on them.

buf->data is of type ieee80211_cts which is already properly aligned.

Quoted 8 lines
Quoted 6 lines

---

drivers/staging/vt6656/device.h   |    4 ++--
drivers/staging/vt6656/main_usb.c |    3 ++-
drivers/staging/vt6656/rxtx.c     |    4 ++--
3 files changed, 6 insertions(+), 5 deletions(-)

Doesn't apply to my tree :(

Strange, I was trying to apply this on your tree to fix any conflicts but apparently you already has this patch in your staging-testing branch. And as far as I can tell I only sent it once to you.

#3 lore raw
Quoted 19 lines · Krzysztof Adamski
Quoted 18 lines · Greg Kroah-Hartman
Quoted 16 lines · Krzysztof Adamski

This patch fixes checkpatch.pl warning:
WARNING: Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)

current_net_addr and permanent_net_addr members of vnt_private alignment is changed to at last 16 bits so that ether_addr_copy can be safely used on them.

buf->data is of type ieee80211_cts which is already properly aligned.

---

drivers/staging/vt6656/device.h   |    4 ++--
drivers/staging/vt6656/main_usb.c |    3 ++-
drivers/staging/vt6656/rxtx.c     |    4 ++--
3 files changed, 6 insertions(+), 5 deletions(-)
Quoted 5 lines
Quoted 1 line

Doesn't apply to my tree :(

Strange, I was trying to apply this on your tree to fix any conflicts but apparently you already has this patch in your staging-testing branch. And as far as I can tell I only sent it once to you.

I think you sent it lots of times, if it's there already, don't worry about it :)

thanks,

greg k-h

#4 lore raw
Quoted 20 lines · Greg Kroah-Hartman
Quoted 19 lines · Krzysztof Adamski
Quoted 18 lines · Greg Kroah-Hartman
Quoted 16 lines · Krzysztof Adamski

This patch fixes checkpatch.pl warning:
WARNING: Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)

current_net_addr and permanent_net_addr members of vnt_private alignment is changed to at last 16 bits so that ether_addr_copy can be safely used on them.

buf->data is of type ieee80211_cts which is already properly aligned.

---

drivers/staging/vt6656/device.h   |    4 ++--
drivers/staging/vt6656/main_usb.c |    3 ++-
drivers/staging/vt6656/rxtx.c     |    4 ++--
3 files changed, 6 insertions(+), 5 deletions(-)
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Doesn't apply to my tree :(

Strange, I was trying to apply this on your tree to fix any conflicts but apparently you already has this patch in your staging-testing branch. And as far as I can tell I only sent it once to you.

I think you sent it lots of times, if it's there already, don't worry about it :)

I've send two other patches for this driver twise but this one only once. But that's not imporant. While we're at this, if I ever feel like I should resend the patch because it was lost (I promise I will wait much longer:)), what would be the best way to mark it as resent? Should it be v2 even though it wasn't really changed? Or write it in comment after "---", or maybe some other way? That's the only thing not explained in your "Write and Submit your first Linux kernel Patch" talk.

#5 lore raw
Quoted 30 lines · Krzysztof Adamski
Quoted 20 lines · Greg Kroah-Hartman
Quoted 19 lines · Krzysztof Adamski
Quoted 18 lines · Greg Kroah-Hartman
Quoted 16 lines · Krzysztof Adamski

This patch fixes checkpatch.pl warning:
WARNING: Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)

current_net_addr and permanent_net_addr members of vnt_private alignment is changed to at last 16 bits so that ether_addr_copy can be safely used on them.

buf->data is of type ieee80211_cts which is already properly aligned.

---

drivers/staging/vt6656/device.h   |    4 ++--
drivers/staging/vt6656/main_usb.c |    3 ++-
drivers/staging/vt6656/rxtx.c     |    4 ++--
3 files changed, 6 insertions(+), 5 deletions(-)
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Doesn't apply to my tree :(

Strange, I was trying to apply this on your tree to fix any conflicts but apparently you already has this patch in your staging-testing branch. And as far as I can tell I only sent it once to you.

I think you sent it lots of times, if it's there already, don't worry about it :)

Quoted 7 lines

I've send two other patches for this driver twise but this one only once. But that's not imporant. While we're at this, if I ever feel like I should resend the patch because it was lost (I promise I will wait much longer:)), what would be the best way to mark it as resent? Should it be v2 even though it wasn't really changed? Or write it in comment after "---", or maybe some other way? That's the only thing not explained in your "Write and Submit your first Linux kernel Patch" talk.

Add a "resend" where you would have put "v2" in the subject line. It's pretty rare to need to do this, be more patient for me to apply stuff during the merge window and the holidays please. :)

thanks,

greg k-h