[U-Boot] [PATCH v4 09/15] dm: Cast away the const-ness of the global_data pointer
Marek Vasut
marex at denx.de
Sun Jun 8 07:00:08 CEST 2014
On Friday, June 06, 2014 at 09:13:26 PM, Simon Glass wrote:
> 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 at chromium.org>
> ---
[...]
> - ret = device_bind_by_name(NULL, &root_info, &gd->dm_root);
> + ret = device_bind_by_name(NULL, &root_info, &DM_ROOT());
[...]
> +/* Cast away any volatile pointer */
> +#define DM_ROOT() (((gd_t *)gd)->dm_root)
> +#define DM_UCLASS_ROOT() (((gd_t *)gd)->uclass_root)
Can you implement this "DM_ROOT()" macro as a function instead ? I believe
that'd be much nicer , would have typechecking etc., usual stuff.
Best regards,
Marek Vasut
More information about the U-Boot
mailing list