All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: aacraid: avoid open-coded upper_32_bits
@ 2017-02-07 12:59 ` Arnd Bergmann
  0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2017-02-07 12:59 UTC (permalink / raw)
  To: Adaptec OEM Raid Solutions, James E.J. Bottomley, Martin K. Petersen
  Cc: Arnd Bergmann, Johannes Thumshirn, Raghava Aditya Renukunta,
	Dave Carroll, linux-scsi, linux-kernel

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")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/scsi/aacraid/src.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
index 46976a3b6952..8e4e2ddbafd7 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -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) +
-- 
2.9.0

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

* [PATCH] scsi: aacraid: avoid open-coded upper_32_bits
@ 2017-02-07 12:59 ` Arnd Bergmann
  0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2017-02-07 12:59 UTC (permalink / raw)
  To: Adaptec OEM Raid Solutions, James E.J. Bottomley, Martin K. Petersen
  Cc: Arnd Bergmann, Johannes Thumshirn, Raghava Aditya Renukunta,
	Dave Carroll, linux-scsi, linux-kernel

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")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/scsi/aacraid/src.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
index 46976a3b6952..8e4e2ddbafd7 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -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) +
-- 
2.9.0

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

* Re: [PATCH] scsi: aacraid: avoid open-coded upper_32_bits
  2017-02-07 12:59 ` Arnd Bergmann
  (?)
@ 2017-02-07 13:05 ` Johannes Thumshirn
  -1 siblings, 0 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2017-02-07 13:05 UTC (permalink / raw)
  To: Arnd Bergmann, Adaptec OEM Raid Solutions, James E.J. Bottomley,
	Martin K. Petersen
  Cc: Raghava Aditya Renukunta, Dave Carroll, linux-scsi, linux-kernel

On 02/07/2017 01:59 PM, Arnd Bergmann wrote:
> 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")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

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

Anyways looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>


-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +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

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

* RE: [PATCH] scsi: aacraid: avoid open-coded upper_32_bits
  2017-02-07 12:59 ` Arnd Bergmann
  (?)
  (?)
@ 2017-02-07 19:37 ` Raghava Aditya Renukunta
  -1 siblings, 0 replies; 6+ messages in thread
From: Raghava Aditya Renukunta @ 2017-02-07 19:37 UTC (permalink / raw)
  To: Arnd Bergmann, dl-esc-Aacraid Linux Driver, James E.J. Bottomley,
	Martin K. Petersen
  Cc: Johannes Thumshirn, Dave Carroll, linux-scsi, linux-kernel



> -----Original Message-----
> From: Arnd Bergmann [mailto:arnd@arndb.de]
> Sent: Tuesday, February 7, 2017 5:00 AM
> To: dl-esc-Aacraid Linux Driver <aacraid@microsemi.com>; James E.J.
> Bottomley <jejb@linux.vnet.ibm.com>; Martin K. Petersen
> <martin.petersen@oracle.com>
> Cc: Arnd Bergmann <arnd@arndb.de>; Johannes Thumshirn
> <jthumshirn@suse.de>; Raghava Aditya Renukunta
> <RaghavaAditya.Renukunta@microsemi.com>; Dave Carroll
> <david.carroll@microsemi.com>; linux-scsi@vger.kernel.org; linux-
> kernel@vger.kernel.org
> 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]
> 
> 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")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

Reviewed-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>

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

* Re: [PATCH] scsi: aacraid: avoid open-coded upper_32_bits
  2017-02-07 12:59 ` Arnd Bergmann
@ 2017-02-07 22:25   ` Martin K. Petersen
  -1 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2017-02-07 22:25 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Adaptec OEM Raid Solutions, James E.J. Bottomley,
	Martin K. Petersen, Johannes Thumshirn, Raghava Aditya Renukunta,
	Dave Carroll, linux-scsi, linux-kernel

>>>>> "Arnd" == Arnd Bergmann <arnd@arndb.de> 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.

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] scsi: aacraid: avoid open-coded upper_32_bits
@ 2017-02-07 22:25   ` Martin K. Petersen
  0 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2017-02-07 22:25 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Adaptec OEM Raid Solutions, James E.J. Bottomley,
	Martin K. Petersen, Johannes Thumshirn, Raghava Aditya Renukunta,
	Dave Carroll, linux-scsi, linux-kernel

>>>>> "Arnd" == Arnd Bergmann <arnd@arndb.de> 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.

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2017-02-07 23:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-07 12:59 [PATCH] scsi: aacraid: avoid open-coded upper_32_bits Arnd Bergmann
2017-02-07 12:59 ` Arnd Bergmann
2017-02-07 13:05 ` Johannes Thumshirn
2017-02-07 19:37 ` Raghava Aditya Renukunta
2017-02-07 22:25 ` Martin K. Petersen
2017-02-07 22:25   ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.