[PATCH] firmware: fix -Wunused-function compiler warnings

From: Qian Cai
Date: Tue Jul 23 2019 - 09:32:18 EST


The commit 5342e7093ff2 ("firmware: Factor out the paged buffer handling
code") introduced a few compilation warnings when
CONFIG_FW_LOADER_USER_HELPER=n due to fw_grow_paged_buf() and
fw_grow_paged_buf() are only used in
drivers/base/firmware_loader/fallback.c, and the later will only be
built if CONFIG_FW_LOADER_USER_HELPER=y.

In file included from drivers/base/firmware_loader/main.c:41:
drivers/base/firmware_loader/firmware.h:145:12: warning:
'fw_map_paged_buf' defined but not used [-Wunused-function]
static int fw_map_paged_buf(struct fw_priv *fw_priv) { return -ENXIO; }
^~~~~~~~~~~~~~~~
drivers/base/firmware_loader/firmware.h:144:12: warning:
'fw_grow_paged_buf' defined but not used [-Wunused-function]
static int fw_grow_paged_buf(struct fw_priv *fw_priv, int pages_needed)
{ return -ENXIO; }

Fix it by removing those unused functions all together when
CONFIG_FW_LOADER_USER_HELPER=n.

Fixes: 5342e7093ff2 ("firmware: Factor out the paged buffer handling code")
Signed-off-by: Qian Cai <cai@xxxxxx>
---
drivers/base/firmware_loader/firmware.h | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/base/firmware_loader/firmware.h b/drivers/base/firmware_loader/firmware.h
index 842e63f19f22..e74117bf8587 100644
--- a/drivers/base/firmware_loader/firmware.h
+++ b/drivers/base/firmware_loader/firmware.h
@@ -141,8 +141,6 @@ int assign_fw(struct firmware *fw, struct device *device,
int fw_map_paged_buf(struct fw_priv *fw_priv);
#else
static inline void fw_free_paged_buf(struct fw_priv *fw_priv) {}
-static int fw_grow_paged_buf(struct fw_priv *fw_priv, int pages_needed) { return -ENXIO; }
-static int fw_map_paged_buf(struct fw_priv *fw_priv) { return -ENXIO; }
#endif

#endif /* __FIRMWARE_LOADER_H */
--
1.8.3.1