Skip to content

Commit 7548786

Browse files
Honghui Zhangjoergroedel
authored andcommitted
memory: mtk-smi: Use of_device_get_match_data helper
Replace custom code with generic helper to retrieve driver data. Signed-off-by: Honghui Zhang <honghui.zhang@mediatek.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 520eccd commit 7548786

1 file changed

Lines changed: 2 additions & 12 deletions

File tree

‎drivers/memory/mtk-smi.c‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -240,20 +240,15 @@ static int mtk_smi_larb_probe(struct platform_device *pdev)
240240
struct device *dev = &pdev->dev;
241241
struct device_node *smi_node;
242242
struct platform_device *smi_pdev;
243-
const struct of_device_id *of_id;
244243

245244
if (!dev->pm_domain)
246245
return -EPROBE_DEFER;
247246

248-
of_id = of_match_node(mtk_smi_larb_of_ids, pdev->dev.of_node);
249-
if (!of_id)
250-
return -EINVAL;
251-
252247
larb = devm_kzalloc(dev, sizeof(*larb), GFP_KERNEL);
253248
if (!larb)
254249
return -ENOMEM;
255250

256-
larb->larb_gen = of_id->data;
251+
larb->larb_gen = of_device_get_match_data(dev);
257252
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
258253
larb->base = devm_ioremap_resource(dev, res);
259254
if (IS_ERR(larb->base))
@@ -319,7 +314,6 @@ static int mtk_smi_common_probe(struct platform_device *pdev)
319314
struct device *dev = &pdev->dev;
320315
struct mtk_smi *common;
321316
struct resource *res;
322-
const struct of_device_id *of_id;
323317
enum mtk_smi_gen smi_gen;
324318

325319
if (!dev->pm_domain)
@@ -338,17 +332,13 @@ static int mtk_smi_common_probe(struct platform_device *pdev)
338332
if (IS_ERR(common->clk_smi))
339333
return PTR_ERR(common->clk_smi);
340334

341-
of_id = of_match_node(mtk_smi_common_of_ids, pdev->dev.of_node);
342-
if (!of_id)
343-
return -EINVAL;
344-
345335
/*
346336
* for mtk smi gen 1, we need to get the ao(always on) base to config
347337
* m4u port, and we need to enable the aync clock for transform the smi
348338
* clock into emi clock domain, but for mtk smi gen2, there's no smi ao
349339
* base.
350340
*/
351-
smi_gen = (enum mtk_smi_gen)of_id->data;
341+
smi_gen = (enum mtk_smi_gen)of_device_get_match_data(dev);
352342
if (smi_gen == MTK_SMI_GEN1) {
353343
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
354344
common->smi_ao_base = devm_ioremap_resource(dev, res);

0 commit comments

Comments
 (0)