sio/nuvoton/npcd378: Use acpi_device_path_join
This achieves the same without the strconcat & free dance.
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Change-Id: I4d8e9bae6085a6e05847b01497fb4b51041ca7b8
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78946
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
diff --git a/src/superio/nuvoton/npcd378/superio.c b/src/superio/nuvoton/npcd378/superio.c
index f1db509..73c814f 100644
--- a/src/superio/nuvoton/npcd378/superio.c
+++ b/src/superio/nuvoton/npcd378/superio.c
@@ -150,7 +150,6 @@
{
const char *name = acpi_device_path(dev);
const char *scope = acpi_device_scope(dev);
- char *tmp_name;
/* Scope */
acpigen_write_scope(name);
@@ -337,9 +336,7 @@
/* Method (SIOW, 1, NotSerialized) */
acpigen_write_method("SIOW", 1);
acpigen_emit_byte(RETURN_OP);
- tmp_name = strconcat(name, ".SIOW");
- acpigen_emit_namestring(tmp_name);
- free(tmp_name);
+ acpigen_emit_namestring(acpi_device_path_join(dev, "SIOW"));
acpigen_emit_byte(ARG0_OP);
acpigen_pop_len();
@@ -348,9 +345,7 @@
/* Method (SIOS, 1, NotSerialized) */
acpigen_write_method("SIOS", 1);
acpigen_emit_byte(RETURN_OP);
- tmp_name = strconcat(name, ".SIOS");
- acpigen_emit_namestring(tmp_name);
- free(tmp_name);
+ acpigen_emit_namestring(acpi_device_path_join(dev, "SIOS"));
acpigen_emit_byte(ARG0_OP);
acpigen_pop_len(); /* Pop Method */
@@ -361,9 +356,7 @@
/* Method (SIOH, 0, NotSerialized) */
acpigen_write_method("_L08", 0);
acpigen_emit_byte(AND_OP);
- tmp_name = strconcat(scope, ".PMFG");
- acpigen_emit_namestring(tmp_name);
- free(tmp_name);
+ acpigen_emit_namestring(acpi_device_path_join(dev, "RMFG"));
acpigen_write_integer(0xE8);
acpigen_emit_byte(LOCAL0_OP);
@@ -373,17 +366,13 @@
acpigen_emit_byte(ZERO_OP);
acpigen_emit_byte(NOTIFY_OP);
- tmp_name = strconcat(scope, ".L060");
- acpigen_emit_namestring(tmp_name);
- free(tmp_name);
+ acpigen_emit_namestring(acpi_device_path_join(dev, "L060"));
acpigen_write_integer(2);
acpigen_pop_len(); /* Pop If */
acpigen_emit_byte(AND_OP);
- tmp_name = strconcat(scope, ".PMFG");
- acpigen_emit_namestring(tmp_name);
- free(tmp_name);
+ acpigen_emit_namestring(acpi_device_path_join(dev, "PMFG"));
acpigen_write_integer(0x10);
acpigen_emit_byte(LOCAL0_OP);
@@ -393,9 +382,7 @@
acpigen_emit_byte(ZERO_OP);
acpigen_emit_byte(NOTIFY_OP);
- tmp_name = strconcat(scope, ".L050");
- acpigen_emit_namestring(tmp_name);
- free(tmp_name);
+ acpigen_emit_namestring(acpi_device_path_join(dev, "L050"));
acpigen_write_integer(2);
acpigen_pop_len(); /* Pop If */