]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
xhci: tegra: allocate workqueue for mailbox
authorTW Chiu <twchiu@nvidia.com>
Mon, 30 Nov 2015 05:59:57 +0000 (13:59 +0800)
committermobile promotions <svcmobile_promotions@nvidia.com>
Thu, 24 Dec 2015 21:18:43 +0000 (13:18 -0800)
Avoid using the shared workqueue as mailbox processing may be delayed
by works scheduled by other drivers.

Allocate a dedicated workqueue for mailbox.

Bug 1691314

DEPENDS ON: < None >

Change-Id: If40bb4263796cb64332dd827cb3bbebcdee5179a
Signed-off-by: TW Chiu <twchiu@nvidia.com>
Reviewed-on: http://git-master/r/839103
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Petlozu Pravareshwar <petlozup@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
drivers/usb/host/xhci-tegra.c
drivers/usb/host/xhci-tegra.h

index a03ce6af66d26bfeb85563f374725a2514504cb9..52c514470123ead11e28ba5966d37a06925a315a 100644 (file)
@@ -3689,7 +3689,7 @@ static irqreturn_t tegra_xhci_smi_irq(int irq, void *ptrdev)
        if (temp & SMI_INTR_STATUS_FW_REINIT)
                xhci_err(tegra->xhci, "Firmware reinit.\n");
        if (temp & SMI_INTR_STATUS_MBOX)
-               schedule_work(&tegra->mbox_work);
+               queue_work(tegra->mbox_wq, &tegra->mbox_work);
 
        spin_unlock(&tegra->lock);
        return IRQ_HANDLED;
@@ -5537,6 +5537,12 @@ static int tegra_xhci_probe2(struct tegra_xhci_hcd *tegra)
        /* do mailbox related initializations */
        tegra->mbox_owner = 0xffff;
        INIT_WORK(&tegra->mbox_work, tegra_xhci_process_mbox_message);
+       tegra->mbox_wq = alloc_ordered_workqueue("mbox_wq", 0);
+       if (IS_ERR_OR_NULL(tegra->mbox_wq)) {
+               dev_err(&pdev->dev, "failed to alloc workqueue\n");
+               ret = -ENOMEM;
+               goto err_remove_usb3_hcd;
+       }
 
        /* do ss partition elpg exit related initialization */
        INIT_WORK(&tegra->ss_elpg_exit_work, ss_partition_elpg_exit_work);
@@ -5684,6 +5690,9 @@ static int tegra_xhci_remove(struct platform_device *pdev)
                usb_put_hcd(hcd);
                kfree(xhci);
 
+               flush_workqueue(tegra->mbox_wq);
+               destroy_workqueue(tegra->mbox_wq);
+
 #if defined(CONFIG_ARCH_TEGRA_21x_SOC)
                /* By default disable the BATTERY_CHRG_OTGPAD for all ports */
                for (port = 0; port <= XUSB_UTMI_COUNT; port++)
index 814186422bb50b622f6b70004ca6326e7e360917..87547e0e8a2eddf66e0e4d7ff16e7c2ce94ef294 100644 (file)
@@ -388,6 +388,7 @@ struct tegra_xhci_hcd {
        int vddio_hsic_refcnt;
 
        struct work_struct mbox_work;
+       struct workqueue_struct *mbox_wq;
        struct work_struct ss_elpg_exit_work;
        struct work_struct host_elpg_exit_work;
        struct work_struct xotg_vbus_work;