diff mbox

[U-Boot,v2,62/80] dm: usb: xhci: Use explicit parameters for xhci_alloc_virt_device()

Message ID 1427307788-7496-63-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass March 25, 2015, 6:22 p.m. UTC
This function should not be delving into struct usb_device. Pass in the
parameters it needs directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 drivers/usb/host/xhci-mem.c | 4 +---
 drivers/usb/host/xhci.c     | 2 +-
 drivers/usb/host/xhci.h     | 2 +-
 3 files changed, 3 insertions(+), 5 deletions(-)

Comments

Simon Glass April 7, 2015, 7:11 p.m. UTC | #1
On 25 March 2015 at 12:22, Simon Glass <sjg@chromium.org> wrote:
> This function should not be delving into struct usb_device. Pass in the
> parameters it needs directly.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2: None
>
>  drivers/usb/host/xhci-mem.c | 4 +---
>  drivers/usb/host/xhci.c     | 2 +-
>  drivers/usb/host/xhci.h     | 2 +-
>  3 files changed, 3 insertions(+), 5 deletions(-)

Applied to u-boot-dm/next.
diff mbox

Patch

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 89908e8..4644ffa 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -352,12 +352,10 @@  static struct xhci_container_ctx
  * @param udev	pointer to USB deivce structure
  * @return 0 on success else -1 on failure
  */
-int xhci_alloc_virt_device(struct usb_device *udev)
+int xhci_alloc_virt_device(struct xhci_ctrl *ctrl, unsigned int slot_id)
 {
 	u64 byte_64 = 0;
-	unsigned int slot_id = udev->slot_id;
 	struct xhci_virt_device *virt_dev;
-	struct xhci_ctrl *ctrl = udev->controller;
 
 	/* Slot ID 0 is reserved */
 	if (ctrl->devs[slot_id]) {
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index ab39878..de006f7 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -491,7 +491,7 @@  int usb_alloc_device(struct usb_device *udev)
 
 	xhci_acknowledge_event(ctrl);
 
-	ret = xhci_alloc_virt_device(udev);
+	ret = xhci_alloc_virt_device(ctrl, udev->slot_id);
 	if (ret < 0) {
 		/*
 		 * TODO: Unsuccessful Address Device command shall leave
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 6e76872..00faa81 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1246,7 +1246,7 @@  void xhci_flush_cache(uint32_t addr, u32 type_len);
 void xhci_inval_cache(uint32_t addr, u32 type_len);
 void xhci_cleanup(struct xhci_ctrl *ctrl);
 struct xhci_ring *xhci_ring_alloc(unsigned int num_segs, bool link_trbs);
-int xhci_alloc_virt_device(struct usb_device *udev);
+int xhci_alloc_virt_device(struct xhci_ctrl *ctrl, unsigned int slot_id);
 int xhci_mem_init(struct xhci_ctrl *ctrl, struct xhci_hccr *hccr,
 		  struct xhci_hcor *hcor);