[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 1/7] tests/libqos/fw_cfg: Document io_fw_cfg_init to drop io_f
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 1/7] tests/libqos/fw_cfg: Document io_fw_cfg_init to drop io_fw_cfg_uninit |
Date: |
Mon, 7 Oct 2019 17:18:59 +0200 |
Document io_fw_cfg_init() return value must be released
with g_free(). Directly calling g_free() we don't really
need io_fw_cfg_uninit(): remove it.
This partly reverts commit 0729d833d6d6:
"tests/libqos: Add io_fw_cfg_uninit()"
Reviewed-by: Laszlo Ersek <address@hidden>
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
tests/libqos/fw_cfg.c | 5 -----
tests/libqos/fw_cfg.h | 11 +++++++++--
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/tests/libqos/fw_cfg.c b/tests/libqos/fw_cfg.c
index 1f46258f96..37c3f2cf4d 100644
--- a/tests/libqos/fw_cfg.c
+++ b/tests/libqos/fw_cfg.c
@@ -157,8 +157,3 @@ QFWCFG *io_fw_cfg_init(QTestState *qts, uint16_t base)
return fw_cfg;
}
-
-void io_fw_cfg_uninit(QFWCFG *fw_cfg)
-{
- g_free(fw_cfg);
-}
diff --git a/tests/libqos/fw_cfg.h b/tests/libqos/fw_cfg.h
index 13325cc4ff..15604040bd 100644
--- a/tests/libqos/fw_cfg.h
+++ b/tests/libqos/fw_cfg.h
@@ -36,8 +36,15 @@ size_t qfw_cfg_get_file(QFWCFG *fw_cfg, const char *filename,
QFWCFG *mm_fw_cfg_init(QTestState *qts, uint64_t base);
void mm_fw_cfg_uninit(QFWCFG *fw_cfg);
+/**
+ * io_fw_cfg_init():
+ * @qts: The #QTestState that will be referred to by the QFWCFG object.
+ * @base: The I/O address of the fw_cfg device in the guest.
+ *
+ * Returns a newly allocated QFWCFG object which must be released
+ * with a call to g_free() when no longer required.
+ */
QFWCFG *io_fw_cfg_init(QTestState *qts, uint16_t base);
-void io_fw_cfg_uninit(QFWCFG *fw_cfg);
static inline QFWCFG *pc_fw_cfg_init(QTestState *qts)
{
@@ -46,7 +53,7 @@ static inline QFWCFG *pc_fw_cfg_init(QTestState *qts)
static inline void pc_fw_cfg_uninit(QFWCFG *fw_cfg)
{
- io_fw_cfg_uninit(fw_cfg);
+ g_free(fw_cfg);
}
#endif
--
2.21.0
- [PATCH v2 0/7] fw_cfg: Run tests on big-endian, Philippe Mathieu-Daudé, 2019/10/07
- [PATCH v2 1/7] tests/libqos/fw_cfg: Document io_fw_cfg_init to drop io_fw_cfg_uninit,
Philippe Mathieu-Daudé <=
- [PATCH v2 2/7] tests/libqos/fw_cfg: Document mm_fw_cfg_init to drop mm_fw_cfg_uninit, Philippe Mathieu-Daudé, 2019/10/07
- [PATCH v2 3/7] tests/libqos/fw_cfg: Document pc_fw_cfg_init to drop pc_fw_cfg_uninit, Philippe Mathieu-Daudé, 2019/10/07
- [PATCH v2 4/7] tests/fw_cfg: Let the tests use a context, Philippe Mathieu-Daudé, 2019/10/07
- [PATCH v2 5/7] tests/libqos/fw_cfg: Pass QTestState as argument, Philippe Mathieu-Daudé, 2019/10/07
- [PATCH v2 6/7] tests/fw_cfg: Declare one QFWCFG for all tests, Philippe Mathieu-Daudé, 2019/10/07