Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH v4 1/1] nvme: Add support for FW activation without reset
Date: Fri, 7 Jul 2017 16:22:45 +0200	[thread overview]
Message-ID: <20170707142245.GA10818@lst.de> (raw)
In-Reply-To: <1499427767-15891-1-git-send-email-a.dawn@samsung.com>

Hi Arnav,

this looks mostly good to me, but a few style nitpicks below:

> +static int nvme_get_fw_slot_info(struct nvme_ctrl *dev,
> +				struct nvme_fw_slot_info_log *log)
> +{
> +	struct nvme_command c = { };
> +
> +	c.common.opcode = nvme_admin_get_log_page;
> +	c.common.nsid = cpu_to_le32(0xFFFFFFFF);
> +	c.common.cdw10[0] = cpu_to_le32(
> +		(((sizeof(struct nvme_fw_slot_info_log) / 4) - 1) << 16)
> +		| NVME_LOG_FW_SLOT);

In Linux we always try to place the operations at the end of previous
line, e.g. in this case:

	(((sizeof(struct nvme_fw_slot_info_log) / 4) - 1) << 16) |
		NVME_LOG_FW_SLOT);

Thay being said I think a little helper for this calculation would
be even better, e.g.:

static __le32 nvme_get_log_dw10(u8 lid, size_t len)
{
	return cpu_to_le32(lid | ((size / 4) - 1) << 16);
}

...

	c.common.cdw10[0] = nvme_get_log_dw10(NVME_LOG_FW_SLOT, sizeof(*log));


> +	/* read FW slot informationi to clear the AER*/
> +	log = kmalloc(sizeof(struct nvme_fw_slot_info_log), GFP_KERNEL);
> +	if (!log)
> +		return;
> +
> +	if (nvme_get_fw_slot_info(ctrl, log))
> +		dev_warn(ctrl->device,
> +				"Get FW SLOT INFO log error\n");
> +	kfree(log);

Please move the allocation and freeing of log into nvme_get_fw_slot_info.
Maybe the warning as well.

> +static inline bool nvme_ctrl_pp_status(struct nvme_ctrl *ctrl)

I don't think this should be inline, as it's not performane critical,
please move it to core.c.

> +	if (ctrl->ops->reg_read32(ctrl, NVME_REG_CC,
> +				&ctrl->ctrl_config))

	if (ctrl->ops->reg_read32(ctrl, NVME_REG_CC, &ctrl->ctrl_config))

> +	return  ((ctrl->ctrl_config & NVME_CC_ENABLE)
> +			&& (csts & NVME_CSTS_PP));

	return ((ctrl->ctrl_config & NVME_CC_ENABLE) && (csts & NVME_CSTS_PP));

  reply	other threads:[~2017-07-07 14:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170707114112epcas1p293dc44953b942eab9d24fcba69d0fb33@epcas1p2.samsung.com>
     [not found] ` <1497078304-5440-1-git-send-email-a.dawn@samsung.com>
2017-07-07 11:41   ` [PATCH v4 0/1]Add Support for FW activation without reset Arnav Dawn
2017-07-07 11:42     ` [PATCH v4 1/1] nvme: Add support " Arnav Dawn
2017-07-07 14:22       ` Christoph Hellwig [this message]
2017-07-07 15:19       ` Keith Busch
2017-07-11 13:44     ` [PATCH v5 0/1] Add Support " Arnav Dawn
2017-07-11 13:48       ` [PATCH v5 1/1] nvme: Add support " Arnav Dawn
2017-07-11 14:36         ` Keith Busch
2017-07-12  7:34         ` Christoph Hellwig
2017-07-12 10:32           ` Sagi Grimberg
2017-07-12 10:44             ` Arnav Dawn
2017-07-12 10:39       ` [PATCH v5 0/2] Add Support " Arnav Dawn
2017-07-12 10:44         ` Sagi Grimberg
2017-07-12 10:40       ` [PATCH v5 1/2] nvme: Add support " Arnav Dawn
2017-07-12 10:41       ` [PATCH v5 2/2] nvme: Define NVME_NSID_ALL Arnav Dawn

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=20170707142245.GA10818@lst.de \
    --to=hch@lst.de \
    /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