#if CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
if (dev->req_seq == -1)
dev->req_seq =
- uclass_find_next_free_req_seq(drv->id);
+ uclass_find_next_free_req_seq(uc);
#endif
} else {
- dev->req_seq = uclass_find_next_free_req_seq(drv->id);
+ dev->req_seq = uclass_find_next_free_req_seq(uc);
}
}
return -ENODEV;
}
-int uclass_find_next_free_req_seq(enum uclass_id id)
+int uclass_find_next_free_req_seq(struct uclass *uc)
{
- struct uclass *uc;
struct udevice *dev;
- int ret;
int max = -1;
- ret = uclass_get(id, &uc);
- if (ret)
- return ret;
-
list_for_each_entry(dev, &uc->dev_head, uclass_node) {
if ((dev->req_seq != -1) && (dev->req_seq > max))
max = dev->req_seq;
static int designware_i2c_pci_bind(struct udevice *dev)
{
+ struct uclass *uc;
char name[20];
+ int ret;
if (dev_of_valid(dev))
return 0;
* be possible. We cannot use static data in drivers since they may be
* used in SPL or before relocation.
*/
- dev->req_seq = uclass_find_next_free_req_seq(UCLASS_I2C);
+ ret = uclass_get(UCLASS_I2C, &uc);
+ if (ret)
+ return ret;
+
+ dev->req_seq = uclass_find_next_free_req_seq(uc);
sprintf(name, "i2c_designware#%u", dev->req_seq);
device_set_name(dev, name);
* maximum req_seq of the uclass + 1.
* This allows assiging req_seq number in the binding order.
*
- * @id: Id number of the uclass
+ * @uc: uclass to check
* @return The next free req_seq number
*/
-int uclass_find_next_free_req_seq(enum uclass_id id);
+int uclass_find_next_free_req_seq(struct uclass *uc);
/**
* uclass_get_device_tail() - handle the end of a get_device call