Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1291630pxb; Fri, 13 Nov 2020 08:56:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwEQ4yaJUzNgOde7q8/YPQxALQxeMQzm0ItoXeIT3yrpaHvarIYIeF2uFaqrwGSyo+br6kW X-Received: by 2002:a50:ed90:: with SMTP id h16mr3254714edr.255.1605286560363; Fri, 13 Nov 2020 08:56:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605286560; cv=none; d=google.com; s=arc-20160816; b=XvS2mXU6HUkyqNlWgTlczasBpXto9pR9PO+wsJ/voi7xeoRNHEZwjpY/6ue2H5i0QA oqrRwxNKh5g9/mD9AwSv1ShG25nuWBxpJCshXSdwks2ufVlSE975XwdfoQ/xGM1L0jzj Gz0xmmv3ZkHPjHLbeZ3NI4KMlQGcZ+rkPnOhkpevhfbQ1b37A6BPx+Nk97WpnRRq6Csl MN2Ky27dRWURNVYXRXwE0221mnDA+7gA0hA47oDN7IH45dvxbPiCVbpUULd45IqPFljp vsjSEYJIPzvJvgOLWjp0KoJg+uZbM2yLizZGSeAXNqUcGMX/pV2RWsl3q/ugWOusddOC AX7w== 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=H9SANiy7klgOXO+CBiHYFVcZ2LoNL5yPWZLcunqe2n7FzonoB3a/n950mmlAYKJIf/ g0f5gTr7M32jbEQkOU6/Avjt/65lsvL6LcfL+c2jbHy4a8/PXGk6t4rMXQrqRADLd2D/ H5ew3vCVNQ2Vxfly+lYShOGP337X1vxUlIuqJpc6Wjx8McsOu4eAEBenRVFtv+VvePE0 1IBWPjHUUp5qTMQuqseqmHG3KZH+a2+pRfLAftjkIBg6knrPP3EGZEV4YCusqKtdB+89 N8hmUGiu8od1abk8n9MFqTnFp/NJUXlRwoB/CYN4a4MXf7d7y0O0r91z2/TTIieU5uYD xmMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EtZd8Owg; 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 j8si7039330edn.520.2020.11.13.08.55.37; Fri, 13 Nov 2020 08:56:00 -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=EtZd8Owg; 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 S1726533AbgKMQxR (ORCPT + 99 others); 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-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 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