From patchwork Wed Mar 7 22:50:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brad Mouring X-Patchwork-Id: 882852 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ni.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zxTQN4ct7z9sfP for ; Thu, 8 Mar 2018 09:51:08 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934375AbeCGWuz (ORCPT ); Wed, 7 Mar 2018 17:50:55 -0500 Received: from mx0a-00010702.pphosted.com ([148.163.156.75]:42680 "EHLO mx0b-00010702.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933743AbeCGWuy (ORCPT ); Wed, 7 Mar 2018 17:50:54 -0500 Received: from pps.filterd (m0098780.ppops.net [127.0.0.1]) by mx0a-00010702.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w27Mjtsi007625; Wed, 7 Mar 2018 16:50:48 -0600 Received: from ni.com (skprod2.natinst.com [130.164.80.23]) by mx0a-00010702.pphosted.com with ESMTP id 2gjac130h5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 07 Mar 2018 16:50:48 -0600 Received: from us-aus-exch1.ni.corp.natinst.com (us-aus-exch1.ni.corp.natinst.com [130.164.68.11]) by us-aus-skprod2.natinst.com (8.16.0.22/8.16.0.22) with ESMTPS id w27MoloI006248 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 7 Mar 2018 16:50:47 -0600 Received: from us-aus-exhub1.ni.corp.natinst.com (130.164.68.41) by us-aus-exch1.ni.corp.natinst.com (130.164.68.11) with Microsoft SMTP Server (TLS) id 15.0.1156.6; Wed, 7 Mar 2018 16:50:46 -0600 Received: from ni.com (130.164.49.7) by us-aus-exhub1.ni.corp.natinst.com (130.164.68.41) with Microsoft SMTP Server id 15.0.1156.6 via Frontend Transport; Wed, 7 Mar 2018 16:50:46 -0600 Received: by ni.com (sSMTP sendmail emulation); Wed, 07 Mar 2018 16:50:46 -0600 From: Brad Mouring To: Andrew Lunn , Florian Fainelli CC: , , Brad Mouring Subject: [PATCH] net: phy: Move interrupt check from phy_check to phy_interrupt Date: Wed, 7 Mar 2018 16:50:42 -0600 Message-ID: <20180307225042.2205-1-brad.mouring@ni.com> X-Mailer: git-send-email 2.16.2 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-07_10:, , signatures=0 X-Proofpoint-Spam-Reason: safe Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If multiple phys share the same interrupt (e.g. a multi-phy chip), the first device registered is the only one checked as phy_interrupt will always return IRQ_HANDLED if the first phydev is not halted. Move the interrupt check into phy_interrupt and, if it was not this phydev, return IRQ_NONE to allow other devices on this irq a chance to check if it was their interrupt. Signed-off-by: Brad Mouring --- drivers/net/phy/phy.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index e3e29c2b028b..ff1aa815568f 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -632,6 +632,12 @@ static irqreturn_t phy_interrupt(int irq, void *phy_dat) if (PHY_HALTED == phydev->state) return IRQ_NONE; /* It can't be ours. */ + if (phy_interrupt_is_valid(phydev)) { + if (phydev->drv->did_interrupt && + !phydev->drv->did_interrupt(phydev)) + return IRQ_NONE; + } + phy_change(phydev); return IRQ_HANDLED; @@ -725,16 +731,6 @@ EXPORT_SYMBOL(phy_stop_interrupts); */ void phy_change(struct phy_device *phydev) { - if (phy_interrupt_is_valid(phydev)) { - if (phydev->drv->did_interrupt && - !phydev->drv->did_interrupt(phydev)) - return; - - if (phydev->state == PHY_HALTED) - if (phy_disable_interrupts(phydev)) - goto phy_err; - } - mutex_lock(&phydev->lock); if ((PHY_RUNNING == phydev->state) || (PHY_NOLINK == phydev->state)) phydev->state = PHY_CHANGELINK;