Skip to content

Commit c8c206c

Browse files
AngeloGioacchino Del Regnolinusw
authored andcommitted
pinctrl: mediatek: common-v1: Use common probe function
Most of the mediatek pinctrl drivers are calling mtk_pctrl_init() and passing only a pointer to struct mtk_pinctrl_devdata, as the regmap handle it passed from device-tree, with the exception of mt6397. For all of the drivers that don't require passing a struct regmap pointer from a parent device, simplify the probe mechanism by assigning the required structure as match data and use mtk_pctrl_common_probe() as their probe function. While at it, also collapse the of_device_id entries to a single line, as they all fit in max 83 columns, which is acceptable. Signed-off-by: AngeloGioacchino Del Regno <[email protected]> Reviewed-by: Chen-Yu Tsai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent e091fed commit c8c206c

File tree

7 files changed

+15
-60
lines changed

7 files changed

+15
-60
lines changed

drivers/pinctrl/mediatek/pinctrl-mt2701.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -534,20 +534,15 @@ static const struct mtk_pinctrl_devdata mt2701_pinctrl_data = {
534534
},
535535
};
536536

537-
static int mt2701_pinctrl_probe(struct platform_device *pdev)
538-
{
539-
return mtk_pctrl_init(pdev, &mt2701_pinctrl_data, NULL);
540-
}
541-
542537
static const struct of_device_id mt2701_pctrl_match[] = {
543-
{ .compatible = "mediatek,mt2701-pinctrl", },
544-
{ .compatible = "mediatek,mt7623-pinctrl", },
538+
{ .compatible = "mediatek,mt2701-pinctrl", .data = &mt2701_pinctrl_data },
539+
{ .compatible = "mediatek,mt7623-pinctrl", .data = &mt2701_pinctrl_data },
545540
{}
546541
};
547542
MODULE_DEVICE_TABLE(of, mt2701_pctrl_match);
548543

