acpi: Call acpi_fill_ssdt() only for enabled devices
Individual drivers check whether the concerned device is enabled before
filling in the SSDT. Move the check before calling acpi_fill_ssdt() and
remove the check in the individual drivers.
BUG=None
TEST=util/abuild/abuild
Change-Id: Ib042bec7e8c68b38fafa60a8e965d781bddcd1f0
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/47148
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Sumeet R Pawnikar <sumeet.r.pawnikar@intel.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Christian Walter <christian.walter@9elements.com>
diff --git a/src/drivers/i2c/da7219/da7219.c b/src/drivers/i2c/da7219/da7219.c
index 1d98023..0423460 100644
--- a/src/drivers/i2c/da7219/da7219.c
+++ b/src/drivers/i2c/da7219/da7219.c
@@ -27,7 +27,7 @@
};
struct acpi_dp *dsd, *aad;
- if (!dev->enabled || !scope)
+ if (!scope)
return;
/* Device */
diff --git a/src/drivers/i2c/designware/dw_i2c.c b/src/drivers/i2c/designware/dw_i2c.c
index e01b5a8..3181e7a 100644
--- a/src/drivers/i2c/designware/dw_i2c.c
+++ b/src/drivers/i2c/designware/dw_i2c.c
@@ -824,9 +824,6 @@
const char *path;
unsigned int speed;
- if (!dev->enabled)
- return;
-
bus = dw_i2c_soc_dev_to_bus(dev);
if (bus < 0)
diff --git a/src/drivers/i2c/generic/generic.c b/src/drivers/i2c/generic/generic.c
index 18fd55c..cd74068 100644
--- a/src/drivers/i2c/generic/generic.c
+++ b/src/drivers/i2c/generic/generic.c
@@ -57,7 +57,7 @@
int reset_gpio_index = -1, enable_gpio_index = -1, irq_gpio_index = -1;
const char *path = acpi_device_path(dev);
- if (!dev->enabled || !scope)
+ if (!scope)
return;
if (!config->hid) {
diff --git a/src/drivers/i2c/gpiomux/bus/bus.c b/src/drivers/i2c/gpiomux/bus/bus.c
index 66aef8e..0bcf36a 100644
--- a/src/drivers/i2c/gpiomux/bus/bus.c
+++ b/src/drivers/i2c/gpiomux/bus/bus.c
@@ -22,7 +22,7 @@
const char *scope = acpi_device_scope(dev);
const char *path = acpi_device_path(dev);
- if (!dev || !dev->enabled || !scope || !path)
+ if (!dev || !scope || !path)
return;
/* Device */
diff --git a/src/drivers/i2c/gpiomux/mux/mux.c b/src/drivers/i2c/gpiomux/mux/mux.c
index 66c8cc5..c1ae758 100644
--- a/src/drivers/i2c/gpiomux/mux/mux.c
+++ b/src/drivers/i2c/gpiomux/mux/mux.c
@@ -27,7 +27,7 @@
struct acpi_gpio_res_params param[MAX_NUM_MUX_GPIOS];
int i;
- if (!dev->enabled || !scope || !path)
+ if (!scope || !path)
return;
/* Device */
diff --git a/src/drivers/i2c/max98373/max98373.c b/src/drivers/i2c/max98373/max98373.c
index 1f8a4f3..b078674 100644
--- a/src/drivers/i2c/max98373/max98373.c
+++ b/src/drivers/i2c/max98373/max98373.c
@@ -24,7 +24,7 @@
};
struct acpi_dp *dp;
- if (!dev->enabled || !scope) {
+ if (!scope) {
printk(BIOS_ERR, "%s: dev not enabled\n", __func__);
return;
}
diff --git a/src/drivers/i2c/max98390/max98390.c b/src/drivers/i2c/max98390/max98390.c
index 24c500b..c216391 100644
--- a/src/drivers/i2c/max98390/max98390.c
+++ b/src/drivers/i2c/max98390/max98390.c
@@ -28,7 +28,7 @@
struct acpi_dp *dp;
uint64_t r0_value, temp_value;
- if (!dev->enabled || !scope)
+ if (!scope)
return;
/* Device */
diff --git a/src/drivers/i2c/max98927/max98927.c b/src/drivers/i2c/max98927/max98927.c
index 9429e4a..642eccf 100644
--- a/src/drivers/i2c/max98927/max98927.c
+++ b/src/drivers/i2c/max98927/max98927.c
@@ -24,7 +24,7 @@
};
struct acpi_dp *dp;
- if (!dev->enabled || !scope)
+ if (!scope)
return;
/* Device */
diff --git a/src/drivers/i2c/nau8825/nau8825.c b/src/drivers/i2c/nau8825/nau8825.c
index e995ebd..a0769d0 100644
--- a/src/drivers/i2c/nau8825/nau8825.c
+++ b/src/drivers/i2c/nau8825/nau8825.c
@@ -30,7 +30,7 @@
};
struct acpi_dp *dp = NULL;
- if (!dev->enabled || !scope)
+ if (!scope)
return;
if (config->sar_threshold_num > NAU8825_MAX_BUTTONS)
return;
diff --git a/src/drivers/i2c/rt1011/rt1011.c b/src/drivers/i2c/rt1011/rt1011.c
index d1732f7..70f1881 100644
--- a/src/drivers/i2c/rt1011/rt1011.c
+++ b/src/drivers/i2c/rt1011/rt1011.c
@@ -28,7 +28,7 @@
struct acpi_dp *dp;
uint64_t r0_value, temp_value;
- if (!dev->enabled || !scope)
+ if (!scope)
return;
/* Device */
diff --git a/src/drivers/i2c/rt5663/rt5663.c b/src/drivers/i2c/rt5663/rt5663.c
index 272cf78..565e3bb 100644
--- a/src/drivers/i2c/rt5663/rt5663.c
+++ b/src/drivers/i2c/rt5663/rt5663.c
@@ -27,7 +27,7 @@
};
struct acpi_dp *dp;
- if (!dev->enabled || !scope)
+ if (!scope)
return;
/* Device */
diff --git a/src/drivers/i2c/sx9310/sx9310.c b/src/drivers/i2c/sx9310/sx9310.c
index c12e4ea..8dc57a2 100644
--- a/src/drivers/i2c/sx9310/sx9310.c
+++ b/src/drivers/i2c/sx9310/sx9310.c
@@ -28,7 +28,7 @@
};
struct acpi_dp *dsd;
- if (!dev->enabled || !scope || !config)
+ if (!scope || !config)
return;
if (config->speed)
diff --git a/src/drivers/i2c/tpm/chip.c b/src/drivers/i2c/tpm/chip.c
index 2baec42..07791c3 100644
--- a/src/drivers/i2c/tpm/chip.c
+++ b/src/drivers/i2c/tpm/chip.c
@@ -20,7 +20,7 @@
.resource = scope,
};
- if (!dev->enabled || !scope)
+ if (!scope)
return;
if (!config->hid) {