[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210414151242.102313-3-krzysztof.kozlowski@canonical.com>
Date: Wed, 14 Apr 2021 17:12:42 +0200
From: Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>
To: Ben Dooks <ben-linux@...ff.org>,
Jaehoon Chung <jh80.chung@...sung.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Ulf Hansson <ulf.hansson@...aro.org>,
linux-mmc@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Marek Szyprowski <m.szyprowski@...sung.com>,
Sylwester Nawrocki <snawrocki@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>
Subject: [PATCH 3/3] 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@...onical.com>
---
drivers/mmc/host/sdhci-s3c.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index a07a8f011741..862f033d235d 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -462,21 +462,21 @@ static int sdhci_s3c_parse_dt(struct device *dev,
}
#endif
-static inline struct sdhci_s3c_drv_data *sdhci_s3c_get_driver_data(
+static inline const struct sdhci_s3c_drv_data *sdhci_s3c_get_driver_data(
struct platform_device *pdev)
{
#ifdef CONFIG_OF
if (pdev->dev.of_node)
- return (struct sdhci_s3c_drv_data *)of_device_get_match_data(&pdev->dev);
+ return of_device_get_match_data(&pdev->dev);
#endif
- return (struct sdhci_s3c_drv_data *)
+ return (const struct sdhci_s3c_drv_data *)
platform_get_device_id(pdev)->driver_data;
}
static int sdhci_s3c_probe(struct platform_device *pdev)
{
struct s3c_sdhci_platdata *pdata;
- struct sdhci_s3c_drv_data *drv_data;
+ const struct sdhci_s3c_drv_data *drv_data;
struct device *dev = &pdev->dev;
struct sdhci_host *host;
struct sdhci_s3c *sc;
@@ -761,7 +761,7 @@ static const struct platform_device_id sdhci_s3c_driver_ids[] = {
MODULE_DEVICE_TABLE(platform, sdhci_s3c_driver_ids);
#ifdef CONFIG_OF
-static struct sdhci_s3c_drv_data exynos4_sdhci_drv_data = {
+static const struct sdhci_s3c_drv_data exynos4_sdhci_drv_data = {
.no_divider = true,
};
--
2.25.1
Powered by blists - more mailing lists