/* Yes, this forcably breaks the klist abstraction temporarily. It just wants to sort the klist, not change reference counts and take/drop locks rapidly in the process. It does all this while holding the lock for the list, so objects can't otherwise be added/removed while we're swizzling.  */
static void device_insertion_sort_klist(struct device *a, struct list_head *list, int(*compare)(const struct device *a, const struct device *b))
/* Yes, this forcably breaks the klist abstraction temporarily. It just wants to sort the klist, not change reference counts and take/drop locks rapidly in the process. It does all this while holding the lock for the list, so objects can't otherwise be added/removed while we're swizzling.  */
static void device_insertion_sort_klist(struct device *a, struct list_head *list, int(*compare)(const struct device *a, const struct device *b))
{
	struct list_head *pos;
	struct klist_node *n;
	struct device_private *dev_prv;
	struct device *b;
	list_for_each(pos, list) {
		n = container_of(pos, struct klist_node, n_node);
		dev_prv = to_device_private_bus(n);
		b = dev_prv->device;
		if (compare(a, b) <= 0) {
			list_move_tail(&a->p->knode_bus.n_node,
				       &b->p->knode_bus.n_node);
			return;
		}
	}
	list_move_tail(&a->p->knode_bus.n_node, list);
}