All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [PATCH 17/26] dm: core: Rename sqq to seq_
Date: Sat, 19 Dec 2020 10:40:09 -0700	[thread overview]
Message-ID: <20201219174018.1114146-16-sjg@chromium.org> (raw)
In-Reply-To: <20201219174018.1114146-1-sjg@chromium.org>

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>
---

 drivers/core/device.c    | 8 ++++----
 drivers/core/dump.c      | 2 +-
 drivers/core/uclass.c    | 8 ++++----
 drivers/pci/pci-uclass.c | 2 +-
 include/dm/device.h      | 9 +++++----
 test/dm/core.c           | 6 +++---
 6 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index 72169632c88..f4ae7786ee9 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -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;
 		}
diff --git a/drivers/core/dump.c b/drivers/core/dump.c
index 7784ec02dea..1d4628abc74 100644
--- a/drivers/core/dump.c
+++ b/drivers/core/dump.c
@@ -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");
 }
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index f60bc9a8504..e773e34833e 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -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;
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index 37a233878d0..1f6c51f1e8d 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -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 */
diff --git a/include/dm/device.h b/include/dm/device.h
index daebd6eb68d..a063bbaa176 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -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_;
 }
 
 /**
diff --git a/test/dm/core.c b/test/dm/core.c
index cf66e27db4e..b274b043882 100644
--- a/test/dm/core.c
+++ b/test/dm/core.c
@@ -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);
 		}
 	}
 
-- 
2.29.2.684.gfbc64c5ab5-goog

  parent reply	other threads:[~2020-12-19 17:40 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-19 17:39 [PATCH 00/26] dm: Preparation for enhanced of-platdata (part C) Simon Glass
2020-12-19 17:39 ` Simon Glass
2020-12-19 17:39 ` [PATCH 01/26] sandbox: serial: Move priv into a header file Simon Glass
2020-12-21 11:38   ` Andy Shevchenko
2020-12-28 16:26   ` Simon Glass
2020-12-19 17:39 ` [PATCH 02/26] sandbox: i2c: " Simon Glass
2020-12-19 17:39 ` [PATCH 03/26] sandbox: Add a compatible string for spltest Simon Glass
2020-12-19 17:39 ` [PATCH 04/26] sandbox: Update dts files to reduce SPL size Simon Glass
2020-12-19 17:39 ` [PATCH 05/26] x86: apl: Move priv/plat structs to headers Simon Glass
2020-12-19 17:39 ` [PATCH 06/26] x86: Move priv/plat structs for intel_common " Simon Glass
2020-12-19 17:39 ` [PATCH 07/26] x86: spl: Move priv/plat structs " Simon Glass
2020-12-19 17:40 ` [PATCH 08/26] spi: Tidy up get/set of device node Simon Glass
2020-12-19 17:40 ` [PATCH 09/26] spi: Tweak a few strange SPI NOR features for of-platdata Simon Glass
2020-12-19 17:40 ` [PATCH 10/26] x86: apl: Use struct spi_nor instead of struct spi_flash Simon Glass
2020-12-19 17:40 ` [PATCH 11/26] dm: core: Move priv/plat structs for simple_bus to headers Simon Glass
2020-12-19 17:40 ` [PATCH 12/26] x86: sysreset: Move priv/plat structs " Simon Glass
2020-12-21 11:38   ` Andy Shevchenko
2020-12-28 16:26   ` Simon Glass
2020-12-19 17:40 ` [PATCH 13/26] x86: apl: Adjust how the UART gets its platform data Simon Glass
2020-12-19 17:40 ` [PATCH 14/26] x86: coral: Remove unwanted nodes from SPL/TPL Simon Glass
2020-12-19 17:40 ` [PATCH 15/26] x86: Drop rtc from SPL Simon Glass
2020-12-19 17:40 ` [PATCH 16/26] dm: core: Split out alloc code into a new function Simon Glass
2020-12-19 17:40 ` Simon Glass [this message]
2020-12-21 11:41   ` [PATCH 17/26] dm: core: Rename sqq to seq_ Andy Shevchenko
2020-12-28 16:26   ` Simon Glass
2020-12-19 17:40 ` [PATCH 18/26] dm: core: Access device flags through functions Simon Glass
2020-12-19 17:40 ` [PATCH 19/26] dm: core: Rename device flags to indicate it is private Simon Glass
2020-12-19 17:40 ` [PATCH 20/26] dm: core: Rename dev_has_of_node() to dev_has_ofnode() Simon Glass
2020-12-19 17:40 ` [PATCH 21/26] dm: core: Use dev_has_ofnode() instead of dev_of_valid() Simon Glass
2020-12-21 11:41   ` Andy Shevchenko
2020-12-28 16:26   ` Simon Glass
2021-01-04 11:01   ` Patrick DELAUNAY
2020-12-19 17:40 ` [PATCH 22/26] dm: core: Access device ofnode through functions Simon Glass
2020-12-19 17:40   ` Simon Glass
2021-01-04 13:02   ` Patrick DELAUNAY
2021-01-04 13:02     ` Patrick DELAUNAY
2021-01-07 12:36     ` Simon Glass
2021-01-07 12:36       ` Simon Glass
2020-12-19 17:40 ` [PATCH 23/26] dm: core: Rename device node to indicate it is private Simon Glass
2020-12-19 17:40 ` [PATCH 24/26] dm: core: Split out scanning code to dm_scan() Simon Glass
2020-12-19 17:40 ` [PATCH 25/26] dm: core: Allow the uclass list to move Simon Glass
2020-12-19 17:40 ` [PATCH 26/26] dm: core: Add logging when lists_bind_fdt() fails Simon Glass
2020-12-28 16:26 ` [PATCH 25/26] dm: core: Allow the uclass list to move Simon Glass
2020-12-28 16:26 ` [PATCH 26/26] dm: core: Add logging when lists_bind_fdt() fails Simon Glass
2020-12-28 16:26 ` [PATCH 24/26] dm: core: Split out scanning code to dm_scan() Simon Glass
2020-12-28 16:26 ` [PATCH 23/26] dm: core: Rename device node to indicate it is private Simon Glass
2020-12-28 16:26 ` [PATCH 22/26] dm: core: Access device ofnode through functions Simon Glass
2020-12-28 16:26   ` Simon Glass
2020-12-28 16:26 ` [PATCH 20/26] dm: core: Rename dev_has_of_node() to dev_has_ofnode() Simon Glass
2020-12-28 16:26 ` [PATCH 19/26] dm: core: Rename device flags to indicate it is private Simon Glass
2020-12-28 16:26 ` [PATCH 18/26] dm: core: Access device flags through functions Simon Glass
2020-12-28 16:26 ` [PATCH 16/26] dm: core: Split out alloc code into a new function Simon Glass
2020-12-28 16:26 ` [PATCH 15/26] x86: Drop rtc from SPL Simon Glass
2020-12-28 16:26 ` [PATCH 14/26] x86: coral: Remove unwanted nodes from SPL/TPL Simon Glass
2020-12-28 16:26 ` [PATCH 13/26] x86: apl: Adjust how the UART gets its platform data Simon Glass
2020-12-28 16:26 ` [PATCH 11/26] dm: core: Move priv/plat structs for simple_bus to headers Simon Glass
2020-12-28 16:26 ` [PATCH 09/26] spi: Tweak a few strange SPI NOR features for of-platdata Simon Glass
2020-12-28 16:26 ` [PATCH 10/26] x86: apl: Use struct spi_nor instead of struct spi_flash Simon Glass
2020-12-28 16:26 ` [PATCH 08/26] spi: Tidy up get/set of device node Simon Glass
2020-12-28 16:26 ` [PATCH 07/26] x86: spl: Move priv/plat structs to headers Simon Glass
2020-12-28 16:26 ` [PATCH 06/26] x86: Move priv/plat structs for intel_common " Simon Glass
2020-12-28 16:26 ` [PATCH 05/26] x86: apl: Move priv/plat structs " Simon Glass
2020-12-28 16:26 ` [PATCH 04/26] sandbox: Update dts files to reduce SPL size Simon Glass
2020-12-28 16:26 ` [PATCH 03/26] sandbox: Add a compatible string for spltest Simon Glass
2020-12-28 16:26 ` [PATCH 02/26] sandbox: i2c: Move priv into a header file Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201219174018.1114146-16-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.