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

mmc: sdhci-s3c: constify uses of driver/match data

The driver data (struct sdhci_s3c_drv_data) stored in of_device_id
table is allocated as const and used only in const-way. Skip
unnecessary const-away casts and convert all users to work with pointer
to const. This is both more logical and safer.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Reviewed-by: Sylwester Nawrocki <snawrocki@kernel.org>
Link: https://lore.kernel.org/r/20210415084412.51125-3-krzysztof.kozlowski@canonical.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Krzysztof Kozlowski and committed by
Ulf Hansson
e614740a 90cdaa84

+5 -5
+5 -5
drivers/mmc/host/sdhci-s3c.c
··· 462 462 } 463 463 #endif 464 464 465 - static inline struct sdhci_s3c_drv_data *sdhci_s3c_get_driver_data( 465 + static inline const struct sdhci_s3c_drv_data *sdhci_s3c_get_driver_data( 466 466 struct platform_device *pdev) 467 467 { 468 468 #ifdef CONFIG_OF 469 469 if (pdev->dev.of_node) 470 - return (struct sdhci_s3c_drv_data *)of_device_get_match_data(&pdev->dev); 470 + return of_device_get_match_data(&pdev->dev); 471 471 #endif 472 - return (struct sdhci_s3c_drv_data *) 472 + return (const struct sdhci_s3c_drv_data *) 473 473 platform_get_device_id(pdev)->driver_data; 474 474 } 475 475 476 476 static int sdhci_s3c_probe(struct platform_device *pdev) 477 477 { 478 478 struct s3c_sdhci_platdata *pdata; 479 - struct sdhci_s3c_drv_data *drv_data; 479 + const struct sdhci_s3c_drv_data *drv_data; 480 480 struct device *dev = &pdev->dev; 481 481 struct sdhci_host *host; 482 482 struct sdhci_s3c *sc; ··· 761 761 MODULE_DEVICE_TABLE(platform, sdhci_s3c_driver_ids); 762 762 763 763 #ifdef CONFIG_OF 764 - static struct sdhci_s3c_drv_data exynos4_sdhci_drv_data = { 764 + static const struct sdhci_s3c_drv_data exynos4_sdhci_drv_data = { 765 765 .no_divider = true, 766 766 }; 767 767