Re: [PATCH v6] amba: Remove deferred device addition

From: Isaac Manjarres
Date: Wed Aug 10 2022 - 17:47:37 EST


On Wed, Aug 10, 2022 at 05:58:58AM -0700, Guenter Roeck wrote:
> On 8/9/22 20:33, Saravana Kannan wrote:
> [ ... ]
>
> >
> > Can you give me more details on the qemu configuration so I could try
> > to reproduce it?
>
> qemu-system-arm -M vexpress-a9 -kernel arch/arm/boot/zImage -no-reboot \
> -initrd rootfs-armv5.cpio -m 128 \
> --append "rdinit=/sbin/init console=ttyAMA0,115200" \
> -dtb arch/arm/boot/dts/vexpress-v2p-ca9.dtb \
> -nographic -monitor null -serial stdio
>
> using multi_v7_defconfig will hang nicely with your patch applied,
> and boot as expected without. This was with qemu v7.0, but I am
> sure older qemu versions will show the same behavior. The initrd
> used should not matter, but you'll find it at
> https://github.com/groeck/linux-build-test/blob/master/rootfs/arm-v7/rootfs-armv5.cpio.gz
>
> Guenter
>
Hi Guenter,

Thanks for the information; I was able to reproduce this on my end as
well. The following changes fixed the problem for me. Can you please try
them out?

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 70f79fc71539..b377f18d8acc 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -881,6 +881,11 @@ static int __device_attach_driver(struct device_driver *drv, void *_data)
dev_dbg(dev, "Device match requests probe deferral\n");
dev->can_match = true;
driver_deferred_probe_add(dev);
+ /*
+ * Device can't match with the bus right now, so don't attempt
+ * to match or bind with other drivers on the bus.
+ */
+ return ret;
} else if (ret < 0) {
dev_dbg(dev, "Bus failed to match device: %d\n", ret);
return ret;
@@ -1120,6 +1125,11 @@ static int __driver_attach(struct device *dev, void *data)
dev_dbg(dev, "Device match requests probe deferral\n");
dev->can_match = true;
driver_deferred_probe_add(dev);
+ /*
+ * Driver could not match with device, but may match with
+ * another device on the bus.
+ */
+ return 0;
} else if (ret < 0) {
dev_dbg(dev, "Bus failed to match device: %d\n", ret);
return ret;


Thanks,
Isaac