Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1292927pxb; Fri, 13 Nov 2020 08:58:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJyWP2lzi9HQYbSJwg5mgxvYHo/XcoOBXIeD2kDpwLsSR0tLQrEo5gGrtgWeJoYuHRpawtr4 X-Received: by 2002:a50:a6d0:: with SMTP id f16mr3274874edc.135.1605286684985; Fri, 13 Nov 2020 08:58:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605286684; cv=none; d=google.com; s=arc-20160816; b=kHSIAnXrRfSWT7cppXuTbZlfN5SRJAxm1mzXF2dswYMw00GkIF18Bu4g8X4qnKtFmp e7ZW6E3juyrfiL9r4175chGAIownJpSp26WrfARe6WOv7N3yRbckM70SyGE2xTxHDH14 6ocJQ+mKqLH6hgOsZktYJpuUVHojMsyZU62t1usz98dCbomanRN3zymehn6Phuc9w+vb hrZOBTIDazRl4b90YCORS2cDaFCM5n5dGbSd2EbEKEvBEraXD+g5xPcntjG2cmxy0MIk RC25fvyt2v1AVpZl+hExm+CC5n3c17SsdzTDiGBvvygEERn9WFDcZrAoHGL0z7/KunzO K/cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=V6jMD8aRzONibBh+E/XbB8QBNX+IURULm74n4EN/rLQ=; b=ljYDuPu08/gGqlq39iDFSQ8t51xt+T3LzIet9WYPuv08zed7959EO1DYs1KrPGilSk fpuGLg9YuYqfBnOPK8eIe39LwmuuWLvxZ2S5OKz0QOcaXugN8sveGRZPHy8jjuS0Y8Vg vp7l4EeAv/1TREDqArDcpZQSuMyzDOUsUjchdMG8ogyc1fw7JHGZ34jWj7RyfCL+inbk VmlpN3GQ7g85ElgzYxJUJs6Gn+D52vre0Zkla6tjzXiT6kfqqBLk3V8ZnYKwStmVuBiM Pa10noKhoNuq1w3RbEvqnnVc9N8eBcOikmqY/JyP2ZIsAr3S1/N18YdEzEkCKK05pRCt 2Z6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CQx44aI6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y18si7144597edl.592.2020.11.13.08.57.42; Fri, 13 Nov 2020 08:58:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CQx44aI6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726739AbgKMQxp (ORCPT + 99 others); Fri, 13 Nov 2020 11:53:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726439AbgKMQxM (ORCPT ); Fri, 13 Nov 2020 11:53:12 -0500 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62E05C0613D1; Fri, 13 Nov 2020 08:53:12 -0800 (PST) Received: by mail-ej1-x643.google.com with SMTP id o21so14439931ejb.3; Fri, 13 Nov 2020 08:53:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V6jMD8aRzONibBh+E/XbB8QBNX+IURULm74n4EN/rLQ=; b=CQx44aI6193GjQCexgTAB2PYUHksVhqbQ1OuprPFMhsLmdeZlGtb8VcUbH+LMAGaIk NoBxN0/ioip5zMqgbMXYAjl/x9yU0WURwRPePkteRoJTF32jLAQfK8yDAg63ixDqOOi1 WTK/KYd33Gigpbb8yerFUnvHxfqHu/W0w+1RYrPMr9MS4fWKeO7LjWAobU2NqGICzy2u 0O9fbSucymyc2x0BRyYQByFdClZjuap/1/2QkchIlLzvJHGAcX8XJ0c8nRyNhxjmXmDg ujKxvuZT8AyLGpkNzeruspC0iASmllpYUKrNRkKfFZ9b/jWpyRowGqB9FWNotz8mpX3e OO5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V6jMD8aRzONibBh+E/XbB8QBNX+IURULm74n4EN/rLQ=; b=I3Z1zpgBJi+UW2xTg2G61lJA8MAG1dlwyR/KllbYfJ9UnSDHCoAsqglNr1vVImmcoO YjtOAhGKpaqEKIMXyfp9TPjpgPqQxj1YNbWorHlKzWnpSJ1sATpLlirWdn6kLIFbZE7B FCErgbqdb59x7EfEOxqPQWLBKxwfCI6nJT/Jy3pb9ZIpw82efvgzcAjuappHdsfcyde1 fSbGsl+05u/aYPnck5Ef4Ifmuh50jc2R6sTkC2mrJlo0L3GdbZlHhRYRKR1v/S5ojl9p nIueT+EiGRUtiBeR6pA7yxeekqfo2EQBS1+txhVxXfl/B2vmvYl00BCLCmls7j/AkB32 T49A== X-Gm-Message-State: AOAM5332g8NRRcAmDpIXS2Qlzdjl982H0IC6V24w4TD7TcmoychOVmjs zBPgZ8MHBUhhNnj/10aMnM4= X-Received: by 2002:a17:906:d94:: with SMTP id m20mr2940038eji.279.1605286386250; Fri, 13 Nov 2020 08:53:06 -0800 (PST) Received: from yoga-910.localhost ([188.25.2.177]) by smtp.gmail.com with ESMTPSA id rp28sm4076570ejb.77.2020.11.13.08.53.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Nov 2020 08:53:05 -0800 (PST) From: Ioana Ciornei To: Andrew Lunn , Heiner Kallweit , Russell King , Florian Fainelli , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ioana Ciornei , Andre Edich , Marco Felsch Subject: [PATCH RESEND net-next 13/18] net: phy: smsc: implement generic .handle_interrupt() callback Date: Fri, 13 Nov 2020 18:52:21 +0200 Message-Id: <20201113165226.561153-14-ciorneiioana@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201113165226.561153-1-ciorneiioana@gmail.com> References: <20201113165226.561153-1-ciorneiioana@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ioana Ciornei In an attempt to actually support shared IRQs in phylib, we now move the responsibility of triggering the phylib state machine or just returning IRQ_NONE, based on the IRQ status register, to the PHY driver. Having 3 different IRQ handling callbacks (.handle_interrupt(), .did_interrupt() and .ack_interrupt() ) is confusing so let the PHY driver implement directly an IRQ handler like any other device driver. Make this driver follow the new convention. Cc: Andre Edich Cc: Marco Felsch Signed-off-by: Ioana Ciornei --- drivers/net/phy/smsc.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index ec97669be5c2..8d9eb1b3d2df 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -72,6 +72,30 @@ static int smsc_phy_ack_interrupt(struct phy_device *phydev) return rc < 0 ? rc : 0; } +static irqreturn_t smsc_phy_handle_interrupt(struct phy_device *phydev) +{ + int irq_status, irq_enabled; + + irq_enabled = phy_read(phydev, MII_LAN83C185_IM); + if (irq_enabled < 0) { + phy_error(phydev); + return IRQ_NONE; + } + + irq_status = phy_read(phydev, MII_LAN83C185_ISF); + if (irq_status < 0) { + phy_error(phydev); + return IRQ_NONE; + } + + if (!(irq_status & irq_enabled)) + return IRQ_NONE; + + phy_trigger_machine(phydev); + + return IRQ_HANDLED; +} + static int smsc_phy_config_init(struct phy_device *phydev) { struct smsc_phy_priv *priv = phydev->priv; @@ -314,6 +338,7 @@ static struct phy_driver smsc_phy_driver[] = { /* IRQ related */ .ack_interrupt = smsc_phy_ack_interrupt, .config_intr = smsc_phy_config_intr, + .handle_interrupt = smsc_phy_handle_interrupt, .suspend = genphy_suspend, .resume = genphy_resume, @@ -333,6 +358,7 @@ static struct phy_driver smsc_phy_driver[] = { /* IRQ related */ .ack_interrupt = smsc_phy_ack_interrupt, .config_intr = smsc_phy_config_intr, + .handle_interrupt = smsc_phy_handle_interrupt, /* Statistics */ .get_sset_count = smsc_get_sset_count, @@ -362,6 +388,7 @@ static struct phy_driver smsc_phy_driver[] = { /* IRQ related */ .ack_interrupt = smsc_phy_ack_interrupt, .config_intr = smsc_phy_config_intr, + .handle_interrupt = smsc_phy_handle_interrupt, /* Statistics */ .get_sset_count = smsc_get_sset_count, @@ -385,6 +412,7 @@ static struct phy_driver smsc_phy_driver[] = { /* IRQ related */ .ack_interrupt = smsc_phy_ack_interrupt, .config_intr = smsc_phy_config_intr, + .handle_interrupt = smsc_phy_handle_interrupt, .suspend = genphy_suspend, .resume = genphy_resume, @@ -410,6 +438,7 @@ static struct phy_driver smsc_phy_driver[] = { /* IRQ related */ .ack_interrupt = smsc_phy_ack_interrupt, .config_intr = smsc_phy_config_intr, + .handle_interrupt = smsc_phy_handle_interrupt, /* Statistics */ .get_sset_count = smsc_get_sset_count, @@ -436,6 +465,7 @@ static struct phy_driver smsc_phy_driver[] = { /* IRQ related */ .ack_interrupt = smsc_phy_ack_interrupt, .config_intr = smsc_phy_config_intr, + .handle_interrupt = smsc_phy_handle_interrupt, /* Statistics */ .get_sset_count = smsc_get_sset_count, -- 2.28.0