From: Roger Quadros <rogerq@ti.com>
To: <mathias.nyman@intel.com>
Cc: <gregkh@linuxfoundation.org>, <linux-usb@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, Roger Quadros <rogerq@ti.com>
Subject: [PATCH 2/5] usb: xhci: plat: Create both HCDs before adding them
Date: Thu, 2 Apr 2015 15:23:26 +0300 [thread overview]
Message-ID: <1427977409-7671-3-git-send-email-rogerq@ti.com> (raw)
In-Reply-To: <1427977409-7671-1-git-send-email-rogerq@ti.com>
As xhci_hcd is now allocated by usb_create_hcd(), we don't
need to add the primary HCD before creating the shared HCD.
Creating the shared HCD before adding the primary HCD is particularly
useful for the OTG use case so that we know at the OTG core if
the HCD is in single configuration or dual (primary + shared)
configuration.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
drivers/usb/host/xhci-plat.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 517fb4c..00f23f5 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -136,21 +136,15 @@ static int xhci_plat_probe(struct platform_device *pdev)
goto put_hcd;
}
- ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
- if (ret)
- goto disable_clk;
-
device_wakeup_enable(hcd->self.controller);
- /* USB 2.0 roothub is stored in the platform_device now. */
- hcd = platform_get_drvdata(pdev);
xhci = hcd_to_xhci(hcd);
xhci->clk = clk;
xhci->shared_hcd = usb_create_shared_hcd(driver, &pdev->dev,
dev_name(&pdev->dev), hcd);
if (!xhci->shared_hcd) {
ret = -ENOMEM;
- goto dealloc_usb2_hcd;
+ goto disable_clk;
}
if ((node && of_property_read_bool(node, "usb3-lpm-capable")) ||
@@ -160,18 +154,22 @@ static int xhci_plat_probe(struct platform_device *pdev)
if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
xhci->shared_hcd->can_do_streams = 1;
- ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
+ ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
if (ret)
goto put_usb3_hcd;
- return 0;
+ ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
+ if (ret)
+ goto dealloc_usb2_hcd;
-put_usb3_hcd:
- usb_put_hcd(xhci->shared_hcd);
+ return 0;
dealloc_usb2_hcd:
usb_remove_hcd(hcd);
+put_usb3_hcd:
+ usb_put_hcd(xhci->shared_hcd);
+
disable_clk:
if (!IS_ERR(clk))
clk_disable_unprepare(clk);
@@ -189,9 +187,9 @@ static int xhci_plat_remove(struct platform_device *dev)
struct clk *clk = xhci->clk;
usb_remove_hcd(xhci->shared_hcd);
- usb_put_hcd(xhci->shared_hcd);
-
usb_remove_hcd(hcd);
+
+ usb_put_hcd(xhci->shared_hcd);
if (!IS_ERR(clk))
clk_disable_unprepare(clk);
usb_put_hcd(hcd);
--
2.1.0
next prev parent reply other threads:[~2015-04-02 12:23 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-02 12:23 [PATCH 0/5] usb: xhci: fixes for OTG/DRD use Roger Quadros
2015-04-02 12:23 ` [PATCH 1/5] usb: xhci: cleanup xhci_hcd allocation Roger Quadros
2015-04-07 14:23 ` Mathias Nyman
2015-04-09 9:22 ` Roger Quadros
2015-04-13 12:48 ` Mathias Nyman
2015-04-14 9:21 ` Roger Quadros
2015-05-11 14:18 ` Roger Quadros
2015-05-12 14:22 ` Mathias Nyman
2015-05-25 15:05 ` Mathias Nyman
2015-05-26 16:31 ` Andrew Bresticker
2015-04-02 12:23 ` Roger Quadros [this message]
2015-04-20 12:35 ` [PATCH 2/5] usb: xhci: plat: Create both HCDs before adding them Mathias Nyman
2015-04-21 9:49 ` Roger Quadros
2015-04-21 7:11 ` Roger Quadros
2015-04-21 8:08 ` Maxime Ripard
2015-04-21 10:46 ` Roger Quadros
2015-04-22 13:46 ` Maxime Ripard
2015-04-02 12:23 ` [PATCH 3/5] usb: xhci: Allow usb_add/remove_hcd() to be called repeatedly Roger Quadros
2015-04-02 12:23 ` [PATCH 4/5] usb: xhci: fix xhci locking up during hcd remove Roger Quadros
2015-04-02 12:23 ` [PATCH 5/5] usb: xhci: Fix suspend/resume when used with OTG core Roger Quadros
2015-05-26 14:15 ` [PATCH] usb: host: xhci-pci: Fix NULL pointer dereference error Roger Quadros
2015-05-29 13:19 ` Mathias Nyman
2015-05-29 13:49 ` Roger Quadros
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1427977409-7671-3-git-send-email-rogerq@ti.com \
--to=rogerq@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®