[PATCH 06/10] ratp: implement generic command support

Aleksander Morgado aleksander at aleksander.es
Tue Feb 6 08:49:10 PST 2018


>> +
>> +#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


-- 
Aleksander
https://aleksander.es



More information about the barebox mailing list