Blame SOURCES/0002-move-PnP-devices-to-the-ISA-LPC-bridge.patch

b58cad
From 126bc4387648fabf0478d0b869fe6bc52676b447 Mon Sep 17 00:00:00 2001
b58cad
From: Lyonel Vincent <lyonel@ezix.org>
b58cad
Date: Sun, 29 Mar 2020 19:25:39 +0200
b58cad
Subject: [PATCH 02/17] move PnP devices to the ISA/LPC bridge
b58cad
b58cad
---
b58cad
 src/core/pnp.cc | 14 ++++++++++----
b58cad
 1 file changed, 10 insertions(+), 4 deletions(-)
b58cad
b58cad
diff --git a/src/core/pnp.cc b/src/core/pnp.cc
b58cad
index 8c92adf647a0..6a391856ec52 100644
b58cad
--- a/src/core/pnp.cc
b58cad
+++ b/src/core/pnp.cc
b58cad
@@ -165,6 +165,11 @@ hw::hwClass pnp_class(const string & pnpid)
b58cad
   return hw::generic;
b58cad
 }
b58cad
 
b58cad
+static bool ISAbridge(const hwNode & n)
b58cad
+{
b58cad
+  return n.getClass()==hw::bridge && n.isCapable("isa");
b58cad
+}
b58cad
+
b58cad
 bool scan_pnp(hwNode & n)
b58cad
 {
b58cad
   vector < sysfs::entry > entries = sysfs::entries_by_bus("pnp");
b58cad
@@ -172,11 +177,12 @@ bool scan_pnp(hwNode & n)
b58cad
   if (entries.empty())
b58cad
     return false;
b58cad
 
b58cad
-  hwNode *core = n.getChild("core");
b58cad
-  if (!core)
b58cad
+  hwNode *isapnpbridge = n.findChild(ISAbridge);
b58cad
+  if (!isapnpbridge) isapnpbridge = n.getChild("core");
b58cad
+  if (!isapnpbridge)
b58cad
   {
b58cad
     n.addChild(hwNode("core", hw::bus));
b58cad
-    core = n.getChild("core");
b58cad
+    isapnpbridge = n.getChild("core");
b58cad
   }
b58cad
 
b58cad
   for (vector < sysfs::entry >::iterator it = entries.begin();
b58cad
@@ -208,7 +214,7 @@ bool scan_pnp(hwNode & n)
b58cad
       device.setProduct("PnP device " + pnpid);
b58cad
     device.claim();
b58cad
 
b58cad
-    core->addChild(device);
b58cad
+    isapnpbridge->addChild(device);
b58cad
   }
b58cad
   return true;
b58cad
 }
b58cad
-- 
b58cad
2.17.1
b58cad