net: phy: intel-xway: remove the use of .ack_interrupt()
authorIoana Ciornei <ioana.ciornei@nxp.com>
Mon, 23 Nov 2020 15:38:04 +0000 (17:38 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 25 Nov 2020 19:18:37 +0000 (11:18 -0800)
In preparation of removing the .ack_interrupt() callback, we must replace
its occurrences (aka phy_clear_interrupt), from the 2 places where it is
called from (phy_enable_interrupts and phy_disable_interrupts), with
equivalent functionality.

This means that clearing interrupts now becomes something that the PHY
driver is responsible of doing, before enabling interrupts and after
clearing them. Make this driver follow the new contract.

Cc: Mathias Kresin <dev@kresin.me>
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/intel-xway.c

index 1a27ae1bec5c8de83f24534b2156a3255ee55c62..6eac50d4b42fc5fff4c696f1bf56a6e0b49b0c73 100644 (file)
@@ -212,11 +212,24 @@ static int xway_gphy_ack_interrupt(struct phy_device *phydev)
 static int xway_gphy_config_intr(struct phy_device *phydev)
 {
        u16 mask = 0;
+       int err;
+
+       if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
+               err = xway_gphy_ack_interrupt(phydev);
+               if (err)
+                       return err;
 
-       if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
                mask = XWAY_MDIO_INIT_MASK;
+               err = phy_write(phydev, XWAY_MDIO_IMASK, mask);
+       } else {
+               err = phy_write(phydev, XWAY_MDIO_IMASK, mask);
+               if (err)
+                       return err;
+
+               err = xway_gphy_ack_interrupt(phydev);
+       }
 
-       return phy_write(phydev, XWAY_MDIO_IMASK, mask);
+       return err;
 }
 
 static irqreturn_t xway_gphy_handle_interrupt(struct phy_device *phydev)
@@ -245,7 +258,6 @@ static struct phy_driver xway_gphy[] = {
                /* PHY_GBIT_FEATURES */
                .config_init    = xway_gphy_config_init,
                .config_aneg    = xway_gphy14_config_aneg,
-               .ack_interrupt  = xway_gphy_ack_interrupt,
                .handle_interrupt = xway_gphy_handle_interrupt,
                .config_intr    = xway_gphy_config_intr,
                .suspend        = genphy_suspend,
@@ -257,7 +269,6 @@ static struct phy_driver xway_gphy[] = {
                /* PHY_BASIC_FEATURES */
                .config_init    = xway_gphy_config_init,
                .config_aneg    = xway_gphy14_config_aneg,
-               .ack_interrupt  = xway_gphy_ack_interrupt,
                .handle_interrupt = xway_gphy_handle_interrupt,
                .config_intr    = xway_gphy_config_intr,
                .suspend        = genphy_suspend,
@@ -269,7 +280,6 @@ static struct phy_driver xway_gphy[] = {
                /* PHY_GBIT_FEATURES */
                .config_init    = xway_gphy_config_init,
                .config_aneg    = xway_gphy14_config_aneg,
-               .ack_interrupt  = xway_gphy_ack_interrupt,
                .handle_interrupt = xway_gphy_handle_interrupt,
                .config_intr    = xway_gphy_config_intr,
                .suspend        = genphy_suspend,
@@ -281,7 +291,6 @@ static struct phy_driver xway_gphy[] = {
                /* PHY_BASIC_FEATURES */
                .config_init    = xway_gphy_config_init,
                .config_aneg    = xway_gphy14_config_aneg,
-               .ack_interrupt  = xway_gphy_ack_interrupt,
                .handle_interrupt = xway_gphy_handle_interrupt,
                .config_intr    = xway_gphy_config_intr,
                .suspend        = genphy_suspend,
@@ -292,7 +301,6 @@ static struct phy_driver xway_gphy[] = {
                .name           = "Intel XWAY PHY11G (PEF 7071/PEF 7072) v1.5 / v1.6",
                /* PHY_GBIT_FEATURES */
                .config_init    = xway_gphy_config_init,
-               .ack_interrupt  = xway_gphy_ack_interrupt,
                .handle_interrupt = xway_gphy_handle_interrupt,
                .config_intr    = xway_gphy_config_intr,
                .suspend        = genphy_suspend,
@@ -303,7 +311,6 @@ static struct phy_driver xway_gphy[] = {
                .name           = "Intel XWAY PHY22F (PEF 7061) v1.5 / v1.6",
                /* PHY_BASIC_FEATURES */
                .config_init    = xway_gphy_config_init,
-               .ack_interrupt  = xway_gphy_ack_interrupt,
                .handle_interrupt = xway_gphy_handle_interrupt,
                .config_intr    = xway_gphy_config_intr,
                .suspend        = genphy_suspend,
@@ -314,7 +321,6 @@ static struct phy_driver xway_gphy[] = {
                .name           = "Intel XWAY PHY11G (xRX v1.1 integrated)",
                /* PHY_GBIT_FEATURES */
                .config_init    = xway_gphy_config_init,
-               .ack_interrupt  = xway_gphy_ack_interrupt,
                .handle_interrupt = xway_gphy_handle_interrupt,
                .config_intr    = xway_gphy_config_intr,
                .suspend        = genphy_suspend,
@@ -325,7 +331,6 @@ static struct phy_driver xway_gphy[] = {
                .name           = "Intel XWAY PHY22F (xRX v1.1 integrated)",
                /* PHY_BASIC_FEATURES */
                .config_init    = xway_gphy_config_init,
-               .ack_interrupt  = xway_gphy_ack_interrupt,
                .handle_interrupt = xway_gphy_handle_interrupt,
                .config_intr    = xway_gphy_config_intr,
                .suspend        = genphy_suspend,
@@ -336,7 +341,6 @@ static struct phy_driver xway_gphy[] = {
                .name           = "Intel XWAY PHY11G (xRX v1.2 integrated)",
                /* PHY_GBIT_FEATURES */
                .config_init    = xway_gphy_config_init,
-               .ack_interrupt  = xway_gphy_ack_interrupt,
                .handle_interrupt = xway_gphy_handle_interrupt,
                .config_intr    = xway_gphy_config_intr,
                .suspend        = genphy_suspend,
@@ -347,7 +351,6 @@ static struct phy_driver xway_gphy[] = {
                .name           = "Intel XWAY PHY22F (xRX v1.2 integrated)",
                /* PHY_BASIC_FEATURES */
                .config_init    = xway_gphy_config_init,
-               .ack_interrupt  = xway_gphy_ack_interrupt,
                .handle_interrupt = xway_gphy_handle_interrupt,
                .config_intr    = xway_gphy_config_intr,
                .suspend        = genphy_suspend,