From: Bart Van Assche <Bart.VanAssche@sandisk.com>
To: "chad.dupuis@cavium.com" <chad.dupuis@cavium.com>,
"martin.petersen@oracle.com" <martin.petersen@oracle.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"james.bottomley@hansenpartnership.com"
<james.bottomley@hansenpartnership.com>,
"QLogic-Storage-Upstream@cavium.com"
<QLogic-Storage-Upstream@cavium.com>
Subject: Re: [PATCH 06/15] qedf: Add fka_period SCSI host attribute to show fip keep alive period.
Date: Wed, 24 May 2017 16:34:58 +0000 [thread overview]
Message-ID: <1495643697.2823.21.camel@sandisk.com> (raw)
In-Reply-To: <20170523131931.1777-7-chad.dupuis@cavium.com>
On Tue, 2017-05-23 at 06:19 -0700, Dupuis, Chad wrote:
> Expose this information for interested applications.
>
> Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
> ---
> drivers/scsi/qedf/qedf_attr.c | 60 +++++++++++++++++++++++++++++--------------
> 1 file changed, 41 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/scsi/qedf/qedf_attr.c b/drivers/scsi/qedf/qedf_attr.c
> index 1349f8a..68e2b77 100644
> --- a/drivers/scsi/qedf/qedf_attr.c
> +++ b/drivers/scsi/qedf/qedf_attr.c
> @@ -8,6 +8,25 @@
> */
> #include "qedf.h"
>
> +inline bool qedf_is_vport(struct qedf_ctx *qedf)
> +{
> + return (!(qedf->lport->vport == NULL));
> +}
Have you considered to write the return statement as follows?
return qedf->lport->vport != NULL;
Checkpatch should have recommended not to use parentheses in the return
statement.
> +
> +/* Get base qedf for physical port from vport */
> +static struct qedf_ctx *qedf_get_base_qedf(struct qedf_ctx *qedf)
> +{
> + struct fc_lport *lport;
> + struct fc_lport *base_lport;
> +
> + if (!(qedf_is_vport(qedf)))
> + return NULL;
> +
> + lport = qedf->lport;
> + base_lport = shost_priv(vport_to_shost(lport->vport));
> + return (struct qedf_ctx *)(lport_priv(base_lport));
> +}
lport_priv() returns a void pointer so the cast in the return statement is not
necessary.
> +static ssize_t
> +qedf_fka_period_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct fc_lport *lport = shost_priv(class_to_shost(dev));
> + struct qedf_ctx *qedf = lport_priv(lport);
> + int fka_period = -1;
> +
> + if (qedf_is_vport(qedf))
> + qedf = qedf_get_base_qedf(qedf);
> +
> + if (!qedf->ctlr.sel_fcf)
> + goto out;
> +
> + fka_period = qedf->ctlr.sel_fcf->fka_period;
> +
> +out:
> + return scnprintf(buf, PAGE_SIZE, "%d\n", fka_period);
> +}
Do we really need a goto statement to skip a single statement? How about the
following:
if (qedf->ctlr.sel_fcf)
fka_period = qedf->ctlr.sel_fcf->fka_period;
return scnprintf(buf, PAGE_SIZE, "%d\n", fka_period);
or this:
return scnprintf(buf, PAGE_SIZE, "%d\n", qedf->ctlr.sel_fcf ?
qedf->ctlr.sel_fcf->fka_period : -1);
Bart.
next prev parent reply other threads:[~2017-05-24 16:35 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-23 13:19 [PATCH 00/15] qedf: Update driver to version 8.18.22.0 Dupuis, Chad
2017-05-23 13:19 ` [PATCH 01/15] qedf: Enable basic FDMI information Dupuis, Chad
2017-05-24 16:16 ` Bart Van Assche
2017-05-23 13:19 ` [PATCH 02/15] qedf: Update copyright to 2017 Dupuis, Chad
2017-05-23 13:19 ` [PATCH 03/15] qedf: Honor qed_ops->common->set_fp_int() return code Dupuis, Chad
2017-05-24 16:22 ` Bart Van Assche
2017-05-23 13:19 ` [PATCH 04/15] qedf: Look at all descriptors when processing a clear virtual link Dupuis, Chad
2017-05-24 16:24 ` Bart Van Assche
2017-05-23 13:19 ` [PATCH 05/15] qedf: Check that fcport is offloaded before dereferencing pointers in initiate_abts|cleanup Dupuis, Chad
2017-05-24 16:25 ` Bart Van Assche
2017-05-23 13:19 ` [PATCH 06/15] qedf: Add fka_period SCSI host attribute to show fip keep alive period Dupuis, Chad
2017-05-24 16:34 ` Bart Van Assche [this message]
2017-05-23 13:19 ` [PATCH 07/15] qedf: Set qed logging level to QED_LEVEL_NOTICE Dupuis, Chad
2017-05-24 16:35 ` Bart Van Assche
2017-05-23 13:19 ` [PATCH 08/15] qedf: Use same logic for SCSI host reset and FC lip_reset Dupuis, Chad
2017-05-24 16:36 ` Bart Van Assche
2017-05-23 13:19 ` [PATCH 09/15] qedf: Add bus_reset No-op Dupuis, Chad
2017-05-24 16:37 ` Bart Van Assche
2017-05-23 13:19 ` [PATCH 10/15] qedf: Add non-offload receive filters Dupuis, Chad
2017-05-24 16:39 ` Bart Van Assche
2017-05-23 13:19 ` [PATCH 11/15] qedf: Fixup unnecessary paratheses around test_bit operations Dupuis, Chad
2017-05-24 16:41 ` Bart Van Assche
2017-05-23 13:19 ` [PATCH 12/15] qedf: Move some prints to a debug level so they do not print when no debugging is enabled Dupuis, Chad
2017-05-24 16:43 ` Bart Van Assche
2017-05-23 13:19 ` [PATCH 13/15] qedf: Change cmd_per_lun in scsi_host_template to 32 to increase performance Dupuis, Chad
2017-05-24 16:43 ` Bart Van Assche
2017-05-23 13:19 ` [PATCH 14/15] qedf: Add change_queue_depth member to scsi_host_template() Dupuis, Chad
2017-05-24 16:44 ` Bart Van Assche
2017-05-23 13:19 ` [PATCH 15/15] qedf: Update version number to 8.18.22.0 Dupuis, Chad
2017-05-24 16:51 ` Bart Van Assche
2017-05-24 2:35 ` [PATCH 00/15] qedf: Update driver to version 8.18.22.0 Martin K. Petersen
2017-05-24 19:12 ` Martin K. Petersen
2017-05-24 19:14 ` Chad Dupuis
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=1495643697.2823.21.camel@sandisk.com \
--to=bart.vanassche@sandisk.com \
--cc=QLogic-Storage-Upstream@cavium.com \
--cc=chad.dupuis@cavium.com \
--cc=james.bottomley@hansenpartnership.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox