commands: Move mem_parse_options() to lib/misc.c
As a first step of de-cluttering /dev/mem related code, move
mem_parse_options() out of commands/mem.c into lib/misc.c where it
seem to fit better. With this change we no longer explicitly turn this
code off using CONFIG_COMPILE_MEMORY and instead rely on LTO to get
rid of it when it's not being used.

While at it, also fix return value by replacing COMMAND_ERROR_USAGE
with -EINVAL. All of the callers of mem_parse_options() expect
negative error code as a sign of failure and COMMAND_ERROR_USAGE is
not negative.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
1 parent 25082ef commit 60aaeb8be019c75d86cd0aa9615d1ef470983418
@Andrey Smirnov Andrey Smirnov authored on 29 Jan 2019
Sascha Hauer committed on 29 Jan 2019
Showing 2 changed files
View
commands/mem.c
View
lib/misc.c