From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH v2 2/2] nvme: Enable autonomous power state transitions
Date: Fri, 20 Jan 2017 11:30:30 +0100 [thread overview]
Message-ID: <20170120103030.GB23149@lst.de> (raw)
In-Reply-To: <9b150934a9d756f69ca241199af512925a4050ec.1484855622.git.luto@kernel.org>
> +static void nvme_set_latency_tolerance(struct device *dev, s32 val)
> +{
> + struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
> +
> + u64 latency;
> +
> + if (val == PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT ||
> + val == PM_QOS_LATENCY_ANY)
> + latency = U64_MAX;
> + else
> + latency = val;
In addition to the latency vs val mixup pointed out earlier -
can you use a switch statement here to make the code a little
more obvious?
> + if (ctrl->ps_max_latency_us != val) {
> + ctrl->ps_max_latency_us = val;
> + nvme_configure_apst(ctrl);
> + }
> +}
> +
> ctrl->identified = true;
The ->identified field seems to never be checked anywhere.
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 7103bce4ba4f..1c3e170da6de 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -1791,6 +1791,8 @@ static void nvme_reset_work(struct work_struct *work)
> if (result)
> goto out;
>
> + nvme_configure_apst(&dev->ctrl);
> +
> /*
> * A controller that can not execute IO typically requires user
> * intervention to correct. For such degraded controllers, the driver
> diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
> index 557f29b1f1bb..a64b5db96fd8 100644
> --- a/drivers/nvme/host/rdma.c
> +++ b/drivers/nvme/host/rdma.c
> @@ -1629,6 +1629,8 @@ static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl)
>
> nvme_start_keep_alive(&ctrl->ctrl);
>
> + nvme_configure_apst(&ctrl->ctrl);
> +
Is there a specific reason for the exact placement of these calls here
and not at inside nvme_init_identify? Having all the code called
from an existing core function would make things a lot easier in the
future. And if that's not possible we'll probably need comments
on why it's placed like it is.
next prev parent reply other threads:[~2017-01-20 10:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-19 19:55 [PATCH v2 0/2] nvme: APST support Andy Lutomirski
2017-01-19 19:55 ` [PATCH v2 1/2] nvme: Add a quirk mechanism that uses identify_ctrl Andy Lutomirski
2017-01-20 10:24 ` Christoph Hellwig
2017-01-19 19:55 ` [PATCH v2 2/2] nvme: Enable autonomous power state transitions Andy Lutomirski
2017-01-19 20:15 ` Keith Busch
2017-01-20 5:17 ` Andy Lutomirski
2017-01-20 10:30 ` Christoph Hellwig [this message]
2017-01-20 18:07 ` Andy Lutomirski
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=20170120103030.GB23149@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