@@ -744,8 +744,8 @@ EXPORT_SYMBOL_GPL(devm_phy_put);
744
744
745
745
/**
746
746
* of_phy_simple_xlate() - returns the phy instance from phy provider
747
- * @dev: the PHY provider device
748
- * @args: of_phandle_args (not used here)
747
+ * @dev: the PHY provider device (not used here)
748
+ * @args: of_phandle_args
749
749
*
750
750
* Intended to be used by phy provider for the common case where #phy-cells is
751
751
* 0. For other cases where #phy-cells is greater than '0', the phy provider
@@ -755,21 +755,14 @@ EXPORT_SYMBOL_GPL(devm_phy_put);
755
755
struct phy * of_phy_simple_xlate (struct device * dev ,
756
756
const struct of_phandle_args * args )
757
757
{
758
- struct phy * phy ;
759
- struct class_dev_iter iter ;
760
-
761
- class_dev_iter_init (& iter , & phy_class , NULL , NULL );
762
- while ((dev = class_dev_iter_next (& iter ))) {
763
- phy = to_phy (dev );
764
- if (args -> np != phy -> dev .of_node )
765
- continue ;
758
+ struct device * target_dev ;
766
759
767
- class_dev_iter_exit ( & iter );
768
- return phy ;
769
- }
760
+ target_dev = class_find_device_by_of_node ( & phy_class , args -> np );
761
+ if (! target_dev )
762
+ return ERR_PTR ( - ENODEV );
770
763
771
- class_dev_iter_exit ( & iter );
772
- return ERR_PTR ( - ENODEV );
764
+ put_device ( target_dev );
765
+ return to_phy ( target_dev );
773
766
}
774
767
EXPORT_SYMBOL_GPL (of_phy_simple_xlate );
775
768
0 commit comments