* firmware (SYSFW) image for various purposes and SYSFW depends on us
* to initialize its pin settings.
*/
- ret = uclass_find_device_by_seq(UCLASS_SERIAL, 0, true, &dev);
+ ret = uclass_find_device_by_seq(UCLASS_SERIAL, 0, &dev);
if (!ret)
pinctrl_select_state(dev, "default");
* firmware (SYSFW) image for various purposes and SYSFW depends on us
* to initialize its pin settings.
*/
- ret = uclass_find_device_by_seq(UCLASS_SERIAL, 0, true, &dev);
+ ret = uclass_find_device_by_seq(UCLASS_SERIAL, 0, &dev);
if (!ret)
pinctrl_select_state(dev, "default");
int ret;
ret = uclass_find_device_by_seq(UCLASS_SPI, CONFIG_SF_DEFAULT_BUS,
- true, &dev);
+ &dev);
if (ret)
return NULL;
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;
}
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);
}
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;
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);
}
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;
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;
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);
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);
/**
* device_find_child_by_seq() - Find a child device based on a sequence
*
- * This searches for a device with the given seq or req_seq.
- *
- * For seq, if an active device has this sequence it will be returned.
- * If there is no such device then this will return -ENODEV.
- *
- * For req_seq, if a device (whether activated or not) has this req_seq
- * value, that device will be returned. This is a strong indication that
- * the device will receive that sequence when activated.
+ * This searches for a device with the given seq.
*
* @parent: Parent device
- * @seq_or_req_seq: Sequence number to find (0=first)
- * @find_req_seq: true to find req_seq, false to find seq
+ * @seq: Sequence number to find (0=first)
* @devp: Returns pointer to device (there is only one per for each seq).
* Set to NULL if none is found
- * @return 0 if OK, -ve on error
+ * @return 0 if OK, -ENODEV if not found
*/
-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);
/**
* device_get_child_by_seq() - Get a child device based on a sequence
/**
* uclass_find_device_by_seq() - Find uclass device based on ID and sequence
*
- * This searches for a device with the given seq or req_seq.
- *
- * For seq, if an active device has this sequence it will be returned.
- * If there is no such device then this will return -ENODEV.
- *
- * For req_seq, if a device (whether activated or not) has this req_seq
- * value, that device will be returned. This is a strong indication that
- * the device will receive that sequence when activated.
+ * This searches for a device with the given seq.
*
* The device is NOT probed, it is merely returned.
*
* @id: ID to look up
- * @seq_or_req_seq: Sequence number to find (0=first)
- * @find_req_seq: true to find req_seq, false to find seq
+ * @seq: Sequence number to find (0=first)
* @devp: Returns pointer to device (there is only one per for each seq)
- * @return 0 if OK, -ve on error
+ * @return 0 if OK, -ENODEV if not found
*/
-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);
/**
* uclass_find_device_by_of_offset() - Find a uclass device by device tree node
/* look for an index after "eth" */
index = simple_strtoul(name + 3, NULL, 10);
- retval = uclass_find_device_by_seq(UCLASS_ETH, index, false, &dev);
+ retval = uclass_find_device_by_seq(UCLASS_ETH, index, &dev);
if (!retval) {
struct eth_pdata *pdata = dev->plat;
switch (op) {
ut_asserteq_str("c-test@5", dev->name);
/* Device with sequence number 0 should be accessible */
- ut_asserteq(-ENODEV, device_find_child_by_seq(bus, -1, true, &dev));
- ut_assertok(device_find_child_by_seq(bus, 0, true, &dev));
+ ut_asserteq(-ENODEV, device_find_child_by_seq(bus, -1, &dev));
+ ut_assertok(device_find_child_by_seq(bus, 0, &dev));
ut_assert(!(dev->flags & DM_FLAG_ACTIVATED));
- ut_asserteq(0, device_find_child_by_seq(bus, 0, false, &dev));
+ ut_asserteq(0, device_find_child_by_seq(bus, 0, &dev));
ut_assertok(device_get_child_by_seq(bus, 0, &dev));
ut_assert(dev->flags & DM_FLAG_ACTIVATED);
- ut_asserteq(0, device_find_child_by_seq(bus, 0, false, &dev));
+ ut_asserteq(0, device_find_child_by_seq(bus, 0, &dev));
/* There is no device with sequence number 2 */
- ut_asserteq(-ENODEV, device_find_child_by_seq(bus, 2, false, &dev));
- ut_asserteq(-ENODEV, device_find_child_by_seq(bus, 2, true, &dev));
+ ut_asserteq(-ENODEV, device_find_child_by_seq(bus, 2, &dev));
+ ut_asserteq(-ENODEV, device_find_child_by_seq(bus, 2, &dev));
ut_asserteq(-ENODEV, device_get_child_by_seq(bus, 2, &dev));
/* Looking for something that is not a child */
ut_asserteq_ptr(dev, NULL);
/* Move to the next child without using device_find_first_child() */
- ut_assertok(device_find_child_by_seq(bus, 5, true, &dev));
+ ut_assertok(device_find_child_by_seq(bus, 5, &dev));
ut_asserteq_str("c-test@5", dev->name);
ut_assertok(device_find_next_child(&dev));
ut_asserteq_str("c-test@0", dev->name);
ut_assertok(uclass_get_device(UCLASS_TEST_BUS, 0, &bus));
/* Check that parent data is allocated */
- ut_assertok(device_find_child_by_seq(bus, 0, true, &dev));
+ ut_assertok(device_find_child_by_seq(bus, 0, &dev));
ut_asserteq_ptr(NULL, dev_get_parent_priv(dev));
ut_assertok(device_get_child_by_seq(bus, 0, &dev));
parent_data = dev_get_parent_priv(dev);
struct udevice *dev;
/* A few basic santiy tests */
- ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_FDT, 3, true, &dev));
+ ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_FDT, 3, &dev));
ut_asserteq_str("b-test", dev->name);
ut_asserteq(3, dev_seq(dev));
- ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_FDT, 8, true, &dev));
+ ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_FDT, 8, &dev));
ut_asserteq_str("a-test", dev->name);
ut_asserteq(8, dev_seq(dev));
* This device has no alias so gets the next value after all available
* aliases. The last alias is testfdt12
*/
- ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_FDT, 13, true, &dev));
+ ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_FDT, 13, &dev));
ut_asserteq_str("d-test", dev->name);
ut_asserteq(13, dev_seq(dev));
- ut_asserteq(-ENODEV, uclass_find_device_by_seq(UCLASS_TEST_FDT, 9, true,
+ ut_asserteq(-ENODEV, uclass_find_device_by_seq(UCLASS_TEST_FDT, 9,
&dev));
ut_asserteq_ptr(NULL, dev);
ut_asserteq(15, dev_seq(dev));
/* And we should still have holes in our sequence numbers */
- ut_asserteq(-ENODEV, uclass_find_device_by_seq(UCLASS_TEST_FDT, 0, true,
+ ut_asserteq(-ENODEV, uclass_find_device_by_seq(UCLASS_TEST_FDT, 0,
&dev));
- ut_asserteq(-ENODEV, uclass_find_device_by_seq(UCLASS_TEST_FDT, 1, true,
+ ut_asserteq(-ENODEV, uclass_find_device_by_seq(UCLASS_TEST_FDT, 1,
&dev));
- ut_asserteq(-ENODEV, uclass_find_device_by_seq(UCLASS_TEST_FDT, 2, true,
+ ut_asserteq(-ENODEV, uclass_find_device_by_seq(UCLASS_TEST_FDT, 2,
&dev));
- ut_asserteq(-ENODEV, uclass_find_device_by_seq(UCLASS_TEST_FDT, 4, true,
+ ut_asserteq(-ENODEV, uclass_find_device_by_seq(UCLASS_TEST_FDT, 4,
&dev));
- ut_asserteq(-ENODEV, uclass_find_device_by_seq(UCLASS_TEST_FDT, 7, true,
+ ut_asserteq(-ENODEV, uclass_find_device_by_seq(UCLASS_TEST_FDT, 7,
&dev));
- ut_asserteq(-ENODEV, uclass_find_device_by_seq(UCLASS_TEST_FDT, 9, true,
+ ut_asserteq(-ENODEV, uclass_find_device_by_seq(UCLASS_TEST_FDT, 9,
&dev));
ut_asserteq(-ENODEV, uclass_find_device_by_seq(UCLASS_TEST_FDT, 10,
- true, &dev));
+ &dev));
ut_asserteq(-ENODEV, uclass_find_device_by_seq(UCLASS_TEST_FDT, 11,
- true, &dev));
+ &dev));
return 0;
}
fdt32_t dma_addr[2];
/* Some simple translations */
- ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev));
+ ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, &dev));
ut_asserteq_str("dev@0,0", dev->name);
ut_asserteq(0x8000, dev_read_addr(dev));
- ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 1, true, &dev));
+ ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 1, &dev));
ut_asserteq_str("dev@1,100", dev->name);
ut_asserteq(0x9000, dev_read_addr(dev));
- ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 2, true, &dev));
+ ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 2, &dev));
ut_asserteq_str("dev@2,200", dev->name);
ut_asserteq(0xA000, dev_read_addr(dev));
/* No translation for busses with #size-cells == 0 */
- ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 3, true, &dev));
+ ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 3, &dev));
ut_asserteq_str("dev@42", dev->name);
ut_asserteq(0x42, dev_read_addr(dev));
/* dma address translation */
- ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev));
+ ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, &dev));
dma_addr[0] = cpu_to_be32(0);
dma_addr[1] = cpu_to_be32(0);
ut_asserteq(0x10000000, dev_translate_dma_address(dev, dma_addr));
- ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 1, true, &dev));
+ ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 1, &dev));
dma_addr[0] = cpu_to_be32(1);
dma_addr[1] = cpu_to_be32(0x100);
ut_asserteq(0x20000000, dev_translate_dma_address(dev, dma_addr));
ut_assertok(uclass_first_device_err(UCLASS_GPIO, &gpio));
ut_assertnull(devfdt_get_addr_ptr(gpio));
- ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev));
+ ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, &dev));
ptr = devfdt_get_addr_ptr(dev);
ut_asserteq_ptr((void *)0x8000, ptr);
fdt_addr_t addr;
void *paddr;
- ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev));
+ ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, &dev));
addr = devfdt_get_addr(dev);
ut_asserteq(0x8000, addr);
fdt_size_t size;
void *paddr;
- ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev));
+ ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, &dev));
addr = devfdt_get_addr_size_index(dev, 0, &size);
ut_asserteq(0x8000, addr);
fdt_size_t size;
void *paddr;
- ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev));
+ ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, &dev));
addr = devfdt_get_addr_size_name(dev, "sandbox-dummy-0", &size);
ut_asserteq(0x8000, addr);
fdt_addr_t addr;
void *paddr;
- ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev));
+ ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, &dev));
addr = dev_read_addr(dev);
ut_asserteq(0x8000, addr);
fdt_size_t size;
void *paddr;
- ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev));
+ ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, &dev));
addr = dev_read_addr_size_index(dev, 0, &size);
ut_asserteq(0x8000, addr);
fdt_size_t size;
void *paddr;
- ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev));
+ ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, &dev));
addr = dev_read_addr_size_name(dev, "sandbox-dummy-0", &size);
ut_asserteq(0x8000, addr);
device_bind_driver_to_node(dm_root(), "usb_sandbox", "usb@2", node,
&dev);
- ut_assertok(uclass_find_device_by_seq(UCLASS_USB, 2, true, &dev));
+ ut_assertok(uclass_find_device_by_seq(UCLASS_USB, 2, &dev));
/* Test string property setting */