From e6b4e660f08894ef8fa2aaee3ef5c0f86ae4c59d Mon Sep 17 00:00:00 2001 From: Ben Levinsky Date: Thu, 28 May 2026 19:16:36 -0700 Subject: remoteproc: Add helper for optional ELF resource tables Add a helper macro around rproc_elf_load_rsc_table() for thin parse_fw() wrappers that treat a missing ELF resource table as optional while keeping per-driver logging decisions local to the caller of rproc_elf_load_rsc_table_optional(). Signed-off-by: Ben Levinsky Tested-by: Peng Fan #i.MX8MP-EVK Link: https://lore.kernel.org/r/20260529021637.2077602-5-ben.levinsky@amd.com Signed-off-by: Mathieu Poirier --- drivers/remoteproc/remoteproc_internal.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h index 9afda697271d..02c00475b010 100644 --- a/drivers/remoteproc/remoteproc_internal.h +++ b/drivers/remoteproc/remoteproc_internal.h @@ -149,6 +149,17 @@ static inline int rproc_mem_entry_iounmap(struct rproc *rproc, return 0; } +#define rproc_elf_load_rsc_table_optional(rproc, fw, dev_func, fmt, ...) \ + ({ \ + int ret = rproc_elf_load_rsc_table(rproc, fw); \ + if (ret == -EINVAL) { \ + dev_func(&rproc->dev, fmt, ##__VA_ARGS__); \ + return 0; \ + } else { \ + return ret; \ + } \ + }) + static inline int rproc_prepare_device(struct rproc *rproc) { if (rproc->ops->prepare) -- cgit v1.2.3