Skip to contentSkip to conversation

scsi: pmcraid: Replace cpu_to_be64 + le64_to_cpu with swab64

PATCH In review Thorsten Blum 3 participants 5 messages Dec 10, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: pmcraid: Replace cpu_to_be64 + le64_to_cpu with swab64

Replace cpu_to_be64(le64_to_cpu()) with swab64() to simplify pmcraid_prepare_cancel_cmd().

---
 drivers/scsi/pmcraid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/pmcraid.c +1 -1
index 33f403e307eb..68c2a10453fe 100644
@@ -1213,7 +1213,7 @@ static void pmcraid_prepare_cancel_cmd(
 	 * cdb[2]..cdb[9] is Big-Endian format. Note that length bits in
 	 * IOARCB address are not masked.
 	 */
-	ioarcb_addr = cpu_to_be64(le64_to_cpu(cmd_to_cancel->ioa_cb->ioarcb.ioarcb_bus_addr));
+	ioarcb_addr = swab64(cmd_to_cancel->ioa_cb->ioarcb.ioarcb_bus_addr);
 
 	/* Get the resource handle to where the command to be aborted has been
 	 * sent.
Signature · 2 lines
Thorsten Blum <[email protected]>
GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4
#1 lore raw
Quoted 2 lines · Thorsten Blum

Replace cpu_to_be64(le64_to_cpu()) with swab64() to simplify pmcraid_prepare_cancel_cmd().

How does this not break the __le64/__be64 annotation checking?

#2 lore raw
Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Thorsten Blum

Replace cpu_to_be64(le64_to_cpu()) with swab64() to simplify pmcraid_prepare_cancel_cmd().

How does this not break the __le64/__be64 annotation checking?

I'm not sure and didn't investigate, but it compiles without warnings.

#3 lore raw
Quoted 10 lines · On Wed, 10 Dec 2025 16:39:36 +0100 Thorsten Blum <[email protected]>…
Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Thorsten Blum

Replace cpu_to_be64(le64_to_cpu()) with swab64() to simplify pmcraid_prepare_cancel_cmd().

How does this not break the __le64/__be64 annotation checking?

I'm not sure and didn't investigate, but it compiles without warnings.

You'd need to run sparse.

David

#4 lore raw
Quoted 4 lines · David Laight

[...]

You'd need to run sparse.

I compiled it with C=1 and there are other, unrelated sparse warnings:

CC [M] drivers/scsi/pmcraid.o
CHECK drivers/scsi/pmcraid.c
drivers/scsi/pmcraid.c:73:1: error: bad constant expression drivers/scsi/pmcraid.c:74:1: error: bad constant expression drivers/scsi/pmcraid.c:75:1: error: bad constant expression drivers/scsi/pmcraid.c:76:1: error: bad constant expression drivers/scsi/pmcraid.c:78:1: error: bad constant expression drivers/scsi/pmcraid.c:79:1: error: bad constant expression drivers/scsi/pmcraid.c:84:1: error: bad constant expression drivers/scsi/pmcraid.c:85:1: error: bad constant expression drivers/scsi/pmcraid.c:89:1: error: bad constant expression drivers/scsi/pmcraid.c:90:1: error: bad constant expression

Compiling with V=1 also confirms that sparse is running:

# CHECK drivers/scsi/pmcraid.c
sparse -D__linux__ ... -D__KBUILD_MODNAME=pmcraid drivers/scsi/pmcraid.c