[PATCH 06/10] ratp: implement generic command support
Sascha Hauer
s.hauer at pengutronix.de
Wed Feb 7 00:34:00 PST 2018
On Tue, Feb 06, 2018 at 05:49:10PM +0100, Aleksander Morgado wrote:
> >> +
> >> +#define BAREBOX_RATP_CMD_START(_name) \
> >> +extern const struct ratp_command __barebox_cmd_##_name; \
> >
> > You shouldn't use the same name as the existing barebox commands,
> > otherwise there might be name clashes. Add some _ratp_ to it.
> >
>
> Ah, sure.
>
> >> +const struct ratp_command __barebox_cmd_##_name \
> >> + __attribute__ ((unused,section (".barebox_ratp_cmd_" __stringify(_name)))) = { \
> >> + .id = BB_RATP_TYPE_##_name,
> >
> > I am not sure if I like the magic construction of the id field. Being
> > able to grep for BB_RATP_TYPE_PING and finding the user has advantages.
> > How about manually setting the field in the body of the command instead
> > of constructing it?
> >
>
> You mean doing this instead?
>
> BAREBOX_RATP_CMD_START(PING)
> .cmd = ratp_cmd_ping,
> .id = BB_RATP_TYPE_PING
> BAREBOX_RATP_CMD_END
Yes, that's what I meant.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list