Merge 6.3-rc6 into usb-next
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 10 Apr 2023 06:56:59 +0000 (08:56 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 10 Apr 2023 06:56:59 +0000 (08:56 +0200)
We need the USB fixes in here for testing, and this resolves two merge
conflicts, one pointed out by linux-next:

drivers/usb/dwc3/dwc3-pci.c
drivers/usb/host/xhci-pci.c

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1  2 
drivers/usb/dwc3/dwc3-pci.c
drivers/usb/gadget/function/f_fs.c
drivers/usb/host/xhci-pci.c
drivers/usb/host/xhci-tegra.c
drivers/usb/host/xhci.c

@@@ -49,6 -49,7 +49,7 @@@
  #define PCI_DEVICE_ID_INTEL_RPLS              0x7a61
  #define PCI_DEVICE_ID_INTEL_MTLM              0x7eb1
  #define PCI_DEVICE_ID_INTEL_MTLP              0x7ec1
+ #define PCI_DEVICE_ID_INTEL_MTLS              0x7f6f
  #define PCI_DEVICE_ID_INTEL_MTL                       0x7e7e
  #define PCI_DEVICE_ID_INTEL_TGL                       0x9a15
  #define PCI_DEVICE_ID_AMD_MR                  0x163a
@@@ -387,40 -388,107 +388,41 @@@ static void dwc3_pci_remove(struct pci_
  }
  
  static const struct pci_device_id dwc3_pci_id_table[] = {
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BSW),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BYT),
 -        (kernel_ulong_t) &dwc3_pci_intel_byt_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD),
 -        (kernel_ulong_t) &dwc3_pci_intel_mrfld_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CMLLP),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CMLH),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_SPTLP),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_SPTH),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BXT),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BXT_M),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_APL),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_KBP),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_GLK),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CNPLP),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CNPH),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CNPV),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICLLP),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_EHL),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGPLP),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGPH),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_JSP),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADL),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADL_PCH),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADLN),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADLN_PCH),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADLS),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_RPL),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_RPLS),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MTLM),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MTLP),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MTLS),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MTL),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGL),
 -        (kernel_ulong_t) &dwc3_pci_intel_swnode, },
 -
 -      { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_NL_USB),
 -        (kernel_ulong_t) &dwc3_pci_amd_swnode, },
 -
 -      { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_MR),
 -        (kernel_ulong_t)&dwc3_pci_amd_mr_swnode, },
 +      { PCI_DEVICE_DATA(INTEL, BSW, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, BYT, &dwc3_pci_intel_byt_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, MRFLD, &dwc3_pci_intel_mrfld_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, CMLLP, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, CMLH, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, SPTLP, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, SPTH, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, BXT, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, BXT_M, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, APL, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, KBP, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, GLK, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, CNPLP, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, CNPH, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, CNPV, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, ICLLP, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, EHL, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, TGPLP, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, TGPH, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, JSP, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, ADL, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, ADL_PCH, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, ADLN, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, ADLN_PCH, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, ADLS, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, RPL, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, RPLS, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, MTLM, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, MTLP, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, MTL, &dwc3_pci_intel_swnode) },
++      { PCI_DEVICE_DATA(INTEL, MTLS, &dwc3_pci_intel_swnode) },
 +      { PCI_DEVICE_DATA(INTEL, TGL, &dwc3_pci_intel_swnode) },
 +
 +      { PCI_DEVICE_DATA(AMD, NL_USB, &dwc3_pci_amd_swnode) },
 +      { PCI_DEVICE_DATA(AMD, MR, &dwc3_pci_amd_mr_swnode) },
  
        {  }    /* Terminating Entry */
  };
