[PATCH 1/3] fixup! common: add initial barebox deep-probe support

Sascha Hauer sha at pengutronix.de
Mon May 3 04:54:59 PDT 2021


On Wed, Apr 28, 2021 at 12:28:19PM +0200, Marco Felsch wrote:
> ---
> Hi,
> 
> this is just a proposal to change the current linker array approach to
> an initcall approach. Why? Because now we can simply register a
> board-driver without having to list each compatible. 
> 
> I used the pure_initcall without adding a new one, since the
> documentation says that pure_initcalls are used to init variables. In
> our case we init boards_list.
> 
> Regards,
>   Marco
> 
>  
> -extern struct deep_probe_entry __barebox_deep_probe_start;
> -extern struct deep_probe_entry __barebox_deep_probe_end;
> +#define deep_probe_enable_board_driver(drv)			\
> +	_deep_probe_enable_driver(__UNIQUE_ID(deepprobe),drv)
>  
> -#define __BAREBOX_DEEP_PROBE_ENABLE(_entry,_compatible)			\
> -	static const struct deep_probe_entry _entry			\
> -	__attribute__ ((used,section (".barebox_deep_probe_" __stringify(_entry)))) = { \
> -		.compatible = _compatible,				\
> -	}
> +#define _deep_probe_enable_compatible(id,compatible)		\
> +	static int __init id(void)				\
> +	{							\
> +		return deep_probe_enable_board(NULL,compatible);\
> +	}							\
> +	pure_initcall(id)
>  
> -#define BAREBOX_DEEP_PROBE_ENABLE(_compatible)	\
> -	__BAREBOX_DEEP_PROBE_ENABLE(__UNIQUE_ID(deepprobe),_compatible)

I like the version with the linker array as we don't add a whole bunch
of new initcalls. Why not simply replace the _compatible argument with a
pointer to a of_device_id array?

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list