spi: s3c64xx: constify driver/match data

The match data (struct s3c64xx_spi_port_config) stored in of_device_id
and platform_device_id tables is not modified by the driver and can be
handled entirely in a const-way to increase the code safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Reviewed-by: Sylwester Nawrocki <snawrocki@kernel.org>
Link: https://lore.kernel.org/r/20210414203343.203119-3-krzysztof.kozlowski@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Krzysztof Kozlowski 2021-04-14 22:33:43 +02:00 коммит произвёл Mark Brown
Родитель 7d712f799a
Коммит d637141551
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 24D68B725D5487D0
1 изменённых файлов: 10 добавлений и 11 удалений

Просмотреть файл

@ -190,7 +190,7 @@ struct s3c64xx_spi_driver_data {
unsigned cur_speed; unsigned cur_speed;
struct s3c64xx_spi_dma_data rx_dma; struct s3c64xx_spi_dma_data rx_dma;
struct s3c64xx_spi_dma_data tx_dma; struct s3c64xx_spi_dma_data tx_dma;
struct s3c64xx_spi_port_config *port_conf; const struct s3c64xx_spi_port_config *port_conf;
unsigned int port_id; unsigned int port_id;
}; };
@ -1049,15 +1049,14 @@ static struct s3c64xx_spi_info *s3c64xx_spi_parse_dt(struct device *dev)
} }
#endif #endif
static inline struct s3c64xx_spi_port_config *s3c64xx_spi_get_port_config( static inline const struct s3c64xx_spi_port_config *s3c64xx_spi_get_port_config(
struct platform_device *pdev) struct platform_device *pdev)
{ {
#ifdef CONFIG_OF #ifdef CONFIG_OF
if (pdev->dev.of_node) if (pdev->dev.of_node)
return (struct s3c64xx_spi_port_config *)of_device_get_match_data(&pdev->dev); return of_device_get_match_data(&pdev->dev);
#endif #endif
return (struct s3c64xx_spi_port_config *) return (const struct s3c64xx_spi_port_config *)platform_get_device_id(pdev)->driver_data;
platform_get_device_id(pdev)->driver_data;
} }
static int s3c64xx_spi_probe(struct platform_device *pdev) static int s3c64xx_spi_probe(struct platform_device *pdev)
@ -1395,27 +1394,27 @@ static const struct dev_pm_ops s3c64xx_spi_pm = {
s3c64xx_spi_runtime_resume, NULL) s3c64xx_spi_runtime_resume, NULL)
}; };
static struct s3c64xx_spi_port_config s3c2443_spi_port_config = { static const struct s3c64xx_spi_port_config s3c2443_spi_port_config = {
.fifo_lvl_mask = { 0x7f }, .fifo_lvl_mask = { 0x7f },
.rx_lvl_offset = 13, .rx_lvl_offset = 13,
.tx_st_done = 21, .tx_st_done = 21,
.high_speed = true, .high_speed = true,
}; };
static struct s3c64xx_spi_port_config s3c6410_spi_port_config = { static const struct s3c64xx_spi_port_config s3c6410_spi_port_config = {
.fifo_lvl_mask = { 0x7f, 0x7F }, .fifo_lvl_mask = { 0x7f, 0x7F },
.rx_lvl_offset = 13, .rx_lvl_offset = 13,
.tx_st_done = 21, .tx_st_done = 21,
}; };
static struct s3c64xx_spi_port_config s5pv210_spi_port_config = { static const struct s3c64xx_spi_port_config s5pv210_spi_port_config = {
.fifo_lvl_mask = { 0x1ff, 0x7F }, .fifo_lvl_mask = { 0x1ff, 0x7F },
.rx_lvl_offset = 15, .rx_lvl_offset = 15,
.tx_st_done = 25, .tx_st_done = 25,
.high_speed = true, .high_speed = true,
}; };
static struct s3c64xx_spi_port_config exynos4_spi_port_config = { static const struct s3c64xx_spi_port_config exynos4_spi_port_config = {
.fifo_lvl_mask = { 0x1ff, 0x7F, 0x7F }, .fifo_lvl_mask = { 0x1ff, 0x7F, 0x7F },
.rx_lvl_offset = 15, .rx_lvl_offset = 15,
.tx_st_done = 25, .tx_st_done = 25,
@ -1424,7 +1423,7 @@ static struct s3c64xx_spi_port_config exynos4_spi_port_config = {
.quirks = S3C64XX_SPI_QUIRK_CS_AUTO, .quirks = S3C64XX_SPI_QUIRK_CS_AUTO,
}; };
static struct s3c64xx_spi_port_config exynos7_spi_port_config = { static const struct s3c64xx_spi_port_config exynos7_spi_port_config = {
.fifo_lvl_mask = { 0x1ff, 0x7F, 0x7F, 0x7F, 0x7F, 0x1ff}, .fifo_lvl_mask = { 0x1ff, 0x7F, 0x7F, 0x7F, 0x7F, 0x1ff},
.rx_lvl_offset = 15, .rx_lvl_offset = 15,
.tx_st_done = 25, .tx_st_done = 25,
@ -1433,7 +1432,7 @@ static struct s3c64xx_spi_port_config exynos7_spi_port_config = {
.quirks = S3C64XX_SPI_QUIRK_CS_AUTO, .quirks = S3C64XX_SPI_QUIRK_CS_AUTO,
}; };
static struct s3c64xx_spi_port_config exynos5433_spi_port_config = { static const struct s3c64xx_spi_port_config exynos5433_spi_port_config = {
.fifo_lvl_mask = { 0x1ff, 0x7f, 0x7f, 0x7f, 0x7f, 0x1ff}, .fifo_lvl_mask = { 0x1ff, 0x7f, 0x7f, 0x7f, 0x7f, 0x1ff},
.rx_lvl_offset = 15, .rx_lvl_offset = 15,
.tx_st_done = 25, .tx_st_done = 25,