All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <Bart.VanAssche@sandisk.com>
To: "mauricfo@linux.vnet.ibm.com" <mauricfo@linux.vnet.ibm.com>,
	"hare@suse.de" <hare@suse.de>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH 2/4] scsi: scsi_dh_alua: create alua_rtpg_print() for alua_rtpg() sdev_printk
Date: Thu, 13 Apr 2017 21:18:47 +0000	[thread overview]
Message-ID: <1492118326.24345.22.camel@sandisk.com> (raw)
In-Reply-To: <1491873481-23900-3-git-send-email-mauricfo@linux.vnet.ibm.com>

On Mon, 2017-04-10 at 22:17 -0300, Mauricio Faria de Oliveira wrote:
>  /*
> + * alua_rtpg_print - Print REPORT TARGET GROUP STATES information
> + * @sdev: the device evaluated (or associated with this port group).
> + * @pg: the port group the information is associated with.
> + * @valid_states: pointer to valid_states value.
> + *                (optional; e.g., obtained via another port group)
> + *
> + * Must be called with pg->lock held.
> + */

Please use lockdep_assert_held() instead of documenting locking conventions as
comments. lockdep_assert_held() is verified at runtime with CONFIG_PROVE_LOCKING=y
but comments not.

> +static void alua_rtpg_print(struct scsi_device *sdev, struct alua_port_group *pg,
> +			    int *valid_states)
> +{
> +	if (valid_states)
> +		sdev_printk(KERN_INFO, sdev,
> +		    "%s: port group %02x state %c %s supports %c%c%c%c%c%c%c\n",
> +		    ALUA_DH_NAME, pg->group_id, print_alua_state(pg->state),
> +		    pg->pref ? "preferred" : "non-preferred",
> +		    (*valid_states) & TPGS_SUPPORT_TRANSITION ? 'T' : 't',
> +		    (*valid_states) & TPGS_SUPPORT_OFFLINE ? 'O' : 'o',
> +		    (*valid_states) & TPGS_SUPPORT_LBA_DEPENDENT ? 'L' : 'l',
> +		    (*valid_states) & TPGS_SUPPORT_UNAVAILABLE ? 'U' : 'u',
> +		    (*valid_states) & TPGS_SUPPORT_STANDBY ? 'S' : 's',
> +		    (*valid_states) & TPGS_SUPPORT_NONOPTIMIZED ? 'N' : 'n',
> +		    (*valid_states) & TPGS_SUPPORT_OPTIMIZED  ?  'A' : 'a');
> +	else
> +		sdev_printk(KERN_INFO, sdev,
> +		    "%s: port group %02x state %c %s\n",
> +		    ALUA_DH_NAME, pg->group_id, print_alua_state(pg->state),
> +		    pg->pref ? "preferred" : "non-preferred");
> +}

Please define two functions - one for valid_states != NULL and one for valid_states
== NULL such that valid_states can be passed by value instead of by reference.

Thanks,

Bart.

  reply	other threads:[~2017-04-13 21:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-11  1:17 [PATCH 0/4] scsi: scsi_dh_alua: handle target port unavailable state Mauricio Faria de Oliveira
2017-04-11  1:17 ` [PATCH 1/4] scsi: scsi_dh_alua: allow I/O in the " Mauricio Faria de Oliveira
2017-04-13 21:14   ` Bart Van Assche
2017-04-11  1:17 ` [PATCH 2/4] scsi: scsi_dh_alua: create alua_rtpg_print() for alua_rtpg() sdev_printk Mauricio Faria de Oliveira
2017-04-13 21:18   ` Bart Van Assche [this message]
2017-04-11  1:18 ` [PATCH 3/4] scsi: scsi_dh_alua: print changes to RTPG state of other PGs too Mauricio Faria de Oliveira
2017-04-13 21:35   ` Bart Van Assche
2017-04-11  1:18 ` [PATCH 4/4] scsi: scsi_dh_alua: do not print target port group state if it remains unavailable Mauricio Faria de Oliveira
2017-04-13 21:40   ` Bart Van Assche
2017-04-11  1:21 ` [PATCH 0/4] scsi: scsi_dh_alua: handle target port unavailable state Mauricio Faria de Oliveira

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=1492118326.24345.22.camel@sandisk.com \
    --to=bart.vanassche@sandisk.com \
    --cc=hare@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mauricfo@linux.vnet.ibm.com \
    /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.