From: Daniel Henrique Barboza <danielhb413@gmail.com>
To: qemu-devel@nongnu.org
Cc: eduardo@habkost.net, pbonzini@redhat.com,
Daniel Henrique Barboza <danielhb413@gmail.com>,
berrange@redhat.com
Subject: [PATCH 2/2] hw/core/fw-path-provider.c: open code fw_path_provider_get_dev_path()
Date: Fri, 21 Jan 2022 17:29:52 -0300 [thread overview]
Message-ID: <20220121202952.24763-3-danielhb413@gmail.com> (raw)
In-Reply-To: <20220121202952.24763-1-danielhb413@gmail.com>
fw_path_provider_get_dev_path() is 2 lines long and it's used only by
fw_path_provider_try_get_dev_path(), which checks if FWPathProvider is
not NULL before calling it.
Open coding fw_path_provider_get_dev_path() into
fw_path_provider_try_get_dev_path() simplifies the code inside
fw-path-provider.c and make it easier to grep our way into finding the
callers of the FWPathProviderClass::get_dev_path() interface.
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
hw/core/fw-path-provider.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/hw/core/fw-path-provider.c b/hw/core/fw-path-provider.c
index 4bcf4e7e34..b8fa649fe2 100644
--- a/hw/core/fw-path-provider.c
+++ b/hw/core/fw-path-provider.c
@@ -19,25 +19,17 @@
#include "hw/fw-path-provider.h"
#include "qemu/module.h"
-static char *fw_path_provider_get_dev_path(FWPathProvider *p, BusState *bus,
- DeviceState *dev)
-{
- FWPathProviderClass *k = FW_PATH_PROVIDER_GET_CLASS(p);
-
- return k->get_dev_path(p, bus, dev);
-}
-
char *fw_path_provider_try_get_dev_path(Object *o, BusState *bus,
DeviceState *dev)
{
FWPathProvider *p = (FWPathProvider *)
object_dynamic_cast(o, TYPE_FW_PATH_PROVIDER);
- if (p) {
- return fw_path_provider_get_dev_path(p, bus, dev);
+ if (!p) {
+ return NULL;
}
- return NULL;
+ return FW_PATH_PROVIDER_GET_CLASS(p)->get_dev_path(p, bus, dev);
}
static const TypeInfo fw_path_provider_info = {
--
2.34.1
next prev parent reply other threads:[~2022-01-21 20:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-21 20:29 [PATCH 0/2] some simplifications in hw/core/fw-path-provider.c Daniel Henrique Barboza
2022-01-21 20:29 ` [PATCH 1/2] hw/core/fw-path-provider: turn fw_path_provider_get_dev_path() static Daniel Henrique Barboza
2022-01-21 20:29 ` Daniel Henrique Barboza [this message]
2022-01-21 23:47 ` [PATCH 0/2] some simplifications in hw/core/fw-path-provider.c Philippe Mathieu-Daudé via
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220121202952.24763-3-danielhb413@gmail.com \
--to=danielhb413@gmail.com \
--cc=berrange@redhat.com \
--cc=eduardo@habkost.net \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).