Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: greybus: spi: remove KERNEL_VERSION checks

No need to support older kernel versions in the Greybus SPI and spilib
driver, so remove the checks as needed, we can now rely on all of the
correct SPI core apis being present.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>

+4 -57
+1 -20
drivers/staging/greybus/fw-core.c
··· 20 20 struct gb_connection *cap_connection; 21 21 }; 22 22 23 - #ifndef SPI_CORE_SUPPORT_PM 24 - static int fw_spi_prepare_transfer_hardware(struct device *dev) 25 - { 26 - return gb_pm_runtime_get_sync(to_gb_bundle(dev)); 27 - } 28 - 29 - static void fw_spi_unprepare_transfer_hardware(struct device *dev) 30 - { 31 - gb_pm_runtime_put_autosuspend(to_gb_bundle(dev)); 32 - } 33 - 34 - static struct spilib_ops __spilib_ops = { 35 - .prepare_transfer_hardware = fw_spi_prepare_transfer_hardware, 36 - .unprepare_transfer_hardware = fw_spi_unprepare_transfer_hardware, 37 - }; 38 - 39 - static struct spilib_ops *spilib_ops = &__spilib_ops; 40 - #else 41 - static struct spilib_ops *spilib_ops = NULL; 42 - #endif 23 + static struct spilib_ops *spilib_ops; 43 24 44 25 struct gb_connection *to_fw_mgmt_connection(struct device *dev) 45 26 {
-13
drivers/staging/greybus/kernel_ver.h
··· 86 86 #define POWER_SUPPLY_PROP_CALIBRATE -1 87 87 #endif 88 88 89 - #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) 90 - #define SPI_DEV_MODALIAS "spidev" 91 - #define SPI_NOR_MODALIAS "spi-nor" 92 - #else 93 - #define SPI_DEV_MODALIAS "spidev" 94 - #define SPI_NOR_MODALIAS "m25p80" 95 - #endif 96 - 97 - #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) 98 - /* Starting from this version, the spi core handles runtime pm automatically */ 99 - #define SPI_CORE_SUPPORT_PM 100 - #endif 101 - 102 89 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) 103 90 /* 104 91 * After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is
+1 -20
drivers/staging/greybus/spi.c
··· 13 13 #include "gbphy.h" 14 14 #include "spilib.h" 15 15 16 - #ifndef SPI_CORE_SUPPORT_PM 17 - static int gbphy_spi_prepare_transfer_hardware(struct device *dev) 18 - { 19 - return gbphy_runtime_get_sync(to_gbphy_dev(dev)); 20 - } 21 - 22 - static void gbphy_spi_unprepare_transfer_hardware(struct device *dev) 23 - { 24 - gbphy_runtime_put_autosuspend(to_gbphy_dev(dev)); 25 - } 26 - 27 - static struct spilib_ops __spilib_ops = { 28 - .prepare_transfer_hardware = gbphy_spi_prepare_transfer_hardware, 29 - .unprepare_transfer_hardware = gbphy_spi_unprepare_transfer_hardware, 30 - }; 31 - 32 - static struct spilib_ops *spilib_ops = &__spilib_ops; 33 - #else 34 - static struct spilib_ops *spilib_ops = NULL; 35 - #endif 16 + static struct spilib_ops *spilib_ops; 36 17 37 18 static int gb_spi_probe(struct gbphy_device *gbphy_dev, 38 19 const struct gbphy_device_id *id)
+2 -4
drivers/staging/greybus/spilib.c
··· 456 456 dev_type = response.device_type; 457 457 458 458 if (dev_type == GB_SPI_SPI_DEV) 459 - strlcpy(spi_board.modalias, SPI_DEV_MODALIAS, 459 + strlcpy(spi_board.modalias, "spidev", 460 460 sizeof(spi_board.modalias)); 461 461 else if (dev_type == GB_SPI_SPI_NOR) 462 - strlcpy(spi_board.modalias, SPI_NOR_MODALIAS, 462 + strlcpy(spi_board.modalias, "spi-nor", 463 463 sizeof(spi_board.modalias)); 464 464 else if (dev_type == GB_SPI_SPI_MODALIAS) 465 465 memcpy(spi_board.modalias, response.name, ··· 526 526 gb_spi_unprepare_transfer_hardware; 527 527 } 528 528 529 - #ifdef SPI_CORE_SUPPORT_PM 530 529 master->auto_runtime_pm = true; 531 - #endif 532 530 533 531 ret = spi_register_master(master); 534 532 if (ret < 0)