Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2976878imu; Sun, 9 Dec 2018 14:07:17 -0800 (PST) X-Google-Smtp-Source: AFSGD/XhKzVOuan5FQJb+7JHYfC6dB1ihSSKP95vTdUJuGXsvAprWmXlCyr9O3NxaOpvPv275D3T X-Received: by 2002:a17:902:b943:: with SMTP id h3mr10026891pls.12.1544393237180; Sun, 09 Dec 2018 14:07:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544393237; cv=none; d=google.com; s=arc-20160816; b=VVVu+BxLcKZ/4JmJ8BuqDpU3LTGV034VwuORgVTt/35tkK9SJNJA6wPiFWOrnUoUYM uZQPuvEHaXKbmUX2dcKTl0HQggWjdnqy9tOFiewIlAZbzIQM4UU+OZGB68ZixGiTvNur rA66raA+OZp3uDX8LxPqie8Rbt0qjVi5WESZg5Xc3riF5wbIl4KwgIcwV7dlvs77JjKF NoFlynKR015cInsjWRTEUX0zUWfu4CWvOUr/sJyk9H8Y4l8KTsc7cYfkMF8I2PJINJjz WPwpGYAcGRd8FcBZGcodZ2s2nP0+AORrr/bnkN3ZHF1AcLWX4OCve6nNe+8ejRtYthoW um1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=FTc3dR1kQi/fZsTGTdWPrSA4IQ1qPIK4DlFa2KEuGjE=; b=UiMb6onkJXVtCr2SLjCbk10JSpB3zJBM+5KbqoiZGpmaLKqYwyBT7RwXNk4hK28nuS pZmyH4BQRzIiv2Kyag/JA+LoLQQNQpg+qjPBPo60fYAVhuWgHiVyNXXGvYDBRX4VBDro i/YN4OELFoKZlghj8CMu4yc04H3favacOIDuewNUQi+q7qGZi4iIA95SmL2kthuuXjoH cfQELybBXJgQ2Jq4dagZ/EIcnQipKtWUFRagL2MevIF8dbuJ6VSqYBSFER31PanKJenB vMCONqyDvmJkILbgTbqisPRIMDjwenOW7/QnA1QTb+3J3Ikb5jPtvAhm18gMamlm5AYP MuqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x33si8707172plb.43.2018.12.09.14.07.01; Sun, 09 Dec 2018 14:07:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727648AbeLIWFl (ORCPT + 99 others); Sun, 9 Dec 2018 17:05:41 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:36966 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727636AbeLIWFj (ORCPT ); Sun, 9 Dec 2018 17:05:39 -0500 Received: from pub.yeoldevic.com ([81.174.156.145] helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gW735-0002iZ-7C; Sun, 09 Dec 2018 21:55:39 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gW72g-0003V1-2S; Sun, 09 Dec 2018 21:55:14 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Oliver Neukum" , "Greg Kroah-Hartman" Date: Sun, 09 Dec 2018 21:50:33 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 199/328] usb: uas: add support for more quirk flags In-Reply-To: X-SA-Exim-Connect-IP: 81.174.156.145 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.62-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Oliver Neukum commit 42d1c6d4a06a77b3ab206a919b9050c3080f3a71 upstream. The hope that UAS devices would be less broken than old style storage devices has turned out to be unfounded. Make UAS support more of the quirk flags of the old driver. Signed-off-by: Oliver Neukum Signed-off-by: Greg Kroah-Hartman [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- drivers/usb/storage/uas.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c @@ -991,6 +991,26 @@ static int uas_slave_configure(struct sc if (devinfo->flags & US_FL_BROKEN_FUA) sdev->broken_fua = 1; + /* + * Some disks return the total number of blocks in response + * to READ CAPACITY rather than the highest block number. + * If this device makes that mistake, tell the sd driver. + */ + if (devinfo->flags & US_FL_FIX_CAPACITY) + sdev->fix_capacity = 1; + + /* + * Some devices don't like MODE SENSE with page=0x3f, + * which is the command used for checking if a device + * is write-protected. Now that we tell the sd driver + * to do a 192-byte transfer with this command the + * majority of devices work fine, but a few still can't + * handle it. The sd driver will simply assume those + * devices are write-enabled. + */ + if (devinfo->flags & US_FL_NO_WP_DETECT) + sdev->skip_ms_page_3f = 1; + scsi_set_tag_type(sdev, MSG_ORDERED_TAG); scsi_activate_tcq(sdev, devinfo->qdepth - 2); return 0;