From: Klaus Jensen <its@irrelevant.dk>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, Keith Busch <kbusch@kernel.org>,
Klaus Jensen <its@irrelevant.dk>,
Klaus Jensen <k.jensen@samsung.com>
Subject: [PATCH 02/12] hw/nvme: remove redundant passing of PCIDevice
Date: Thu, 23 Jun 2022 23:18:11 +0200 [thread overview]
Message-ID: <20220623211821.50534-3-its@irrelevant.dk> (raw)
In-Reply-To: <20220623211821.50534-1-its@irrelevant.dk>
From: Klaus Jensen <k.jensen@samsung.com>
The NvmeCtrl is a PCIDevice, so remove the redundant passing of the
PCIDevice parameter.
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
---
hw/nvme/ctrl.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index c8c4a0718fc4..b688afccbe5a 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -7007,8 +7007,9 @@ static void nvme_init_state(NvmeCtrl *n)
}
}
-static void nvme_init_cmb(NvmeCtrl *n, PCIDevice *pci_dev)
+static void nvme_init_cmb(NvmeCtrl *n)
{
+ PCIDevice *pci_dev = PCI_DEVICE(n);
uint64_t cmb_size = n->params.cmb_size_mb * MiB;
uint64_t cap = ldq_le_p(&n->bar.cap);
@@ -7029,8 +7030,9 @@ static void nvme_init_cmb(NvmeCtrl *n, PCIDevice *pci_dev)
}
}
-static void nvme_init_pmr(NvmeCtrl *n, PCIDevice *pci_dev)
+static void nvme_init_pmr(NvmeCtrl *n)
{
+ PCIDevice *pci_dev = PCI_DEVICE(n);
uint32_t pmrcap = ldl_le_p(&n->bar.pmrcap);
NVME_PMRCAP_SET_RDS(pmrcap, 1);
@@ -7116,8 +7118,9 @@ static int nvme_add_pm_capability(PCIDevice *pci_dev, uint8_t offset)
return 0;
}
-static int nvme_init_pci(NvmeCtrl *n, PCIDevice *pci_dev, Error **errp)
+static int nvme_init_pci(NvmeCtrl *n, Error **errp)
{
+ PCIDevice *pci_dev = PCI_DEVICE(n);
uint8_t *pci_conf = pci_dev->config;
uint64_t bar_size;
unsigned msix_table_offset, msix_pba_offset;
@@ -7174,11 +7177,11 @@ static int nvme_init_pci(NvmeCtrl *n, PCIDevice *pci_dev, Error **errp)
nvme_update_msixcap_ts(pci_dev, n->conf_msix_qsize);
if (n->params.cmb_size_mb) {
- nvme_init_cmb(n, pci_dev);
+ nvme_init_cmb(n);
}
if (n->pmr.dev) {
- nvme_init_pmr(n, pci_dev);
+ nvme_init_pmr(n);
}
if (!pci_is_vf(pci_dev) && n->params.sriov_max_vfs) {
@@ -7201,8 +7204,9 @@ static void nvme_init_subnqn(NvmeCtrl *n)
}
}
-static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice *pci_dev)
+static void nvme_init_ctrl(NvmeCtrl *n)
{
+ PCIDevice *pci_dev = PCI_DEVICE(n);
NvmeIdCtrl *id = &n->id_ctrl;
uint8_t *pci_conf = pci_dev->config;
uint64_t cap = ldq_le_p(&n->bar.cap);
@@ -7360,10 +7364,11 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp)
return;
}
nvme_init_state(n);
- if (nvme_init_pci(n, pci_dev, errp)) {
+ if (nvme_init_pci(n, errp)) {
return;
}
- nvme_init_ctrl(n, pci_dev);
+
+ nvme_init_ctrl(n);
/* setup a namespace if the controller drive property was given */
if (n->namespace.blkconf.blk) {
--
2.36.1
next prev parent reply other threads:[~2022-06-23 21:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-23 21:18 [PATCH 00/12] hw/nvme: misc fixes and updates Klaus Jensen
2022-06-23 21:18 ` [PATCH 01/12] hw/nvme: fix incorrect use of errp/local_err Klaus Jensen
2022-06-23 21:18 ` Klaus Jensen [this message]
2022-06-23 21:18 ` [PATCH 03/12] hw/nvme: cleanup error reporting in nvme_init_pci() Klaus Jensen
2022-06-23 21:18 ` [PATCH 04/12] hw/nvme: fix numzrwa handling Klaus Jensen
2022-06-23 21:18 ` [PATCH 05/12] hw/nvme: fix accidental reintroduction of redundant code Klaus Jensen
2022-06-23 21:18 ` [PATCH 06/12] hw/nvme: fix cancellation of format operations Klaus Jensen
2022-06-23 21:18 ` [PATCH 07/12] hw/nvme: fix flush cancel Klaus Jensen
2022-06-23 21:18 ` [PATCH 08/12] hw/nvme: rework flush bh scheduling Klaus Jensen
2022-06-23 21:18 ` [PATCH 09/12] hw/nvme: improve cancellation handling in zone reset Klaus Jensen
2022-06-23 21:18 ` [PATCH 10/12] hw/nvme: improve cancellation handling in dsm Klaus Jensen
2022-06-23 21:18 ` [PATCH 11/12] hw/nvme: simplify copy command error handling Klaus Jensen
2022-06-23 21:18 ` [PATCH 12/12] hw/nvme: align logic of format with flush Klaus Jensen
2022-07-14 5:37 ` [PATCH 00/12] hw/nvme: misc fixes and updates Klaus Jensen
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=20220623211821.50534-3-its@irrelevant.dk \
--to=its@irrelevant.dk \
--cc=k.jensen@samsung.com \
--cc=kbusch@kernel.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.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.