From 0a0945c6a211b51fada3c89f2ed1989356540bbb Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Tue, 7 Nov 2023 11:01:34 +0100 Subject: sio/nuvoton/npcd378: Use acpi_device_path_join This achieves the same without the strconcat & free dance. Signed-off-by: Arthur Heymans Change-Id: I4d8e9bae6085a6e05847b01497fb4b51041ca7b8 Reviewed-on: https://review.coreboot.org/c/coreboot/+/78946 Tested-by: build bot (Jenkins) Reviewed-by: Felix Held --- src/superio/nuvoton/npcd378/superio.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/superio/nuvoton/npcd378/superio.c b/src/superio/nuvoton/npcd378/superio.c index f1db50934a..73c814fd28 100644 --- a/src/superio/nuvoton/npcd378/superio.c +++ b/src/superio/nuvoton/npcd378/superio.c @@ -150,7 +150,6 @@ static void npcd378_ssdt_pwr(const struct device *dev) { 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 @@ static void npcd378_ssdt_pwr(const struct device *dev) /* 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 @@ static void npcd378_ssdt_pwr(const struct device *dev) /* 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 @@ static void npcd378_ssdt_pwr(const struct device *dev) /* 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 @@ static void npcd378_ssdt_pwr(const struct device *dev) 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 @@ static void npcd378_ssdt_pwr(const struct device *dev) 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 */ -- cgit v1.2.3