[PATCH] scsi: pmcraid: Replace cpu_to_be64 + le64_to_cpu with swab64

Thorsten Blum posted 1 patch 3 days, 11 hours ago
drivers/scsi/pmcraid.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] scsi: pmcraid: Replace cpu_to_be64 + le64_to_cpu with swab64
Posted by Thorsten Blum 3 days, 11 hours ago
Replace cpu_to_be64(le64_to_cpu()) with swab64() to simplify
pmcraid_prepare_cancel_cmd().

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 drivers/scsi/pmcraid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 33f403e307eb..68c2a10453fe 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -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.
-- 
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4
Re: [PATCH] scsi: pmcraid: Replace cpu_to_be64 + le64_to_cpu with swab64
Posted by Christoph Hellwig 3 days, 11 hours ago
On Wed, Dec 10, 2025 at 03:33:21PM +0100, Thorsten Blum wrote:
> 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?
Re: [PATCH] scsi: pmcraid: Replace cpu_to_be64 + le64_to_cpu with swab64
Posted by Thorsten Blum 3 days, 10 hours ago
On 10. Dec 2025, at 16:13, Christoph Hellwig wrote:
> On Wed, Dec 10, 2025 at 03:33:21PM +0100, Thorsten Blum wrote:
>> 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.
Re: [PATCH] scsi: pmcraid: Replace cpu_to_be64 + le64_to_cpu with swab64
Posted by David Laight 3 days, 3 hours ago
On Wed, 10 Dec 2025 16:39:36 +0100
Thorsten Blum <thorsten.blum@linux.dev> wrote:

> On 10. Dec 2025, at 16:13, Christoph Hellwig wrote:
> > On Wed, Dec 10, 2025 at 03:33:21PM +0100, Thorsten Blum wrote:  
> >> 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
Re: [PATCH] scsi: pmcraid: Replace cpu_to_be64 + le64_to_cpu with swab64
Posted by Thorsten Blum 3 days, 3 hours ago
On 10. Dec 2025, at 23:21, David Laight wrote:
> 
> [...]
> 
> 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