All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: dgilbert@interlog.com, James Bottomley <jbottomley@parallels.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	linux-scsi@vger.kernel.org, Robert Elliott <elliott@hp.com>
Subject: Re: [PATCH 13/38] Implement scsi_opcode_sa_name
Date: Tue, 30 Sep 2014 07:50:40 +0200	[thread overview]
Message-ID: <542A44B0.5000907@suse.de> (raw)
In-Reply-To: <5429B320.2090003@interlog.com>

On 09/29/2014 09:29 PM, Douglas Gilbert wrote:
> On 14-09-29 07:58 AM, Hannes Reinecke wrote:
>> Implement a lookup array for SERVICE ACTION commands instead
>> of hardcoding it in a large switch statement.
>>
>> Reviewed-by: Christoph Hellwig <hch@infradead.org>
>> Signed-off-by: Hannes Reinecke <hare@suse.de>
>> ---
>>   drivers/scsi/constants.c | 132
>> +++++++++++++++++++----------------------------
>>   1 file changed, 54 insertions(+), 78 deletions(-)
>>
>> diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
>> index 6e16b19..b9eb6a1 100644
>> --- a/drivers/scsi/constants.c
>> +++ b/drivers/scsi/constants.c
>> @@ -244,102 +244,77 @@ static const struct value_name_pair
>> variable_length_arr[] = {
>>   };
>>   #define VARIABLE_LENGTH_SZ ARRAY_SIZE(variable_length_arr)
>>
>> -static const char * get_sa_name(const struct value_name_pair * arr,
>> -                    int arr_sz, int service_action)
>> +struct sa_name_list {
>> +    int cmd;
>> +    const struct value_name_pair *arr;
>> +    int arr_sz;
>> +};
>> +
>> +static struct sa_name_list sa_names_arr[] = {
>> +    {VARIABLE_LENGTH_CMD, variable_length_arr, VARIABLE_LENGTH_SZ},
>> +    {MAINTENANCE_IN, maint_in_arr, MAINT_IN_SZ},
>> +    {MAINTENANCE_OUT, maint_out_arr, MAINT_OUT_SZ},
>> +    {PERSISTENT_RESERVE_IN, pr_in_arr, PR_IN_SZ},
>> +    {PERSISTENT_RESERVE_OUT, pr_out_arr, PR_OUT_SZ},
>> +    {SERVICE_ACTION_IN_12, serv_in12_arr, SERV_IN12_SZ},
>> +    {SERVICE_ACTION_OUT_12, serv_out12_arr, SERV_OUT12_SZ},
>> +    {SERVICE_ACTION_BIDIRECTIONAL, serv_bidi_arr, SERV_BIDI_SZ},
>> +    {SERVICE_ACTION_IN_16, serv_in16_arr, SERV_IN16_SZ},
>> +    {SERVICE_ACTION_OUT_16, serv_out16_arr, SERV_OUT16_SZ},
>> +    {THIRD_PARTY_COPY_IN, tpc_in_arr, TPC_IN_SZ},
>> +    {THIRD_PARTY_COPY_OUT, tpc_out_arr, TPC_OUT_SZ},
>> +    {0, NULL, 0},
>> +};
>> +#define SA_NAME_LIST_SZ ARRAY_SIZE(sa_names_arr)
>
> Since you placed a terminating element on sa_names_arr[] then
> you don't need the SA_NAME_LIST_SZ define any more.
>
> The for loop can become:
>    for (sa_name_ptr = sa_names_arr; sa_name_ptr->arr; ++sa_name_ptr) {
> ...
>
Good point. Will be including this for the next round.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2014-09-30  5:50 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-29 11:58 [PATCHv3 00/38] scsi logging update Hannes Reinecke
2014-09-29 11:58 ` [PATCH 01/38] Remove scsi_cmd_print_sense_hdr() Hannes Reinecke
2014-09-29 11:58 ` [PATCH 02/38] sd: Remove scsi_print_sense() in sd_done() Hannes Reinecke
2014-09-29 11:58 ` [PATCH 03/38] aha152x: Debug output update and whitespace cleanup Hannes Reinecke
2014-09-29 11:58 ` [PATCH 04/38] scsi: introduce sdev_prefix_printk() Hannes Reinecke
2014-09-29 11:58 ` [PATCH 05/38] scsi: Use sdev as argument for sense code printing Hannes Reinecke
2014-09-29 11:58 ` [PATCH 06/38] acornscsi: use scsi_print_command() Hannes Reinecke
2014-09-29 11:58 ` [PATCH 07/38] fas216: Update logging messages Hannes Reinecke
2014-09-29 11:58 ` [PATCH 08/38] 53c700: remove scsi_print_sense() usage Hannes Reinecke
2014-09-29 11:58 ` [PATCH 09/38] scsi: stop decoding if scsi_normalize_sense() fails Hannes Reinecke
2014-09-29 11:58 ` [PATCH 10/38] scsi: do not decode sense extras Hannes Reinecke
2014-09-29 11:58 ` [PATCH 11/38] scsi: use 'bool' as return value for scsi_normalize_sense() Hannes Reinecke
2014-09-29 11:58 ` [PATCH 12/38] scsi: remove scsi_print_status() Hannes Reinecke
2014-09-29 11:58 ` [PATCH 13/38] Implement scsi_opcode_sa_name Hannes Reinecke
2014-09-29 19:29   ` Douglas Gilbert
2014-09-30  5:50     ` Hannes Reinecke [this message]
2014-09-29 11:58 ` [PATCH 14/38] scsi: merge print_opcode_name() Hannes Reinecke
2014-09-29 11:58 ` [PATCH 15/38] scsi: consolidate opcode lookup in scsi_opcode_sa_name() Hannes Reinecke
2014-09-29 11:58 ` [PATCH 16/38] scsi: remove last argument from print_opcode_name() Hannes Reinecke
2014-09-29 11:58 ` [PATCH 17/38] scsi: Remove scsi_print_command when calling abort Hannes Reinecke
2014-09-29 11:58 ` [PATCH 18/38] scsi: separate out scsi_(host|driver)byte_string() Hannes Reinecke
2014-09-29 11:58 ` [PATCH 19/38] sd: Cleanup logging Hannes Reinecke
2014-09-29 11:58 ` [PATCH 20/38] scsi: simplify scsi_log_(send|completion) Hannes Reinecke
2014-09-29 11:58 ` [PATCH 21/38] scsi: fixup logging messages in scsi_error.c Hannes Reinecke
2014-09-29 11:58 ` [PATCH 22/38] scsi: use shost argument in scsi_eh_prt_fail_stats Hannes Reinecke
2014-09-29 11:58 ` [PATCH 23/38] scsi_trace: add tracepoint for completion Hannes Reinecke
2014-09-29 11:58 ` [PATCH 24/38] tracing: Add trace_seq_buffer_ptr() helper function Hannes Reinecke
2014-09-29 11:58 ` [PATCH 25/38] tracing: Create seq_buf layer in trace_seq Hannes Reinecke
2014-09-29 11:58 ` [PATCH 26/38] seq_buf: Move the seq_buf code to lib/ Hannes Reinecke
2014-09-29 14:04   ` Steven Rostedt
2014-09-29 14:08     ` Hannes Reinecke
2014-09-29 11:58 ` [PATCH 27/38] Rearrange buffer formatting in printk() Hannes Reinecke
2014-09-30 16:16   ` Petr Mladek
2014-09-30 19:37     ` Petr Mladek
2014-09-29 11:58 ` [PATCH 28/38] Externalize string buffer for printk Hannes Reinecke
2014-09-30 16:39   ` Petr Mladek
2014-09-30 18:52     ` Hannes Reinecke
2014-09-29 11:58 ` [PATCH 29/38] Introduce dev_printk_string() and dev_printk_header() Hannes Reinecke
2014-09-29 16:58   ` Greg Kroah-Hartman
2014-09-30  5:48     ` Hannes Reinecke
2014-09-29 11:58 ` [PATCH 30/38] scsi: Use real functions for logging Hannes Reinecke
2014-09-29 11:59 ` [PATCH 31/38] scsi: log request tag for scmd_printk() Hannes Reinecke
2014-09-29 11:59 ` [PATCH 32/38] scsi: use external buffer for command logging Hannes Reinecke
2014-09-29 11:59 ` [PATCH 33/38] libata: use __scsi_print_command() Hannes Reinecke
2014-09-29 14:06   ` Tejun Heo
2014-09-29 14:10     ` Hannes Reinecke
2014-09-29 14:11       ` Tejun Heo
2014-09-29 11:59 ` [PATCH 34/38] scsi: Remove command pointer argument from logging messages Hannes Reinecke
2014-09-29 11:59 ` [PATCH 35/38] scsi: use seq_buf for formatting sense buffer Hannes Reinecke
2014-09-29 11:59 ` [PATCH 36/38] scsi: use seq_buf for formatting scsi_print_result() Hannes Reinecke
2014-09-29 11:59 ` [PATCH 37/38] scsi: Conditionally compile in constants.c Hannes Reinecke
2014-09-29 11:59 ` [PATCH 38/38] scsi_error: document scsi_try_to_abort_cmd Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=542A44B0.5000907@suse.de \
    --to=hare@suse.de \
    --cc=dgilbert@interlog.com \
    --cc=elliott@hp.com \
    --cc=hch@infradead.org \
    --cc=jbottomley@parallels.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.