Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp463509pxb; Thu, 12 Nov 2020 08:04:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJxnOZR5LdEcTBDVxrTxL/hpEDRyeDCoeJbzJ+MAeeBCniMHqOOVAxIUQqYoPGP+bUfwwjVR X-Received: by 2002:a2e:9842:: with SMTP id e2mr27188ljj.373.1605197045779; Thu, 12 Nov 2020 08:04:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605197045; cv=none; d=google.com; s=arc-20160816; b=cJQBXNn6CWzQ3ggSUm8tSmzbsNqth70puTw3/2TQyjYjBzhNYSSM+Lk6bwD02vKdwD gf/l4QUXxuppmqdnLqZPqB2zqsZ74vzSwW5ytx1bvZb7HnGWPgaS56NQBh4EEcthGnH7 RYVXMeWkIxg2+optD+TjuIUScm8YFoorR3d1NX/gCSKnRJbfNokWXLCVPcyo74A4n7aZ fuiqWwxNvM1GgdQD2Sqbui2cxhevDsaYmNl1QC2489ifvXiJ5pNZ489l6aMcqP3BUCI0 lZdtX7QrBqLVgX4xdiwNjvR6iuwqgw6fYWqm07RV7Qa3F8QB8jLItnExqsIOFC0PUX3j u7XQ== 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=oGBDzVq5PZR4Pbyh6TLReVGAkLMraG8njIqpD/GjZy4=; b=qw2ldZKXztcebkzR0gNYfboAiZkBdSEDm/YjlLVDNrHeM/Phor8bbihCweBml51kOp oNxRaxf81xAheZd0wLulKj4HeuLbGXQJENUwOIY4M17RNkCKrKDC3a+r0G7Dv3HTQLjk cZUmpCYcwNoXNLrO+xkH+Z/D65QHabRDa/v4l306/F7J9c3biF3wWkvxx2RH+jYQ0LLX ZX80KqR5jw32DQ2WHwxg14X93Sl/Lk9OO++Bbxtk13v3SVi7vUBMr7zuHysU4m4nzj2q 90VpSE0pW/BTDzML3w/739lGGAMadUPoHS+48Jltyv7HrpfLTec78JWDvdouPVfx1nS+ im1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gyU2ZClu; 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 f12si4093127ejb.687.2020.11.12.08.03.33; Thu, 12 Nov 2020 08:04:05 -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=gyU2ZClu; 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 S1729047AbgKLP7Z (ORCPT + 99 others); Thu, 12 Nov 2020 10:59:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728911AbgKLP6g (ORCPT ); Thu, 12 Nov 2020 10:58:36 -0500 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B2ECC0613D6; Thu, 12 Nov 2020 07:58:35 -0800 (PST) Received: by mail-ed1-x541.google.com with SMTP id t11so6808221edj.13; Thu, 12 Nov 2020 07:58:35 -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=oGBDzVq5PZR4Pbyh6TLReVGAkLMraG8njIqpD/GjZy4=; b=gyU2ZCluc6uOODrLzfErFIjhrVH3ygBhzm4oeVFQgYBNWEbKb7/gPnbW/blK4V6TiP O0+DtQU496ra3TUjgPJsvGnKrpBxsO8Az1ezzaUmjTr9pG9i8AvfnERzpX/diI5+iqA4 Dz55bbj1eDCry5cQM4BiJLpBYCPr+BsqyRj6EB2g8r7CCYt/AMrivnVG5WSjTOPyy/sp c8md/XImr/R8XgiAQ1okrgDIpGwxdbgvXc12nryhyBcAeJd/FYub0lznDeGBnS2fYJ4/ eMAEOHGhKi3E+Ph/cGF82UqGdnEjs4Pvk6YcdTiFiQLRj3wUevFY71dl/l60i72PKoOA 4eUw== 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=oGBDzVq5PZR4Pbyh6TLReVGAkLMraG8njIqpD/GjZy4=; b=aujkOP+OeOPGV2vfPvo/oFCvfKmNKUfX/9kT3+HRlnHCigELodjoBnx3FuwzCC3Rtc jkyQ0JHxmkwx7N5hdWO6Z/4YMhx+hVj4XAnsjQy24Y9wSPW93RR4jjwdZvOCRs2vn/JI eUttLQvfrkTsJzzarxhGJhOjCEPpJd7q9gt70VkDC5CmznNZtWch8LmCTONraRMleXYL UbeNG+2LCk9SzCvvajcQ3wm7+CDytLaxAqzs10dYE3/gx4DjJvGN6tn1teM1hxSKyGYB CCCYNGV1kFnFpHJnKXLx88sTt2ysNctNy0lVCZ0f0+492r+5HWWmDx/oDu7W8MxfnLdG h/yQ== X-Gm-Message-State: AOAM532bRwms7V4oOAbFTC+S9Ttj+xwGquO+YZEvj3IS1dhwPNzTYgyV aCEZfFcuhXz771tHrbTp6S4= X-Received: by 2002:aa7:c716:: with SMTP id i22mr459791edq.94.1605196714198; Thu, 12 Nov 2020 07:58:34 -0800 (PST) Received: from yoga-910.localhost ([188.25.2.177]) by smtp.gmail.com with ESMTPSA id q15sm2546540edt.95.2020.11.12.07.58.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2020 07:58:33 -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 net-next 14/18] net: phy: smsc: remove the use of .ack_interrupt() Date: Thu, 12 Nov 2020 17:55:09 +0200 Message-Id: <20201112155513.411604-15-ciorneiioana@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201112155513.411604-1-ciorneiioana@gmail.com> References: <20201112155513.411604-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 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: Andre Edich Cc: Marco Felsch Signed-off-by: Ioana Ciornei --- drivers/net/phy/smsc.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index 8d9eb1b3d2df..bc05a4a9d10a 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -48,6 +48,13 @@ struct smsc_phy_priv { struct clk *refclk; }; +static int smsc_phy_ack_interrupt(struct phy_device *phydev) +{ + int rc = phy_read(phydev, MII_LAN83C185_ISF); + + return rc < 0 ? rc : 0; +} + static int smsc_phy_config_intr(struct phy_device *phydev) { struct smsc_phy_priv *priv = phydev->priv; @@ -55,19 +62,21 @@ static int smsc_phy_config_intr(struct phy_device *phydev) int rc; if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { + rc = smsc_phy_ack_interrupt(phydev); + if (rc) + return rc; + intmask = MII_LAN83C185_ISF_INT4 | MII_LAN83C185_ISF_INT6; if (priv->energy_enable) intmask |= MII_LAN83C185_ISF_INT7; - } - - rc = phy_write(phydev, MII_LAN83C185_IM, intmask); - - return rc < 0 ? rc : 0; -} + rc = phy_write(phydev, MII_LAN83C185_IM, intmask); + } else { + rc = phy_write(phydev, MII_LAN83C185_IM, intmask); + if (rc) + return rc; -static int smsc_phy_ack_interrupt(struct phy_device *phydev) -{ - int rc = phy_read (phydev, MII_LAN83C185_ISF); + rc = smsc_phy_ack_interrupt(phydev); + } return rc < 0 ? rc : 0; } @@ -336,7 +345,6 @@ static struct phy_driver smsc_phy_driver[] = { .soft_reset = smsc_phy_reset, /* IRQ related */ - .ack_interrupt = smsc_phy_ack_interrupt, .config_intr = smsc_phy_config_intr, .handle_interrupt = smsc_phy_handle_interrupt, @@ -356,7 +364,6 @@ static struct phy_driver smsc_phy_driver[] = { .soft_reset = smsc_phy_reset, /* IRQ related */ - .ack_interrupt = smsc_phy_ack_interrupt, .config_intr = smsc_phy_config_intr, .handle_interrupt = smsc_phy_handle_interrupt, @@ -386,7 +393,6 @@ static struct phy_driver smsc_phy_driver[] = { .config_aneg = lan87xx_config_aneg, /* IRQ related */ - .ack_interrupt = smsc_phy_ack_interrupt, .config_intr = smsc_phy_config_intr, .handle_interrupt = smsc_phy_handle_interrupt, @@ -410,7 +416,6 @@ static struct phy_driver smsc_phy_driver[] = { .config_init = lan911x_config_init, /* IRQ related */ - .ack_interrupt = smsc_phy_ack_interrupt, .config_intr = smsc_phy_config_intr, .handle_interrupt = smsc_phy_handle_interrupt, @@ -436,7 +441,6 @@ static struct phy_driver smsc_phy_driver[] = { .config_aneg = lan87xx_config_aneg_ext, /* IRQ related */ - .ack_interrupt = smsc_phy_ack_interrupt, .config_intr = smsc_phy_config_intr, .handle_interrupt = smsc_phy_handle_interrupt, @@ -463,7 +467,6 @@ static struct phy_driver smsc_phy_driver[] = { .soft_reset = smsc_phy_reset, /* IRQ related */ - .ack_interrupt = smsc_phy_ack_interrupt, .config_intr = smsc_phy_config_intr, .handle_interrupt = smsc_phy_handle_interrupt, -- 2.28.0