diff --git a/src/ec/google/chromeec/ec_acpi.c b/src/ec/google/chromeec/ec_acpi.c index 4dfd44bf4e..47d60d5b75 100644 --- a/src/ec/google/chromeec/ec_acpi.c +++ b/src/ec/google/chromeec/ec_acpi.c @@ -177,19 +177,14 @@ static void add_usb_port_references(struct acpi_dp *dsd, int port_number) } } -static void fill_ssdt_typec_device(struct device *dev) +static void fill_ssdt_typec_device(int num_ports) { struct usb_pd_port_caps port_caps; char con_name[] = "CONx"; struct acpi_dp *dsd; - int num_ports; int rv; int i; - rv = google_chromeec_get_num_pd_ports(&num_ports); - if (rv) - return; - acpigen_write_device(GOOGLE_CHROMEEC_USBC_DEVICE_NAME); acpigen_write_name_string("_HID", GOOGLE_CHROMEEC_USBC_DEVICE_HID); acpigen_write_name_string("_DDN", "ChromeOS EC Embedded Controller " @@ -220,8 +215,12 @@ static void fill_ssdt_typec_device(struct device *dev) void google_chromeec_fill_ssdt_generator(struct device *dev) { + int num_ports; + if (google_chromeec_get_num_pd_ports(&num_ports)) + return; + /* Reference the existing device's scope */ acpigen_write_scope(acpi_device_path(dev)); - fill_ssdt_typec_device(dev); + fill_ssdt_typec_device(num_ports); acpigen_pop_len(); /* Scope */ }