Skip to contentSkip to conversation

nvdimm: clean up

PATCH New Wei Yang 1 participant 4 messages Mar 12, 2019

lore
Share & tools
lore

Wei Yang

author
#0 lore raw

v2 cover nvdimm: clean up

Here are three trivial cleanup on argument/variable.

---
v2:
* remove the last one which breaks hotplug

Wei Yang (3):
nvdimm: fix typo in nvdimm_build_nvdimm_devices argument
nvdimm: use *function* directly instead of allocating it again
nvdimm: use NVDIMM_ACPI_IO_LEN for the proper IO size

 hw/acpi/nvdimm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.19.1
author
#1 lore raw

PATCH v2 1/3 nvdimm: fix typo in nvdimm_build_nvdimm_devices argument

Quoted 1 line

From dsm_dma_arrea to dsm_dma_area.

---
 hw/acpi/nvdimm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/acpi/nvdimm.c +2 -2
index e53b2cb681..39af8cdba8 100644
@@ -1260,7 +1260,7 @@ static void nvdimm_build_nvdimm_devices(Aml *root_dev, uint32_t ram_slots)
 }
 
 static void nvdimm_build_ssdt(GArray *table_offsets, GArray *table_data,
-                              BIOSLinker *linker, GArray *dsm_dma_arrea,
+                              BIOSLinker *linker, GArray *dsm_dma_area,
                               uint32_t ram_slots)
 {
     Aml *ssdt, *sb_scope, *dev;
@@ -1307,7 +1307,7 @@ static void nvdimm_build_ssdt(GArray *table_offsets, GArray *table_data,
                                                NVDIMM_ACPI_MEM_ADDR);
 
     bios_linker_loader_alloc(linker,
-                             NVDIMM_DSM_MEM_FILE, dsm_dma_arrea,
+                             NVDIMM_DSM_MEM_FILE, dsm_dma_area,
                              sizeof(NvdimmDsmIn), false /* high memory */);
     bios_linker_loader_add_pointer(linker,
         ACPI_BUILD_TABLE_FILE, mem_addr_offset, sizeof(uint32_t),
Signature · 1 line
2.19.1
author
#2 lore raw

PATCH v2 2/3 nvdimm: use *function* directly instead of allocating it again

In reply to Wei Yang

At the beginning or nvdimm_build_common_dsm(), variable *function* is already allocated for Arg2.

This patch reuse variable *function* instead of allocating it again.

---
 hw/acpi/nvdimm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/acpi/nvdimm.c +1 -1
index 39af8cdba8..e63a1ef15d 100644
@@ -1086,7 +1086,7 @@ static void nvdimm_build_common_dsm(Aml *dev)
      */
     aml_append(method, aml_store(handle, aml_name(NVDIMM_DSM_HANDLE)));
     aml_append(method, aml_store(aml_arg(1), aml_name(NVDIMM_DSM_REVISION)));
-    aml_append(method, aml_store(aml_arg(2), aml_name(NVDIMM_DSM_FUNCTION)));
+    aml_append(method, aml_store(function, aml_name(NVDIMM_DSM_FUNCTION)));
 
     /*
      * The fourth parameter (Arg3) of _DSM is a package which contains
Signature · 1 line
2.19.1
author
#3 lore raw

PATCH v2 3/3 nvdimm: use NVDIMM_ACPI_IO_LEN for the proper IO size

In reply to Wei Yang

The IO range is defined to 4 bytes with NVDIMM_ACPI_IO_LEN, so it is more proper to use this macro instead of calculating it by sizeof.

---
 hw/acpi/nvdimm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/acpi/nvdimm.c +1 -1
index e63a1ef15d..2457c1aa44 100644
@@ -992,7 +992,7 @@ static void nvdimm_build_common_dsm(Aml *dev)
     field = aml_field(NVDIMM_DSM_IOPORT, AML_DWORD_ACC, AML_NOLOCK,
                       AML_PRESERVE);
     aml_append(field, aml_named_field(NVDIMM_DSM_NOTIFY,
-               sizeof(uint32_t) * BITS_PER_BYTE));
+               NVDIMM_ACPI_IO_LEN * BITS_PER_BYTE));
     aml_append(method, field);
 
     /*
Signature · 1 line
2.19.1