Skip to content

Commit a2b8fa7

Browse files
robherringUlf Hansson
authored andcommitted
mmc: jz4740: Use device_get_match_data()
Use preferred device_get_match_data() instead of of_match_device() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Signed-off-by: Rob Herring <robh@kernel.org> Reviewed-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20231006224343.441720-1-robh@kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 0ebebb2 commit a2b8fa7

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

drivers/mmc/host/jz4740_mmc.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818
#include <linux/mmc/host.h>
1919
#include <linux/mmc/slot-gpio.h>
2020
#include <linux/module.h>
21-
#include <linux/of_device.h>
21+
#include <linux/of.h>
2222
#include <linux/pinctrl/consumer.h>
2323
#include <linux/platform_device.h>
24+
#include <linux/property.h>
2425
#include <linux/regulator/consumer.h>
2526
#include <linux/scatterlist.h>
2627

@@ -1040,7 +1041,6 @@ static int jz4740_mmc_probe(struct platform_device* pdev)
10401041
int ret;
10411042
struct mmc_host *mmc;
10421043
struct jz4740_mmc_host *host;
1043-
const struct of_device_id *match;
10441044

10451045
mmc = mmc_alloc_host(sizeof(struct jz4740_mmc_host), &pdev->dev);
10461046
if (!mmc) {
@@ -1050,13 +1050,8 @@ static int jz4740_mmc_probe(struct platform_device* pdev)
10501050

10511051
host = mmc_priv(mmc);
10521052

1053-
match = of_match_device(jz4740_mmc_of_match, &pdev->dev);
1054-
if (match) {
1055-
host->version = (enum jz4740_mmc_version)match->data;
1056-
} else {
1057-
/* JZ4740 should be the only one using legacy probe */
1058-
host->version = JZ_MMC_JZ4740;
1059-
}
1053+
/* Default if no match is JZ4740 */
1054+
host->version = (enum jz4740_mmc_version)device_get_match_data(&pdev->dev);
10601055

10611056
ret = mmc_of_parse(mmc);
10621057
if (ret) {
@@ -1200,7 +1195,7 @@ static struct platform_driver jz4740_mmc_driver = {
12001195
.driver = {
12011196
.name = "jz4740-mmc",
12021197
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
1203-
.of_match_table = of_match_ptr(jz4740_mmc_of_match),
1198+
.of_match_table = jz4740_mmc_of_match,
12041199
.pm = pm_sleep_ptr(&jz4740_mmc_pm_ops),
12051200
},
12061201
};

0 commit comments

Comments
 (0)