Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: John Garry <john.g.garry@oracle.com>
To: James.Bottomley@HansenPartnership.com,
	martin.petersen@oracle.com, m.szyprowski@samsung.com,
	robin.murphy@arm.com, hch@lst.de
Cc: linux-scsi@vger.kernel.org, iommu@lists.linux.dev,
	ionut.nechita@windriver.com, John Garry <john.g.garry@oracle.com>
Subject: [PATCH 2/2] scsi: core: Drop dev->dma_mask check in evaluating max_sectors
Date: Mon, 29 Jun 2026 08:53:10 +0000	[thread overview]
Message-ID: <20260629085310.2298552-3-john.g.garry@oracle.com> (raw)
In-Reply-To: <20260629085310.2298552-1-john.g.garry@oracle.com>

When evaluating shost->max_sectors, we currently check dma_dev->dma_mask
is non-NULL, as dma_max_mapping_size(dma_dev) could previously not handle
unset dma_dev->dma_mask - this is no longer the case.

Signed-off-by: John Garry <john.g.garry@oracle.com>
---
 drivers/scsi/hosts.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index e047747d4ecf8..d512080268afe 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -252,10 +252,8 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
 
 	shost->dma_dev = dma_dev;
 
-	if (dma_dev->dma_mask) {
-		shost->max_sectors = min_t(unsigned int, shost->max_sectors,
-				dma_max_mapping_size(dma_dev) >> SECTOR_SHIFT);
-	}
+	shost->max_sectors = min_not_zero(shost->max_sectors,
+			dma_max_mapping_size(dma_dev) >> SECTOR_SHIFT);
 
 	error = scsi_mq_setup_tags(shost);
 	if (error)
-- 
2.43.7


  parent reply	other threads:[~2026-06-29  8:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29  8:53 [PATCH 0/2] Drop SCSI core dev->dma_mask check John Garry
2026-06-29  8:53 ` [PATCH 1/2] dma-mapping: make dma_max_mapping_size() return 0 for no DMA capability John Garry
2026-06-29  9:10   ` sashiko-bot
2026-06-29 10:11   ` Robin Murphy
2026-06-29 10:46     ` John Garry
2026-06-29 11:09       ` Robin Murphy
2026-07-02 14:11         ` Christoph Hellwig
2026-07-02 14:32           ` John Garry
2026-07-02 14:11   ` Christoph Hellwig
2026-06-29  8:53 ` John Garry [this message]
2026-07-02 14:12   ` [PATCH 2/2] scsi: core: Drop dev->dma_mask check in evaluating max_sectors Christoph Hellwig

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=20260629085310.2298552-3-john.g.garry@oracle.com \
    --to=john.g.garry@oracle.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux.dev \
    --cc=ionut.nechita@windriver.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=martin.petersen@oracle.com \
    --cc=robin.murphy@arm.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