Skip to contentSkip to conversation

Trivial cleanup in hw/acpi

PATCH Applied Wei Yang 2 participants 7 messages Feb 14, 2019 – Mar 6, 2019

lore
Share & tools
lore

Wei Yang

author
#0 lore raw

v4 cover Trivial cleanup in hw/acpi

There are several functions/variable which are not used anymore.

This serials just remove those without functional change.

v4: fix reviewed-by tags
v3: add ack and repost in a new thread
v2: change commit log from "is now used in no place" to "in not used anymore"

Wei Yang (3):
hw/i386/pc.c: remove unused function pc_acpi_init() hw/acpi: remove unused function acpi_table_add_builtin() hw/acpi: remove unnecessary variable acpi_table_builtin

 hw/acpi/core.c         | 10 +---------
 hw/i386/pc.c           | 27 ---------------------------
 include/hw/acpi/acpi.h |  1 -
 include/hw/i386/pc.h   |  1 -
 4 files changed, 1 insertion(+), 38 deletions(-)
Signature · 1 line
2.19.1
author
#1 lore raw

PATCH v4 1/3 hw/i386/pc.c: remove unused function pc_acpi_init()

Function pc_acpi_init() is not used anymore.

Remove the definition and declaration.

---
 hw/i386/pc.c         | 27 ---------------------------
 include/hw/i386/pc.h |  1 -
 2 files changed, 28 deletions(-)
hw/i386/pc.c +0 -27
index 5317e08f60..734d3268fa 100644
@@ -1280,33 +1280,6 @@ void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory,
                                         pci_address_space, -1);
 }
 
-void pc_acpi_init(const char *default_dsdt)
-{
-    char *filename;
-
-    if (acpi_tables != NULL) {
-        /* manually set via -acpitable, leave it alone */
-        return;
-    }
-
-    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, default_dsdt);
-    if (filename == NULL) {
-        warn_report("failed to find %s", default_dsdt);
-    } else {
-        QemuOpts *opts = qemu_opts_create(qemu_find_opts("acpi"), NULL, 0,
-                                          &error_abort);
-        Error *err = NULL;
-
-        qemu_opt_set(opts, "file", filename, &error_abort);
-
-        acpi_table_add_builtin(opts, &err);
-        if (err) {
-            warn_reportf_err(err, "failed to load %s: ", filename);
-        }
-        g_free(filename);
-    }
-}
-
 void xen_load_linux(PCMachineState *pcms)
 {
     int i;
include/hw/i386/pc.h +0 -1
index 9d29c4b1df..541124ba6d 100644
@@ -187,7 +187,6 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
 
 void pc_cpus_init(PCMachineState *pcms);
 void pc_hot_add_cpu(const int64_t id, Error **errp);
-void pc_acpi_init(const char *default_dsdt);
 
 void pc_guest_info_init(PCMachineState *pcms);
 
Signature · 1 line
2.19.1
#2 lore raw

Re: [Qemu-devel] [Qemu-trivial] [Patch v4 1/3] hw/i386/pc.c: remove unused function pc_acpi_init()

Quoted 58 lines · Wei Yang

Function pc_acpi_init() is not used anymore.

Remove the definition and declaration.

---
 hw/i386/pc.c         | 27 ---------------------------
 include/hw/i386/pc.h |  1 -
 2 files changed, 28 deletions(-)
hw/i386/pc.c +0 -27
index 5317e08f60..734d3268fa 100644
@@ -1280,33 +1280,6 @@ void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory,
                                         pci_address_space, -1);
 }
 
