diff mbox series

[v2,5/6] qla2xxx: Convert MAKE_HANDLE() from a define into an inline function

Message ID 20200123042345.23886-6-bvanassche@acm.org (mailing list archive)
State Changes Requested
Headers show
Series qla2xxx patches for kernel v5.6 | expand

Commit Message

Bart Van Assche Jan. 23, 2020, 4:23 a.m. UTC
This patch allows sparse to verify the endianness of the arguments passed
to MAKE_HANDLE().

Cc: Quinn Tran <qutran@marvell.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Daniel Wagner <dwagner@suse.de>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/qla2xxx/qla_def.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Daniel Wagner Jan. 23, 2020, 10:39 a.m. UTC | #1
On Wed, Jan 22, 2020 at 08:23:44PM -0800, Bart Van Assche wrote:
> This patch allows sparse to verify the endianness of the arguments passed
> to MAKE_HANDLE().
> 
> Cc: Quinn Tran <qutran@marvell.com>
> Cc: Martin Wilck <mwilck@suse.com>
> Cc: Daniel Wagner <dwagner@suse.de>
> Cc: Roman Bolshakov <r.bolshakov@yadro.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  drivers/scsi/qla2xxx/qla_def.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
> index b04d334933ef..968f19995063 100644
> --- a/drivers/scsi/qla2xxx/qla_def.h
> +++ b/drivers/scsi/qla2xxx/qla_def.h
> @@ -119,7 +119,10 @@ typedef struct {
>  #define LSD(x)	((uint32_t)((uint64_t)(x)))
>  #define MSD(x)	((uint32_t)((((uint64_t)(x)) >> 16) >> 16))
>  
> -#define MAKE_HANDLE(x, y) ((uint32_t)((((uint32_t)(x)) << 16) | (uint32_t)(y)))
> +static inline uint32_t MAKE_HANDLE(uint16_t x, uint16_t y)
> +{
> +	return ((uint32_t)x << 16) | y;
> +}

s/MAKE_HANDLE/make_handle/ ?
Bart Van Assche Jan. 24, 2020, 3:13 a.m. UTC | #2
On 2020-01-23 02:39, Daniel Wagner wrote:
> s/MAKE_HANDLE/make_handle/ ?

That will make the function name conformant with the coding style. I
will look into this.

Bart.
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index b04d334933ef..968f19995063 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -119,7 +119,10 @@  typedef struct {
 #define LSD(x)	((uint32_t)((uint64_t)(x)))
 #define MSD(x)	((uint32_t)((((uint64_t)(x)) >> 16) >> 16))
 
-#define MAKE_HANDLE(x, y) ((uint32_t)((((uint32_t)(x)) << 16) | (uint32_t)(y)))
+static inline uint32_t MAKE_HANDLE(uint16_t x, uint16_t y)
+{
+	return ((uint32_t)x << 16) | y;
+}
 
 /*
  * I/O register