[PATCH v2] cmd: ubi: add a command to rename volume

Philippe REYNES philippe.reynes at softathome.com
Mon Mar 23 19:24:53 CET 2020

Hi Rasmus,

> On 23/03/2020 18.16, Philippe REYNES wrote:
>>> Can you use IS_ENABLED(CONFIG_...) and drop the #ifdef way above?
>> I've sent a v3 where I use IS_ENABLED instead of #ifdef.
>> But I've kept a #if IS_ENABLED(...) around the function ubi_rename_vol.
>> Otherwise if this option is not enabled, there is a warning when building :
>> CC cmd/ubi.o
>> cmd/ubi.c:254:12: warning: 'ubi_rename_vol' defined but not used
>> [-Wunused-function]
>> static int ubi_rename_vol(char *oldname, char *newname)
>> ^~~~~~~~~~~~~~
> Use C
> if (IS_ENABLED(CONFIG_...) && !strcmp(cmd, "rename"))
> not cpp
> if (!strcmp(cmd, "rename"))
> That way the compiler sees ubi_rename_vol is used, but also knows that
> it is dead code that can be eliminated. Less ifdeffery (none, actually),
> and the code in ubi_rename_vol gets compile coverage regardless of
> configuration.

Thanks a lot for this explanation.

I have sent a v4. And it works as expected, without the #if ... before
the function ubi_rename_vol, there isn't a warning if ubi rename is not
enabled in the config.

> Rasmus


More information about the U-Boot mailing list