aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSimon Glass2020-12-16 21:20:29 -0700
committerSimon Glass2020-12-18 20:32:21 -0700
commit991759196faa74b2e7df1cb8e87820f4ec7285f8 (patch)
treec006a0c22ee148df5c777c865751bdd3e4a72199 /drivers
parentb5b11558bc2d7088dfbb67253d8b094782334dea (diff)
dm: Drop the unused arg in uclass_find_device_by_seq()
Now that there is only one sequence number (rather than both requested and assigned ones) we can simplify this function. Also update its caller to simplify the logic. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/core/device.c16
-rw-r--r--drivers/core/uclass.c22
-rw-r--r--drivers/spi/spi-uclass.c4
-rw-r--r--drivers/usb/host/usb-uclass.c4
4 files changed, 16 insertions, 30 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c
index e8435b8ba42..b878a4d4b69 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -647,15 +647,15 @@ int device_get_child_count(const struct udevice *parent)
return count;
}
-int device_find_child_by_seq(const struct udevice *parent, int seq_or_req_seq,
- bool find_req_seq, struct udevice **devp)
+int device_find_child_by_seq(const struct udevice *parent, int seq,
+ struct udevice **devp)
{
struct udevice *dev;
*devp = NULL;
list_for_each_entry(dev, &parent->child_head, sibling_node) {
- if (dev->sqq == seq_or_req_seq) {
+ if (dev->sqq == seq) {
*devp = dev;
return 0;
}
@@ -671,14 +671,8 @@ int device_get_child_by_seq(const struct udevice *parent, int seq,
int ret;
*devp = NULL;
- ret = device_find_child_by_seq(parent, seq, false, &dev);
- if (ret == -ENODEV) {
- /*
- * We didn't find it in probed devices. See if there is one
- * that will request this seq if probed.
- */
- ret = device_find_child_by_seq(parent, seq, true, &dev);
- }
+ ret = device_find_child_by_seq(parent, seq, &dev);
+
return device_get_device_tail(dev, ret, devp);
}
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 78765e548ef..42c9ba58281 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -288,25 +288,23 @@ int uclass_find_next_free_req_seq(struct uclass *uc)
return max + 1;
}
-int uclass_find_device_by_seq(enum uclass_id id, int seq_or_req_seq,
- bool find_req_seq, struct udevice **devp)
+int uclass_find_device_by_seq(enum uclass_id id, int seq, struct udevice **devp)
{
struct uclass *uc;
struct udevice *dev;
int ret;
*devp = NULL;
- log_debug("%d %d\n", find_req_seq, seq_or_req_seq);
- if (seq_or_req_seq == -1)
+ log_debug("%d\n", seq);
+ if (seq == -1)
return -ENODEV;
ret = uclass_get(id, &uc);
if (ret)
return ret;
uclass_foreach_dev(dev, uc) {
- log_debug(" - %d %d '%s'\n",
- dev->req_seq, dev_seq(dev), dev->name);
- if (dev_seq(dev) == seq_or_req_seq) {
+ log_debug(" - %d '%s'\n", dev->sqq, dev->name);
+ if (dev->sqq == seq) {
*devp = dev;
log_debug(" - found\n");
return 0;
@@ -466,14 +464,8 @@ int uclass_get_device_by_seq(enum uclass_id id, int seq, struct udevice **devp)
int ret;
*devp = NULL;
- ret = uclass_find_device_by_seq(id, seq, false, &dev);
- if (ret == -ENODEV) {
- /*
- * We didn't find it in probed devices. See if there is one
- * that will request this seq if probed.
- */
- ret = uclass_find_device_by_seq(id, seq, true, &dev);
- }
+ ret = uclass_find_device_by_seq(id, seq, &dev);
+
return uclass_get_device_tail(dev, ret, devp);
}
diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
index 9dd32ab333b..f3b8ffad425 100644
--- a/drivers/spi/spi-uclass.c
+++ b/drivers/spi/spi-uclass.c
@@ -273,7 +273,7 @@ int spi_cs_is_valid(unsigned int busnum, unsigned int cs)
struct udevice *bus;
int ret;
- ret = uclass_find_device_by_seq(UCLASS_SPI, busnum, false, &bus);
+ ret = uclass_find_device_by_seq(UCLASS_SPI, busnum, &bus);
if (ret) {
debug("%s: No bus %d\n", __func__, busnum);
return ret;
@@ -302,7 +302,7 @@ int spi_find_bus_and_cs(int busnum, int cs, struct udevice **busp,
struct udevice *bus, *dev;
int ret;
- ret = uclass_find_device_by_seq(UCLASS_SPI, busnum, false, &bus);
+ ret = uclass_find_device_by_seq(UCLASS_SPI, busnum, &bus);
if (ret) {
debug("%s: No bus %d\n", __func__, busnum);
return ret;
diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index fee92c9d779..a2bd7436f42 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -394,7 +394,7 @@ int usb_setup_ehci_gadget(struct ehci_ctrl **ctlrp)
int ret;
/* Find the old device and remove it */
- ret = uclass_find_device_by_seq(UCLASS_USB, 0, true, &dev);
+ ret = uclass_find_device_by_seq(UCLASS_USB, 0, &dev);
if (ret)
return ret;
ret = device_remove(dev, DM_REMOVE_NORMAL);
@@ -417,7 +417,7 @@ int usb_remove_ehci_gadget(struct ehci_ctrl **ctlrp)
int ret;
/* Find the old device and remove it */
- ret = uclass_find_device_by_seq(UCLASS_USB, 0, true, &dev);
+ ret = uclass_find_device_by_seq(UCLASS_USB, 0, &dev);
if (ret)
return ret;
ret = device_remove(dev, DM_REMOVE_NORMAL);