549544
static struct platform_driver mtk_pinctrl_driver = {
550-
.probe = mt2701_pinctrl_probe,
545+
.probe = mtk_pctrl_common_probe,
551546
.driver = {
552547
.name = "mediatek-mt2701-pinctrl",
553548
.of_match_table = mt2701_pctrl_match,

drivers/pinctrl/mediatek/pinctrl-mt2712.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -587,21 +587,14 @@ static const struct mtk_pinctrl_devdata mt2712_pinctrl_data = {
587587
},
588588
};
589589

590-
static int mt2712_pinctrl_probe(struct platform_device *pdev)
591-
{
592-
return mtk_pctrl_init(pdev, &mt2712_pinctrl_data, NULL);
593-
}
594-
595590
static const struct of_device_id mt2712_pctrl_match[] = {
596-
{
597-
.compatible = "mediatek,mt2712-pinctrl",
598-
},
591+
{ .compatible = "mediatek,mt2712-pinctrl", .data = &mt2712_pinctrl_data },
599592
{ }
600593
};
601594
MODULE_DEVICE_TABLE(of, mt2712_pctrl_match);
602595

603596
static struct platform_driver mtk_pinctrl_driver = {
604-
.probe = mt2712_pinctrl_probe,
597+
.probe = mtk_pctrl_common_probe,
605598
.driver = {
606599
.name = "mediatek-mt2712-pinctrl",
607600
.of_match_table = mt2712_pctrl_match,

drivers/pinctrl/mediatek/pinctrl-mt8127.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -303,18 +303,13 @@ static const struct mtk_pinctrl_devdata mt8127_pinctrl_data = {
303303
},
304304
};
305305

306-
static int mt8127_pinctrl_probe(struct platform_device *pdev)
307-
{
308-
return mtk_pctrl_init(pdev, &mt8127_pinctrl_data, NULL);
309-
}
310-
311306
static const struct of_device_id mt8127_pctrl_match[] = {
312-
{ .compatible = "mediatek,mt8127-pinctrl", },
307+
{ .compatible = "mediatek,mt8127-pinctrl", .data = &mt8127_pinctrl_data },
313308
{ }
314309
};
315310

316311
static struct platform_driver mtk_pinctrl_driver = {
317-
.probe = mt8127_pinctrl_probe,
312+
.probe = mtk_pctrl_common_probe,
318313
.driver = {
319314
.name = "mediatek-mt8127-pinctrl",
320315
.of_match_table = mt8127_pctrl_match,

drivers/pinctrl/mediatek/pinctrl-mt8135.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -316,20 +316,13 @@ static const struct mtk_pinctrl_devdata mt8135_pinctrl_data = {
316316
},
317317
};
318318

319-
static int mt8135_pinctrl_probe(struct platform_device *pdev)
320-
{
321-
return mtk_pctrl_init(pdev, &mt8135_pinctrl_data, NULL);
322-
}
323-
324319
static const struct of_device_id mt8135_pctrl_match[] = {
325-
{
326-
.compatible = "mediatek,mt8135-pinctrl",
327-
},
320+
{ .compatible = "mediatek,mt8135-pinctrl", .data = &mt8135_pinctrl_data },
328321
{ }
329322
};
330323

331324
static struct platform_driver mtk_pinctrl_driver = {
332-
.probe = mt8135_pinctrl_probe,
325+
.probe = mtk_pctrl_common_probe,
333326
.driver = {
334327
.name = "mediatek-mt8135-pinctrl",
335328
.of_match_table = mt8135_pctrl_match,

drivers/pinctrl/mediatek/pinctrl-mt8167.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -335,22 +335,15 @@ static const struct mtk_pinctrl_devdata mt8167_pinctrl_data = {
335335
},
336336
};
337337

338-
static int mt8167_pinctrl_probe(struct platform_device *pdev)
339-
{
340-
return mtk_pctrl_init(pdev, &mt8167_pinctrl_data, NULL);
341-
}
342-
343338
static const struct of_device_id mt8167_pctrl_match[] = {
344-
{
345-
.compatible = "mediatek,mt8167-pinctrl",
346-
},
339+
{ .compatible = "mediatek,mt8167-pinctrl", .data = &mt8167_pinctrl_data },
347340
{}
348341
};
349342

350343
MODULE_DEVICE_TABLE(of, mt8167_pctrl_match);
351344

352345
static struct platform_driver mtk_pinctrl_driver = {
353-
.probe = mt8167_pinctrl_probe,
346+
.probe = mtk_pctrl_common_probe,
354347
.driver = {
355348
.name = "mediatek-mt8167-pinctrl",
356349
.of_match_table = mt8167_pctrl_match,

drivers/pinctrl/mediatek/pinctrl-mt8365.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -469,20 +469,13 @@ static const struct mtk_pinctrl_devdata mt8365_pinctrl_data = {
469469
},
470470
};
471471

472-
static int mtk_pinctrl_probe(struct platform_device *pdev)
473-
{
474-
return mtk_pctrl_init(pdev, &mt8365_pinctrl_data, NULL);
475-
}
476-
477472
static const struct of_device_id mt8365_pctrl_match[] = {
478-
{
479-
.compatible = "mediatek,mt8365-pinctrl",
480-
},
473+
{ .compatible = "mediatek,mt8365-pinctrl", .data = &mt8365_pinctrl_data },
481474
{}
482475
};
483476

484477
static struct platform_driver mtk_pinctrl_driver = {
485-
.probe = mtk_pinctrl_probe,
478+
.probe = mtk_pctrl_common_probe,
486479
.driver = {
487480
.name = "mediatek-mt8365-pinctrl",
488481
.of_match_table = mt8365_pctrl_match,

drivers/pinctrl/mediatek/pinctrl-mt8516.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -335,22 +335,15 @@ static const struct mtk_pinctrl_devdata mt8516_pinctrl_data = {
335335
},
336336
};
337337

338-
static int mt8516_pinctrl_probe(struct platform_device *pdev)
339-
{
340-
return mtk_pctrl_init(pdev, &mt8516_pinctrl_data, NULL);
341-
}
342-
343338
static const struct of_device_id mt8516_pctrl_match[] = {
344-
{
345-
.compatible = "mediatek,mt8516-pinctrl",
346-
},
339+
{ .compatible = "mediatek,mt8516-pinctrl", .data = &mt8516_pinctrl_data },
347340
{}
348341
};
349342

350343
MODULE_DEVICE_TABLE(of, mt8516_pctrl_match);
351344

352345
static struct platform_driver mtk_pinctrl_driver = {
353-
.probe = mt8516_pinctrl_probe,
346+
.probe = mtk_pctrl_common_probe,
354347
.driver = {
355348
.name = "mediatek-mt8516-pinctrl",
356349
.of_match_table = mt8516_pctrl_match,

0 commit comments

Comments
 (0)