All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
Subject: [PATCH 3/5] ACPI: pci_root: use driver data rather than list lookup
Date: Thu, 18 Jun 2009 14:46:57 -0600	[thread overview]
Message-ID: <20090618204657.15850.22025.stgit@bob.kio> (raw)
In-Reply-To: <20090618203916.15850.7977.stgit@bob.kio>

There's no need to search the list to find the acpi_pci_root
structure.  We saved it as device->driver_data when we added
the device.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
---
 drivers/acpi/pci_root.c |   21 ++++-----------------
 1 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index c780008..e490a2e 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -599,30 +599,17 @@ end:
 
 static int acpi_pci_root_start(struct acpi_device *device)
 {
-	struct acpi_pci_root *root;
-
+	struct acpi_pci_root *root = acpi_driver_data(device);
 
-	list_for_each_entry(root, &acpi_pci_roots, node) {
-		if (root->device == device) {
-			pci_bus_add_devices(root->bus);
-			return 0;
-		}
-	}
-	return -ENODEV;
+	pci_bus_add_devices(root->bus);
+	return 0;
 }
 
 static int acpi_pci_root_remove(struct acpi_device *device, int type)
 {
-	struct acpi_pci_root *root = NULL;
-
-
-	if (!device || !acpi_driver_data(device))
-		return -EINVAL;
-
-	root = acpi_driver_data(device);
+	struct acpi_pci_root *root = acpi_driver_data(device);
 
 	kfree(root);
-
 	return 0;
 }
 


  parent reply	other threads:[~2009-06-18 20:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-18 20:46 [PATCH 0/5] PCI root bridge: get bus info from _CRS Bjorn Helgaas
2009-06-18 20:46 ` [PATCH 1/5] ACPI: pci_root: check _CRS, then _BBN for downstream bus number Bjorn Helgaas
2009-06-19  3:35   ` Kenji Kaneshige
2009-06-18 20:46 ` [PATCH 2/5] ACPI: pci_root: simplify acpi_pci_root_add() control flow Bjorn Helgaas
2009-06-18 20:46 ` Bjorn Helgaas [this message]
2009-06-18 20:47 ` [PATCH 4/5] ACPI: pci_root: simplify list traversals Bjorn Helgaas
2009-06-18 20:47 ` [PATCH 5/5] ACPI: pci_root: remove unused dev/fn information Bjorn Helgaas
2009-06-20  4:10 ` [PATCH 0/5] PCI root bridge: get bus info from _CRS Len Brown

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=20090618204657.15850.22025.stgit@bob.kio \
    --to=bjorn.helgaas@hp.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@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 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.