diff mbox series

[RESEND,net-next,18/18] net: phy: adin: remove the use of the .ack_interrupt()

Message ID 20201113165226.561153-19-ciorneiioana@gmail.com (mailing list archive)
State Accepted
Commit 1d8300d3ce9db9bfac91140bd9386cf335e935bf
Delegated to: Netdev Maintainers
Headers show
Series net: phy: add support for shared interrupts (part 2) | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count fail Series longer than 15 patches
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 44 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Ioana Ciornei Nov. 13, 2020, 4:52 p.m. UTC
From: Ioana Ciornei <ioana.ciornei@nxp.com>

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: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
 drivers/net/phy/adin.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

Comments

Alexandru Ardelean Nov. 14, 2020, 6:38 a.m. UTC | #1
> -----Original Message-----
> From: Ioana Ciornei <ciorneiioana@gmail.com>
> Sent: Friday, November 13, 2020 6:52 PM
> To: Andrew Lunn <andrew@lunn.ch>; Heiner Kallweit <hkallweit1@gmail.com>;
> Russell King <linux@armlinux.org.uk>; Florian Fainelli <f.fainelli@gmail.com>;
> Jakub Kicinski <kuba@kernel.org>; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Cc: Ioana Ciornei <ioana.ciornei@nxp.com>; Ardelean, Alexandru
> <alexandru.Ardelean@analog.com>
> Subject: [PATCH RESEND net-next 18/18] net: phy: adin: remove the use of the
> .ack_interrupt()
> 
> [External]
> 
> From: Ioana Ciornei <ioana.ciornei@nxp.com>
> 
> 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.
> 

Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com>

> Cc: Alexandru Ardelean <alexandru.ardelean@analog.com>
> Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
> ---
>  drivers/net/phy/adin.c | 25 ++++++++++++++++++-------
>  1 file changed, 18 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/phy/adin.c b/drivers/net/phy/adin.c index
> ba24434b867d..55a0b91816e2 100644
> --- a/drivers/net/phy/adin.c
> +++ b/drivers/net/phy/adin.c
> @@ -471,12 +471,25 @@ static int adin_phy_ack_intr(struct phy_device
> *phydev)
> 
>  static int adin_phy_config_intr(struct phy_device *phydev)  {
> -	if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
> -		return phy_set_bits(phydev, ADIN1300_INT_MASK_REG,
> -				    ADIN1300_INT_MASK_EN);
> +	int err;
> +
> +	if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
> +		err = adin_phy_ack_intr(phydev);
> +		if (err)
> +			return err;
> +
> +		err = phy_set_bits(phydev, ADIN1300_INT_MASK_REG,
> +				   ADIN1300_INT_MASK_EN);
> +	} else {
> +		err = phy_clear_bits(phydev, ADIN1300_INT_MASK_REG,
> +				     ADIN1300_INT_MASK_EN);
> +		if (err)
> +			return err;
> +
> +		err = adin_phy_ack_intr(phydev);
> +	}
> 
> -	return phy_clear_bits(phydev, ADIN1300_INT_MASK_REG,
> -			      ADIN1300_INT_MASK_EN);
> +	return err;
>  }
> 
>  static irqreturn_t adin_phy_handle_interrupt(struct phy_device *phydev) @@ -
> 895,7 +908,6 @@ static struct phy_driver adin_driver[] = {
>  		.read_status	= adin_read_status,
>  		.get_tunable	= adin_get_tunable,
>  		.set_tunable	= adin_set_tunable,
> -		.ack_interrupt	= adin_phy_ack_intr,
>  		.config_intr	= adin_phy_config_intr,
>  		.handle_interrupt = adin_phy_handle_interrupt,
>  		.get_sset_count	= adin_get_sset_count,
> @@ -919,7 +931,6 @@ static struct phy_driver adin_driver[] = {
>  		.read_status	= adin_read_status,
>  		.get_tunable	= adin_get_tunable,
>  		.set_tunable	= adin_set_tunable,
> -		.ack_interrupt	= adin_phy_ack_intr,
>  		.config_intr	= adin_phy_config_intr,
>  		.handle_interrupt = adin_phy_handle_interrupt,
>  		.get_sset_count	= adin_get_sset_count,
> --
> 2.28.0
diff mbox series

Patch

diff --git a/drivers/net/phy/adin.c b/drivers/net/phy/adin.c
index ba24434b867d..55a0b91816e2 100644
--- a/drivers/net/phy/adin.c
+++ b/drivers/net/phy/adin.c
@@ -471,12 +471,25 @@  static int adin_phy_ack_intr(struct phy_device *phydev)
 
 static int adin_phy_config_intr(struct phy_device *phydev)
 {
-	if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
-		return phy_set_bits(phydev, ADIN1300_INT_MASK_REG,
-				    ADIN1300_INT_MASK_EN);
+	int err;
+
+	if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
+		err = adin_phy_ack_intr(phydev);
+		if (err)
+			return err;
+
+		err = phy_set_bits(phydev, ADIN1300_INT_MASK_REG,
+				   ADIN1300_INT_MASK_EN);
+	} else {
+		err = phy_clear_bits(phydev, ADIN1300_INT_MASK_REG,
+				     ADIN1300_INT_MASK_EN);
+		if (err)
+			return err;
+
+		err = adin_phy_ack_intr(phydev);
+	}
 
-	return phy_clear_bits(phydev, ADIN1300_INT_MASK_REG,
-			      ADIN1300_INT_MASK_EN);
+	return err;
 }
 
 static irqreturn_t adin_phy_handle_interrupt(struct phy_device *phydev)
@@ -895,7 +908,6 @@  static struct phy_driver adin_driver[] = {
 		.read_status	= adin_read_status,
 		.get_tunable	= adin_get_tunable,
 		.set_tunable	= adin_set_tunable,
-		.ack_interrupt	= adin_phy_ack_intr,
 		.config_intr	= adin_phy_config_intr,
 		.handle_interrupt = adin_phy_handle_interrupt,
 		.get_sset_count	= adin_get_sset_count,
@@ -919,7 +931,6 @@  static struct phy_driver adin_driver[] = {
 		.read_status	= adin_read_status,
 		.get_tunable	= adin_get_tunable,
 		.set_tunable	= adin_set_tunable,
-		.ack_interrupt	= adin_phy_ack_intr,
 		.config_intr	= adin_phy_config_intr,
 		.handle_interrupt = adin_phy_handle_interrupt,
 		.get_sset_count	= adin_get_sset_count,