dm: core: Rename sqq to seq_

Now that the sequence-numbering migration is complete, rename this member
back to seq_, adding an underscore to indicate it is internal to driver
model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This commit is contained in:
Simon Glass 2020-12-19 10:40:09 -07:00
parent 82021e31a7
commit 2462139fdd
6 changed files with 18 additions and 17 deletions

View file

@ -73,7 +73,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
dev->driver = drv;
dev->uclass = uc;
dev->sqq = -1;
dev->seq_ = -1;
if (CONFIG_IS_ENABLED(DM_SEQ_ALIAS) &&
(uc->uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS)) {
/*
@ -83,13 +83,13 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
if (CONFIG_IS_ENABLED(OF_CONTROL) &&
!CONFIG_IS_ENABLED(OF_PLATDATA)) {
if (uc->uc_drv->name && ofnode_valid(node)) {
if (!dev_read_alias_seq(dev, &dev->sqq))
if (!dev_read_alias_seq(dev, &dev->seq_))
auto_seq = false;
}
}
}
if (auto_seq && !(uc->uc_drv->flags & DM_UC_FLAG_NO_AUTO_SEQ))
dev->sqq = uclass_find_next_free_seq(uc);
dev->seq_ = uclass_find_next_free_seq(uc);
if (drv->plat_auto) {
bool alloc = !plat;
@ -658,7 +658,7 @@ int device_find_child_by_seq(const struct udevice *parent, int seq,
*devp = NULL;
list_for_each_entry(dev, &parent->child_head, sibling_node) {
if (dev->sqq == seq) {
if (dev->seq_ == seq) {
*devp = dev;
return 0;
}

View file

@ -69,7 +69,7 @@ static void dm_display_line(struct udevice *dev, int index)
printf("%-3i %c %s @ %08lx", index,
dev->flags & DM_FLAG_ACTIVATED ? '*' : ' ',
dev->name, (ulong)map_to_sysmem(dev));
if (dev->sqq != -1)
if (dev->seq_ != -1)
printf(", seq %d", dev_seq(dev));
puts("\n");
}

View file

@ -297,8 +297,8 @@ int uclass_find_next_free_seq(struct uclass *uc)
/* Avoid conflict with existing devices */
list_for_each_entry(dev, &uc->dev_head, uclass_node) {
if (dev->sqq > max)
max = dev->sqq;
if (dev->seq_ > max)
max = dev->seq_;
}
/*
* At this point, max will be -1 if there are no existing aliases or
@ -323,8 +323,8 @@ int uclass_find_device_by_seq(enum uclass_id id, int seq, struct udevice **devp)
return ret;
uclass_foreach_dev(dev, uc) {
log_debug(" - %d '%s'\n", dev->sqq, dev->name);
if (dev->sqq == seq) {
log_debug(" - %d '%s'\n", dev->seq_, dev->name);
if (dev->seq_ == seq) {
*devp = dev;
log_debug(" - found\n");
return 0;

View file

@ -1019,7 +1019,7 @@ static int pci_uclass_pre_probe(struct udevice *bus)
ret = uclass_get(UCLASS_PCI, &uc);
if (ret)
return ret;
bus->sqq = uclass_find_next_free_seq(uc);
bus->seq_ = uclass_find_next_free_seq(uc);
}
/* For bridges, use the top-level PCI controller */

View file

@ -136,11 +136,12 @@ enum {
* @child_head: List of children of this device
* @sibling_node: Next device in list of all devices
* @flags: Flags for this device DM_FLAG_...
* @seq: Allocated sequence number for this device (-1 = none). This is set up
* @seq_: Allocated sequence number for this device (-1 = none). This is set up
* when the device is bound and is unique within the device's uclass. If the
* device has an alias in the devicetree then that is used to set the sequence
* number. Otherwise, the next available number is used. Sequence numbers are
* used by certain commands that need device to be numbered (e.g. 'mmc dev')
* used by certain commands that need device to be numbered (e.g. 'mmc dev').
* (do not access outside driver model)
* @devres_head: List of memory allocations associated with this device.
* When CONFIG_DEVRES is enabled, devm_kmalloc() and friends will
* add to this list. Memory so-allocated will be freed
@ -163,7 +164,7 @@ struct udevice {
struct list_head child_head;
struct list_head sibling_node;
uint32_t flags;
int sqq;
int seq_;
#ifdef CONFIG_DEVRES
struct list_head devres_head;
#endif
@ -190,7 +191,7 @@ static inline bool dev_has_of_node(struct udevice *dev)
static inline int dev_seq(const struct udevice *dev)
{
return dev->sqq;
return dev->seq_;
}
/**

View file

@ -1075,10 +1075,10 @@ static int dm_test_all_have_seq(struct unit_test_state *uts)
list_for_each_entry(uc, &gd->uclass_root, sibling_node) {
list_for_each_entry(dev, &uc->dev_head, uclass_node) {
if (dev->sqq == -1)
if (dev->seq_ == -1)
printf("Device '%s' has no seq (%d)\n",
dev->name, dev->sqq);
ut_assert(dev->sqq != -1);
dev->name, dev->seq_);
ut_assert(dev->seq_ != -1);
}
}