diff mbox series

[12/18] hw/nvram/fw_cfg: Inline fw_cfg_file_slots()

Message ID 20250501210456.89071-13-philmd@linaro.org
State New
Headers show
Series hw/i386/pc: Remove deprecated 2.8 and 2.9 PC machines | expand

Commit Message

Philippe Mathieu-Daudé May 1, 2025, 9:04 p.m. UTC
Now than fw_cfg_file_slots() only returns
FW_CFG_FILE_SLOTS_DFLT, we can inline it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/nvram/fw_cfg.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index 71c41c979d7..de65ee8342e 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -255,15 +255,10 @@  static void fw_cfg_write(FWCfgState *s, uint8_t value)
     /* nothing, write support removed in QEMU v2.4+ */
 }
 
-static inline uint16_t fw_cfg_file_slots(const FWCfgState *s)
-{
-    return FW_CFG_FILE_SLOTS_DFLT;
-}
-
 /* Note: this function returns an exclusive limit. */
 static inline uint32_t fw_cfg_max_entry(const FWCfgState *s)
 {
-    return FW_CFG_FILE_FIRST + fw_cfg_file_slots(s);
+    return FW_CFG_FILE_FIRST + FW_CFG_FILE_SLOTS_DFLT;
 }
 
 static int fw_cfg_select(FWCfgState *s, uint16_t key)
@@ -845,13 +840,13 @@  void fw_cfg_add_file_callback(FWCfgState *s,  const char *filename,
     int order = 0;
 
     if (!s->files) {
-        dsize = sizeof(uint32_t) + sizeof(FWCfgFile) * fw_cfg_file_slots(s);
+        dsize = sizeof(uint32_t) + sizeof(FWCfgFile) * FW_CFG_FILE_SLOTS_DFLT;
         s->files = g_malloc0(dsize);
         fw_cfg_add_bytes(s, FW_CFG_FILE_DIR, s->files, dsize);
     }
 
     count = be32_to_cpu(s->files->count);
-    assert(count < fw_cfg_file_slots(s));
+    assert(count < FW_CFG_FILE_SLOTS_DFLT);
 
     /* Find the insertion point, sorting by file name. */
     for (index = count;
@@ -926,7 +921,7 @@  void *fw_cfg_modify_file(FWCfgState *s, const char *filename,
         }
     }
 
-    assert(index < fw_cfg_file_slots(s));
+    assert(index < FW_CFG_FILE_SLOTS_DFLT);
 
     /* add new one */
     fw_cfg_add_file_callback(s, filename, NULL, NULL, NULL, data, len, true);