The first patch simplies do_read somewhat by making use of an existing helper instead of parsing the dev_part string manually. As a bonus (and my actual motivation), it now understands dev#partname syntax - hard-coded partition numbers are so last decade.
I also need the symmetrical operation, being able to write to a named raw partition, and fortunately it doesn't require that many lines of code to implement that. There's a very minor change in the error reporting due to using cmdtp->name to generate the new messages, but I don't think "Error reading blocks" offers much that "read error" doesn't. Rasmus Villemoes (2): cmd: read: use part_get_info_by_dev_and_name_or_num() instead of open-coded dev_part parsing cmd: introduce 'write' command cmd/Kconfig | 5 +++++ cmd/Makefile | 1 + cmd/read.c | 61 ++++++++++++++++++++++++++-------------------------- 3 files changed, 36 insertions(+), 31 deletions(-) -- 2.37.2