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>
diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index ca083b4..fad9770 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -137,7 +137,7 @@
 			continue;
 		/* Check for the name or the sequence number to match */
 		if (strcmp(it->name, devname) == 0 ||
-		    (endp > startp && it->seq == seq))
+		    (endp > startp && dev_seq(it) == seq))
 			return it;
 	}
 
@@ -189,7 +189,7 @@
 int eth_get_dev_index(void)
 {
 	if (eth_get_dev())
-		return eth_get_dev()->seq;
+		return dev_seq(eth_get_dev());
 	return -1;
 }
 
@@ -202,7 +202,7 @@
 		return -EINVAL;
 
 	/* seq is valid since the device is active */
-	if (eth_get_ops(dev)->write_hwaddr && !eth_mac_skip(dev->seq)) {
+	if (eth_get_ops(dev)->write_hwaddr && !eth_mac_skip(dev_seq(dev))) {
 		pdata = dev->plat;
 		if (!is_valid_ethaddr(pdata->enetaddr)) {
 			printf("\nError: %s address %pM illegal value\n",
@@ -434,11 +434,11 @@
 
 		bootstage_mark(BOOTSTAGE_ID_NET_ETH_INIT);
 		do {
-			if (dev->seq != -1) {
+			if (dev_seq(dev) != -1) {
 				if (num_devices)
 					printf(", ");
 
-				printf("eth%d: %s", dev->seq, dev->name);
+				printf("eth%d: %s", dev_seq(dev), dev->name);
 
 				if (ethprime && dev == prime_dev)
 					printf(" [PRIME]");
@@ -446,7 +446,7 @@
 
 			eth_write_hwaddr(dev);
 
-			if (dev->seq != -1)
+			if (dev_seq(dev) != -1)
 				num_devices++;
 			uclass_next_device_check(&dev);
 		} while (dev);
@@ -547,7 +547,7 @@
 			eth_get_ops(dev)->read_rom_hwaddr(dev);
 	}
 
-	eth_env_get_enetaddr_by_index("eth", dev->seq, env_enetaddr);
+	eth_env_get_enetaddr_by_index("eth", dev_seq(dev), env_enetaddr);
 	if (!is_zero_ethaddr(env_enetaddr)) {
 		if (!is_zero_ethaddr(pdata->enetaddr) &&
 		    memcmp(pdata->enetaddr, env_enetaddr, ARP_HLEN)) {
@@ -562,13 +562,14 @@
 		/* Override the ROM MAC address */
 		memcpy(pdata->enetaddr, env_enetaddr, ARP_HLEN);
 	} else if (is_valid_ethaddr(pdata->enetaddr)) {
-		eth_env_set_enetaddr_by_index("eth", dev->seq, pdata->enetaddr);
+		eth_env_set_enetaddr_by_index("eth", dev_seq(dev),
+					      pdata->enetaddr);
 	} else if (is_zero_ethaddr(pdata->enetaddr) ||
 		   !is_valid_ethaddr(pdata->enetaddr)) {
 #ifdef CONFIG_NET_RANDOM_ETHADDR
 		net_random_ethaddr(pdata->enetaddr);
 		printf("\nWarning: %s (eth%d) using random MAC address - %pM\n",
-		       dev->name, dev->seq, pdata->enetaddr);
+		       dev->name, dev_seq(dev), pdata->enetaddr);
 #else
 		printf("\nError: %s address not set.\n",
 		       dev->name);