dm: core: Update uclass_find_next_free_req_seq() for new scheme

This function current deals with req_seq which is deprecated. Update it to
use the new sequence numbers, putting them above existing aliases. Rename
the function to make this clear.

Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 42c9ba5..6409457 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -272,18 +272,25 @@
 	return -ENODEV;
 }
 
-int uclass_find_next_free_req_seq(struct uclass *uc)
+int uclass_find_next_free_seq(struct uclass *uc)
 {
 	struct udevice *dev;
 	int max = -1;
 
+	/* If using aliases, start with the highest alias value */
+	if (CONFIG_IS_ENABLED(DM_SEQ_ALIAS) &&
+	    (uc->uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS))
+		max = dev_read_alias_highest_id(uc->uc_drv->name);
+
+	/* Avoid conflict with existing devices */
 	list_for_each_entry(dev, &uc->dev_head, uclass_node) {
-		if ((dev->req_seq != -1) && (dev->req_seq > max))
-			max = dev->req_seq;
+		if (dev->sqq > max)
+			max = dev->sqq;
 	}
-
-	if (max == -1)
-		return 0;
+	/*
+	 * At this point, max will be -1 if there are no existing aliases or
+	 * devices
+	 */
 
 	return max + 1;
 }