From patchwork Mon May 23 16:02:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Yan X-Patchwork-Id: 9132099 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DFF1860761 for ; Mon, 23 May 2016 16:02:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D76BF28220 for ; Mon, 23 May 2016 16:02:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC0A028237; Mon, 23 May 2016 16:02:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7DD4328220 for ; Mon, 23 May 2016 16:02:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753462AbcEWQC5 (ORCPT ); Mon, 23 May 2016 12:02:57 -0400 Received: from mail-pa0-f66.google.com ([209.85.220.66]:35640 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753114AbcEWQCz (ORCPT ); Mon, 23 May 2016 12:02:55 -0400 Received: by mail-pa0-f66.google.com with SMTP id rw9so18446179pab.2; Mon, 23 May 2016 09:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:to:cc:subject:date; bh=Dbn2MAoiwZiWCejuN5ln3I7hlAA8hcFEzYC0GbauRtQ=; b=t/7yjExfTz3sTdZyoAgXIpuPgZn6t5P6aCXEb32qtpPQlQ6qrRsbPbyh9fsW6MhvZ6 kxq+TjJ5LGPMzPfPMOG+jlCxXkx+/hqALBiFtjrHJsI4Z0kQmmz3bcIm2Dn6jBaK6Rrp UaXJRDlEONRe4HpNEQmv8C1qwRfeHy73QHrk2x6Il/f6HwbbuOa27YT9wbWS+AxA0+aJ NKMl7pQBtbrhNKLUZcJjgJ97abdLgWFTzHHRcbWcYzjGjtq9U4sEjZXjqX8nppny+wPT QJ3Dvvkt6hWYlHf1cGYUU2hmxSsNhixXduxcn6oXJ5NuGOzeehq2nsAp3T1DVUatoqmX Mc0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:from:to:cc:subject:date; bh=Dbn2MAoiwZiWCejuN5ln3I7hlAA8hcFEzYC0GbauRtQ=; b=NTDgqkTZ0Yi/Q/mq+FZSxWkqk7uCU/cCOGhPC40tOry34FYmxc3xwzRvD350n9RrSu BloXMlMWZ1719RRT9Nkzky39DhNu6iCBUrzxYv4mZrMxKSCiR1cfcrAq7x7FU47A316E p/AwvX3wjFdQBQTED+MBkKWm3iZCWSz23PW/T+c8DmIYiiAinWGeTHKF5dIU593zFQfo SMRL7NOnMgzBfiS7Cg53T1DvuamRqlvhJWkM6/ktSq6BlwxVgEX+ZZ00ywP1heYalM8D cZ37/aHr/hBONQNPev6fkAU9GqnyPKqgsv63LysRvFUGmujzxuinhORqWOnvv77N2kM8 NxJQ== X-Gm-Message-State: AOPr4FX7XKrIm/mNBIBZ7yd+t0a526XriPsEjyyIP2ThX1oDu8/iIw5GRynU/475ZSTVXQ== X-Received: by 10.66.171.41 with SMTP id ar9mr28336364pac.125.1464019374795; Mon, 23 May 2016 09:02:54 -0700 (PDT) Received: from localhost.localdomain ([2404:c805:e00:5d00:ae22:bff:fe29:e60c]) by smtp.gmail.com with ESMTPSA id m190sm47685915pfm.29.2016.05.23.09.02.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 May 2016 09:02:54 -0700 (PDT) Message-ID: <574329ae.c726620a.60f3.ffffd14b@mx.google.com> X-Google-Original-Message-ID: <1464019363-6067-1-git-send-email-me> From: tom.ty89@gmail.com X-Google-Original-From: me To: gregkh@linuxfoundation.org Cc: kraxel@redhat.com, stern@rowland.harvard.edu, linux-usb@vger.kernel.org, linux-scsi@vger.kernel.org, stable@vger.kernel.org, hdegoede@redhat.com, Tom Yan Subject: [PATCH 1/1] uas: leave can_queue as MAX_CMNDS if device reports larger qdepth Date: Tue, 24 May 2016 00:02:43 +0800 X-Mailer: git-send-email 2.8.2 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tom Yan Commit 198de51dbc34 ("USB: uas: Limit qdepth at the scsi-host level") made qdepth limit set in host template (`.can_queue = MAX_CMNDS`) useless. Instead of removing the template limit, now we only change limit according to the qdepth reported by the device if it is smaller than MAX_CMNDS. Signed-off-by: Tom Yan diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index 4d49fce..d7790e6 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c @@ -972,7 +972,8 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id) * 1 tag is reserved for untagged commands + * 1 tag to avoid off by one errors in some bridge firmwares */ - shost->can_queue = devinfo->qdepth - 2; + if (devinfo->qdepth - 2 < MAX_CMNDS) + shost->can_queue = devinfo->qdepth - 2; usb_set_intfdata(intf, shost); result = scsi_add_host(shost, &intf->dev);