dm: Cast away the const-ness of the global_data pointer

In a very few cases we need to adjust the driver model root device, such as
when setting it up at initialisation. Add a macro to make this easier.

Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h
index ea3df36..26e5cf5 100644
--- a/include/dm/device-internal.h
+++ b/include/dm/device-internal.h
@@ -84,4 +84,8 @@
  */
 int device_unbind(struct udevice *dev);
 
+/* Cast away any volatile pointer */
+#define DM_ROOT_NON_CONST		(((gd_t *)gd)->dm_root)
+#define DM_UCLASS_ROOT_NON_CONST	(((gd_t *)gd)->uclass_root)
+
 #endif