diff mbox series

[U-Boot,027/126] pci: sandbox: Probe PCI emulation devices when used

Message ID 20190925145750.200592-28-sjg@chromium.org
State Accepted
Delegated to: Bin Meng
Headers show
Series x86: Add initial support for apollolake | expand

Commit Message

Simon Glass Sept. 25, 2019, 2:56 p.m. UTC
At present PCI emulation devices are not probed before use, since they
used to be children of the device that used them, and children cannot be
probed before their parents.

Now that PCI emulation devices are attached to the root node, we can
simply probe them, and avoid using the internal function.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/pci/pci-emul-uclass.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Bin Meng Oct. 5, 2019, 5:03 a.m. UTC | #1
On Wed, Sep 25, 2019 at 10:58 PM Simon Glass <sjg@chromium.org> wrote:
>
> At present PCI emulation devices are not probed before use, since they
> used to be children of the device that used them, and children cannot be
> probed before their parents.
>
> Now that PCI emulation devices are attached to the root node, we can
> simply probe them, and avoid using the internal function.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  drivers/pci/pci-emul-uclass.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Bin Meng Oct. 6, 2019, 10:04 a.m. UTC | #2
On Sat, Oct 5, 2019 at 1:03 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Wed, Sep 25, 2019 at 10:58 PM Simon Glass <sjg@chromium.org> wrote:
> >
> > At present PCI emulation devices are not probed before use, since they
> > used to be children of the device that used them, and children cannot be
> > probed before their parents.
> >
> > Now that PCI emulation devices are attached to the root node, we can
> > simply probe them, and avoid using the internal function.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> >  drivers/pci/pci-emul-uclass.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> >
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> Tested-by: Bin Meng <bmeng.cn@gmail.com>

Rebased the patch against u-boot-x86/next to get it applied cleanly, and

applied to u-boot-x86/next, thanks!
diff mbox series

Patch

diff --git a/drivers/pci/pci-emul-uclass.c b/drivers/pci/pci-emul-uclass.c
index f918e9a52fd..a70c5e7633d 100644
--- a/drivers/pci/pci-emul-uclass.c
+++ b/drivers/pci/pci-emul-uclass.c
@@ -10,7 +10,6 @@ 
 #include <linux/libfdt.h>
 #include <pci.h>
 #include <dm/lists.h>
-#include <dm/uclass-internal.h>
 
 struct sandbox_pci_emul_priv {
 	int dev_count;
@@ -36,8 +35,8 @@  int sandbox_pci_get_emul(struct udevice *bus, pci_dev_t find_devfn,
 	 * why UCLASS_PCI_GENERIC devices end up being their own emulators. I
 	 * left this code as is.
 	 */
-	ret = uclass_find_device_by_phandle(UCLASS_PCI_EMUL, dev,
-					    "sandbox,emul", emulp);
+	ret = uclass_get_device_by_phandle(UCLASS_PCI_EMUL, dev, "sandbox,emul",
+					   emulp);
 	if (ret && device_get_uclass_id(dev) != UCLASS_PCI_GENERIC)
 		*emulp = dev;