-void pc_acpi_init(const char *default_dsdt)
-{
-    char *filename;
-
-    if (acpi_tables != NULL) {
-        /* manually set via -acpitable, leave it alone */
-        return;
-    }
-
-    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, default_dsdt);
-    if (filename == NULL) {
-        warn_report("failed to find %s", default_dsdt);
-    } else {
-        QemuOpts *opts = qemu_opts_create(qemu_find_opts("acpi"), NULL, 0,
-                                          &error_abort);
-        Error *err = NULL;
-
-        qemu_opt_set(opts, "file", filename, &error_abort);
-
-        acpi_table_add_builtin(opts, &err);
-        if (err) {
-            warn_reportf_err(err, "failed to load %s: ", filename);
-        }
-        g_free(filename);
-    }
-}
-
 void xen_load_linux(PCMachineState *pcms)
 {
     int i;
include/hw/i386/pc.h +0 -0
index 9d29c4b1df..541124ba6d 100644

include/hw/i386/pc.h void pc_acpi_smi_interrupt(void *opaque, int irq, int level); · line 192

Quoted 7 lines
include/hw/i386/pc.h +0 -1
@@ -187,7 +187,6 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
 
 void pc_cpus_init(PCMachineState *pcms);
 void pc_hot_add_cpu(const int64_t id, Error **errp);
-void pc_acpi_init(const char *default_dsdt);
 
 void pc_guest_info_init(PCMachineState *pcms);
 

Applied to my trivial-patches branch.

Thanks,
Laurent

author
#3 lore raw

PATCH v4 2/3 hw/acpi: remove unused function acpi_table_add_builtin()

In reply to Wei Yang

Function acpi_table_add_builtin() is not used anymore.

Remove the definition and declaration.

---
 hw/acpi/core.c         | 6 ------
 include/hw/acpi/acpi.h | 1 -
 2 files changed, 7 deletions(-)
hw/acpi/core.c +0 -6
index d6f0709691..e9b1a85e54 100644
@@ -305,12 +305,6 @@ out:
 
 static bool acpi_table_builtin = false;
 
-void acpi_table_add_builtin(const QemuOpts *opts, Error **errp)
-{
-    acpi_table_builtin = true;
-    acpi_table_add(opts, errp);
-}
-
 unsigned acpi_table_len(void *current)
 {
     struct acpi_table_header *hdr = current - sizeof(hdr->_length);
include/hw/acpi/acpi.h +0 -1
index c20ace0d0b..4a8bbaf1b5 100644
@@ -190,7 +190,6 @@ uint8_t *acpi_table_first(void);
 uint8_t *acpi_table_next(uint8_t *current);
 unsigned acpi_table_len(void *current);
 void acpi_table_add(const QemuOpts *opts, Error **errp);
-void acpi_table_add_builtin(const QemuOpts *opts, Error **errp);
 
 typedef struct AcpiSlicOem AcpiSlicOem;
 struct AcpiSlicOem {
Signature · 1 line
2.19.1
#4 lore raw

Re: [Qemu-devel] [Qemu-trivial] [Patch v4 2/3] hw/acpi: remove unused function acpi_table_add_builtin()

Quoted 36 lines · Wei Yang

Function acpi_table_add_builtin() is not used anymore.

Remove the definition and declaration.

---
 hw/acpi/core.c         | 6 ------
 include/hw/acpi/acpi.h | 1 -
 2 files changed, 7 deletions(-)
hw/acpi/core.c +0 -6
index d6f0709691..e9b1a85e54 100644
@@ -305,12 +305,6 @@ out:
 
 static bool acpi_table_builtin = false;
 
-void acpi_table_add_builtin(const QemuOpts *opts, Error **errp)
-{
-    acpi_table_builtin = true;
-    acpi_table_add(opts, errp);
-}
-
 unsigned acpi_table_len(void *current)
 {
     struct acpi_table_header *hdr = current - sizeof(hdr->_length);
include/hw/acpi/acpi.h +0 -0
index c20ace0d0b..4a8bbaf1b5 100644

include/hw/acpi/acpi.h uint8_t *acpi_table_first(void); · line 195

Quoted 7 lines
include/hw/acpi/acpi.h +0 -1
@@ -190,7 +190,6 @@ uint8_t *acpi_table_first(void);
 uint8_t *acpi_table_next(uint8_t *current);
 unsigned acpi_table_len(void *current);
 void acpi_table_add(const QemuOpts *opts, Error **errp);
-void acpi_table_add_builtin(const QemuOpts *opts, Error **errp);
 
 typedef struct AcpiSlicOem AcpiSlicOem;
 struct AcpiSlicOem {

Applied to my trivial-patches branch.

Thanks,
Laurent

author
#5 lore raw

PATCH v4 3/3 hw/acpi: remove unnecessary variable acpi_table_builtin

In reply to Wei Yang

acpi_table_builtin is now always false, it is not necessary to check it again.

This patch just removes it.

---
 hw/acpi/core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
hw/acpi/core.c +1 -3
index e9b1a85e54..f9c96535d1 100644
@@ -303,8 +303,6 @@ out:
     error_propagate(errp, err);
 }
 
-static bool acpi_table_builtin = false;
-
 unsigned acpi_table_len(void *current)
 {
     struct acpi_table_header *hdr = current - sizeof(hdr->_length);
@@ -320,7 +318,7 @@ void *acpi_table_hdr(void *h)
 
 uint8_t *acpi_table_first(void)
 {
-    if (acpi_table_builtin || !acpi_tables) {
+    if (!acpi_tables) {
         return NULL;
     }
     return acpi_table_hdr(acpi_tables + ACPI_TABLE_PFX_SIZE);
Signature · 1 line
2.19.1
#6 lore raw

Re: [Qemu-devel] [Qemu-trivial] [Patch v4 3/3] hw/acpi: remove unnecessary variable acpi_table_builtin

Quoted 28 lines · Wei Yang

acpi_table_builtin is now always false, it is not necessary to check it again.

This patch just removes it.

---
 hw/acpi/core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
hw/acpi/core.c +0 -2
index e9b1a85e54..f9c96535d1 100644
@@ -303,8 +303,6 @@ out:
     error_propagate(errp, err);
 }
 
-static bool acpi_table_builtin = false;
-
 unsigned acpi_table_len(void *current)
 {
     struct acpi_table_header *hdr = current - sizeof(hdr->_length);

hw/acpi/core.c void *acpi_table_hdr(void *h) · line 324

Quoted 8 lines
hw/acpi/core.c +1 -1
@@ -320,7 +318,7 @@ void *acpi_table_hdr(void *h)
 
 uint8_t *acpi_table_first(void)
 {
-    if (acpi_table_builtin || !acpi_tables) {
+    if (!acpi_tables) {
         return NULL;
     }
     return acpi_table_hdr(acpi_tables + ACPI_TABLE_PFX_SIZE);

Applied to my trivial-patches branch.

Thanks,
Laurent