@@@ -335,6 -335,8 +335,6 @@@ static ssize_t ffs_ep0_write(struct fil
        ssize_t ret;
        char *data;
  
 -      ENTER();
 -
        /* Fast check if setup was canceled */
        if (ffs_setup_state_clear_cancelled(ffs) == FFS_SETUP_CANCELLED)
                return -EIDRM;
@@@ -510,6 -512,8 +510,6 @@@ static ssize_t ffs_ep0_read(struct fil
        size_t n;
        int ret;
  
 -      ENTER();
 -
        /* Fast check if setup was canceled */
        if (ffs_setup_state_clear_cancelled(ffs) == FFS_SETUP_CANCELLED)
                return -EIDRM;
@@@ -608,6 -612,8 +608,6 @@@ static int ffs_ep0_open(struct inode *i
  {
        struct ffs_data *ffs = inode->i_private;
  
 -      ENTER();
 -
        if (ffs->state == FFS_CLOSING)
                return -EBUSY;
  
@@@ -621,6 -627,8 +621,6 @@@ static int ffs_ep0_release(struct inod
  {
        struct ffs_data *ffs = file->private_data;
  
 -      ENTER();
 -
        ffs_data_closed(ffs);
  
        return 0;
@@@ -632,6 -640,8 +632,6 @@@ static long ffs_ep0_ioctl(struct file *
        struct usb_gadget *gadget = ffs->gadget;
        long ret;
  
 -      ENTER();
 -
        if (code == FUNCTIONFS_INTERFACE_REVMAP) {
                struct ffs_function *func = ffs->func;
                ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV;
@@@ -705,6 -715,7 +705,6 @@@ static void ffs_epfile_io_complete(stru
  {
        struct ffs_io_data *io_data = req->context;
  
 -      ENTER();
        if (req->status)
                io_data->status = req->status;
        else
@@@ -845,6 -856,8 +845,6 @@@ static void ffs_epfile_async_io_complet
        struct ffs_io_data *io_data = req->context;
        struct ffs_data *ffs = io_data->ffs;
  
 -      ENTER();
 -
        io_data->status = req->status ? req->status : req->actual;
        usb_ep_free_request(_ep, req);
  
@@@ -1148,6 -1161,8 +1148,6 @@@ ffs_epfile_open(struct inode *inode, st
  {
        struct ffs_epfile *epfile = inode->i_private;
  
 -      ENTER();
 -
        if (WARN_ON(epfile->ffs->state != FFS_ACTIVE))
                return -ENODEV;
  
@@@ -1164,6 -1179,8 +1164,6 @@@ static int ffs_aio_cancel(struct kiocb 
        unsigned long flags;
        int value;
  
 -      ENTER();
 -
        spin_lock_irqsave(&epfile->ffs->eps_lock, flags);
  
        if (io_data && io_data->ep && io_data->req)
@@@ -1181,6 -1198,8 +1181,6 @@@ static ssize_t ffs_epfile_write_iter(st
        struct ffs_io_data io_data, *p = &io_data;
        ssize_t res;
  
 -      ENTER();
 -
        if (!is_sync_kiocb(kiocb)) {
                p = kzalloc(sizeof(io_data), GFP_KERNEL);
                if (!p)
@@@ -1216,6 -1235,8 +1216,6 @@@ static ssize_t ffs_epfile_read_iter(str
        struct ffs_io_data io_data, *p = &io_data;
        ssize_t res;
  
 -      ENTER();
 -
        if (!is_sync_kiocb(kiocb)) {
                p = kzalloc(sizeof(io_data), GFP_KERNEL);
                if (!p)
        p->kiocb = kiocb;
        if (p->aio) {
                p->to_free = dup_iter(&p->data, to, GFP_KERNEL);
-               if (!p->to_free) {
+               if (!iter_is_ubuf(&p->data) && !p->to_free) {
                        kfree(p);
                        return -ENOMEM;
                }
@@@ -1263,6 -1284,8 +1263,6 @@@ ffs_epfile_release(struct inode *inode
  {
        struct ffs_epfile *epfile = inode->i_private;
  
 -      ENTER();
 -
        __ffs_epfile_read_buffer_free(epfile);
        ffs_data_closed(epfile->ffs);
  
@@@ -1276,6 -1299,8 +1276,6 @@@ static long ffs_epfile_ioctl(struct fil
        struct ffs_ep *ep;
        int ret;
  
 -      ENTER();
 -
        if (WARN_ON(epfile->ffs->state != FFS_ACTIVE))
                return -ENODEV;
  
@@@ -1374,6 -1399,8 +1374,6 @@@ ffs_sb_make_inode(struct super_block *s
  {
        struct inode *inode;
  
 -      ENTER();
 -
        inode = new_inode(sb);
  
        if (inode) {
@@@ -1405,6 -1432,8 +1405,6 @@@ static struct dentry *ffs_sb_create_fil
        struct dentry   *dentry;
        struct inode    *inode;
  
 -      ENTER();
 -
        dentry = d_alloc_name(sb->s_root, name);
        if (!dentry)
                return NULL;
@@@ -1439,6 -1468,8 +1439,6 @@@ static int ffs_sb_fill(struct super_blo
        struct inode    *inode;
        struct ffs_data *ffs = data->ffs_data;
  
 -      ENTER();
 -
        ffs->sb              = sb;
        data->ffs_data       = NULL;
        sb->s_fs_info        = ffs;
@@@ -1490,6 -1521,8 +1490,6 @@@ static int ffs_fs_parse_param(struct fs
        struct fs_parse_result result;
        int opt;
  
 -      ENTER();
 -
        opt = fs_parse(fc, ffs_fs_fs_parameters, param, &result);
        if (opt < 0)
                return opt;
@@@ -1539,6 -1572,8 +1539,6 @@@ static int ffs_fs_get_tree(struct fs_co
        struct ffs_data *ffs;
        int ret;
  
 -      ENTER();
 -
        if (!fc->source)
                return invalf(fc, "No source specified");
  
@@@ -1605,6 -1640,8 +1605,6 @@@ static int ffs_fs_init_fs_context(struc
  static void
  ffs_fs_kill_sb(struct super_block *sb)
  {
 -      ENTER();
 -
        kill_litter_super(sb);
        if (sb->s_fs_info)
                ffs_data_closed(sb->s_fs_info);
@@@ -1626,6 -1663,8 +1626,6 @@@ static int functionfs_init(void
  {
        int ret;
  
 -      ENTER();
 -
        ret = register_filesystem(&ffs_fs_type);
        if (!ret)
                pr_info("file system registered\n");
  
  static void functionfs_cleanup(void)
  {
 -      ENTER();
 -
        pr_info("unloading\n");
        unregister_filesystem(&ffs_fs_type);
  }
@@@ -1649,11 -1690,15 +1649,11 @@@ static void ffs_data_reset(struct ffs_d
  
  static void ffs_data_get(struct ffs_data *ffs)
  {
 -      ENTER();
 -
        refcount_inc(&ffs->ref);
  }
  
  static void ffs_data_opened(struct ffs_data *ffs)
  {
 -      ENTER();
 -
        refcount_inc(&ffs->ref);
        if (atomic_add_return(1, &ffs->opened) == 1 &&
                        ffs->state == FFS_DEACTIVATED) {
  
  static void ffs_data_put(struct ffs_data *ffs)
  {
 -      ENTER();
 -
        if (refcount_dec_and_test(&ffs->ref)) {
                pr_info("%s(): freeing\n", __func__);
                ffs_data_clear(ffs);
@@@ -1682,6 -1729,8 +1682,6 @@@ static void ffs_data_closed(struct ffs_
        struct ffs_epfile *epfiles;
        unsigned long flags;
  
 -      ENTER();
 -
        if (atomic_dec_and_test(&ffs->opened)) {
                if (ffs->no_disconnect) {
                        ffs->state = FFS_DEACTIVATED;
@@@ -1716,6 -1765,8 +1716,6 @@@ static struct ffs_data *ffs_data_new(co
        if (!ffs)
                return NULL;
  
 -      ENTER();
 -
        ffs->io_completion_wq = alloc_ordered_workqueue("%s", 0, dev_name);
        if (!ffs->io_completion_wq) {
                kfree(ffs);
@@@ -1742,6 -1793,8 +1742,6 @@@ static void ffs_data_clear(struct ffs_d
        struct ffs_epfile *epfiles;
        unsigned long flags;
  
 -      ENTER();
 -
        ffs_closed(ffs);
  
        BUG_ON(ffs->gadget);
  
  static void ffs_data_reset(struct ffs_data *ffs)
  {
 -      ENTER();
 -
        ffs_data_clear(ffs);
  
        ffs->raw_descs_data = NULL;
@@@ -1806,6 -1861,8 +1806,6 @@@ static int functionfs_bind(struct ffs_d
        struct usb_gadget_strings **lang;
        int first_id;
  
 -      ENTER();
 -
        if (WARN_ON(ffs->state != FFS_ACTIVE
                 || test_and_set_bit(FFS_FL_BOUND, &ffs->flags)))
                return -EBADFD;
  
  static void functionfs_unbind(struct ffs_data *ffs)
  {
 -      ENTER();
 -
        if (!WARN_ON(!ffs->gadget)) {
                /* dequeue before freeing ep0req */
                usb_ep_dequeue(ffs->gadget->ep0, ffs->ep0req);
@@@ -1855,6 -1914,8 +1855,6 @@@ static int ffs_epfiles_create(struct ff
        struct ffs_epfile *epfile, *epfiles;
        unsigned i, count;
  
 -      ENTER();
 -
        count = ffs->eps_count;
        epfiles = kcalloc(count, sizeof(*epfiles), GFP_KERNEL);
        if (!epfiles)
@@@ -1885,6 -1946,8 +1885,6 @@@ static void ffs_epfiles_destroy(struct 
  {
        struct ffs_epfile *epfile = epfiles;
  
 -      ENTER();
 -
        for (; count; --count, ++epfile) {
                BUG_ON(mutex_is_locked(&epfile->mutex));
                if (epfile->dentry) {
@@@ -2001,6 -2064,8 +2001,6 @@@ static int __must_check ffs_do_single_d
        u8 length;
        int ret;
  
 -      ENTER();
 -
        /* At least two bytes are required: length and type */
        if (len < 2) {
                pr_vdebug("descriptor too short\n");
@@@ -2139,6 -2204,8 +2139,6 @@@ static int __must_check ffs_do_descs(un
        unsigned long num = 0;
        int current_class = -1;
  
 -      ENTER();
 -
        for (;;) {
                int ret;
  
@@@ -2176,6 -2243,8 +2176,6 @@@ static int __ffs_data_do_entity(enum ff
        struct ffs_desc_helper *helper = priv;
        struct usb_endpoint_descriptor *d;
  
 -      ENTER();
 -
        switch (type) {
        case FFS_DESCRIPTOR:
                break;
@@@ -2223,11 -2292,8 +2223,11 @@@ static int __ffs_do_os_desc_header(enu
        u16 bcd_version = le16_to_cpu(desc->bcdVersion);
        u16 w_index = le16_to_cpu(desc->wIndex);
  
 -      if (bcd_version != 1) {
 -              pr_vdebug("unsupported os descriptors version: %d",
 +      if (bcd_version == 0x1) {
 +              pr_warn("bcdVersion must be 0x0100, stored in Little Endian order. "
 +                      "Userspace driver should be fixed, accepting 0x0001 for compatibility.\n");
 +      } else if (bcd_version != 0x100) {
 +              pr_vdebug("unsupported os descriptors version: 0x%x\n",
                          bcd_version);
                return -EINVAL;
        }
@@@ -2260,6 -2326,8 +2260,6 @@@ static int __must_check ffs_do_single_o
        int ret;
        const unsigned _len = len;
  
 -      ENTER();
 -
        /* loop over all ext compat/ext prop descriptors */
        while (feature_count--) {
                ret = entity(type, h, data, len, priv);
@@@ -2281,6 -2349,8 +2281,6 @@@ static int __must_check ffs_do_os_descs
        const unsigned _len = len;
        unsigned long num = 0;
  
 -      ENTER();
 -
        for (num = 0; num < count; ++num) {
                int ret;
                enum ffs_os_desc_type type;
@@@ -2343,6 -2413,8 +2343,6 @@@ static int __ffs_data_do_os_desc(enum f
        struct ffs_data *ffs = priv;
        u8 length;
  
 -      ENTER();
 -
        switch (type) {
        case FFS_OS_DESC_EXT_COMPAT: {
                struct usb_ext_compat_desc *d = data;
@@@ -2418,6 -2490,8 +2418,6 @@@ static int __ffs_data_got_descs(struct 
        int ret = -EINVAL, i;
        struct ffs_desc_helper helper;
  
 -      ENTER();
 -
        if (get_unaligned_le32(data + 4) != len)
                goto error;
  
@@@ -2548,6 -2622,8 +2548,6 @@@ static int __ffs_data_got_strings(struc
        const char *data = _data;
        struct usb_string *s;
  
 -      ENTER();
 -
        if (len < 16 ||
            get_unaligned_le32(data) != FUNCTIONFS_STRINGS_MAGIC ||
            get_unaligned_le32(data + 4) != len)
@@@ -3006,6 -3082,8 +3006,6 @@@ static inline struct f_fs_opts *ffs_do_
        struct ffs_data *ffs_data;
        int ret;
  
 -      ENTER();
 -
        /*
         * Legacy gadget triggers binding in functionfs_ready_callback,
         * which already uses locking; taking the same lock here would
@@@ -3082,6 -3160,8 +3082,6 @@@ static int _ffs_func_bind(struct usb_co
        vla_item_with_sz(d, char, raw_descs, ffs->raw_descs_length);
        char *vlabuf;
  
 -      ENTER();
 -
        /* Has descriptors only for speeds gadget does not support */
        if (!(full | high | super))
                return -ENOTSUPP;
@@@ -3285,6 -3365,8 +3285,6 @@@ static int ffs_func_setup(struct usb_fu
        unsigned long flags;
        int ret;
  
 -      ENTER();
 -
        pr_vdebug("creq->bRequestType = %02x\n", creq->bRequestType);
        pr_vdebug("creq->bRequest     = %02x\n", creq->bRequest);
        pr_vdebug("creq->wValue       = %04x\n", le16_to_cpu(creq->wValue));
@@@ -3359,11 -3441,13 +3359,11 @@@ static bool ffs_func_req_match(struct u
  
  static void ffs_func_suspend(struct usb_function *f)
  {
 -      ENTER();
        ffs_event_add(ffs_func_from_usb(f)->ffs, FUNCTIONFS_SUSPEND);
  }
  
  static void ffs_func_resume(struct usb_function *f)
  {
 -      ENTER();
        ffs_event_add(ffs_func_from_usb(f)->ffs, FUNCTIONFS_RESUME);
  }
  
@@@ -3527,6 -3611,7 +3527,6 @@@ static void ffs_func_unbind(struct usb_
        unsigned count = ffs->eps_count;
        unsigned long flags;
  
 -      ENTER();
        if (ffs->func == func) {
                ffs_func_eps_disable(func);
                ffs->func = NULL;
@@@ -3566,6 -3651,8 +3566,6 @@@ static struct usb_function *ffs_alloc(s
  {
        struct ffs_function *func;
  
 -      ENTER();
 -
        func = kzalloc(sizeof(*func), GFP_KERNEL);
        if (!func)
                return ERR_PTR(-ENOMEM);
@@@ -3666,6 -3753,7 +3666,6 @@@ static int ffs_acquire_dev(const char *
        int ret = 0;
        struct ffs_dev *ffs_dev;
  
 -      ENTER();
        ffs_dev_lock();
  
        ffs_dev = _ffs_find_dev(dev_name);
  
  static void ffs_release_dev(struct ffs_dev *ffs_dev)
  {
 -      ENTER();
        ffs_dev_lock();
  
        if (ffs_dev && ffs_dev->mounted) {
@@@ -3709,6 -3798,7 +3709,6 @@@ static int ffs_ready(struct ffs_data *f
        struct ffs_dev *ffs_obj;
        int ret = 0;
  
 -      ENTER();
        ffs_dev_lock();
  
        ffs_obj = ffs->private_data;
@@@ -3741,6 -3831,7 +3741,6 @@@ static void ffs_closed(struct ffs_data 
        struct f_fs_opts *opts;
        struct config_item *ci;
  
 -      ENTER();
        ffs_dev_lock();
  
        ffs_obj = ffs->private_data;
@@@ -78,207 -78,14 +78,207 @@@ static const char hcd_name[] = "xhci_hc
  static struct hc_driver __read_mostly xhci_pci_hc_driver;
  
  static int xhci_pci_setup(struct usb_hcd *hcd);
 +static int xhci_pci_run(struct usb_hcd *hcd);
  static int xhci_pci_update_hub_device(struct usb_hcd *hcd, struct usb_device *hdev,
                                      struct usb_tt *tt, gfp_t mem_flags);
  
  static const struct xhci_driver_overrides xhci_pci_overrides __initconst = {
        .reset = xhci_pci_setup,
 +      .start = xhci_pci_run,
        .update_hub_device = xhci_pci_update_hub_device,
  };
  
 +static void xhci_msix_sync_irqs(struct xhci_hcd *xhci)
 +{
 +      struct usb_hcd *hcd = xhci_to_hcd(xhci);
 +
 +      if (hcd->msix_enabled) {
 +              struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
 +              int i;
 +
 +              for (i = 0; i < xhci->msix_count; i++)
 +                      synchronize_irq(pci_irq_vector(pdev, i));
 +      }
 +}
 +
 +/* Free any IRQs and disable MSI-X */
 +static void xhci_cleanup_msix(struct xhci_hcd *xhci)
 +{
 +      struct usb_hcd *hcd = xhci_to_hcd(xhci);
 +      struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
 +
 +      if (xhci->quirks & XHCI_PLAT)
 +              return;
 +
 +      /* return if using legacy interrupt */
 +      if (hcd->irq > 0)
 +              return;
 +
 +      if (hcd->msix_enabled) {
 +              int i;
 +
 +              for (i = 0; i < xhci->msix_count; i++)
 +                      free_irq(pci_irq_vector(pdev, i), xhci_to_hcd(xhci));
 +      } else {
 +              free_irq(pci_irq_vector(pdev, 0), xhci_to_hcd(xhci));
 +      }
 +
 +      pci_free_irq_vectors(pdev);
 +      hcd->msix_enabled = 0;
 +}
 +
 +/*
 + * Set up MSI
 + */
 +static int xhci_setup_msi(struct xhci_hcd *xhci)
 +{
 +      int ret;
 +      /*
 +       * TODO:Check with MSI Soc for sysdev
 +       */
 +      struct pci_dev  *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller);
 +
 +      ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSI);
 +      if (ret < 0) {
 +              xhci_dbg_trace(xhci, trace_xhci_dbg_init,
 +                              "failed to allocate MSI entry");
 +              return ret;
 +      }
 +
 +      ret = request_irq(pdev->irq, xhci_msi_irq,
 +                              0, "xhci_hcd", xhci_to_hcd(xhci));
 +      if (ret) {
 +              xhci_dbg_trace(xhci, trace_xhci_dbg_init,
 +                              "disable MSI interrupt");
 +              pci_free_irq_vectors(pdev);
 +      }
 +
 +      return ret;
 +}
 +
 +/*
 + * Set up MSI-X
 + */
 +static int xhci_setup_msix(struct xhci_hcd *xhci)
 +{
 +      int i, ret;
 +      struct usb_hcd *hcd = xhci_to_hcd(xhci);
 +      struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
 +
 +      /*
 +       * calculate number of msi-x vectors supported.
 +       * - HCS_MAX_INTRS: the max number of interrupts the host can handle,
 +       *   with max number of interrupters based on the xhci HCSPARAMS1.
 +       * - num_online_cpus: maximum msi-x vectors per CPUs core.
 +       *   Add additional 1 vector to ensure always available interrupt.
 +       */
 +      xhci->msix_count = min(num_online_cpus() + 1,
 +                              HCS_MAX_INTRS(xhci->hcs_params1));
 +
 +      ret = pci_alloc_irq_vectors(pdev, xhci->msix_count, xhci->msix_count,
 +                      PCI_IRQ_MSIX);
 +      if (ret < 0) {
 +              xhci_dbg_trace(xhci, trace_xhci_dbg_init,
 +                              "Failed to enable MSI-X");
 +              return ret;
 +      }
 +
 +      for (i = 0; i < xhci->msix_count; i++) {
 +              ret = request_irq(pci_irq_vector(pdev, i), xhci_msi_irq, 0,
 +                              "xhci_hcd", xhci_to_hcd(xhci));
 +              if (ret)
 +                      goto disable_msix;
 +      }
 +
 +      hcd->msix_enabled = 1;
 +      return ret;
 +
 +disable_msix:
 +      xhci_dbg_trace(xhci, trace_xhci_dbg_init, "disable MSI-X interrupt");
 +      while (--i >= 0)
 +              free_irq(pci_irq_vector(pdev, i), xhci_to_hcd(xhci));
 +      pci_free_irq_vectors(pdev);
 +      return ret;
 +}
 +
 +static int xhci_try_enable_msi(struct usb_hcd *hcd)
 +{
 +      struct xhci_hcd *xhci = hcd_to_xhci(hcd);
 +      struct pci_dev  *pdev;
 +      int ret;
 +
 +      /* The xhci platform device has set up IRQs through usb_add_hcd. */
 +      if (xhci->quirks & XHCI_PLAT)
 +              return 0;
 +
 +      pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller);
 +      /*
 +       * Some Fresco Logic host controllers advertise MSI, but fail to
 +       * generate interrupts.  Don't even try to enable MSI.
 +       */
 +      if (xhci->quirks & XHCI_BROKEN_MSI)
 +              goto legacy_irq;
 +
 +      /* unregister the legacy interrupt */
 +      if (hcd->irq)
 +              free_irq(hcd->irq, hcd);
 +      hcd->irq = 0;
 +
 +      ret = xhci_setup_msix(xhci);
 +      if (ret)
 +              /* fall back to msi*/
 +              ret = xhci_setup_msi(xhci);
 +
 +      if (!ret) {
 +              hcd->msi_enabled = 1;
 +              return 0;
 +      }
 +
 +      if (!pdev->irq) {
 +              xhci_err(xhci, "No msi-x/msi found and no IRQ in BIOS\n");
 +              return -EINVAL;
 +      }
 +
 + legacy_irq:
 +      if (!strlen(hcd->irq_descr))
 +              snprintf(hcd->irq_descr, sizeof(hcd->irq_descr), "%s:usb%d",
 +                       hcd->driver->description, hcd->self.busnum);
 +
 +      /* fall back to legacy interrupt*/
 +      ret = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED,
 +                      hcd->irq_descr, hcd);
 +      if (ret) {
 +              xhci_err(xhci, "request interrupt %d failed\n",
 +                              pdev->irq);
 +              return ret;
 +      }
 +      hcd->irq = pdev->irq;
 +      return 0;
 +}
 +
 +static int xhci_pci_run(struct usb_hcd *hcd)
 +{
 +      int ret;
 +
 +      if (usb_hcd_is_primary_hcd(hcd)) {
 +              ret = xhci_try_enable_msi(hcd);
 +              if (ret)
 +                      return ret;
 +      }
 +
 +      return xhci_run(hcd);
 +}
 +
 +static void xhci_pci_stop(struct usb_hcd *hcd)
 +{
 +      struct xhci_hcd *xhci = hcd_to_xhci(hcd);
 +
 +      xhci_stop(hcd);
 +
 +      if (usb_hcd_is_primary_hcd(hcd))
 +              xhci_cleanup_msix(xhci);
 +}
 +
  /* called after powerup, by probe or system-pm "wakeup" */
  static int xhci_pci_reinit(struct xhci_hcd *xhci, struct pci_dev *pdev)
  {
@@@ -728,6 -535,7 +728,6 @@@ static void xhci_pci_remove(struct pci_
        usb_hcd_pci_remove(dev);
  }
  
 -#ifdef CONFIG_PM
  /*
   * In some Intel xHCI controllers, in order to get D3 working,
   * through a vendor specific SSIC CONFIG register at offset 0x883c,
@@@ -814,10 -622,6 +814,10 @@@ static int xhci_pci_suspend(struct usb_
                xhci_sparse_control_quirk(hcd);
  
        ret = xhci_suspend(xhci, do_wakeup);
 +
 +      /* synchronize irq when using MSI-X */
 +      xhci_msix_sync_irqs(xhci);
 +
        if (ret && (xhci->quirks & XHCI_SSIC_PORT_UNUSED))
                xhci_ssic_port_unused_quirk(hcd, false);
  
@@@ -920,12 -724,12 +920,12 @@@ static void xhci_pci_shutdown(struct us
        struct pci_dev          *pdev = to_pci_dev(hcd->self.controller);
  
        xhci_shutdown(hcd);
 +      xhci_cleanup_msix(xhci);
  
        /* Yet another workaround for spurious wakeups at shutdown with HSW */
        if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
                pci_set_power_state(pdev, PCI_D3hot);
  }
 -#endif /* CONFIG_PM */
  
  /*-------------------------------------------------------------------------*/
  
@@@ -967,20 -771,22 +967,19 @@@ static struct pci_driver xhci_pci_drive
        /* suspend and resume implemented later */
  
        .shutdown =     usb_hcd_pci_shutdown,
 -#ifdef CONFIG_PM
        .driver = {
 -              .pm = &usb_hcd_pci_pm_ops
 +              .pm = pm_ptr(&usb_hcd_pci_pm_ops),
-               .probe_type = PROBE_PREFER_ASYNCHRONOUS,
        },
 -#endif
  };
  
  static int __init xhci_pci_init(void)
  {
        xhci_init_driver(&xhci_pci_hc_driver, &xhci_pci_overrides);
 -#ifdef CONFIG_PM
 -      xhci_pci_hc_driver.pci_suspend = xhci_pci_suspend;
 -      xhci_pci_hc_driver.pci_resume = xhci_pci_resume;
 -      xhci_pci_hc_driver.pci_poweroff_late = xhci_pci_poweroff_late;
 -      xhci_pci_hc_driver.shutdown = xhci_pci_shutdown;
 -#endif
 +      xhci_pci_hc_driver.pci_suspend = pm_ptr(xhci_pci_suspend);
 +      xhci_pci_hc_driver.pci_resume = pm_ptr(xhci_pci_resume);
 +      xhci_pci_hc_driver.pci_poweroff_late = pm_ptr(xhci_pci_poweroff_late);
 +      xhci_pci_hc_driver.shutdown = pm_ptr(xhci_pci_shutdown);
 +      xhci_pci_hc_driver.stop = xhci_pci_stop;
        return pci_register_driver(&xhci_pci_driver);
  }
  module_init(xhci_pci_init);
@@@ -1360,6 -1360,9 +1360,9 @@@ static void tegra_xhci_id_work(struct w
  
        mutex_unlock(&tegra->lock);
  
+       tegra->otg_usb3_port = tegra_xusb_padctl_get_usb3_companion(tegra->padctl,
+                                                                   tegra->otg_usb2_port);
        if (tegra->host_mode) {
                /* switch to host mode */
                if (tegra->otg_usb3_port >= 0) {
@@@ -1474,9 -1477,6 +1477,6 @@@ static int tegra_xhci_id_notify(struct 
        }
  
        tegra->otg_usb2_port = tegra_xusb_get_usb2_port(tegra, usbphy);
-       tegra->otg_usb3_port = tegra_xusb_padctl_get_usb3_companion(
-                                                       tegra->padctl,
-                                                       tegra->otg_usb2_port);
  
        tegra->host_mode = (usbphy->last_event == USB_EVENT_ID) ? true : false;
  
@@@ -1535,6 -1535,7 +1535,6 @@@ static void tegra_xusb_deinit_usb_phy(s
  
  static int tegra_xusb_probe(struct platform_device *pdev)
  {
 -      struct of_phandle_args args;
        struct tegra_xusb *tegra;
        struct device_node *np;
        struct resource *regs;
                goto put_padctl;
        }
  
 -      /* Older device-trees don't have padctrl interrupt */
 -      err = of_irq_parse_one(np, 0, &args);
 -      if (!err) {
 -              tegra->padctl_irq = of_irq_get(np, 0);
 -              if (tegra->padctl_irq <= 0) {
 -                      err = (tegra->padctl_irq == 0) ? -ENODEV : tegra->padctl_irq;
 -                      goto put_padctl;
 -              }
 -      } else {
 +      tegra->padctl_irq = of_irq_get(np, 0);
 +      if (tegra->padctl_irq == -EPROBE_DEFER) {
 +              err = tegra->padctl_irq;
 +              goto put_padctl;
 +      } else if (tegra->padctl_irq <= 0) {
 +              /* Older device-trees don't have padctrl interrupt */
 +              tegra->padctl_irq = 0;
                dev_dbg(&pdev->dev,
                        "%pOF is missing an interrupt, disabling PM support\n", np);
        }
diff --combined drivers/usb/host/xhci.c
@@@ -9,6 -9,7 +9,7 @@@
   */
  
  #include <linux/pci.h>
+ #include <linux/iommu.h>
  #include <linux/iopoll.h>
  #include <linux/irq.h>
  #include <linux/log2.h>
@@@ -228,6 -229,7 +229,7 @@@ int xhci_reset(struct xhci_hcd *xhci, u
  static void xhci_zero_64b_regs(struct xhci_hcd *xhci)
  {
        struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
+       struct iommu_domain *domain;
        int err, i;
        u64 val;
        u32 intrs;
         * an iommu. Doing anything when there is no iommu is definitely
         * unsafe...
         */
-       if (!(xhci->quirks & XHCI_ZERO_64B_REGS) || !device_iommu_mapped(dev))
+       domain = iommu_get_domain_for_dev(dev);
+       if (!(xhci->quirks & XHCI_ZERO_64B_REGS) || !domain ||
+           domain->type == IOMMU_DOMAIN_IDENTITY)
                return;
  
        xhci_info(xhci, "Zeroing 64bit base registers, expecting fault\n");
@@@ -318,6 -322,192 +322,6 @@@ static int xhci_disable_interrupter(str
        return 0;
  }
  
 -#ifdef CONFIG_USB_PCI
 -/*
 - * Set up MSI
 - */
 -static int xhci_setup_msi(struct xhci_hcd *xhci)
 -{
 -      int ret;
 -      /*
 -       * TODO:Check with MSI Soc for sysdev
 -       */
 -      struct pci_dev  *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller);
 -
 -      ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSI);
 -      if (ret < 0) {
 -              xhci_dbg_trace(xhci, trace_xhci_dbg_init,
 -                              "failed to allocate MSI entry");
 -              return ret;
 -      }
 -
 -      ret = request_irq(pdev->irq, xhci_msi_irq,
 -                              0, "xhci_hcd", xhci_to_hcd(xhci));
 -      if (ret) {
 -              xhci_dbg_trace(xhci, trace_xhci_dbg_init,
 -                              "disable MSI interrupt");
 -              pci_free_irq_vectors(pdev);
 -      }
 -
 -      return ret;
 -}
 -
 -/*
 - * Set up MSI-X
 - */
 -static int xhci_setup_msix(struct xhci_hcd *xhci)
 -{
 -      int i, ret;
 -      struct usb_hcd *hcd = xhci_to_hcd(xhci);
 -      struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
 -
 -      /*
 -       * calculate number of msi-x vectors supported.
 -       * - HCS_MAX_INTRS: the max number of interrupts the host can handle,
 -       *   with max number of interrupters based on the xhci HCSPARAMS1.
 -       * - num_online_cpus: maximum msi-x vectors per CPUs core.
 -       *   Add additional 1 vector to ensure always available interrupt.
 -       */
 -      xhci->msix_count = min(num_online_cpus() + 1,
 -                              HCS_MAX_INTRS(xhci->hcs_params1));
 -
 -      ret = pci_alloc_irq_vectors(pdev, xhci->msix_count, xhci->msix_count,
 -                      PCI_IRQ_MSIX);
 -      if (ret < 0) {
 -              xhci_dbg_trace(xhci, trace_xhci_dbg_init,
 -                              "Failed to enable MSI-X");
 -              return ret;
 -      }
 -
 -      for (i = 0; i < xhci->msix_count; i++) {
 -              ret = request_irq(pci_irq_vector(pdev, i), xhci_msi_irq, 0,
 -                              "xhci_hcd", xhci_to_hcd(xhci));
 -              if (ret)
 -                      goto disable_msix;
 -      }
 -
 -      hcd->msix_enabled = 1;
 -      return ret;
 -
 -disable_msix:
 -      xhci_dbg_trace(xhci, trace_xhci_dbg_init, "disable MSI-X interrupt");
 -      while (--i >= 0)
 -              free_irq(pci_irq_vector(pdev, i), xhci_to_hcd(xhci));
 -      pci_free_irq_vectors(pdev);
 -      return ret;
 -}
 -
 -/* Free any IRQs and disable MSI-X */
 -static void xhci_cleanup_msix(struct xhci_hcd *xhci)
 -{
 -      struct usb_hcd *hcd = xhci_to_hcd(xhci);
 -      struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
 -
 -      if (xhci->quirks & XHCI_PLAT)
 -              return;
 -
 -      /* return if using legacy interrupt */
 -      if (hcd->irq > 0)
 -              return;
 -
 -      if (hcd->msix_enabled) {
 -              int i;
 -
 -              for (i = 0; i < xhci->msix_count; i++)
 -                      free_irq(pci_irq_vector(pdev, i), xhci_to_hcd(xhci));
 -      } else {
 -              free_irq(pci_irq_vector(pdev, 0), xhci_to_hcd(xhci));
 -      }
 -
 -      pci_free_irq_vectors(pdev);
 -      hcd->msix_enabled = 0;
 -}
 -
 -static void __maybe_unused xhci_msix_sync_irqs(struct xhci_hcd *xhci)
 -{
 -      struct usb_hcd *hcd = xhci_to_hcd(xhci);
 -
 -      if (hcd->msix_enabled) {
 -              struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
 -              int i;
 -
 -              for (i = 0; i < xhci->msix_count; i++)
 -                      synchronize_irq(pci_irq_vector(pdev, i));
 -      }
 -}
 -
 -static int xhci_try_enable_msi(struct usb_hcd *hcd)
 -{
 -      struct xhci_hcd *xhci = hcd_to_xhci(hcd);
 -      struct pci_dev  *pdev;
 -      int ret;
 -
 -      /* The xhci platform device has set up IRQs through usb_add_hcd. */
 -      if (xhci->quirks & XHCI_PLAT)
 -              return 0;
 -
 -      pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller);
 -      /*
 -       * Some Fresco Logic host controllers advertise MSI, but fail to
 -       * generate interrupts.  Don't even try to enable MSI.
 -       */
 -      if (xhci->quirks & XHCI_BROKEN_MSI)
 -              goto legacy_irq;
 -
 -      /* unregister the legacy interrupt */
 -      if (hcd->irq)
 -              free_irq(hcd->irq, hcd);
 -      hcd->irq = 0;
 -
 -      ret = xhci_setup_msix(xhci);
 -      if (ret)
 -              /* fall back to msi*/
 -              ret = xhci_setup_msi(xhci);
 -
 -      if (!ret) {
 -              hcd->msi_enabled = 1;
 -              return 0;
 -      }
 -
 -      if (!pdev->irq) {
 -              xhci_err(xhci, "No msi-x/msi found and no IRQ in BIOS\n");
 -              return -EINVAL;
 -      }
 -
 - legacy_irq:
 -      if (!strlen(hcd->irq_descr))
 -              snprintf(hcd->irq_descr, sizeof(hcd->irq_descr), "%s:usb%d",
 -                       hcd->driver->description, hcd->self.busnum);
 -
 -      /* fall back to legacy interrupt*/
 -      ret = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED,
 -                      hcd->irq_descr, hcd);
 -      if (ret) {
 -              xhci_err(xhci, "request interrupt %d failed\n",
 -                              pdev->irq);
 -              return ret;
 -      }
 -      hcd->irq = pdev->irq;
 -      return 0;
 -}
 -
 -#else
 -
 -static inline int xhci_try_enable_msi(struct usb_hcd *hcd)
 -{
 -      return 0;
 -}
 -
 -static inline void xhci_cleanup_msix(struct xhci_hcd *xhci)
 -{
 -}
 -
 -static inline void xhci_msix_sync_irqs(struct xhci_hcd *xhci)
 -{
 -}
 -
 -#endif
 -
  static void compliance_mode_recovery(struct timer_list *t)
  {
        struct xhci_hcd *xhci;
@@@ -515,6 -705,10 +519,6 @@@ int xhci_run(struct usb_hcd *hcd
  
        xhci_dbg_trace(xhci, trace_xhci_dbg_init, "xhci_run");
  
 -      ret = xhci_try_enable_msi(hcd);
 -      if (ret)
 -              return ret;
 -
        temp_64 = xhci_read_64(xhci, &ir->ir_set->erst_dequeue);
        temp_64 &= ~ERST_PTR_MASK;
        xhci_dbg_trace(xhci, trace_xhci_dbg_init,
@@@ -564,7 -758,7 +568,7 @@@ EXPORT_SYMBOL_GPL(xhci_run)
   * Disable device contexts, disable IRQs, and quiesce the HC.
   * Reset the HC, finish any completed transactions, and cleanup memory.
   */
 -static void xhci_stop(struct usb_hcd *hcd)
 +void xhci_stop(struct usb_hcd *hcd)
  {
        u32 temp;
        struct xhci_hcd *xhci = hcd_to_xhci(hcd);
        xhci_reset(xhci, XHCI_RESET_SHORT_USEC);
        spin_unlock_irq(&xhci->lock);
  
 -      xhci_cleanup_msix(xhci);
 -
        /* Deleting Compliance Mode Recovery Timer */
        if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) &&
                        (!(xhci_all_ports_seen_u0(xhci)))) {
                        readl(&xhci->op_regs->status));
        mutex_unlock(&xhci->mutex);
  }
 +EXPORT_SYMBOL_GPL(xhci_stop);
  
  /*
   * Shutdown HC (not bus-specific)
@@@ -655,6 -850,8 +659,6 @@@ void xhci_shutdown(struct usb_hcd *hcd
  
        spin_unlock_irq(&xhci->lock);
  
 -      xhci_cleanup_msix(xhci);
 -
        xhci_dbg_trace(xhci, trace_xhci_dbg_init,
                        "xhci_shutdown completed - status = %x",
                        readl(&xhci->op_regs->status));
@@@ -946,6 -1143,10 +950,6 @@@ int xhci_suspend(struct xhci_hcd *xhci
                                __func__);
        }
  
 -      /* step 5: remove core well power */
 -      /* synchronize irq when using MSI-X */
 -      xhci_msix_sync_irqs(xhci);
 -
        return rc;
  }
  EXPORT_SYMBOL_GPL(xhci_suspend);
@@@ -1049,6 -1250,7 +1053,6 @@@ int xhci_resume(struct xhci_hcd *xhci, 
                spin_unlock_irq(&xhci->lock);
                if (retval)
                        return retval;
 -              xhci_cleanup_msix(xhci);
  
                xhci_dbg(xhci, "// Disabling event ring interrupts\n");
                temp = readl(&xhci->op_regs->status);
@@@ -4240,6 -4442,7 +4244,7 @@@ static int __maybe_unused xhci_change_m
  
        if (!virt_dev || max_exit_latency == virt_dev->current_mel) {
                spin_unlock_irqrestore(&xhci->lock, flags);
+               xhci_free_command(xhci, command);
                return 0;
        }