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

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>

authored by

Krzysztof Kozlowski and committed by
Mark Brown
d6371415 7d712f79

+10 -11
+10 -11
drivers/spi/spi-s3c64xx.c
··· 190 190 unsigned cur_speed; 191 191 struct s3c64xx_spi_dma_data rx_dma; 192 192 struct s3c64xx_spi_dma_data tx_dma; 193 - struct s3c64xx_spi_port_config *port_conf; 193 + const struct s3c64xx_spi_port_config *port_conf; 194 194 unsigned int port_id; 195 195 }; 196 196 ··· 1049 1049 } 1050 1050 #endif 1051 1051 1052 - static inline struct s3c64xx_spi_port_config *s3c64xx_spi_get_port_config( 1052 + static inline const struct s3c64xx_spi_port_config *s3c64xx_spi_get_port_config( 1053 1053 struct platform_device *pdev) 1054 1054 { 1055 1055 #ifdef CONFIG_OF 1056 1056 if (pdev->dev.of_node) 1057 - return (struct s3c64xx_spi_port_config *)of_device_get_match_data(&pdev->dev); 1057 + return of_device_get_match_data(&pdev->dev); 1058 1058 #endif 1059 - return (struct s3c64xx_spi_port_config *) 1060 - platform_get_device_id(pdev)->driver_data; 1059 + return (const struct s3c64xx_spi_port_config *)platform_get_device_id(pdev)->driver_data; 1061 1060 } 1062 1061 1063 1062 static int s3c64xx_spi_probe(struct platform_device *pdev) ··· 1394 1395 s3c64xx_spi_runtime_resume, NULL) 1395 1396 }; 1396 1397 1397 - static struct s3c64xx_spi_port_config s3c2443_spi_port_config = { 1398 + static const struct s3c64xx_spi_port_config s3c2443_spi_port_config = { 1398 1399 .fifo_lvl_mask = { 0x7f }, 1399 1400 .rx_lvl_offset = 13, 1400 1401 .tx_st_done = 21, 1401 1402 .high_speed = true, 1402 1403 }; 1403 1404 1404 - static struct s3c64xx_spi_port_config s3c6410_spi_port_config = { 1405 + static const struct s3c64xx_spi_port_config s3c6410_spi_port_config = { 1405 1406 .fifo_lvl_mask = { 0x7f, 0x7F }, 1406 1407 .rx_lvl_offset = 13, 1407 1408 .tx_st_done = 21, 1408 1409 }; 1409 1410 1410 - static struct s3c64xx_spi_port_config s5pv210_spi_port_config = { 1411 + static const struct s3c64xx_spi_port_config s5pv210_spi_port_config = { 1411 1412 .fifo_lvl_mask = { 0x1ff, 0x7F }, 1412 1413 .rx_lvl_offset = 15, 1413 1414 .tx_st_done = 25, 1414 1415 .high_speed = true, 1415 1416 }; 1416 1417 1417 - static struct s3c64xx_spi_port_config exynos4_spi_port_config = { 1418 + static const struct s3c64xx_spi_port_config exynos4_spi_port_config = { 1418 1419 .fifo_lvl_mask = { 0x1ff, 0x7F, 0x7F }, 1419 1420 .rx_lvl_offset = 15, 1420 1421 .tx_st_done = 25, ··· 1423 1424 .quirks = S3C64XX_SPI_QUIRK_CS_AUTO, 1424 1425 }; 1425 1426 1426 - static struct s3c64xx_spi_port_config exynos7_spi_port_config = { 1427 + static const struct s3c64xx_spi_port_config exynos7_spi_port_config = { 1427 1428 .fifo_lvl_mask = { 0x1ff, 0x7F, 0x7F, 0x7F, 0x7F, 0x1ff}, 1428 1429 .rx_lvl_offset = 15, 1429 1430 .tx_st_done = 25, ··· 1432 1433 .quirks = S3C64XX_SPI_QUIRK_CS_AUTO, 1433 1434 }; 1434 1435 1435 - static struct s3c64xx_spi_port_config exynos5433_spi_port_config = { 1436 + static const struct s3c64xx_spi_port_config exynos5433_spi_port_config = { 1436 1437 .fifo_lvl_mask = { 0x1ff, 0x7f, 0x7f, 0x7f, 0x7f, 0x1ff}, 1437 1438 .rx_lvl_offset = 15, 1438 1439 .tx_st_done = 25,