dm: core: Add dev_get_uclass_priv() to access uclass private data

Add a convenience function to access the private data that a uclass stores
for each of its devices. Convert over most existing uses for consistency
and to provide an example for others.

Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c
index 5846e76..1c29ba8 100644
--- a/drivers/misc/cros_ec.c
+++ b/drivers/misc/cros_ec.c
@@ -1087,7 +1087,7 @@
 #ifdef CONFIG_DM_CROS_EC
 int cros_ec_register(struct udevice *dev)
 {
-	struct cros_ec_dev *cdev = dev->uclass_priv;
+	struct cros_ec_dev *cdev = dev_get_uclass_priv(dev);
 	const void *blob = gd->fdt_blob;
 	int node = dev->of_offset;
 	char id[MSG_BYTES];
@@ -1128,7 +1128,7 @@
 	ret = uclass_get_device(UCLASS_CROS_EC, 0, &udev);
 	if (ret)
 		return ret;
-	dev = udev->uclass_priv;
+	dev = dev_get_uclass_priv(udev);
 	return 0;
 #else
 	int node = 0;
@@ -1610,7 +1610,7 @@
 		printf("Cannot get cros-ec device (err=%d)\n", ret);
 		return 1;
 	}
-	dev = udev->uclass_priv;
+	dev = dev_get_uclass_priv(udev);
 #else
 	/* Just use the last allocated device; there should be only one */
 	if (!last_dev) {