Re: [PATCH v2 1/6] usb: usbip: Remove unnecessary get_vdev()
On 04/04/2017 08:43 AM, Krzysztof Opasiak wrote: > > > On 03/31/2017 02:28 AM, Yuyang Du wrote: >> vhci_tx_urb() should be able to get the vhci_device from >> its caller vhci_urb_enqueue(), instead of brutal-force >> searching it. >> >> Signed-off-by: Yuyang Du>> --- >> drivers/usb/usbip/vhci_hcd.c | 32 ++-- >> 1 file changed, 2 insertions(+), 30 deletions(-) >> >> diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c >> index e4cb9f0..5d8b2c2 100644 >> --- a/drivers/usb/usbip/vhci_hcd.c >> +++ b/drivers/usb/usbip/vhci_hcd.c >> @@ -430,36 +430,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 >> typeReq, u16 wValue, >> return retval; >> } >> >> -static struct vhci_device *get_vdev(struct usb_device *udev) >> +static void vhci_tx_urb(struct urb *urb, struct vhci_device *vdev) >> { >> -struct platform_device *pdev; >> -struct usb_hcd *hcd; >> -struct vhci_hcd *vhci; >> -int pdev_nr, rhport; >> - >> -if (!udev) >> -return NULL; >> - >> -for (pdev_nr = 0; pdev_nr < vhci_num_controllers; pdev_nr++) { >> -pdev = *(vhci_pdevs + pdev_nr); >> -if (pdev == NULL) >> -continue; >> -hcd = platform_get_drvdata(pdev); >> -if (hcd == NULL) >> -continue; >> -vhci = hcd_to_vhci(hcd); >> -for (rhport = 0; rhport < VHCI_HC_PORTS; rhport++) { >> -if (vhci->vdev[rhport].udev == udev) >> -return >vdev[rhport]; >> -} >> -} >> - >> -return NULL; >> -} >> - >> -static void vhci_tx_urb(struct urb *urb) >> -{ >> -struct vhci_device *vdev = get_vdev(urb->dev); >> struct vhci_priv *priv; >> struct vhci_hcd *vhci; >> unsigned long flags; >> @@ -601,7 +573,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct >> urb *urb, >> } >> >> out: >> -vhci_tx_urb(urb); >> +vhci_tx_urb(urb, vdev); >> spin_unlock_irqrestore(>lock, flags); >> >> return 0; >> > > I think that I've already gave you my reviewed by for this patch. > Nevertheless: > > Reviewed-by: Krzysztof Opasiak > Thanks. Here is my Ack for Greg to pick this up: Acked-by: Shuah Khan thanks, -- Shuah -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/6] usb: usbip: Remove unnecessary get_vdev()
On 03/31/2017 02:28 AM, Yuyang Du wrote: vhci_tx_urb() should be able to get the vhci_device from its caller vhci_urb_enqueue(), instead of brutal-force searching it. Signed-off-by: Yuyang Du--- drivers/usb/usbip/vhci_hcd.c | 32 ++-- 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c index e4cb9f0..5d8b2c2 100644 --- a/drivers/usb/usbip/vhci_hcd.c +++ b/drivers/usb/usbip/vhci_hcd.c @@ -430,36 +430,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, return retval; } -static struct vhci_device *get_vdev(struct usb_device *udev) +static void vhci_tx_urb(struct urb *urb, struct vhci_device *vdev) { - struct platform_device *pdev; - struct usb_hcd *hcd; - struct vhci_hcd *vhci; - int pdev_nr, rhport; - - if (!udev) - return NULL; - - for (pdev_nr = 0; pdev_nr < vhci_num_controllers; pdev_nr++) { - pdev = *(vhci_pdevs + pdev_nr); - if (pdev == NULL) - continue; - hcd = platform_get_drvdata(pdev); - if (hcd == NULL) - continue; - vhci = hcd_to_vhci(hcd); - for (rhport = 0; rhport < VHCI_HC_PORTS; rhport++) { - if (vhci->vdev[rhport].udev == udev) - return >vdev[rhport]; - } - } - - return NULL; -} - -static void vhci_tx_urb(struct urb *urb) -{ - struct vhci_device *vdev = get_vdev(urb->dev); struct vhci_priv *priv; struct vhci_hcd *vhci; unsigned long flags; @@ -601,7 +573,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, } out: - vhci_tx_urb(urb); + vhci_tx_urb(urb, vdev); spin_unlock_irqrestore(>lock, flags); return 0; I think that I've already gave you my reviewed by for this patch. Nevertheless: Reviewed-by: Krzysztof Opasiak -- Krzysztof Opasiak Samsung R Institute Poland Samsung Electronics -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 1/6] usb: usbip: Remove unnecessary get_vdev()
vhci_tx_urb() should be able to get the vhci_device from its caller vhci_urb_enqueue(), instead of brutal-force searching it. Signed-off-by: Yuyang Du--- drivers/usb/usbip/vhci_hcd.c | 32 ++-- 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c index e4cb9f0..5d8b2c2 100644 --- a/drivers/usb/usbip/vhci_hcd.c +++ b/drivers/usb/usbip/vhci_hcd.c @@ -430,36 +430,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, return retval; } -static struct vhci_device *get_vdev(struct usb_device *udev) +static void vhci_tx_urb(struct urb *urb, struct vhci_device *vdev) { - struct platform_device *pdev; - struct usb_hcd *hcd; - struct vhci_hcd *vhci; - int pdev_nr, rhport; - - if (!udev) - return NULL; - - for (pdev_nr = 0; pdev_nr < vhci_num_controllers; pdev_nr++) { - pdev = *(vhci_pdevs + pdev_nr); - if (pdev == NULL) - continue; - hcd = platform_get_drvdata(pdev); - if (hcd == NULL) - continue; - vhci = hcd_to_vhci(hcd); - for (rhport = 0; rhport < VHCI_HC_PORTS; rhport++) { - if (vhci->vdev[rhport].udev == udev) - return >vdev[rhport]; - } - } - - return NULL; -} - -static void vhci_tx_urb(struct urb *urb) -{ - struct vhci_device *vdev = get_vdev(urb->dev); struct vhci_priv *priv; struct vhci_hcd *vhci; unsigned long flags; @@ -601,7 +573,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, } out: - vhci_tx_urb(urb); + vhci_tx_urb(urb, vdev); spin_unlock_irqrestore(>lock, flags); return 0; -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html