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

phy: Drop unnecessary of_match_device() calls

If probe is reached, we've already matched the device and in the case of
DT matching, the struct device_node pointer will be set. Therefore, there
is no need to call of_match_device() in probe.

Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20231009172923.2457844-16-robh@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Rob Herring and committed by
Vinod Koul
dd69a637 8b6fba3e

+1 -17
-7
drivers/phy/motorola/phy-cpcap-usb.c
··· 15 15 #include <linux/io.h> 16 16 #include <linux/module.h> 17 17 #include <linux/of.h> 18 - #include <linux/of_platform.h> 19 18 #include <linux/iio/consumer.h> 20 19 #include <linux/pinctrl/consumer.h> 21 20 #include <linux/platform_device.h> ··· 611 612 struct phy *generic_phy; 612 613 struct phy_provider *phy_provider; 613 614 struct usb_otg *otg; 614 - const struct of_device_id *of_id; 615 615 int error; 616 - 617 - of_id = of_match_device(of_match_ptr(cpcap_usb_phy_id_table), 618 - &pdev->dev); 619 - if (!of_id) 620 - return -EINVAL; 621 616 622 617 ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); 623 618 if (!ddata)
+1 -10
drivers/phy/ti/phy-dm816x-usb.c
··· 13 13 #include <linux/pm_runtime.h> 14 14 #include <linux/delay.h> 15 15 #include <linux/phy/phy.h> 16 - #include <linux/of_platform.h> 17 16 18 17 #include <linux/mfd/syscon.h> 19 18 ··· 160 161 dm816x_usb_phy_runtime_resume, 161 162 NULL); 162 163 163 - #ifdef CONFIG_OF 164 164 static const struct of_device_id dm816x_usb_phy_id_table[] = { 165 165 { 166 166 .compatible = "ti,dm8168-usb-phy", ··· 167 169 {}, 168 170 }; 169 171 MODULE_DEVICE_TABLE(of, dm816x_usb_phy_id_table); 170 - #endif 171 172 172 173 static int dm816x_usb_phy_probe(struct platform_device *pdev) 173 174 { ··· 175 178 struct phy *generic_phy; 176 179 struct phy_provider *phy_provider; 177 180 struct usb_otg *otg; 178 - const struct of_device_id *of_id; 179 181 int error; 180 - 181 - of_id = of_match_device(of_match_ptr(dm816x_usb_phy_id_table), 182 - &pdev->dev); 183 - if (!of_id) 184 - return -EINVAL; 185 182 186 183 phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL); 187 184 if (!phy) ··· 263 272 .driver = { 264 273 .name = "dm816x-usb-phy", 265 274 .pm = &dm816x_usb_phy_pm_ops, 266 - .of_match_table = of_match_ptr(dm816x_usb_phy_id_table), 275 + .of_match_table = dm816x_usb_phy_id_table, 267 276 }, 268 277 }; 269 278