Linux 6.9-rc1
[linux-2.6-microblaze.git] / drivers / phy / phy-core.c
index d9be6a4..c5c8d70 100644 (file)
@@ -489,6 +489,53 @@ int phy_calibrate(struct phy *phy)
 }
 EXPORT_SYMBOL_GPL(phy_calibrate);
 
+/**
+ * phy_notify_connect() - phy connect notification
+ * @phy: the phy returned by phy_get()
+ * @port: the port index for connect
+ *
+ * If the phy needs to get connection status, the callback can be used.
+ * Returns: %0 if successful, a negative error code otherwise
+ */
+int phy_notify_connect(struct phy *phy, int port)
+{
+       int ret;
+
+       if (!phy || !phy->ops->connect)
+               return 0;
+
+       mutex_lock(&phy->mutex);
+       ret = phy->ops->connect(phy, port);
+       mutex_unlock(&phy->mutex);
+
+       return ret;
+}
+EXPORT_SYMBOL_GPL(phy_notify_connect);
+
+/**
+ * phy_notify_disconnect() - phy disconnect notification
+ * @phy: the phy returned by phy_get()
+ * @port: the port index for disconnect
+ *
+ * If the phy needs to get connection status, the callback can be used.
+ *
+ * Returns: %0 if successful, a negative error code otherwise
+ */
+int phy_notify_disconnect(struct phy *phy, int port)
+{
+       int ret;
+
+       if (!phy || !phy->ops->disconnect)
+               return 0;
+
+       mutex_lock(&phy->mutex);
+       ret = phy->ops->disconnect(phy, port);
+       mutex_unlock(&phy->mutex);
+
+       return ret;
+}
+EXPORT_SYMBOL_GPL(phy_notify_disconnect);
+
 /**
  * phy_configure() - Changes the phy parameters
  * @phy: the phy returned by phy_get()
@@ -700,8 +747,8 @@ EXPORT_SYMBOL_GPL(devm_phy_put);
  * should provide a custom of_xlate function that reads the *args* and returns
  * the appropriate phy.
  */
-struct phy *of_phy_simple_xlate(struct device *dev, struct of_phandle_args
-       *args)
+struct phy *of_phy_simple_xlate(struct device *dev,
+                               const struct of_phandle_args *args)
 {
        struct phy *phy;
        struct class_dev_iter iter;
@@ -1095,7 +1142,7 @@ EXPORT_SYMBOL_GPL(devm_phy_destroy);
 struct phy_provider *__of_phy_provider_register(struct device *dev,
        struct device_node *children, struct module *owner,
        struct phy * (*of_xlate)(struct device *dev,
-                                struct of_phandle_args *args))
+                                const struct of_phandle_args *args))
 {
        struct phy_provider *phy_provider;
 
@@ -1158,7 +1205,7 @@ EXPORT_SYMBOL_GPL(__of_phy_provider_register);
 struct phy_provider *__devm_of_phy_provider_register(struct device *dev,
        struct device_node *children, struct module *owner,
        struct phy * (*of_xlate)(struct device *dev,
-                                struct of_phandle_args *args))
+                                const struct of_phandle_args *args))
 {
        struct phy_provider **ptr, *phy_provider;