linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	David Miller <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"maintainer:BROADCOM BCM63XX ARM ARCHITECTURE" 
	<bcm-kernel-feedback-list@broadcom.com>,
	Richard Cochran <richardcochran@gmail.com>,
	Carlo Caione <carlo@caione.org>,
	Kevin Hilman <khilman@baylibre.com>,
	open list <linux-kernel@vger.kernel.org>,
	"moderated list:BROADCOM BCM63XX ARM ARCHITECTURE" 
	<linux-arm-kernel@lists.infradead.org>,
	"open list:ARM/Amlogic Meson SoC support" 
	<linux-amlogic@lists.infradead.org>
Subject: [PATCH net-next v3 1/2] net: phy: replace PHY_HAS_INTERRUPT with a check for config_intr and ack_interrupt
Date: Fri, 9 Nov 2018 18:16:28 +0100	[thread overview]
Message-ID: <fd9674b3-4033-95c6-a93e-10c8b5ba2e6a@gmail.com> (raw)
In-Reply-To: <203c4d9e-f39a-7a08-46c3-4ee6e61f181e@gmail.com>

Flag PHY_HAS_INTERRUPT is used only here for this small check. I think
using interrupts isn't possible if a driver defines neither
config_intr nor ack_interrupts callback. So we can replace checking
flag PHY_HAS_INTERRUPT with checking for these callbacks.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
v2:
- add helper for the check
v3:
- no changes
---
 drivers/net/phy/phy_device.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index ab33d1777..00a46218c 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -2074,6 +2074,11 @@ static void of_set_phy_eee_broken(struct phy_device *phydev)
 	phydev->eee_broken_modes = broken;
 }
 
+static bool phy_drv_supports_irq(struct phy_driver *phydrv)
+{
+	return phydrv->config_intr || phydrv->ack_interrupt;
+}
+
 /**
  * phy_probe - probe and init a PHY device
  * @dev: device to probe and init
@@ -2095,8 +2100,7 @@ static int phy_probe(struct device *dev)
 	/* Disable the interrupt if the PHY doesn't support it
 	 * but the interrupt is still a valid one
 	 */
-	if (!(phydrv->flags & PHY_HAS_INTERRUPT) &&
-	    phy_interrupt_is_valid(phydev))
+	 if (!phy_drv_supports_irq(phydrv) && phy_interrupt_is_valid(phydev))
 		phydev->irq = PHY_POLL;
 
 	if (phydrv->flags & PHY_IS_INTERNAL)
-- 
2.19.1



  reply	other threads:[~2018-11-09 17:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-09 17:15 [PATCH net-next v3 0/2] net: phy: replace PHY_HAS_INTERRUPT with a check for config_intr and ack_interrupt Heiner Kallweit
2018-11-09 17:16 ` Heiner Kallweit [this message]
2018-11-09 20:13   ` [PATCH net-next v3 1/2] " Andrew Lunn
2018-11-09 20:22     ` Heiner Kallweit
2018-11-09 20:33       ` Florian Fainelli
2018-11-09 20:56         ` Heiner Kallweit
2018-11-12 20:32           ` Martin Blumenstingl
2018-11-12 20:38             ` Heiner Kallweit
2018-11-12 21:53               ` Martin Blumenstingl
2018-11-09 20:38       ` Andrew Lunn
2018-11-09 17:17 ` [PATCH net-next v3 2/2] net: phy: remove flag PHY_HAS_INTERRUPT from driver configs Heiner Kallweit
2018-11-09 20:13   ` Andrew Lunn
2018-11-11 17:38 ` [PATCH net-next v3 0/2] net: phy: replace PHY_HAS_INTERRUPT with a check for config_intr and ack_interrupt David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fd9674b3-4033-95c6-a93e-10c8b5ba2e6a@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=carlo@caione.org \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).