static int ssb_attach_queued_buses()

in main.c [557:598]


static int ssb_attach_queued_buses(void)
{
	struct ssb_bus *bus, *n;
	int err = 0;
	int drop_them_all = 0;

	list_for_each_entry_safe(bus, n, &attach_queue, list) {
		if (drop_them_all) {
			list_del(&bus->list);
			continue;
		}
		/* Can't init the PCIcore in ssb_bus_register(), as that
		 * is too early in boot for embedded systems
		 * (no udelay() available). So do it here in attach stage.
		 */
		err = ssb_bus_powerup(bus, 0);
		if (err)
			goto error;
		ssb_pcicore_init(&bus->pcicore);
		if (bus->bustype == SSB_BUSTYPE_SSB)
			ssb_watchdog_register(bus);

		err = ssb_gpio_init(bus);
		if (err == -ENOTSUPP)
			pr_debug("GPIO driver not activated\n");
		else if (err)
			pr_debug("Error registering GPIO driver: %i\n", err);

		ssb_bus_may_powerdown(bus);

		err = ssb_devices_register(bus);
error:
		if (err) {
			drop_them_all = 1;
			list_del(&bus->list);
			continue;
		}
		list_move_tail(&bus->list, &buses);
	}

	return err;
}