From 148e0b8f48a83008596876befe1d9aed256c8ea1 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 8 Sep 2016 16:06:27 +0200 Subject: [PATCH] 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 --- drivers/staging/greybus/fw-core.c | 21 +-------------------- drivers/staging/greybus/kernel_ver.h | 13 ------------- drivers/staging/greybus/spi.c | 21 +-------------------- drivers/staging/greybus/spilib.c | 6 ++---- 4 files changed, 4 insertions(+), 57 deletions(-) diff --git a/drivers/staging/greybus/fw-core.c b/drivers/staging/greybus/fw-core.c index a7e4a8c24d22..454a98957ba5 100644 --- a/drivers/staging/greybus/fw-core.c +++ b/drivers/staging/greybus/fw-core.c @@ -20,26 +20,7 @@ struct gb_fw_core { struct gb_connection *cap_connection; }; -#ifndef SPI_CORE_SUPPORT_PM -static int fw_spi_prepare_transfer_hardware(struct device *dev) -{ - return gb_pm_runtime_get_sync(to_gb_bundle(dev)); -} - -static void fw_spi_unprepare_transfer_hardware(struct device *dev) -{ - gb_pm_runtime_put_autosuspend(to_gb_bundle(dev)); -} - -static struct spilib_ops __spilib_ops = { - .prepare_transfer_hardware = fw_spi_prepare_transfer_hardware, - .unprepare_transfer_hardware = fw_spi_unprepare_transfer_hardware, -}; - -static struct spilib_ops *spilib_ops = &__spilib_ops; -#else -static struct spilib_ops *spilib_ops = NULL; -#endif +static struct spilib_ops *spilib_ops; struct gb_connection *to_fw_mgmt_connection(struct device *dev) { diff --git a/drivers/staging/greybus/kernel_ver.h b/drivers/staging/greybus/kernel_ver.h index 0e129ff6c6d6..59d55be1dd8a 100644 --- a/drivers/staging/greybus/kernel_ver.h +++ b/drivers/staging/greybus/kernel_ver.h @@ -86,19 +86,6 @@ #define POWER_SUPPLY_PROP_CALIBRATE -1 #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) -#define SPI_DEV_MODALIAS "spidev" -#define SPI_NOR_MODALIAS "spi-nor" -#else -#define SPI_DEV_MODALIAS "spidev" -#define SPI_NOR_MODALIAS "m25p80" -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) -/* Starting from this version, the spi core handles runtime pm automatically */ -#define SPI_CORE_SUPPORT_PM -#endif - #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) /* * After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is diff --git a/drivers/staging/greybus/spi.c b/drivers/staging/greybus/spi.c index bb76b3c0118d..c893552b5c0b 100644 --- a/drivers/staging/greybus/spi.c +++ b/drivers/staging/greybus/spi.c @@ -13,26 +13,7 @@ #include "gbphy.h" #include "spilib.h" -#ifndef SPI_CORE_SUPPORT_PM -static int gbphy_spi_prepare_transfer_hardware(struct device *dev) -{ - return gbphy_runtime_get_sync(to_gbphy_dev(dev)); -} - -static void gbphy_spi_unprepare_transfer_hardware(struct device *dev) -{ - gbphy_runtime_put_autosuspend(to_gbphy_dev(dev)); -} - -static struct spilib_ops __spilib_ops = { - .prepare_transfer_hardware = gbphy_spi_prepare_transfer_hardware, - .unprepare_transfer_hardware = gbphy_spi_unprepare_transfer_hardware, -}; - -static struct spilib_ops *spilib_ops = &__spilib_ops; -#else -static struct spilib_ops *spilib_ops = NULL; -#endif +static struct spilib_ops *spilib_ops; static int gb_spi_probe(struct gbphy_device *gbphy_dev, const struct gbphy_device_id *id) diff --git a/drivers/staging/greybus/spilib.c b/drivers/staging/greybus/spilib.c index 9427c313dd4e..e97b19148497 100644 --- a/drivers/staging/greybus/spilib.c +++ b/drivers/staging/greybus/spilib.c @@ -456,10 +456,10 @@ static int gb_spi_setup_device(struct gb_spilib *spi, u8 cs) dev_type = response.device_type; if (dev_type == GB_SPI_SPI_DEV) - strlcpy(spi_board.modalias, SPI_DEV_MODALIAS, + strlcpy(spi_board.modalias, "spidev", sizeof(spi_board.modalias)); else if (dev_type == GB_SPI_SPI_NOR) - strlcpy(spi_board.modalias, SPI_NOR_MODALIAS, + strlcpy(spi_board.modalias, "spi-nor", sizeof(spi_board.modalias)); else if (dev_type == GB_SPI_SPI_MODALIAS) memcpy(spi_board.modalias, response.name, @@ -526,9 +526,7 @@ int gb_spilib_master_init(struct gb_connection *connection, struct device *dev, gb_spi_unprepare_transfer_hardware; } -#ifdef SPI_CORE_SUPPORT_PM master->auto_runtime_pm = true; -#endif ret = spi_register_master(master); if (ret < 0) -- 2.39.5