public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
* [PATCH] scsi - gvp11.c: fix DMA mask calculation error
@ 2022-07-13  7:49 Michael Schmitz
  2022-07-14  3:18 ` Martin K. Petersen
  2022-07-19  3:08 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Schmitz @ 2022-07-13  7:49 UTC (permalink / raw)
  To: linux-m68k, arnd; +Cc: linux-scsi, geert, Michael Schmitz

DMA masks given in the Zorro ID table don't contain the 2 byte
alignment quirk seen in the GVP11_XFER_MASK macro from gvp11.h
so no need to account for that.

DMA masks passed to dma_set_mask_and_coherent() must be 64 bit,
add the missing cast in the TO_DMA_MASK macro used to convert
driver DMA masks to DMA API masks.

CC: linux-scsi@vger.kernel.org
Link: https://lore.kernel.org/r/6d1d88ee-1cf6-c735-1e6d-bafd2096e322@gmail.com
Fixes: f4a09e5a3a36 ("scsi - gvp11.c: convert m68k WD33C93 drivers to DMA API")
Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
---
 drivers/scsi/gvp11.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/gvp11.c b/drivers/scsi/gvp11.c
index e8b7a09eb8c7..7d56a236a011 100644
--- a/drivers/scsi/gvp11.c
+++ b/drivers/scsi/gvp11.c
@@ -30,7 +30,7 @@ struct gvp11_hostdata {
 };
 
 #define DMA_DIR(d)   ((d == DATA_OUT_DIR) ? DMA_TO_DEVICE : DMA_FROM_DEVICE)
-#define TO_DMA_MASK(m)	((~(m & 0xfffffff0))-1)
+#define TO_DMA_MASK(m)	(~((unsigned long long)m & 0xffffffff))
 
 static irqreturn_t gvp11_intr(int irq, void *data)
 {
@@ -334,7 +334,7 @@ static int gvp11_probe(struct zorro_dev *z, const struct zorro_device_id *ent)
 
 	if (dma_set_mask_and_coherent(&z->dev,
 		TO_DMA_MASK(default_dma_xfer_mask))) {
-		dev_warn(&z->dev, "cannot use DMA mask %x\n",
+		dev_warn(&z->dev, "cannot use DMA mask %llx\n",
 			 TO_DMA_MASK(default_dma_xfer_mask));
 		return -ENODEV;
 	}
@@ -383,7 +383,7 @@ static int gvp11_probe(struct zorro_dev *z, const struct zorro_device_id *ent)
 		hdata->wh.dma_xfer_mask = gvp11_xfer_mask;
 		if (dma_set_mask_and_coherent(&z->dev,
 			TO_DMA_MASK(gvp11_xfer_mask))) {
-			dev_warn(&z->dev, "cannot use DMA mask %x\n",
+			dev_warn(&z->dev, "cannot use DMA mask %llx\n",
 				 TO_DMA_MASK(gvp11_xfer_mask));
 			error = -ENODEV;
 			goto fail_check_or_alloc;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi - gvp11.c: fix DMA mask calculation error
  2022-07-13  7:49 [PATCH] scsi - gvp11.c: fix DMA mask calculation error Michael Schmitz
@ 2022-07-14  3:18 ` Martin K. Petersen
  2022-07-19  3:08 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2022-07-14  3:18 UTC (permalink / raw)
  To: Michael Schmitz; +Cc: linux-m68k, arnd, linux-scsi, geert


Michael,

> DMA masks given in the Zorro ID table don't contain the 2 byte
> alignment quirk seen in the GVP11_XFER_MASK macro from gvp11.h
> so no need to account for that.
>
> DMA masks passed to dma_set_mask_and_coherent() must be 64 bit,
> add the missing cast in the TO_DMA_MASK macro used to convert
> driver DMA masks to DMA API masks.

Applied to 5.20/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi - gvp11.c: fix DMA mask calculation error
  2022-07-13  7:49 [PATCH] scsi - gvp11.c: fix DMA mask calculation error Michael Schmitz
  2022-07-14  3:18 ` Martin K. Petersen
@ 2022-07-19  3:08 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2022-07-19  3:08 UTC (permalink / raw)
  To: linux-m68k, arnd, Michael Schmitz; +Cc: Martin K . Petersen, linux-scsi, geert

On Wed, 13 Jul 2022 19:49:13 +1200, Michael Schmitz wrote:

> DMA masks given in the Zorro ID table don't contain the 2 byte
> alignment quirk seen in the GVP11_XFER_MASK macro from gvp11.h
> so no need to account for that.
> 
> DMA masks passed to dma_set_mask_and_coherent() must be 64 bit,
> add the missing cast in the TO_DMA_MASK macro used to convert
> driver DMA masks to DMA API masks.
> 
> [...]

Applied to 5.20/scsi-queue, thanks!

[1/1] scsi - gvp11.c: fix DMA mask calculation error
      https://git.kernel.org/mkp/scsi/c/f712e24c0b2e

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-19  3:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-13  7:49 [PATCH] scsi - gvp11.c: fix DMA mask calculation error Michael Schmitz
2022-07-14  3:18 ` Martin K. Petersen
2022-07-19  3:08 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox