linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 07/29] PCI, ACPI: add acpi_bus_type for host bridge
       [not found] <1348561590-28067-1-git-send-email-yinghai@kernel.org>
@ 2012-09-25  8:26 ` Yinghai Lu
  2012-09-25  8:26 ` [PATCH 08/29] PCI, ACPI: Remove acpi_find_bridge_device for acpi_bus_type Yinghai Lu
  2012-09-25  8:26 ` [PATCH 11/29] PCI, ACPI: remove find_bridge in acpi_bus_type Yinghai Lu
  2 siblings, 0 replies; 3+ messages in thread
From: Yinghai Lu @ 2012-09-25  8:26 UTC (permalink / raw)
  To: Bjorn Helgaas, Len Brown; +Cc: linux-pci, Yinghai Lu, linux-acpi

Instead of abusing of acp_bus_type for pci device and checking device
name tricks

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
---
 drivers/acpi/glue.c    |    4 ++--
 drivers/pci/pci-acpi.c |   13 +++++++++++--
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index 243ee85..3079634 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -210,8 +210,8 @@ static int acpi_platform_notify(struct device *dev)
 	acpi_handle handle;
 	int ret = -EINVAL;
 
-	if (!dev->bus || !dev->parent) {
-		/* bridge devices genernally haven't bus or parent */
+	if (!dev->bus) {
+		/* bridge devices genernally haven't bus */
 		ret = acpi_find_bridge_device(dev, &handle);
 		goto end;
 	}
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index c5792d6..a167f6d 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -360,7 +360,8 @@ static int acpi_pci_find_device(struct device *dev, acpi_handle *handle)
 	return 0;
 }
 
-static int acpi_pci_find_root_bridge(struct device *dev, acpi_handle *handle)
+static int acpi_pci_host_bridge_find_device(struct device *dev,
+						acpi_handle *handle)
 {
 	int num;
 	unsigned int seg, bus;
@@ -378,10 +379,14 @@ static int acpi_pci_find_root_bridge(struct device *dev, acpi_handle *handle)
 	return 0;
 }
 
+static struct acpi_bus_type acpi_pci_host_bridge_bus = {
+	.bus = &pci_host_bridge_bus_type,
+	.find_device = acpi_pci_host_bridge_find_device,
+};
+
 static struct acpi_bus_type acpi_pci_bus = {
 	.bus = &pci_bus_type,
 	.find_device = acpi_pci_find_device,
-	.find_bridge = acpi_pci_find_root_bridge,
 };
 
 static int __init acpi_pci_init(void)
@@ -398,6 +403,10 @@ static int __init acpi_pci_init(void)
 		pcie_no_aspm();
 	}
 
+	ret = register_acpi_bus_type(&acpi_pci_host_bridge_bus);
+	if (ret)
+		return 0;
+
 	ret = register_acpi_bus_type(&acpi_pci_bus);
 	if (ret)
 		return 0;
-- 
1.7.7

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 08/29] PCI, ACPI: Remove acpi_find_bridge_device for acpi_bus_type
       [not found] <1348561590-28067-1-git-send-email-yinghai@kernel.org>
  2012-09-25  8:26 ` [PATCH 07/29] PCI, ACPI: add acpi_bus_type for host bridge Yinghai Lu
@ 2012-09-25  8:26 ` Yinghai Lu
  2012-09-25  8:26 ` [PATCH 11/29] PCI, ACPI: remove find_bridge in acpi_bus_type Yinghai Lu
  2 siblings, 0 replies; 3+ messages in thread
From: Yinghai Lu @ 2012-09-25  8:26 UTC (permalink / raw)
  To: Bjorn Helgaas, Len Brown; +Cc: linux-pci, Yinghai Lu, linux-acpi

Now all acpi_bus_typs definitions have bus assigned, so remove not needed code.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
---
 drivers/acpi/glue.c |   20 ++------------------
 1 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index 3079634..db6b625 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -72,22 +72,6 @@ static struct acpi_bus_type *acpi_get_bus_type(struct bus_type *type)
 	return ret;
 }
 
-static int acpi_find_bridge_device(struct device *dev, acpi_handle * handle)
-{
-	struct acpi_bus_type *tmp;
-	int ret = -ENODEV;
-
-	down_read(&bus_type_sem);
-	list_for_each_entry(tmp, &bus_type_list, list) {
-		if (tmp->find_bridge && !tmp->find_bridge(dev, handle)) {
-			ret = 0;
-			break;
-		}
-	}
-	up_read(&bus_type_sem);
-	return ret;
-}
-
 /* Get device's handler per its address under its parent */
 struct acpi_find_child {
 	acpi_handle handle;
@@ -211,10 +195,10 @@ static int acpi_platform_notify(struct device *dev)
 	int ret = -EINVAL;
 
 	if (!dev->bus) {
-		/* bridge devices genernally haven't bus */
-		ret = acpi_find_bridge_device(dev, &handle);
+		DBG("No bus is set for %s\n", dev_name(dev));
 		goto end;
 	}
+
 	type = acpi_get_bus_type(dev->bus);
 	if (!type) {
 		DBG("No ACPI bus support for %s\n", dev_name(dev));
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 11/29] PCI, ACPI: remove find_bridge in acpi_bus_type
       [not found] <1348561590-28067-1-git-send-email-yinghai@kernel.org>
  2012-09-25  8:26 ` [PATCH 07/29] PCI, ACPI: add acpi_bus_type for host bridge Yinghai Lu
  2012-09-25  8:26 ` [PATCH 08/29] PCI, ACPI: Remove acpi_find_bridge_device for acpi_bus_type Yinghai Lu
@ 2012-09-25  8:26 ` Yinghai Lu
  2 siblings, 0 replies; 3+ messages in thread
From: Yinghai Lu @ 2012-09-25  8:26 UTC (permalink / raw)
  To: Bjorn Helgaas, Len Brown; +Cc: linux-pci, Yinghai Lu, linux-acpi

The struct member is not used anymore, remove it.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
---
 include/acpi/acpi_bus.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index bde976e..0e41e5f 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -389,8 +389,6 @@ struct acpi_bus_type {
 	struct bus_type *bus;
 	/* For general devices under the bus */
 	int (*find_device) (struct device *, acpi_handle *);
-	/* For bridges, such as PCI root bridge, IDE controller */
-	int (*find_bridge) (struct device *, acpi_handle *);
 };
 int register_acpi_bus_type(struct acpi_bus_type *);
 int unregister_acpi_bus_type(struct acpi_bus_type *);
-- 
1.7.7

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-25  8:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1348561590-28067-1-git-send-email-yinghai@kernel.org>
2012-09-25  8:26 ` [PATCH 07/29] PCI, ACPI: add acpi_bus_type for host bridge Yinghai Lu
2012-09-25  8:26 ` [PATCH 08/29] PCI, ACPI: Remove acpi_find_bridge_device for acpi_bus_type Yinghai Lu
2012-09-25  8:26 ` [PATCH 11/29] PCI, ACPI: remove find_bridge in acpi_bus_type Yinghai Lu

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).