diff options
author | Simon Glass <sjg@chromium.org> | 2020-12-16 21:20:07 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2020-12-18 20:32:21 -0700 |
commit | 8b85dfc675f12de8d04126c07f3c796965b990c2 (patch) | |
tree | 9b8d6df956b02734a1b910b0a4c072e1e80b672a /drivers/core | |
parent | 0b2fa98aa5e5dbdac4f5e2b2f67a34cc34dcc6b8 (diff) | |
download | u-boot-8b85dfc675f12de8d04126c07f3c796965b990c2.zip u-boot-8b85dfc675f12de8d04126c07f3c796965b990c2.tar.gz u-boot-8b85dfc675f12de8d04126c07f3c796965b990c2.tar.bz2 |
dm: Avoid accessing seq directly
At present various drivers etc. access the device's 'seq' member directly.
This makes it harder to change the meaning of that member. Change access
to go through a function instead.
The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core')
-rw-r--r-- | drivers/core/device.c | 2 | ||||
-rw-r--r-- | drivers/core/dump.c | 4 | ||||
-rw-r--r-- | drivers/core/uclass.c | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c index a6b8c3e..fce9909 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -655,7 +655,7 @@ int device_find_child_by_seq(const struct udevice *parent, int seq_or_req_seq, return -ENODEV; list_for_each_entry(dev, &parent->child_head, sibling_node) { - if ((find_req_seq ? dev->req_seq : dev->seq) == + if ((find_req_seq ? dev->req_seq : dev_seq(dev)) == seq_or_req_seq) { *devp = dev; return 0; diff --git a/drivers/core/dump.c b/drivers/core/dump.c index 221b4f7..33cfee6 100644 --- a/drivers/core/dump.c +++ b/drivers/core/dump.c @@ -67,8 +67,8 @@ 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->seq != -1 || dev->req_seq != -1) - printf(", seq %d, (req %d)", dev->seq, dev->req_seq); + if (dev_seq(dev) != -1 || dev->req_seq != -1) + printf(", seq %d, (req %d)", dev_seq(dev), dev->req_seq); puts("\n"); } diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index b1d882e..e2372c6 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -311,8 +311,8 @@ int uclass_find_device_by_seq(enum uclass_id id, int seq_or_req_seq, uclass_foreach_dev(dev, uc) { log_debug(" - %d %d '%s'\n", - dev->req_seq, dev->seq, dev->name); - if ((find_req_seq ? dev->req_seq : dev->seq) == + dev->req_seq, dev_seq(dev), dev->name); + if ((find_req_seq ? dev->req_seq : dev_seq(dev)) == seq_or_req_seq) { *devp = dev; log_debug(" - found\n"); @@ -695,7 +695,7 @@ int uclass_resolve_seq(struct udevice *dev) int seq = 0; int ret; - assert(dev->seq == -1); + assert(dev_seq(dev) == -1); ret = uclass_find_device_by_seq(uc_drv->id, dev->req_seq, false, &dup); if (!ret) { dm_warn("Device '%s': seq %d is in use by '%s'\n", |