All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] some simplifications in hw/core/fw-path-provider.c
@ 2022-01-21 20:29 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
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Daniel Henrique Barboza @ 2022-01-21 20:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: eduardo, pbonzini, Daniel Henrique Barboza, berrange

Hi,

These are somes simplifications I found interesting to make while I was
investigating Gitlab #720.

It isn't clear in the MAINTAINERS file who is responsible for this file,
so I'm ccing the QOM maintainers since it's the closest match.


Daniel Henrique Barboza (2):
  hw/core/fw-path-provider: turn fw_path_provider_get_dev_path() static
  hw/core/fw-path-provider.c: open code fw_path_provider_get_dev_path()

 hw/core/fw-path-provider.c    | 14 +++-----------
 include/hw/fw-path-provider.h |  2 --
 2 files changed, 3 insertions(+), 13 deletions(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] hw/core/fw-path-provider: turn fw_path_provider_get_dev_path() static
  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 ` Daniel Henrique Barboza
  2022-01-21 20:29 ` [PATCH 2/2] hw/core/fw-path-provider.c: open code fw_path_provider_get_dev_path() Daniel Henrique Barboza
  2022-01-21 23:47 ` [PATCH 0/2] some simplifications in hw/core/fw-path-provider.c Philippe Mathieu-Daudé via
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Henrique Barboza @ 2022-01-21 20:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: eduardo, pbonzini, Daniel Henrique Barboza, berrange

This function is used only by fw_path_provider_try_get_dev_path() in the
same file.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
 hw/core/fw-path-provider.c    | 4 ++--
 include/hw/fw-path-provider.h | 2 --
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/hw/core/fw-path-provider.c b/hw/core/fw-path-provider.c
index 4840faefd1..4bcf4e7e34 100644
--- a/hw/core/fw-path-provider.c
+++ b/hw/core/fw-path-provider.c
@@ -19,8 +19,8 @@
 #include "hw/fw-path-provider.h"
 #include "qemu/module.h"
 
-char *fw_path_provider_get_dev_path(FWPathProvider *p, BusState *bus,
-                                    DeviceState *dev)
+static char *fw_path_provider_get_dev_path(FWPathProvider *p, BusState *bus,
+                                           DeviceState *dev)
 {
     FWPathProviderClass *k = FW_PATH_PROVIDER_GET_CLASS(p);
 
diff --git a/include/hw/fw-path-provider.h b/include/hw/fw-path-provider.h
index 8e1d45651c..9ef50ebe4a 100644
--- a/include/hw/fw-path-provider.h
+++ b/include/hw/fw-path-provider.h
@@ -36,8 +36,6 @@ struct FWPathProviderClass {
     char *(*get_dev_path)(FWPathProvider *p, BusState *bus, DeviceState *dev);
 };
 
-char *fw_path_provider_get_dev_path(FWPathProvider *p, BusState *bus,
-                                    DeviceState *dev);
 char *fw_path_provider_try_get_dev_path(Object *o, BusState *bus,
                                         DeviceState *dev);
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] hw/core/fw-path-provider.c: open code fw_path_provider_get_dev_path()
  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
  2022-01-21 23:47 ` [PATCH 0/2] some simplifications in hw/core/fw-path-provider.c Philippe Mathieu-Daudé via
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Henrique Barboza @ 2022-01-21 20:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: eduardo, pbonzini, Daniel Henrique Barboza, berrange

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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] some simplifications in hw/core/fw-path-provider.c
  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 ` [PATCH 2/2] hw/core/fw-path-provider.c: open code fw_path_provider_get_dev_path() Daniel Henrique Barboza
@ 2022-01-21 23:47 ` Philippe Mathieu-Daudé via
  2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-01-21 23:47 UTC (permalink / raw)
  To: Daniel Henrique Barboza, qemu-devel; +Cc: eduardo, pbonzini, berrange

On 21/1/22 21:29, Daniel Henrique Barboza wrote:
> Hi,
> 
> These are somes simplifications I found interesting to make while I was
> investigating Gitlab #720.
> 
> It isn't clear in the MAINTAINERS file who is responsible for this file,
> so I'm ccing the QOM maintainers since it's the closest match.
> 
> 
> Daniel Henrique Barboza (2):
>    hw/core/fw-path-provider: turn fw_path_provider_get_dev_path() static
>    hw/core/fw-path-provider.c: open code fw_path_provider_get_dev_path()

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-01-21 23:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 2/2] hw/core/fw-path-provider.c: open code fw_path_provider_get_dev_path() Daniel Henrique Barboza
2022-01-21 23:47 ` [PATCH 0/2] some simplifications in hw/core/fw-path-provider.c Philippe Mathieu-Daudé via

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.