+static int otto_emdio_notify_phy_attach(struct phy_device *phydev)
+{
+ struct otto_emdio_priv *priv = otto_emdio_bus_to_priv(phydev->mdio.bus);
+ int port = otto_emdio_phy_to_port(phydev->mdio.bus, phydev->mdio.addr);
+ int ret;
+
+ if (port < 0)
+ return port;
+
+ scoped_guard(mutex, &priv->lock) {
+ if (test_bit(port, priv->phy_poll))
+ return 0;
You seem to be assuming otto_emdio_notify_phy_attach() and
otto_emdio_notify_phy_detach() are not called strictly as pairs. Does
this actually happen?
+static int otto_emdio_init_polling(struct otto_emdio_priv *priv)
+{
+ int err;
+
+ for (int port = 0; port < priv->info->num_ports; port++) {
+ scoped_guard(mutex, &priv->lock) {
What is this mutex protecting?
+ err = otto_emdio_set_port_polling(priv, port, false);
+ if (err)
+ return err;
+ }
+ }
+
+ return 0;
+}
+
Andrew
---
pw-bot: cr