soc/intel/**/fast_spi.c: Reorganize some statements
Avoid calling `acpi_device_scope()` and `fast_spi_acpi_hid()` if the result won't be used. Also, reorder a condition so that compile-time constants appear first, so as to help the compiler optimize it out. Change-Id: I42ce55c2978ad9c593c359c5decd5842fb3a97a1 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/69168 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
This commit is contained in:
@@ -502,17 +502,17 @@ static const char *fast_spi_acpi_name(const struct device *dev)
|
|||||||
*/
|
*/
|
||||||
static void fast_spi_fill_ssdt(const struct device *dev)
|
static void fast_spi_fill_ssdt(const struct device *dev)
|
||||||
{
|
{
|
||||||
|
/* Do not add SSDT if the fast SPI device is hidden. */
|
||||||
|
if (!CONFIG(FAST_SPI_GENERATE_SSDT) || dev->hidden)
|
||||||
|
return;
|
||||||
|
|
||||||
const char *scope = acpi_device_scope(dev);
|
const char *scope = acpi_device_scope(dev);
|
||||||
const char *hid = fast_spi_acpi_hid(dev);
|
const char *hid = fast_spi_acpi_hid(dev);
|
||||||
struct resource *res;
|
|
||||||
|
|
||||||
/* Do not add SSDT if the fast SPI device is hidden. */
|
|
||||||
if (dev->hidden || !CONFIG(FAST_SPI_GENERATE_SSDT))
|
|
||||||
return;
|
|
||||||
if (!scope || !hid)
|
if (!scope || !hid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
res = probe_resource(dev, PCI_BASE_ADDRESS_0);
|
struct resource *res = probe_resource(dev, PCI_BASE_ADDRESS_0);
|
||||||
if (!res)
|
if (!res)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user