linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Derrick <jonathan.derrick@intel.com>
To: helgaas@kernel.org
Cc: Jon Derrick <jonathan.derrick@intel.com>,
	keith.busch@intel.com, linux-pci@vger.kernel.org
Subject: [PATCH 1/2] vmd: allocate irq lists with correct msix count
Date: Mon, 29 Aug 2016 11:19:01 -0600	[thread overview]
Message-ID: <1472491142-13783-1-git-send-email-jonathan.derrick@intel.com> (raw)

To reduce the amount of memory required for irq lists, only allocate
their space after calling pci_msix_enable_range which may reduce the
number of msix vectors allocated.

Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
---
 arch/x86/pci/vmd.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/pci/vmd.c b/arch/x86/pci/vmd.c
index 8d6bb8a..514b446 100644
--- a/arch/x86/pci/vmd.c
+++ b/arch/x86/pci/vmd.c
@@ -679,11 +679,6 @@ static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	if (vmd->msix_count < 0)
 		return -ENODEV;
 
-	vmd->irqs = devm_kcalloc(&dev->dev, vmd->msix_count, sizeof(*vmd->irqs),
-				 GFP_KERNEL);
-	if (!vmd->irqs)
-		return -ENOMEM;
-
 	vmd->msix_entries = devm_kcalloc(&dev->dev, vmd->msix_count,
 					 sizeof(*vmd->msix_entries),
 					 GFP_KERNEL);
@@ -697,6 +692,11 @@ static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	if (vmd->msix_count < 0)
 		return vmd->msix_count;
 
+	vmd->irqs = devm_kcalloc(&dev->dev, vmd->msix_count, sizeof(*vmd->irqs),
+				 GFP_KERNEL);
+	if (!vmd->irqs)
+		return -ENOMEM;
+
 	for (i = 0; i < vmd->msix_count; i++) {
 		INIT_LIST_HEAD(&vmd->irqs[i].irq_list);
 		vmd->irqs[i].vmd_vector = vmd->msix_entries[i].vector;
-- 
1.8.3.1

             reply	other threads:[~2016-08-29 17:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-29 17:19 Jon Derrick [this message]
2016-08-29 17:19 ` [PATCH 2/2] vmd: convert to use pci_alloc_irq_vectors api Jon Derrick
2016-08-29 17:55   ` Keith Busch
2016-08-29 17:52 ` [PATCH 1/2] vmd: allocate irq lists with correct msix count Keith Busch
2016-09-12 22:00 ` Bjorn Helgaas

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=1472491142-13783-1-git-send-email-jonathan.derrick@intel.com \
    --to=jonathan.derrick@intel.com \
    --cc=helgaas@kernel.org \
    --cc=keith.busch@intel.com \
    --cc=linux-pci@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).