Loading Documentation/phy.txt +6 −4 Original line number Original line Diff line number Diff line Loading @@ -53,9 +53,11 @@ unregister the PHY. The PHY driver should create the PHY in order for other peripheral controllers The PHY driver should create the PHY in order for other peripheral controllers to make use of it. The PHY framework provides 2 APIs to create the PHY. to make use of it. The PHY framework provides 2 APIs to create the PHY. struct phy *phy_create(struct device *dev, const struct phy_ops *ops, struct phy *phy_create(struct device *dev, struct device_node *node, const struct phy_ops *ops, struct phy_init_data *init_data); struct phy_init_data *init_data); struct phy *devm_phy_create(struct device *dev, const struct phy_ops *ops, struct phy *devm_phy_create(struct device *dev, struct device_node *node, const struct phy_ops *ops, struct phy_init_data *init_data); struct phy_init_data *init_data); The PHY drivers can use one of the above 2 APIs to create the PHY by passing The PHY drivers can use one of the above 2 APIs to create the PHY by passing Loading drivers/phy/phy-core.c +18 −7 Original line number Original line Diff line number Diff line Loading @@ -398,13 +398,20 @@ struct phy *of_phy_simple_xlate(struct device *dev, struct of_phandle_args struct phy *phy; struct phy *phy; struct class_dev_iter iter; struct class_dev_iter iter; struct device_node *node = dev->of_node; struct device_node *node = dev->of_node; struct device_node *child; class_dev_iter_init(&iter, phy_class, NULL, NULL); class_dev_iter_init(&iter, phy_class, NULL, NULL); while ((dev = class_dev_iter_next(&iter))) { while ((dev = class_dev_iter_next(&iter))) { phy = to_phy(dev); phy = to_phy(dev); if (node != phy->dev.of_node) if (node != phy->dev.of_node) { for_each_child_of_node(node, child) { if (child == phy->dev.of_node) goto phy_found; } continue; continue; } phy_found: class_dev_iter_exit(&iter); class_dev_iter_exit(&iter); return phy; return phy; } } Loading Loading @@ -562,12 +569,14 @@ EXPORT_SYMBOL_GPL(devm_of_phy_get); /** /** * phy_create() - create a new phy * phy_create() - create a new phy * @dev: device that is creating the new phy * @dev: device that is creating the new phy * @node: device node of the phy * @ops: function pointers for performing phy operations * @ops: function pointers for performing phy operations * @init_data: contains the list of PHY consumers or NULL * @init_data: contains the list of PHY consumers or NULL * * * Called to create a phy using phy framework. * Called to create a phy using phy framework. */ */ struct phy *phy_create(struct device *dev, const struct phy_ops *ops, struct phy *phy_create(struct device *dev, struct device_node *node, const struct phy_ops *ops, struct phy_init_data *init_data) struct phy_init_data *init_data) { { int ret; int ret; Loading @@ -593,7 +602,7 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops, phy->dev.class = phy_class; phy->dev.class = phy_class; phy->dev.parent = dev; phy->dev.parent = dev; phy->dev.of_node = dev->of_node; phy->dev.of_node = node ?: dev->of_node; phy->id = id; phy->id = id; phy->ops = ops; phy->ops = ops; phy->init_data = init_data; phy->init_data = init_data; Loading Loading @@ -625,6 +634,7 @@ EXPORT_SYMBOL_GPL(phy_create); /** /** * devm_phy_create() - create a new phy * devm_phy_create() - create a new phy * @dev: device that is creating the new phy * @dev: device that is creating the new phy * @node: device node of the phy * @ops: function pointers for performing phy operations * @ops: function pointers for performing phy operations * @init_data: contains the list of PHY consumers or NULL * @init_data: contains the list of PHY consumers or NULL * * Loading @@ -633,7 +643,8 @@ EXPORT_SYMBOL_GPL(phy_create); * On driver detach, release function is invoked on the devres data, * On driver detach, release function is invoked on the devres data, * then, devres data is freed. * then, devres data is freed. */ */ struct phy *devm_phy_create(struct device *dev, const struct phy_ops *ops, struct phy *devm_phy_create(struct device *dev, struct device_node *node, const struct phy_ops *ops, struct phy_init_data *init_data) struct phy_init_data *init_data) { { struct phy **ptr, *phy; struct phy **ptr, *phy; Loading @@ -642,7 +653,7 @@ struct phy *devm_phy_create(struct device *dev, const struct phy_ops *ops, if (!ptr) if (!ptr) return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM); phy = phy_create(dev, ops, init_data); phy = phy_create(dev, node, ops, init_data); if (!IS_ERR(phy)) { if (!IS_ERR(phy)) { *ptr = phy; *ptr = phy; devres_add(dev, ptr); devres_add(dev, ptr); Loading drivers/phy/phy-msm-sata.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -644,7 +644,7 @@ static int msm_sata_phy_probe(struct platform_device *pdev) goto out; goto out; } } generic_phy = devm_phy_create(dev, &msm_sata_phy_ops, NULL); generic_phy = devm_phy_create(dev, NULL, &msm_sata_phy_ops, NULL); if (IS_ERR(generic_phy)) { if (IS_ERR(generic_phy)) { err = PTR_ERR(generic_phy); err = PTR_ERR(generic_phy); dev_err(dev, "%s: failed to create phy %d\n", __func__, err); dev_err(dev, "%s: failed to create phy %d\n", __func__, err); Loading drivers/phy/phy-qcom-ufs.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -92,7 +92,7 @@ struct phy *ufs_qcom_phy_generic_probe(struct platform_device *pdev, goto out; goto out; } } generic_phy = devm_phy_create(dev, ufs_qcom_phy_gen_ops, NULL); generic_phy = devm_phy_create(dev, NULL, ufs_qcom_phy_gen_ops, NULL); if (IS_ERR(generic_phy)) { if (IS_ERR(generic_phy)) { err = PTR_ERR(generic_phy); err = PTR_ERR(generic_phy); dev_err(dev, "%s: failed to create phy %d\n", __func__, err); dev_err(dev, "%s: failed to create phy %d\n", __func__, err); Loading include/linux/phy/phy.h +10 −5 Original line number Original line Diff line number Diff line Loading @@ -156,9 +156,10 @@ void devm_phy_put(struct device *dev, struct phy *phy); struct phy *of_phy_get(struct device_node *np, const char *con_id); struct phy *of_phy_get(struct device_node *np, const char *con_id); struct phy *of_phy_simple_xlate(struct device *dev, struct phy *of_phy_simple_xlate(struct device *dev, struct of_phandle_args *args); struct of_phandle_args *args); struct phy *phy_create(struct device *dev, const struct phy_ops *ops, struct phy *phy_create(struct device *dev, struct device_node *node, const struct phy_ops *ops, struct phy_init_data *init_data); struct phy_init_data *init_data); struct phy *devm_phy_create(struct device *dev, struct phy *devm_phy_create(struct device *dev, struct device_node *node, const struct phy_ops *ops, struct phy_init_data *init_data); const struct phy_ops *ops, struct phy_init_data *init_data); void phy_destroy(struct phy *phy); void phy_destroy(struct phy *phy); void devm_phy_destroy(struct device *dev, struct phy *phy); void devm_phy_destroy(struct device *dev, struct phy *phy); Loading Loading @@ -297,13 +298,17 @@ static inline struct phy *of_phy_simple_xlate(struct device *dev, } } static inline struct phy *phy_create(struct device *dev, static inline struct phy *phy_create(struct device *dev, const struct phy_ops *ops, struct phy_init_data *init_data) struct device_node *node, const struct phy_ops *ops, struct phy_init_data *init_data) { { return ERR_PTR(-ENOSYS); return ERR_PTR(-ENOSYS); } } static inline struct phy *devm_phy_create(struct device *dev, static inline struct phy *devm_phy_create(struct device *dev, const struct phy_ops *ops, struct phy_init_data *init_data) struct device_node *node, const struct phy_ops *ops, struct phy_init_data *init_data) { { return ERR_PTR(-ENOSYS); return ERR_PTR(-ENOSYS); } } Loading Loading
Documentation/phy.txt +6 −4 Original line number Original line Diff line number Diff line Loading @@ -53,9 +53,11 @@ unregister the PHY. The PHY driver should create the PHY in order for other peripheral controllers The PHY driver should create the PHY in order for other peripheral controllers to make use of it. The PHY framework provides 2 APIs to create the PHY. to make use of it. The PHY framework provides 2 APIs to create the PHY. struct phy *phy_create(struct device *dev, const struct phy_ops *ops, struct phy *phy_create(struct device *dev, struct device_node *node, const struct phy_ops *ops, struct phy_init_data *init_data); struct phy_init_data *init_data); struct phy *devm_phy_create(struct device *dev, const struct phy_ops *ops, struct phy *devm_phy_create(struct device *dev, struct device_node *node, const struct phy_ops *ops, struct phy_init_data *init_data); struct phy_init_data *init_data); The PHY drivers can use one of the above 2 APIs to create the PHY by passing The PHY drivers can use one of the above 2 APIs to create the PHY by passing Loading
drivers/phy/phy-core.c +18 −7 Original line number Original line Diff line number Diff line Loading @@ -398,13 +398,20 @@ struct phy *of_phy_simple_xlate(struct device *dev, struct of_phandle_args struct phy *phy; struct phy *phy; struct class_dev_iter iter; struct class_dev_iter iter; struct device_node *node = dev->of_node; struct device_node *node = dev->of_node; struct device_node *child; class_dev_iter_init(&iter, phy_class, NULL, NULL); class_dev_iter_init(&iter, phy_class, NULL, NULL); while ((dev = class_dev_iter_next(&iter))) { while ((dev = class_dev_iter_next(&iter))) { phy = to_phy(dev); phy = to_phy(dev); if (node != phy->dev.of_node) if (node != phy->dev.of_node) { for_each_child_of_node(node, child) { if (child == phy->dev.of_node) goto phy_found; } continue; continue; } phy_found: class_dev_iter_exit(&iter); class_dev_iter_exit(&iter); return phy; return phy; } } Loading Loading @@ -562,12 +569,14 @@ EXPORT_SYMBOL_GPL(devm_of_phy_get); /** /** * phy_create() - create a new phy * phy_create() - create a new phy * @dev: device that is creating the new phy * @dev: device that is creating the new phy * @node: device node of the phy * @ops: function pointers for performing phy operations * @ops: function pointers for performing phy operations * @init_data: contains the list of PHY consumers or NULL * @init_data: contains the list of PHY consumers or NULL * * * Called to create a phy using phy framework. * Called to create a phy using phy framework. */ */ struct phy *phy_create(struct device *dev, const struct phy_ops *ops, struct phy *phy_create(struct device *dev, struct device_node *node, const struct phy_ops *ops, struct phy_init_data *init_data) struct phy_init_data *init_data) { { int ret; int ret; Loading @@ -593,7 +602,7 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops, phy->dev.class = phy_class; phy->dev.class = phy_class; phy->dev.parent = dev; phy->dev.parent = dev; phy->dev.of_node = dev->of_node; phy->dev.of_node = node ?: dev->of_node; phy->id = id; phy->id = id; phy->ops = ops; phy->ops = ops; phy->init_data = init_data; phy->init_data = init_data; Loading Loading @@ -625,6 +634,7 @@ EXPORT_SYMBOL_GPL(phy_create); /** /** * devm_phy_create() - create a new phy * devm_phy_create() - create a new phy * @dev: device that is creating the new phy * @dev: device that is creating the new phy * @node: device node of the phy * @ops: function pointers for performing phy operations * @ops: function pointers for performing phy operations * @init_data: contains the list of PHY consumers or NULL * @init_data: contains the list of PHY consumers or NULL * * Loading @@ -633,7 +643,8 @@ EXPORT_SYMBOL_GPL(phy_create); * On driver detach, release function is invoked on the devres data, * On driver detach, release function is invoked on the devres data, * then, devres data is freed. * then, devres data is freed. */ */ struct phy *devm_phy_create(struct device *dev, const struct phy_ops *ops, struct phy *devm_phy_create(struct device *dev, struct device_node *node, const struct phy_ops *ops, struct phy_init_data *init_data) struct phy_init_data *init_data) { { struct phy **ptr, *phy; struct phy **ptr, *phy; Loading @@ -642,7 +653,7 @@ struct phy *devm_phy_create(struct device *dev, const struct phy_ops *ops, if (!ptr) if (!ptr) return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM); phy = phy_create(dev, ops, init_data); phy = phy_create(dev, node, ops, init_data); if (!IS_ERR(phy)) { if (!IS_ERR(phy)) { *ptr = phy; *ptr = phy; devres_add(dev, ptr); devres_add(dev, ptr); Loading
drivers/phy/phy-msm-sata.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -644,7 +644,7 @@ static int msm_sata_phy_probe(struct platform_device *pdev) goto out; goto out; } } generic_phy = devm_phy_create(dev, &msm_sata_phy_ops, NULL); generic_phy = devm_phy_create(dev, NULL, &msm_sata_phy_ops, NULL); if (IS_ERR(generic_phy)) { if (IS_ERR(generic_phy)) { err = PTR_ERR(generic_phy); err = PTR_ERR(generic_phy); dev_err(dev, "%s: failed to create phy %d\n", __func__, err); dev_err(dev, "%s: failed to create phy %d\n", __func__, err); Loading
drivers/phy/phy-qcom-ufs.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -92,7 +92,7 @@ struct phy *ufs_qcom_phy_generic_probe(struct platform_device *pdev, goto out; goto out; } } generic_phy = devm_phy_create(dev, ufs_qcom_phy_gen_ops, NULL); generic_phy = devm_phy_create(dev, NULL, ufs_qcom_phy_gen_ops, NULL); if (IS_ERR(generic_phy)) { if (IS_ERR(generic_phy)) { err = PTR_ERR(generic_phy); err = PTR_ERR(generic_phy); dev_err(dev, "%s: failed to create phy %d\n", __func__, err); dev_err(dev, "%s: failed to create phy %d\n", __func__, err); Loading
include/linux/phy/phy.h +10 −5 Original line number Original line Diff line number Diff line Loading @@ -156,9 +156,10 @@ void devm_phy_put(struct device *dev, struct phy *phy); struct phy *of_phy_get(struct device_node *np, const char *con_id); struct phy *of_phy_get(struct device_node *np, const char *con_id); struct phy *of_phy_simple_xlate(struct device *dev, struct phy *of_phy_simple_xlate(struct device *dev, struct of_phandle_args *args); struct of_phandle_args *args); struct phy *phy_create(struct device *dev, const struct phy_ops *ops, struct phy *phy_create(struct device *dev, struct device_node *node, const struct phy_ops *ops, struct phy_init_data *init_data); struct phy_init_data *init_data); struct phy *devm_phy_create(struct device *dev, struct phy *devm_phy_create(struct device *dev, struct device_node *node, const struct phy_ops *ops, struct phy_init_data *init_data); const struct phy_ops *ops, struct phy_init_data *init_data); void phy_destroy(struct phy *phy); void phy_destroy(struct phy *phy); void devm_phy_destroy(struct device *dev, struct phy *phy); void devm_phy_destroy(struct device *dev, struct phy *phy); Loading Loading @@ -297,13 +298,17 @@ static inline struct phy *of_phy_simple_xlate(struct device *dev, } } static inline struct phy *phy_create(struct device *dev, static inline struct phy *phy_create(struct device *dev, const struct phy_ops *ops, struct phy_init_data *init_data) struct device_node *node, const struct phy_ops *ops, struct phy_init_data *init_data) { { return ERR_PTR(-ENOSYS); return ERR_PTR(-ENOSYS); } } static inline struct phy *devm_phy_create(struct device *dev, static inline struct phy *devm_phy_create(struct device *dev, const struct phy_ops *ops, struct phy_init_data *init_data) struct device_node *node, const struct phy_ops *ops, struct phy_init_data *init_data) { { return ERR_PTR(-ENOSYS); return ERR_PTR(-ENOSYS); } } Loading