Re: [PATCH v6] drivers: amba: properly handle devices with power domains

From: Ulf Hansson
Date: Tue Apr 12 2016 - 10:49:17 EST


[...]

>
> +static int __init amba_deferred_device_init(void)
> +{
> + struct deferred_device *ddev, *tmp;
> +
> + list_for_each_entry_safe(ddev, tmp, &deferred_devices, node) {
> + int ret = amba_device_try_add(ddev->dev, ddev->parent);
> +
> + if (ret == -EPROBE_DEFER)
> + continue;

What happens with devices that still fails to be added here? Should we
schedule a periodic work to re-try?

> +
> + list_del_init(&ddev->node);
> + kfree(ddev);
> + }
> +
> + return 0;
> +}
> +late_initcall(amba_deferred_device_init);
> +
> static struct amba_device *
> amba_aphb_device_add(struct device *parent, const char *name,
> resource_size_t base, size_t size, int irq1, int irq2,
> --
> 1.9.2
>

I assume there are other similar buses like AMBA that needs
enumeration before it can bind an appropriate driver for its device.

Perhaps that's a good reason to make this new "device add re-try"
mechanism a generic thing supported by the driver core?

Kind regards
Uffe