diff --git a/drivers/spi/spi-cadence-xspi.c b/drivers/spi/spi-cadence-xspi.c index 6dcba0e0ddaa..a63a3aa608c6 100644 --- a/drivers/spi/spi-cadence-xspi.c +++ b/drivers/spi/spi-cadence-xspi.c @@ -2,7 +2,6 @@ // Cadence XSPI flash controller driver // Copyright (C) 2020-21 Cadence -#include #include #include #include @@ -21,6 +20,7 @@ #include #include #include +#include #define CDNS_XSPI_MAGIC_NUM_VALUE 0x6522 #define CDNS_XSPI_MAX_BANKS 8 @@ -774,19 +774,15 @@ static int marvell_xspi_mem_op_execute(struct spi_mem *mem, return ret; } -#ifdef CONFIG_ACPI static bool cdns_xspi_supports_op(struct spi_mem *mem, const struct spi_mem_op *op) { struct spi_device *spi = mem->spi; - const union acpi_object *obj; - struct acpi_device *adev; + struct device *dev = &spi->dev; + u32 value; - adev = ACPI_COMPANION(&spi->dev); - - if (!acpi_dev_get_property(adev, "spi-tx-bus-width", ACPI_TYPE_INTEGER, - &obj)) { - switch (obj->integer.value) { + if (!device_property_read_u32(dev, "spi-tx-bus-width", &value)) { + switch (value) { case 1: break; case 2: @@ -799,16 +795,13 @@ static bool cdns_xspi_supports_op(struct spi_mem *mem, spi->mode |= SPI_TX_OCTAL; break; default: - dev_warn(&spi->dev, - "spi-tx-bus-width %lld not supported\n", - obj->integer.value); + dev_warn(dev, "spi-tx-bus-width %u not supported\n", value); break; } } - if (!acpi_dev_get_property(adev, "spi-rx-bus-width", ACPI_TYPE_INTEGER, - &obj)) { - switch (obj->integer.value) { + if (!device_property_read_u32(dev, "spi-rx-bus-width", &value)) { + switch (value) { case 1: break; case 2: @@ -821,9 +814,7 @@ static bool cdns_xspi_supports_op(struct spi_mem *mem, spi->mode |= SPI_RX_OCTAL; break; default: - dev_warn(&spi->dev, - "spi-rx-bus-width %lld not supported\n", - obj->integer.value); + dev_warn(dev, "spi-rx-bus-width %u not supported\n", value); break; } } @@ -833,7 +824,6 @@ static bool cdns_xspi_supports_op(struct spi_mem *mem, return true; } -#endif static int cdns_xspi_adjust_mem_op_size(struct spi_mem *mem, struct spi_mem_op *op) { @@ -846,17 +836,13 @@ static int cdns_xspi_adjust_mem_op_size(struct spi_mem *mem, struct spi_mem_op * } static const struct spi_controller_mem_ops cadence_xspi_mem_ops = { -#ifdef CONFIG_ACPI - .supports_op = cdns_xspi_supports_op, -#endif + .supports_op = PTR_IF(IS_ENABLED(CONFIG_ACPI), cdns_xspi_supports_op), .exec_op = cdns_xspi_mem_op_execute, .adjust_op_size = cdns_xspi_adjust_mem_op_size, }; static const struct spi_controller_mem_ops marvell_xspi_mem_ops = { -#ifdef CONFIG_ACPI - .supports_op = cdns_xspi_supports_op, -#endif + .supports_op = PTR_IF(IS_ENABLED(CONFIG_ACPI), cdns_xspi_supports_op), .exec_op = marvell_xspi_mem_op_execute, .adjust_op_size = cdns_xspi_adjust_mem_op_size, };