@@ -1009,26 +1009,8 @@ static const struct of_device_id of_match_clk_mt2701[] = {
}
};
-static int clk_mt2701_probe(struct platform_device *pdev)
-{
- int (*clk_init)(struct platform_device *);
- int r;
-
- clk_init = of_device_get_match_data(&pdev->dev);
- if (!clk_init)
- return -EINVAL;
-
- r = clk_init(pdev);
- if (r)
- dev_err(&pdev->dev,
- "could not register clock provider: %s: %d\n",
- pdev->name, r);
-
- return r;
-}
-
static struct platform_driver clk_mt2701_drv = {
- .probe = clk_mt2701_probe,
+ .probe = platform_driver_probe_by_of_match_data,
.driver = {
.name = "clk-mt2701",
.of_match_table = of_match_clk_mt2701,
@@ -1441,26 +1441,8 @@ static const struct of_device_id of_match_clk_mt2712[] = {
}
};
-static int clk_mt2712_probe(struct platform_device *pdev)
-{
- int (*clk_probe)(struct platform_device *);
- int r;
-
- clk_probe = of_device_get_match_data(&pdev->dev);
- if (!clk_probe)
- return -EINVAL;
-
- r = clk_probe(pdev);
- if (r != 0)
- dev_err(&pdev->dev,
- "could not register clock provider: %s: %d\n",
- pdev->name, r);
-
- return r;
-}
-
static struct platform_driver clk_mt2712_drv = {
- .probe = clk_mt2712_probe,
+ .probe = platform_driver_probe_by_of_match_data,
.driver = {
.name = "clk-mt2712",
.owner = THIS_MODULE,
@@ -680,26 +680,8 @@ static const struct of_device_id of_match_clk_mt6797[] = {
}
};
-static int clk_mt6797_probe(struct platform_device *pdev)
-{
- int (*clk_init)(struct platform_device *);
- int r;
-
- clk_init = of_device_get_match_data(&pdev->dev);
- if (!clk_init)
- return -EINVAL;
-
- r = clk_init(pdev);
- if (r)
- dev_err(&pdev->dev,
- "could not register clock provider: %s: %d\n",
- pdev->name, r);
-
- return r;
-}
-
static struct platform_driver clk_mt6797_drv = {
- .probe = clk_mt6797_probe,
+ .probe = platform_driver_probe_by_of_match_data,
.driver = {
.name = "clk-mt6797",
.of_match_table = of_match_clk_mt6797,
@@ -127,26 +127,8 @@ static const struct of_device_id of_match_clk_mt7622_eth[] = {
}
};
-static int clk_mt7622_eth_probe(struct platform_device *pdev)
-{
- int (*clk_init)(struct platform_device *);
- int r;
-
- clk_init = of_device_get_match_data(&pdev->dev);
- if (!clk_init)
- return -EINVAL;
-
- r = clk_init(pdev);
- if (r)
- dev_err(&pdev->dev,
- "could not register clock provider: %s: %d\n",
- pdev->name, r);
-
- return r;
-}
-
static struct platform_driver clk_mt7622_eth_drv = {
- .probe = clk_mt7622_eth_probe,
+ .probe = platform_driver_probe_by_of_match_data,
.driver = {
.name = "clk-mt7622-eth",
.of_match_table = of_match_clk_mt7622_eth,
@@ -140,26 +140,8 @@ static const struct of_device_id of_match_clk_mt7622_hif[] = {
}
};
-static int clk_mt7622_hif_probe(struct platform_device *pdev)
-{
- int (*clk_init)(struct platform_device *);
- int r;
-
- clk_init = of_device_get_match_data(&pdev->dev);
- if (!clk_init)
- return -EINVAL;
-
- r = clk_init(pdev);
- if (r)
- dev_err(&pdev->dev,
- "could not register clock provider: %s: %d\n",
- pdev->name, r);
-
- return r;
-}
-
static struct platform_driver clk_mt7622_hif_drv = {
- .probe = clk_mt7622_hif_probe,
+ .probe = platform_driver_probe_by_of_match_data,
.driver = {
.name = "clk-mt7622-hif",
.of_match_table = of_match_clk_mt7622_hif,
@@ -746,26 +746,8 @@ static const struct of_device_id of_match_clk_mt7622[] = {
}
};
-static int clk_mt7622_probe(struct platform_device *pdev)
-{
- int (*clk_init)(struct platform_device *);
- int r;
-
- clk_init = of_device_get_match_data(&pdev->dev);
- if (!clk_init)
- return -EINVAL;
-
- r = clk_init(pdev);
- if (r)
- dev_err(&pdev->dev,
- "could not register clock provider: %s: %d\n",
- pdev->name, r);
-
- return r;
-}
-
static struct platform_driver clk_mt7622_drv = {
- .probe = clk_mt7622_probe,
+ .probe = platform_driver_probe_by_of_match_data,
.driver = {
.name = "clk-mt7622",
.of_match_table = of_match_clk_mt7622,
Use this function to reduce the boiler-plate code that the mediatek clk driver needs to implement to probe clks for different devices within the same driver. Cc: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org> --- drivers/clk/mediatek/clk-mt2701.c | 20 +------------------- drivers/clk/mediatek/clk-mt2712.c | 20 +------------------- drivers/clk/mediatek/clk-mt6797.c | 20 +------------------- drivers/clk/mediatek/clk-mt7622-eth.c | 20 +------------------- drivers/clk/mediatek/clk-mt7622-hif.c | 20 +------------------- drivers/clk/mediatek/clk-mt7622.c | 20 +------------------- 6 files changed, 6 insertions(+), 114 deletions(-)