pinctrl: mediatek: paris: Unify probe function by using OF match data
All of the SoCs using Paris pinctrl are defining a custom probe function that is simply calling mtk_paris_pinctrl_probe() passing a pointer to the SoC specific mtk_pin_soc structure and nothing else. Simplify the probe mechanism across all pinctrl drivers that are using pinctrl-paris by passing the specific mtk_pin_soc as match data and using function mtk_paris_pinctrl_probe as a common probe function for all of them. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org> Link: https://lore.kernel.org/r/20220222111144.20796-2-angelogioacchino.delregno@collabora.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
89388f8730
commit
78df7bba4a
|
@ -1082,21 +1082,16 @@ static const struct mtk_pin_soc mt6765_data = {
|
|||
};
|
||||
|
||||
static const struct of_device_id mt6765_pinctrl_of_match[] = {
|
||||
{ .compatible = "mediatek,mt6765-pinctrl", },
|
||||
{ .compatible = "mediatek,mt6765-pinctrl", .data = &mt6765_data },
|
||||
{ }
|
||||
};
|
||||
|
||||
static int mt6765_pinctrl_probe(struct platform_device *pdev)
|
||||
{
|
||||
return mtk_paris_pinctrl_probe(pdev, &mt6765_data);
|
||||
}
|
||||
|
||||
static struct platform_driver mt6765_pinctrl_driver = {
|
||||
.driver = {
|
||||
.name = "mt6765-pinctrl",
|
||||
.of_match_table = mt6765_pinctrl_of_match,
|
||||
},
|
||||
.probe = mt6765_pinctrl_probe,
|
||||
.probe = mtk_paris_pinctrl_probe,
|
||||
};
|
||||
|
||||
static int __init mt6765_pinctrl_init(void)
|
||||
|
|
|
@ -758,21 +758,16 @@ static const struct mtk_pin_soc mt6779_data = {
|
|||
};
|
||||
|
||||
static const struct of_device_id mt6779_pinctrl_of_match[] = {
|
||||
{ .compatible = "mediatek,mt6779-pinctrl", },
|
||||
{ .compatible = "mediatek,mt6779-pinctrl", .data = &mt6779_data },
|
||||
{ }
|
||||
};
|
||||
|
||||
static int mt6779_pinctrl_probe(struct platform_device *pdev)
|
||||
{
|
||||
return mtk_paris_pinctrl_probe(pdev, &mt6779_data);
|
||||
}
|
||||
|
||||
static struct platform_driver mt6779_pinctrl_driver = {
|
||||
.driver = {
|
||||
.name = "mt6779-pinctrl",
|
||||
.of_match_table = mt6779_pinctrl_of_match,
|
||||
},
|
||||
.probe = mt6779_pinctrl_probe,
|
||||
.probe = mtk_paris_pinctrl_probe,
|
||||
};
|
||||
|
||||
static int __init mt6779_pinctrl_init(void)
|
||||
|
|
|
@ -58,21 +58,16 @@ static const struct mtk_pin_soc mt6797_data = {
|
|||
};
|
||||
|
||||
static const struct of_device_id mt6797_pinctrl_of_match[] = {
|
||||
{ .compatible = "mediatek,mt6797-pinctrl", },
|
||||
{ .compatible = "mediatek,mt6797-pinctrl", .data = &mt6797_data },
|
||||
{ }
|
||||
};
|
||||
|
||||
static int mt6797_pinctrl_probe(struct platform_device *pdev)
|
||||
{
|
||||
return mtk_paris_pinctrl_probe(pdev, &mt6797_data);
|
||||
}
|
||||
|
||||
static struct platform_driver mt6797_pinctrl_driver = {
|
||||
.driver = {
|
||||
.name = "mt6797-pinctrl",
|
||||
.of_match_table = mt6797_pinctrl_of_match,
|
||||
},
|
||||
.probe = mt6797_pinctrl_probe,
|
||||
.probe = mtk_paris_pinctrl_probe,
|
||||
};
|
||||
|
||||
static int __init mt6797_pinctrl_init(void)
|
||||
|
|
|
@ -567,22 +567,17 @@ static const struct mtk_pin_soc mt8183_data = {
|
|||
};
|
||||
|
||||
static const struct of_device_id mt8183_pinctrl_of_match[] = {
|
||||
{ .compatible = "mediatek,mt8183-pinctrl", },
|
||||
{ .compatible = "mediatek,mt8183-pinctrl", .data = &mt8183_data },
|
||||
{ }
|
||||
};
|
||||
|
||||
static int mt8183_pinctrl_probe(struct platform_device *pdev)
|
||||
{
|
||||
return mtk_paris_pinctrl_probe(pdev, &mt8183_data);
|
||||
}
|
||||
|
||||
static struct platform_driver mt8183_pinctrl_driver = {
|
||||
.driver = {
|
||||
.name = "mt8183-pinctrl",
|
||||
.of_match_table = mt8183_pinctrl_of_match,
|
||||
.pm = &mtk_paris_pinctrl_pm_ops,
|
||||
},
|
||||
.probe = mt8183_pinctrl_probe,
|
||||
.probe = mtk_paris_pinctrl_probe,
|
||||
};
|
||||
|
||||
static int __init mt8183_pinctrl_init(void)
|
||||
|
|
|
@ -1381,22 +1381,17 @@ static const struct mtk_pin_soc mt8192_data = {
|
|||
};
|
||||
|
||||
static const struct of_device_id mt8192_pinctrl_of_match[] = {
|
||||
{ .compatible = "mediatek,mt8192-pinctrl", },
|
||||
{ .compatible = "mediatek,mt8192-pinctrl", .data = &mt8192_data },
|
||||
{ }
|
||||
};
|
||||
|
||||
static int mt8192_pinctrl_probe(struct platform_device *pdev)
|
||||
{
|
||||
return mtk_paris_pinctrl_probe(pdev, &mt8192_data);
|
||||
}
|
||||
|
||||
static struct platform_driver mt8192_pinctrl_driver = {
|
||||
.driver = {
|
||||
.name = "mt8192-pinctrl",
|
||||
.of_match_table = mt8192_pinctrl_of_match,
|
||||
.pm = &mtk_paris_pinctrl_pm_ops,
|
||||
},
|
||||
.probe = mt8192_pinctrl_probe,
|
||||
.probe = mtk_paris_pinctrl_probe,
|
||||
};
|
||||
|
||||
static int __init mt8192_pinctrl_init(void)
|
||||
|
|
|
@ -959,22 +959,17 @@ static const struct mtk_pin_soc mt8195_data = {
|
|||
};
|
||||
|
||||
static const struct of_device_id mt8195_pinctrl_of_match[] = {
|
||||
{ .compatible = "mediatek,mt8195-pinctrl", },
|
||||
{ .compatible = "mediatek,mt8195-pinctrl", .data = &mt8195_data },
|
||||
{ }
|
||||
};
|
||||
|
||||
static int mt8195_pinctrl_probe(struct platform_device *pdev)
|
||||
{
|
||||
return mtk_paris_pinctrl_probe(pdev, &mt8195_data);
|
||||
}
|
||||
|
||||
static struct platform_driver mt8195_pinctrl_driver = {
|
||||
.driver = {
|
||||
.name = "mt8195-pinctrl",
|
||||
.of_match_table = mt8195_pinctrl_of_match,
|
||||
.pm = &mtk_paris_pinctrl_pm_ops,
|
||||
},
|
||||
.probe = mt8195_pinctrl_probe,
|
||||
.probe = mtk_paris_pinctrl_probe,
|
||||
};
|
||||
|
||||
static int __init mt8195_pinctrl_init(void)
|
||||
|
|
|
@ -1021,8 +1021,7 @@ static int mtk_pctrl_build_state(struct platform_device *pdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int mtk_paris_pinctrl_probe(struct platform_device *pdev,
|
||||
const struct mtk_pin_soc *soc)
|
||||
int mtk_paris_pinctrl_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct pinctrl_pin_desc *pins;
|
||||
|
@ -1034,7 +1033,11 @@ int mtk_paris_pinctrl_probe(struct platform_device *pdev,
|
|||
return -ENOMEM;
|
||||
|
||||
platform_set_drvdata(pdev, hw);
|
||||
hw->soc = soc;
|
||||
|
||||
hw->soc = device_get_match_data(dev);
|
||||
if (!hw->soc)
|
||||
return -ENOENT;
|
||||
|
||||
hw->dev = &pdev->dev;
|
||||
|
||||
if (!hw->soc->nbase_names)
|
||||
|
|
|
@ -57,8 +57,7 @@
|
|||
id##_funcs, \
|
||||
}
|
||||
|
||||
int mtk_paris_pinctrl_probe(struct platform_device *pdev,
|
||||
const struct mtk_pin_soc *soc);
|
||||
int mtk_paris_pinctrl_probe(struct platform_device *pdev);
|
||||
|
||||
ssize_t mtk_pctrl_show_one_pin(struct mtk_pinctrl *hw,
|
||||
unsigned int gpio, char *buf, unsigned int bufLen);
|
||||
|
|
Loading…
Reference in New Issue