Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

phy: samsung: use of_device_get_match_data()

reduce the boilerplate code to get the specific data

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

authored by

Chunfeng Yun and committed by
Kishon Vijay Abraham I
e0ed4082 cd4ec4b0

+9 -12
+2 -3
drivers/phy/samsung/phy-exynos-dp-video.c
··· 16 16 #include <linux/mfd/syscon.h> 17 17 #include <linux/of.h> 18 18 #include <linux/of_address.h> 19 + #include <linux/of_device.h> 19 20 #include <linux/phy/phy.h> 20 21 #include <linux/platform_device.h> 21 22 #include <linux/regmap.h> ··· 79 78 { 80 79 struct exynos_dp_video_phy *state; 81 80 struct device *dev = &pdev->dev; 82 - const struct of_device_id *match; 83 81 struct phy_provider *phy_provider; 84 82 struct phy *phy; 85 83 ··· 93 93 return PTR_ERR(state->regs); 94 94 } 95 95 96 - match = of_match_node(exynos_dp_video_phy_of_match, dev->of_node); 97 - state->drvdata = match->data; 96 + state->drvdata = of_device_get_match_data(dev); 98 97 99 98 phy = devm_phy_create(dev, NULL, &exynos_dp_video_phy_ops); 100 99 if (IS_ERR(phy)) {
+4 -3
drivers/phy/samsung/phy-exynos5-usbdrd.c
··· 18 18 #include <linux/module.h> 19 19 #include <linux/of.h> 20 20 #include <linux/of_address.h> 21 + #include <linux/of_device.h> 21 22 #include <linux/phy/phy.h> 22 23 #include <linux/platform_device.h> 23 24 #include <linux/mutex.h> ··· 663 662 struct exynos5_usbdrd_phy *phy_drd; 664 663 struct phy_provider *phy_provider; 665 664 struct resource *res; 666 - const struct of_device_id *match; 667 665 const struct exynos5_usbdrd_phy_drvdata *drv_data; 668 666 struct regmap *reg_pmu; 669 667 u32 pmu_offset; ··· 681 681 if (IS_ERR(phy_drd->reg_phy)) 682 682 return PTR_ERR(phy_drd->reg_phy); 683 683 684 - match = of_match_node(exynos5_usbdrd_phy_of_match, pdev->dev.of_node); 684 + drv_data = of_device_get_match_data(dev); 685 + if (!drv_data) 686 + return -EINVAL; 685 687 686 - drv_data = match->data; 687 688 phy_drd->drv_data = drv_data; 688 689 689 690 ret = exynos5_usbdrd_phy_clk_handle(phy_drd);
+3 -6
drivers/phy/samsung/phy-samsung-usb2.c
··· 14 14 #include <linux/module.h> 15 15 #include <linux/of.h> 16 16 #include <linux/of_address.h> 17 + #include <linux/of_device.h> 17 18 #include <linux/phy/phy.h> 18 19 #include <linux/platform_device.h> 19 20 #include <linux/spinlock.h> ··· 143 142 144 143 static int samsung_usb2_phy_probe(struct platform_device *pdev) 145 144 { 146 - const struct of_device_id *match; 147 145 const struct samsung_usb2_phy_config *cfg; 148 146 struct device *dev = &pdev->dev; 149 147 struct phy_provider *phy_provider; ··· 155 155 return -EINVAL; 156 156 } 157 157 158 - match = of_match_node(samsung_usb2_phy_of_match, pdev->dev.of_node); 159 - if (!match) { 160 - dev_err(dev, "of_match_node() failed\n"); 158 + cfg = of_device_get_match_data(dev); 159 + if (!cfg) 161 160 return -EINVAL; 162 - } 163 - cfg = match->data; 164 161 165 162 drv = devm_kzalloc(dev, sizeof(struct samsung_usb2_phy_driver) + 166 163 cfg->num_phys * sizeof(struct samsung_usb2_phy_instance),