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

phy: constify of_phandle_args in xlate

The xlate callbacks are supposed to translate of_phandle_args to proper
provider without modifying the of_phandle_args. Make the argument
pointer to const for code safety and readability.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Thierry Reding <treding@nvidia.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Florian Fainelli <florian.fainelli@broadcom.com> #Broadcom
Link: https://lore.kernel.org/r/20240217093937.58234-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Vinod Koul
00ca8a15 505dfc6b

+55 -55
+1 -1
drivers/phy/allwinner/phy-sun4i-usb.c
··· 683 683 } 684 684 685 685 static struct phy *sun4i_usb_phy_xlate(struct device *dev, 686 - struct of_phandle_args *args) 686 + const struct of_phandle_args *args) 687 687 { 688 688 struct sun4i_usb_phy_data *data = dev_get_drvdata(dev); 689 689
+1 -1
drivers/phy/amlogic/phy-meson-g12a-usb3-pcie.c
··· 350 350 } 351 351 352 352 static struct phy *phy_g12a_usb3_pcie_xlate(struct device *dev, 353 - struct of_phandle_args *args) 353 + const struct of_phandle_args *args) 354 354 { 355 355 struct phy_g12a_usb3_pcie_priv *priv = dev_get_drvdata(dev); 356 356 unsigned int mode;
+1 -1
drivers/phy/broadcom/phy-bcm-sr-pcie.c
··· 195 195 }; 196 196 197 197 static struct phy *sr_pcie_phy_xlate(struct device *dev, 198 - struct of_phandle_args *args) 198 + const struct of_phandle_args *args) 199 199 { 200 200 struct sr_pcie_phy_core *core; 201 201 int phy_idx;
+1 -1
drivers/phy/broadcom/phy-bcm-sr-usb.c
··· 209 209 }; 210 210 211 211 static struct phy *bcm_usb_phy_xlate(struct device *dev, 212 - struct of_phandle_args *args) 212 + const struct of_phandle_args *args) 213 213 { 214 214 struct bcm_usb_phy_cfg *phy_cfg; 215 215 int phy_idx;
+1 -1
drivers/phy/broadcom/phy-bcm63xx-usbh.c
··· 366 366 }; 367 367 368 368 static struct phy *bcm63xx_usbh_phy_xlate(struct device *dev, 369 - struct of_phandle_args *args) 369 + const struct of_phandle_args *args) 370 370 { 371 371 struct bcm63xx_usbh_phy *usbh = dev_get_drvdata(dev); 372 372
+1 -1
drivers/phy/broadcom/phy-brcm-usb.c
··· 175 175 }; 176 176 177 177 static struct phy *brcm_usb_phy_xlate(struct device *dev, 178 - struct of_phandle_args *args) 178 + const struct of_phandle_args *args) 179 179 { 180 180 struct brcm_usb_phy_data *data = dev_get_drvdata(dev); 181 181
+1 -1
drivers/phy/freescale/phy-fsl-imx8qm-lvds-phy.c
··· 294 294 } 295 295 296 296 static struct phy *mixel_lvds_phy_xlate(struct device *dev, 297 - struct of_phandle_args *args) 297 + const struct of_phandle_args *args) 298 298 { 299 299 struct mixel_lvds_phy_priv *priv = dev_get_drvdata(dev); 300 300 unsigned int phy_id;
+1 -1
drivers/phy/freescale/phy-fsl-lynx-28g.c
··· 556 556 } 557 557 558 558 static struct phy *lynx_28g_xlate(struct device *dev, 559 - struct of_phandle_args *args) 559 + const struct of_phandle_args *args) 560 560 { 561 561 struct lynx_28g_priv *priv = dev_get_drvdata(dev); 562 562 int idx = args->args[0];
+1 -1
drivers/phy/hisilicon/phy-histb-combphy.c
··· 163 163 }; 164 164 165 165 static struct phy *histb_combphy_xlate(struct device *dev, 166 - struct of_phandle_args *args) 166 + const struct of_phandle_args *args) 167 167 { 168 168 struct histb_combphy_priv *priv = dev_get_drvdata(dev); 169 169 struct histb_combphy_mode *mode = &priv->mode;
+1 -1
drivers/phy/intel/phy-intel-lgm-combo.c
··· 508 508 }; 509 509 510 510 static struct phy *intel_cbphy_xlate(struct device *dev, 511 - struct of_phandle_args *args) 511 + const struct of_phandle_args *args) 512 512 { 513 513 struct intel_combo_phy *cbphy = dev_get_drvdata(dev); 514 514 u32 iphy_id;
+1 -1
drivers/phy/lantiq/phy-lantiq-vrx200-pcie.c
··· 358 358 }; 359 359 360 360 static struct phy *ltq_vrx200_pcie_phy_xlate(struct device *dev, 361 - struct of_phandle_args *args) 361 + const struct of_phandle_args *args) 362 362 { 363 363 struct ltq_vrx200_pcie_phy_priv *priv = dev_get_drvdata(dev); 364 364 unsigned int mode;
+1 -1
drivers/phy/marvell/phy-armada375-usb2.c
··· 61 61 * USB3 case it still optional and we use ENODEV. 62 62 */ 63 63 static struct phy *armada375_usb_phy_xlate(struct device *dev, 64 - struct of_phandle_args *args) 64 + const struct of_phandle_args *args) 65 65 { 66 66 struct armada375_cluster_phy *cluster_phy = dev_get_drvdata(dev); 67 67
+1 -1
drivers/phy/marvell/phy-armada38x-comphy.c
··· 160 160 }; 161 161 162 162 static struct phy *a38x_comphy_xlate(struct device *dev, 163 - struct of_phandle_args *args) 163 + const struct of_phandle_args *args) 164 164 { 165 165 struct a38x_comphy_lane *lane; 166 166 struct phy *phy;
+1 -1
drivers/phy/marvell/phy-berlin-sata.c
··· 155 155 } 156 156 157 157 static struct phy *phy_berlin_sata_phy_xlate(struct device *dev, 158 - struct of_phandle_args *args) 158 + const struct of_phandle_args *args) 159 159 { 160 160 struct phy_berlin_priv *priv = dev_get_drvdata(dev); 161 161 int i;
+1 -1
drivers/phy/marvell/phy-mvebu-a3700-comphy.c
··· 1213 1213 }; 1214 1214 1215 1215 static struct phy *mvebu_a3700_comphy_xlate(struct device *dev, 1216 - struct of_phandle_args *args) 1216 + const struct of_phandle_args *args) 1217 1217 { 1218 1218 struct mvebu_a3700_comphy_lane *lane; 1219 1219 unsigned int port;
+1 -1
drivers/phy/marvell/phy-mvebu-cp110-comphy.c
··· 917 917 }; 918 918 919 919 static struct phy *mvebu_comphy_xlate(struct device *dev, 920 - struct of_phandle_args *args) 920 + const struct of_phandle_args *args) 921 921 { 922 922 struct mvebu_comphy_lane *lane; 923 923 struct phy *phy;
+1 -1
drivers/phy/mediatek/phy-mtk-mipi-csi-0-5.c
··· 165 165 } 166 166 167 167 static struct phy *mtk_mipi_cdphy_xlate(struct device *dev, 168 - struct of_phandle_args *args) 168 + const struct of_phandle_args *args) 169 169 { 170 170 struct mtk_mipi_cdphy_port *priv = dev_get_drvdata(dev); 171 171
+1 -1
drivers/phy/mediatek/phy-mtk-tphy.c
··· 1467 1467 } 1468 1468 1469 1469 static struct phy *mtk_phy_xlate(struct device *dev, 1470 - struct of_phandle_args *args) 1470 + const struct of_phandle_args *args) 1471 1471 { 1472 1472 struct mtk_tphy *tphy = dev_get_drvdata(dev); 1473 1473 struct mtk_phy_instance *instance = NULL;
+1 -1
drivers/phy/mediatek/phy-mtk-xsphy.c
··· 378 378 } 379 379 380 380 static struct phy *mtk_phy_xlate(struct device *dev, 381 - struct of_phandle_args *args) 381 + const struct of_phandle_args *args) 382 382 { 383 383 struct mtk_xsphy *xsphy = dev_get_drvdata(dev); 384 384 struct xsphy_instance *inst = NULL;
+1 -1
drivers/phy/microchip/lan966x_serdes.c
··· 516 516 }; 517 517 518 518 static struct phy *serdes_simple_xlate(struct device *dev, 519 - struct of_phandle_args *args) 519 + const struct of_phandle_args *args) 520 520 { 521 521 struct serdes_ctrl *ctrl = dev_get_drvdata(dev); 522 522 unsigned int port, idx, i;
+1 -1
drivers/phy/microchip/sparx5_serdes.c
··· 2509 2509 2510 2510 /* Client lookup function, uses serdes index */ 2511 2511 static struct phy *sparx5_serdes_xlate(struct device *dev, 2512 - struct of_phandle_args *args) 2512 + const struct of_phandle_args *args) 2513 2513 { 2514 2514 struct sparx5_serdes_private *priv = dev_get_drvdata(dev); 2515 2515 int idx;
+1 -1
drivers/phy/mscc/phy-ocelot-serdes.c
··· 441 441 }; 442 442 443 443 static struct phy *serdes_simple_xlate(struct device *dev, 444 - struct of_phandle_args *args) 444 + const struct of_phandle_args *args) 445 445 { 446 446 struct serdes_ctrl *ctrl = dev_get_drvdata(dev); 447 447 unsigned int port, idx, i;
+4 -4
drivers/phy/phy-core.c
··· 700 700 * should provide a custom of_xlate function that reads the *args* and returns 701 701 * the appropriate phy. 702 702 */ 703 - struct phy *of_phy_simple_xlate(struct device *dev, struct of_phandle_args 704 - *args) 703 + struct phy *of_phy_simple_xlate(struct device *dev, 704 + const struct of_phandle_args *args) 705 705 { 706 706 struct phy *phy; 707 707 struct class_dev_iter iter; ··· 1095 1095 struct phy_provider *__of_phy_provider_register(struct device *dev, 1096 1096 struct device_node *children, struct module *owner, 1097 1097 struct phy * (*of_xlate)(struct device *dev, 1098 - struct of_phandle_args *args)) 1098 + const struct of_phandle_args *args)) 1099 1099 { 1100 1100 struct phy_provider *phy_provider; 1101 1101 ··· 1158 1158 struct phy_provider *__devm_of_phy_provider_register(struct device *dev, 1159 1159 struct device_node *children, struct module *owner, 1160 1160 struct phy * (*of_xlate)(struct device *dev, 1161 - struct of_phandle_args *args)) 1161 + const struct of_phandle_args *args)) 1162 1162 { 1163 1163 struct phy_provider **ptr, *phy_provider; 1164 1164
+1 -1
drivers/phy/phy-xgene.c
··· 1611 1611 }; 1612 1612 1613 1613 static struct phy *xgene_phy_xlate(struct device *dev, 1614 - struct of_phandle_args *args) 1614 + const struct of_phandle_args *args) 1615 1615 { 1616 1616 struct xgene_phy_ctx *ctx = dev_get_drvdata(dev); 1617 1617
+1 -1
drivers/phy/qualcomm/phy-qcom-qmp-combo.c
··· 3454 3454 return 0; 3455 3455 } 3456 3456 3457 - static struct phy *qmp_combo_phy_xlate(struct device *dev, struct of_phandle_args *args) 3457 + static struct phy *qmp_combo_phy_xlate(struct device *dev, const struct of_phandle_args *args) 3458 3458 { 3459 3459 struct qmp_combo *qmp = dev_get_drvdata(dev); 3460 3460
+1 -1
drivers/phy/ralink/phy-mt7621-pci.c
··· 263 263 }; 264 264 265 265 static struct phy *mt7621_pcie_phy_of_xlate(struct device *dev, 266 - struct of_phandle_args *args) 266 + const struct of_phandle_args *args) 267 267 { 268 268 struct mt7621_pci_phy *mt7621_phy = dev_get_drvdata(dev); 269 269
+1 -1
drivers/phy/renesas/phy-rcar-gen2.c
··· 306 306 MODULE_DEVICE_TABLE(of, rcar_gen2_phy_match_table); 307 307 308 308 static struct phy *rcar_gen2_phy_xlate(struct device *dev, 309 - struct of_phandle_args *args) 309 + const struct of_phandle_args *args) 310 310 { 311 311 struct rcar_gen2_phy_driver *drv; 312 312 struct device_node *np = args->np;
+1 -1
drivers/phy/renesas/phy-rcar-gen3-usb2.c
··· 608 608 }; 609 609 610 610 static struct phy *rcar_gen3_phy_usb2_xlate(struct device *dev, 611 - struct of_phandle_args *args) 611 + const struct of_phandle_args *args) 612 612 { 613 613 struct rcar_gen3_chan *ch = dev_get_drvdata(dev); 614 614
+1 -1
drivers/phy/renesas/r8a779f0-ether-serdes.c
··· 334 334 }; 335 335 336 336 static struct phy *r8a779f0_eth_serdes_xlate(struct device *dev, 337 - struct of_phandle_args *args) 337 + const struct of_phandle_args *args) 338 338 { 339 339 struct r8a779f0_eth_serdes_drv_data *dd = dev_get_drvdata(dev); 340 340
+1 -1
drivers/phy/rockchip/phy-rockchip-naneng-combphy.c
··· 251 251 .owner = THIS_MODULE, 252 252 }; 253 253 254 - static struct phy *rockchip_combphy_xlate(struct device *dev, struct of_phandle_args *args) 254 + static struct phy *rockchip_combphy_xlate(struct device *dev, const struct of_phandle_args *args) 255 255 { 256 256 struct rockchip_combphy_priv *priv = dev_get_drvdata(dev); 257 257
+1 -1
drivers/phy/rockchip/phy-rockchip-pcie.c
··· 82 82 } 83 83 84 84 static struct phy *rockchip_pcie_phy_of_xlate(struct device *dev, 85 - struct of_phandle_args *args) 85 + const struct of_phandle_args *args) 86 86 { 87 87 struct rockchip_pcie_phy *rk_phy = dev_get_drvdata(dev); 88 88
+1 -1
drivers/phy/samsung/phy-exynos-mipi-video.c
··· 274 274 } 275 275 276 276 static struct phy *exynos_mipi_video_phy_xlate(struct device *dev, 277 - struct of_phandle_args *args) 277 + const struct of_phandle_args *args) 278 278 { 279 279 struct exynos_mipi_video_phy *state = dev_get_drvdata(dev); 280 280
+1 -1
drivers/phy/samsung/phy-exynos5-usbdrd.c
··· 715 715 } 716 716 717 717 static struct phy *exynos5_usbdrd_phy_xlate(struct device *dev, 718 - struct of_phandle_args *args) 718 + const struct of_phandle_args *args) 719 719 { 720 720 struct exynos5_usbdrd_phy *phy_drd = dev_get_drvdata(dev); 721 721
+1 -1
drivers/phy/samsung/phy-samsung-usb2.c
··· 87 87 }; 88 88 89 89 static struct phy *samsung_usb2_phy_xlate(struct device *dev, 90 - struct of_phandle_args *args) 90 + const struct of_phandle_args *args) 91 91 { 92 92 struct samsung_usb2_phy_driver *drv; 93 93
+1 -1
drivers/phy/socionext/phy-uniphier-usb2.c
··· 81 81 } 82 82 83 83 static struct phy *uniphier_u2phy_xlate(struct device *dev, 84 - struct of_phandle_args *args) 84 + const struct of_phandle_args *args) 85 85 { 86 86 struct uniphier_u2phy_priv *priv = dev_get_drvdata(dev); 87 87
+1 -1
drivers/phy/st/phy-miphy28lp.c
··· 1074 1074 } 1075 1075 1076 1076 static struct phy *miphy28lp_xlate(struct device *dev, 1077 - struct of_phandle_args *args) 1077 + const struct of_phandle_args *args) 1078 1078 { 1079 1079 struct miphy28lp_dev *miphy_dev = dev_get_drvdata(dev); 1080 1080 struct miphy28lp_phy *miphy_phy = NULL;
+1 -1
drivers/phy/st/phy-spear1310-miphy.c
··· 183 183 }; 184 184 185 185 static struct phy *spear1310_miphy_xlate(struct device *dev, 186 - struct of_phandle_args *args) 186 + const struct of_phandle_args *args) 187 187 { 188 188 struct spear1310_miphy_priv *priv = dev_get_drvdata(dev); 189 189
+1 -1
drivers/phy/st/phy-spear1340-miphy.c
··· 220 220 spear1340_miphy_resume); 221 221 222 222 static struct phy *spear1340_miphy_xlate(struct device *dev, 223 - struct of_phandle_args *args) 223 + const struct of_phandle_args *args) 224 224 { 225 225 struct spear1340_miphy_priv *priv = dev_get_drvdata(dev); 226 226
+1 -1
drivers/phy/st/phy-stm32-usbphyc.c
··· 574 574 } 575 575 576 576 static struct phy *stm32_usbphyc_of_xlate(struct device *dev, 577 - struct of_phandle_args *args) 577 + const struct of_phandle_args *args) 578 578 { 579 579 struct stm32_usbphyc *usbphyc = dev_get_drvdata(dev); 580 580 struct stm32_usbphyc_phy *usbphyc_phy = NULL;
+1 -1
drivers/phy/tegra/xusb.c
··· 22 22 #include "xusb.h" 23 23 24 24 static struct phy *tegra_xusb_pad_of_xlate(struct device *dev, 25 - struct of_phandle_args *args) 25 + const struct of_phandle_args *args) 26 26 { 27 27 struct tegra_xusb_pad *pad = dev_get_drvdata(dev); 28 28 struct phy *phy = NULL;
+1 -1
drivers/phy/ti/phy-am654-serdes.c
··· 495 495 } 496 496 497 497 static struct phy *serdes_am654_xlate(struct device *dev, 498 - struct of_phandle_args *args) 498 + const struct of_phandle_args *args) 499 499 { 500 500 struct serdes_am654 *am654_phy; 501 501 struct phy *phy;
+1 -1
drivers/phy/ti/phy-da8xx-usb.c
··· 119 119 }; 120 120 121 121 static struct phy *da8xx_usb_phy_of_xlate(struct device *dev, 122 - struct of_phandle_args *args) 122 + const struct of_phandle_args *args) 123 123 { 124 124 struct da8xx_usb_phy *d_phy = dev_get_drvdata(dev); 125 125
+1 -1
drivers/phy/ti/phy-gmii-sel.c
··· 297 297 }; 298 298 299 299 static struct phy *phy_gmii_sel_of_xlate(struct device *dev, 300 - struct of_phandle_args *args) 300 + const struct of_phandle_args *args) 301 301 { 302 302 struct phy_gmii_sel_priv *priv = dev_get_drvdata(dev); 303 303 int phy_id = args->args[0];
+1 -1
drivers/phy/xilinx/phy-zynqmp.c
··· 768 768 769 769 /* Translate OF phandle and args to PHY instance. */ 770 770 static struct phy *xpsgtr_xlate(struct device *dev, 771 - struct of_phandle_args *args) 771 + const struct of_phandle_args *args) 772 772 { 773 773 struct xpsgtr_dev *gtr_dev = dev_get_drvdata(dev); 774 774 struct xpsgtr_phy *gtr_phy;
+1 -1
drivers/pinctrl/tegra/pinctrl-tegra-xusb.c
··· 685 685 }; 686 686 687 687 static struct phy *tegra_xusb_padctl_xlate(struct device *dev, 688 - struct of_phandle_args *args) 688 + const struct of_phandle_args *args) 689 689 { 690 690 struct tegra_xusb_padctl *padctl = dev_get_drvdata(dev); 691 691 unsigned int index = args->args[0];
+7 -7
include/linux/phy/phy.h
··· 176 176 struct module *owner; 177 177 struct list_head list; 178 178 struct phy * (*of_xlate)(struct device *dev, 179 - struct of_phandle_args *args); 179 + const struct of_phandle_args *args); 180 180 }; 181 181 182 182 /** ··· 265 265 void devm_phy_put(struct device *dev, struct phy *phy); 266 266 struct phy *of_phy_get(struct device_node *np, const char *con_id); 267 267 struct phy *of_phy_simple_xlate(struct device *dev, 268 - struct of_phandle_args *args); 268 + const struct of_phandle_args *args); 269 269 struct phy *phy_create(struct device *dev, struct device_node *node, 270 270 const struct phy_ops *ops); 271 271 struct phy *devm_phy_create(struct device *dev, struct device_node *node, ··· 275 275 struct phy_provider *__of_phy_provider_register(struct device *dev, 276 276 struct device_node *children, struct module *owner, 277 277 struct phy * (*of_xlate)(struct device *dev, 278 - struct of_phandle_args *args)); 278 + const struct of_phandle_args *args)); 279 279 struct phy_provider *__devm_of_phy_provider_register(struct device *dev, 280 280 struct device_node *children, struct module *owner, 281 281 struct phy * (*of_xlate)(struct device *dev, 282 - struct of_phandle_args *args)); 282 + const struct of_phandle_args *args)); 283 283 void of_phy_provider_unregister(struct phy_provider *phy_provider); 284 284 void devm_of_phy_provider_unregister(struct device *dev, 285 285 struct phy_provider *phy_provider); ··· 479 479 } 480 480 481 481 static inline struct phy *of_phy_simple_xlate(struct device *dev, 482 - struct of_phandle_args *args) 482 + const struct of_phandle_args *args) 483 483 { 484 484 return ERR_PTR(-ENOSYS); 485 485 } ··· 509 509 static inline struct phy_provider *__of_phy_provider_register( 510 510 struct device *dev, struct device_node *children, struct module *owner, 511 511 struct phy * (*of_xlate)(struct device *dev, 512 - struct of_phandle_args *args)) 512 + const struct of_phandle_args *args)) 513 513 { 514 514 return ERR_PTR(-ENOSYS); 515 515 } ··· 517 517 static inline struct phy_provider *__devm_of_phy_provider_register(struct device 518 518 *dev, struct device_node *children, struct module *owner, 519 519 struct phy * (*of_xlate)(struct device *dev, 520 - struct of_phandle_args *args)) 520 + const struct of_phandle_args *args)) 521 521 { 522 522 return ERR_PTR(-ENOSYS); 523 523 }