From patchwork Fri Nov 13 16:52:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 11904251 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6099FC388F7 for ; Fri, 13 Nov 2020 16:53:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F259B2225D for ; Fri, 13 Nov 2020 16:53:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EtZd8Owg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726530AbgKMQxR (ORCPT ); Fri, 13 Nov 2020 11:53:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726506AbgKMQxQ (ORCPT ); Fri, 13 Nov 2020 11:53:16 -0500 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 363CDC0613D1; Fri, 13 Nov 2020 08:53:14 -0800 (PST) Received: by mail-ej1-x642.google.com with SMTP id 7so14422514ejm.0; Fri, 13 Nov 2020 08:53:14 -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=EtZd8OwgbOLqoIZfd5Jb7pm4r6JzHOwyoxm/Tfz63atbND+7xIUhVMvgtAM6ngX4EK 2dPTUAqIu1nQKW706keacPPiKcyB1ZwECWZZ04Ds0HpNCAuHNJmSTdhXmWOi61vVBCj+ UCz2k0Tlb1JNPgTiDzPpBiJmvxcRTgB2GwH6aR8zm0VDVgvTp+I5kpXp35q3QdwoV8KO 49CqgWJbu77zasI13rALawSlOkM3kozxDyBfrfwBqS3KRhxjXs9ICoJyrR9Jgg2gXxrs R9qXOWfX+sZ3V7CRNdSBuKQy6cVwRUUvBnGdGeAczw/68qepY1jOgGtZjSNz0sq+qdCJ rasg== 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=Ux3TdWsajnCJyteGRLLZphw/TkDsaDdvcncg2v+jhH03E/0qoT9mX6aYPvvshKHerA prrUg6O74I7UjW0XxTGiI3XgYVbun+rVqz4jADZXZK8h2bHrmUFgF4xYCnW7W5z87Dyh kkXuRwxxh9Up9+U0V9ueZzgpulynxFKUjPCE4Sio+mC0PCKkV2K6NkvbafGv+Z5u65oq HJxBvfTUi9Ag/CypeHmw3XTBhii+VRc3gI2lWffcYvlRPH36M+frNBFvJL1HDThl3lT2 1UPveTge7FtdWOaweFwNIsatC7yrEBRHRB3o0XY+bhM85ImfD4jvfBHiMfRNKSz6EQo4 GUFQ== X-Gm-Message-State: AOAM5333sF5dhBusxJRiG1qLmazFKxs3Zw28DSHY3nj8DgsYg02kiFTs Cbqc50S5anHGhbwa1XZPbAE= X-Google-Smtp-Source: ABdhPJzIsDh+m1soIX80keARC9jBzgVsaeveP4Xkiv9BsUe0nkC8CxTtS/vW7RnY80KFG8nG+eR7UA== X-Received: by 2002:a17:907:2175:: with SMTP id rl21mr2875737ejb.59.1605286387669; Fri, 13 Nov 2020 08:53:07 -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.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Nov 2020 08:53:07 -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 14/18] net: phy: smsc: remove the use of .ack_interrupt() Date: Fri, 13 Nov 2020 18:52:22 +0200 Message-Id: <20201113165226.561153-15-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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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,