Skip to contentSkip to conversation

scsi: aacraid: avoid open-coded upper_32_bits

PATCH Applied Arnd Bergmann 4 participants 4 messages Feb 7, 2017

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

PATCH 1/1 scsi: aacraid: avoid open-coded upper_32_bits

Shifting a dma_addr_t right by 32 bits causes a compile-time warning when that type is only 32 bit wide:

drivers/scsi/aacraid/src.c: In function 'aac_src_start_adapter':
drivers/scsi/aacraid/src.c:414:29: error: right shift count >= width of type [-Werror=shift-count-overflow]

This changes the driver to use the predefined macros consistently, including one correct but open-coded upper_32_bits() instance.

Fixes d1ef4da8487f ("scsi: aacraid: added support for init_struct_8")
Fixes 423400e64d37 ("scsi: aacraid: Include HBA direct interface")
---
 drivers/scsi/aacraid/src.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/aacraid/src.c +3 -3
index 46976a3b6952..8e4e2ddbafd7 100644
@@ -410,8 +410,8 @@ static void aac_src_start_adapter(struct aac_dev *dev)
 	if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE3) {
 		init->r8.host_elapsed_seconds = cpu_to_le32(get_seconds());
 		src_sync_cmd(dev, INIT_STRUCT_BASE_ADDRESS,
-			(u32)(ulong)dev->init_pa,
-			(u32)((ulong)dev->init_pa>>32),
+			lower_32_bits(dev->init_pa),
+			upper_32_bits(dev->init_pa),
 			sizeof(struct _r8) +
 			(AAC_MAX_HRRQ - 1) * sizeof(struct _rrq),
 			0, 0, 0, NULL, NULL, NULL, NULL, NULL);
@@ -563,7 +563,7 @@ static int aac_src_deliver_message(struct fib *fib)
 			fib->hw_fib_va->header.SenderFibAddress =
 				cpu_to_le32((u32)address);
 			fib->hw_fib_va->header.u.TimeStamp = 0;
-			WARN_ON(((u32)(((address) >> 16) >> 16)) != 0L);
+			WARN_ON(upper_32_bits(address) != 0L);
 		} else {
 			/* Calculate the amount to the fibsize bits */
 			fibsize = (sizeof(struct aac_fib_xporthdr) +
Signature · 1 line
2.9.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Arnd Bergmann

Shifting a dma_addr_t right by 32 bits causes a compile-time warning when that type is only 32 bit wide:

drivers/scsi/aacraid/src.c: In function 'aac_src_start_adapter':
drivers/scsi/aacraid/src.c:414:29: error: right shift count >= width of type [-Werror=shift-count-overflow]

Quoted 7 lines

This changes the driver to use the predefined macros consistently, including one correct but open-coded upper_32_bits() instance.

Fixes d1ef4da8487f ("scsi: aacraid: added support for init_struct_8")
Fixes 423400e64d37 ("scsi: aacraid: Include HBA direct interface")

---

The coolest thing with your patches is, one gets to know new cool functions/macros.

Anyways looks good,

Signature · 6 lines
Johannes Thumshirn                                          Storage
[email protected]                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Reviewed-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 25 lines

-----Original Message-----
From: Arnd Bergmann [mailto:[email protected]]
Sent: Tuesday, February 7, 2017 5:00 AM
To: dl-esc-Aacraid Linux Driver <[email protected]>; James E.J. Bottomley <[email protected]>; Martin K. Petersen <[email protected]>
Cc: Arnd Bergmann <[email protected]>; Johannes Thumshirn <[email protected]>; Raghava Aditya Renukunta <[email protected]>; Dave Carroll <[email protected]>; [email protected]; linux- [email protected]
Subject: [PATCH] scsi: aacraid: avoid open-coded upper_32_bits

EXTERNAL EMAIL

Shifting a dma_addr_t right by 32 bits causes a compile-time warning when that type is only 32 bit wide:

drivers/scsi/aacraid/src.c: In function 'aac_src_start_adapter':
drivers/scsi/aacraid/src.c:414:29: error: right shift count >= width of type [- Werror=shift-count-overflow]

Quoted 7 lines

This changes the driver to use the predefined macros consistently, including one correct but open-coded upper_32_bits() instance.

Fixes d1ef4da8487f ("scsi: aacraid: added support for init_struct_8")
Fixes 423400e64d37 ("scsi: aacraid: Include HBA direct interface")

---

#3 lore raw
In reply to Arnd Bergmann
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnd" == Arnd Bergmann <[email protected]> writes:

Arnd> Shifting a dma_addr_t right by 32 bits causes a compile-time Arnd> warning when that type is only 32 bit wide:

Arnd> drivers/scsi/aacraid/src.c: In function 'aac_src_start_adapter':
Arnd> drivers/scsi/aacraid/src.c:414:29: error: right shift count >= Arnd> width of type [-Werror=shift-count-overflow]

Arnd> This changes the driver to use the predefined macros consistently, Arnd> including one correct but open-coded upper_32_bits() instance.

Applied to 4.11/scsi-queue.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering