Re: [PATCH v2 04/14] qla2xxx: Use IOCB interface to submit non-critical MBX.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2017-02-03 at 14:40 -0800, Himanshu Madhani wrote:
> diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
> index db6bd92..4225256 100644
> --- a/drivers/scsi/qla2xxx/qla_mbx.c
> +++ b/drivers/scsi/qla2xxx/qla_mbx.c
> @@ -10,6 +10,29 @@
>  #include <linux/delay.h>
>  #include <linux/gfp.h>
>  
> +static struct mb_cmd_name {
> +	uint16_t cmd;
> +	char *str;
> +} mb_str[] = {
> +	{0xffff,		"unknown"},
> +	{MBC_GET_PORT_DATABASE,	"GPDB"},
> +	{MBC_GET_ID_LIST,	"GIDList"},
> +	{MBC_GET_LINK_PRIV_STATS, "Stats"},
> +};
> +
> +static char *mb_to_str(uint16_t cmd)
> +{
> +	int i;
> +	struct mb_cmd_name *e;
> +
> +	for (i = 0; i < ARRAY_SIZE(mb_str); i++) {
> +		e = mb_str + i;
> +		if (cmd == e->cmd)
> +			return e->str;
> +	}
> +	return mb_str[0].str; /* unknown */
> +}

Please use const char * instead of char * in the struct definition and for
the mb_to_str() function return type. Please also leave out the element with
index 0xffff from the mb_str[] array and make mb_to_str() return "unknown"
instead of mb_str[0].str if lookup fails.

Bart.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux