From: Tom Yan <tom.ty89@gmail.com>
To: linux-usb@vger.kernel.org, gregkh@linuxfoundation.org,
stern@rowland.harvard.edu, arnd@arndb.de
Cc: cyrozap@gmail.com, yoshihiro.shimoda.uh@renesas.com,
Tom Yan <tom.ty89@gmail.com>
Subject: [PATCH v6 1/3] usb-storage: fix sdev->host->dma_dev
Date: Fri, 4 Sep 2020 02:17:23 +0800 [thread overview]
Message-ID: <20200903181725.2931-1-tom.ty89@gmail.com> (raw)
In-Reply-To: <20200903155438.GC663761@rowland.harvard.edu>
Use scsi_add_host_with_dma() instead of scsi_add_host().
When the scsi request queue is initialized/allocated, hw_max_sectors is clamped
to the dma max mapping size. Therefore, the correct device that should be used
for the clamping needs to be set.
The same clamping is still needed in usb-storage as hw_max_sectors could be
changed there. The original clamping would be invalidated in such cases.
Signed-off-by: Tom Yan <tom.ty89@gmail.com>
---
v2: fix commit message line length; bump hw_max_sectors to 2048 for SS UAS
drives; split the "fallback" hw_max_sectors setting into another patch
v3: use a different approach: fix the dma_dev instead
v4: add the changelog of the patch series
v5: fix changelog line length
v6: split dma_dev fix for usb-storage and uas
drivers/usb/storage/scsiglue.c | 2 +-
drivers/usb/storage/usb.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index e5a971b83e3f..560efd1479ba 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -92,7 +92,7 @@ static int slave_alloc (struct scsi_device *sdev)
static int slave_configure(struct scsi_device *sdev)
{
struct us_data *us = host_to_us(sdev->host);
- struct device *dev = us->pusb_dev->bus->sysdev;
+ struct device *dev = sdev->host->dma_dev;
/*
* Many devices have trouble transferring more than 32KB at a time,
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 94a64729dc27..c2ef367cf257 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -1049,8 +1049,9 @@ int usb_stor_probe2(struct us_data *us)
goto BadDevice;
usb_autopm_get_interface_no_resume(us->pusb_intf);
snprintf(us->scsi_name, sizeof(us->scsi_name), "usb-storage %s",
- dev_name(&us->pusb_intf->dev));
- result = scsi_add_host(us_to_host(us), dev);
+ dev_name(dev));
+ result = scsi_add_host_with_dma(us_to_host(us), dev,
+ us->pusb_dev->bus->sysdev);
if (result) {
dev_warn(dev,
"Unable to add the scsi host\n");
--
2.28.0
next prev parent reply other threads:[~2020-09-03 18:17 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-01 5:54 [PATCH] usb-storage: always set hw_max_sectors in slave_configure to avoid inappropriate clamping Tom Yan
2020-09-01 14:55 ` Alan Stern
2020-09-01 23:24 ` Tom Yan
2020-09-01 23:44 ` Tom Yan
2020-09-02 15:24 ` Alan Stern
2020-09-02 0:09 ` [PATCH v2 1/2] uas: bump hw_max_sectors to 2048 blocks for SS or faster drives Tom Yan
2020-09-02 0:09 ` [PATCH v2 2/2] usb-storage: always set hw_max_sectors in slave_configure to avoid inappropriate clamping Tom Yan
2020-09-02 0:20 ` Tom Yan
2020-09-02 15:30 ` [PATCH v2 1/2] uas: bump hw_max_sectors to 2048 blocks for SS or faster drives Alan Stern
2020-09-03 6:57 ` Tom Yan
2020-09-03 7:56 ` [PATCH v3 1/2] usb-storage: fix sdev->host->dma_dev Tom Yan
2020-09-03 7:56 ` [PATCH v3 2/2] uas: bump hw_max_sectors to 2048 blocks for SS or faster drives Tom Yan
2020-09-03 8:20 ` [PATCH v3 1/2] usb-storage: fix sdev->host->dma_dev Greg KH
2020-09-03 8:28 ` Tom Yan
2020-09-03 8:34 ` Greg KH
2020-09-03 8:46 ` [PATCH v4 " Tom Yan
2020-09-03 8:46 ` [PATCH v4 2/2] uas: bump hw_max_sectors to 2048 blocks for SS or faster drives Tom Yan
2020-09-03 8:50 ` [PATCH v5 1/2] usb-storage: fix sdev->host->dma_dev Tom Yan
2020-09-03 8:50 ` [PATCH v5 2/2] uas: bump hw_max_sectors to 2048 blocks for SS or faster drives Tom Yan
2020-09-03 15:54 ` [PATCH v5 1/2] usb-storage: fix sdev->host->dma_dev Alan Stern
2020-09-03 18:17 ` Tom Yan [this message]
2020-09-03 18:17 ` [PATCH v6 2/3] uas: " Tom Yan
2020-09-03 18:17 ` [PATCH v6 3/3] uas: bump hw_max_sectors to 2048 blocks for SS or faster drives Tom Yan
2020-09-03 18:31 ` [PATCH v6 1/3] usb-storage: fix sdev->host->dma_dev Alan Stern
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=20200903181725.2931-1-tom.ty89@gmail.com \
--to=tom.ty89@gmail.com \
--cc=arnd@arndb.de \
--cc=cyrozap@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=yoshihiro.shimoda.uh@renesas.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;
as well as URLs for NNTP newsgroup(s).