Skip to contentSkip to conversation

usbip: simplify port status saving

PATCH In review Németh Márton 1 participant 2 messages Jun 13, 2011 – Jun 14, 2011 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 usbip: simplify port status saving

From: Márton Németh <[email protected]>

Use memcpy() function to save port status instead of a handwritten for loop.

---
 drivers/staging/usbip/vhci_hcd.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/staging/usbip/vhci_hcd.c +2 -3
index d3ce569..ccb30e1 100644
@@ -281,9 +281,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
 
 	/* store old status and compare now and old later */
 	if (usbip_dbg_flag_vhci_rh) {
-		int i = 0;
-		for (i = 0; i < VHCI_NPORTS; i++)
-			prev_port_status[i] = dum->port_status[i];
+		memcpy(prev_port_status, dum->port_status,
+			sizeof(prev_port_status));
 	}
 
 	switch (typeReq) {
Signature · 1 line
1.7.2.5
#1 lore raw

From: Márton Németh <[email protected]>

Use memcpy() function to save port status instead of a handwritten for loop.

---
 drivers/staging/usbip/vhci_hcd.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/staging/usbip/vhci_hcd.c +2 -3
index d3f11a3..878b5bf 100644
@@ -287,9 +287,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
 
 	/* store old status and compare now and old later */
 	if (usbip_dbg_flag_vhci_rh) {
-		int i = 0;
-		for (i = 0; i < VHCI_NPORTS; i++)
-			prev_port_status[i] = dum->port_status[i];
+		memcpy(prev_port_status, dum->port_status,
+			sizeof(prev_port_status));
 	}
 
 	switch (typeReq) {
Signature · 1 line
1.7.2.5