Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp308766pxx; Thu, 29 Oct 2020 03:14:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymT8AxsmY6blt30j3dpfCjk3GUWfpoyw3Z6CiJJGiP4JiM45ihRxWdXln43Zn8mOlBAscT X-Received: by 2002:a17:906:3397:: with SMTP id v23mr3256975eja.212.1603966485220; Thu, 29 Oct 2020 03:14:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603966485; cv=none; d=google.com; s=arc-20160816; b=SNA2CxB+jIngyuB5/9K3FaL+gCPJCDaybvmUTvx/hikYmW15BiAtG2ySN5TDokfaYi rSeSEC+5+elGjp5E229fcCUyba9go9MgnW5S/UqRO5MnAyNE5981ou+q8ydrX2vFJzBI S/O+KHUxEnQVhj0/Yn3JR7KWJa6c8Y0ZmAvU3mfExtig/x3ut0J9SJ9I0wKlOCQTV8tD qd6Hmj/mUtA4ibsBEY31azoimiqU91iGv1a9gs3LOlm/82BkpMiwBNDpqyJ4iQ2Pbag8 QSRfUF5y8YK4OnlcgXNbbeiIML1E4YQb2o1vANp9IE/3UN1hGjGZEdbQ6zRn7zem9OYD VdqQ== 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=4c3y7mYHvBKW0XrZqrRuVJn6e5rCazgTqbTaRv1N11g=; b=lhg2NGnfuS7mO8fuw8dhiQwTkBB3Tt8pqnrMUQwqfGvgMZAZk0OnAfZZHnVBJHMAQ0 miYyG/Y2mFd2S32nodqSgYQNllTePuhjShi5WdWU6ExmiJxNN5lwKx07P6IU/UspM2O1 0oOlqQJ2E0L6AIODvzqs9dvLl4KXuI/tBlSbY1SFwnRRU/EVfYrtteyPaYN96hqjCo4Z f6lzR5jcIXw+rYUf76mXiVlqYq5JBgSsfkCILlpvyJZPNVPiMDXtNX/jhJj3ot/M/VOl iTfHdWeao20JDf20YzGwh6ybSo9GXll2UjkEDmVXrEhMAwUgZwNgcrzAmEtQcKgNa64f 6viA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oMNW+UEm; 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 v25si1469341ejf.560.2020.10.29.03.14.22; Thu, 29 Oct 2020 03:14:45 -0700 (PDT) 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=oMNW+UEm; 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 S1726299AbgJ2KKJ (ORCPT + 99 others); Thu, 29 Oct 2020 06:10:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726743AbgJ2KIz (ORCPT ); Thu, 29 Oct 2020 06:08:55 -0400 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 E8539C0613D3; Thu, 29 Oct 2020 03:08:53 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id dk16so2407212ejb.12; Thu, 29 Oct 2020 03:08:53 -0700 (PDT) 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=4c3y7mYHvBKW0XrZqrRuVJn6e5rCazgTqbTaRv1N11g=; b=oMNW+UEmTl13c0tinc2JX5h7iaIQtM6dmq0tjXWQJm9SAKT9+2bkb2hZw3iGiWW9J2 BBQgf/vIQi5YSu4dC7mTgW6Hv4rVDZhKqyALTgUBreMR0mAd+JBNhrma35xskRmra+sd qY3LL2rNbjRe4WHyXkJoKD8JiRwcOL3zEJSK7FIzJBH1cHO8i52YURI8N1c7HMlyGt/6 YaTYhZ+0dSqLkenxxUIqOarnKvjR9deU73ENlMmcqlhF7jvE2l2g00JvioqhNJtCC+sJ 1BQG9n4OBZeY9o89WdI6HyrRa/zjNXEoupJuEnMQmM73vfm5yH8wROFaRhaQa04+2cdt SHpw== 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=4c3y7mYHvBKW0XrZqrRuVJn6e5rCazgTqbTaRv1N11g=; b=KQmG2RfoPWJP+LC1CqPVGaTc/qijgGG4nFp8OuV1me69tkZHWmHT2ydfRk4R6jqxb0 0vBzcSfAE/zNKfTKDBKJrs0H1FB791PhXVs/3mK+ufdXfPPh6KP8B4eIVusPXs/mrxVl shIrud/2Ftd+9GjxY+mgZ8ThLbUXJjI9TPhk3xSegqg6d19kcn6fk0isTN7zqgwHn1r6 BVMe7xHxmy+Hw+HS9n40NuKNNkIH/siLFNjnsoaa1R37L79W5FszV+K26xPshbDgiyC5 UEA3h5yHxsD/i6rDS3eiSxZHgDDbu9lDsdlGuthON13UutfR8taAFw27I5MuilDqhko5 eHdg== X-Gm-Message-State: AOAM531a2qTyJsAYbaH5h+VT7DFmV3oFEY70VTp4B0+yoQD48l27Z/ep A+Z6TJWl0qlIF9LbKJi9Sdo= X-Received: by 2002:a17:906:b043:: with SMTP id bj3mr3148729ejb.543.1603966132662; Thu, 29 Oct 2020 03:08:52 -0700 (PDT) Received: from yoga-910.localhost ([188.25.2.177]) by smtp.gmail.com with ESMTPSA id m1sm1198650ejj.117.2020.10.29.03.08.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 03:08:52 -0700 (PDT) From: Ioana Ciornei To: Andrew Lunn , Heiner Kallweit , Russell King , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ioana Ciornei Subject: [PATCH net-next 10/19] net: phy: aquantia: remove the use of .ack_interrupt() Date: Thu, 29 Oct 2020 12:07:32 +0200 Message-Id: <20201029100741.462818-11-ciorneiioana@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201029100741.462818-1-ciorneiioana@gmail.com> References: <20201029100741.462818-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: Heiner Kallweit Signed-off-by: Ioana Ciornei --- drivers/net/phy/aquantia_main.c | 36 +++++++++++++++++---------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/drivers/net/phy/aquantia_main.c b/drivers/net/phy/aquantia_main.c index e7f315898efb..287178340625 100644 --- a/drivers/net/phy/aquantia_main.c +++ b/drivers/net/phy/aquantia_main.c @@ -246,6 +246,13 @@ static int aqr_config_intr(struct phy_device *phydev) bool en = phydev->interrupts == PHY_INTERRUPT_ENABLED; int err; + if (en) { + /* Clear any pending interrupts before enabling them */ + err = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_TX_VEND_INT_STATUS2); + if (err) + return err; + } + err = phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_TX_VEND_INT_MASK2, en ? MDIO_AN_TX_VEND_INT_MASK2_LINK : 0); if (err < 0) @@ -256,18 +263,20 @@ static int aqr_config_intr(struct phy_device *phydev) if (err < 0) return err; - return phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_INT_VEND_MASK, - en ? VEND1_GLOBAL_INT_VEND_MASK_GLOBAL3 | - VEND1_GLOBAL_INT_VEND_MASK_AN : 0); -} + err = phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_INT_VEND_MASK, + en ? VEND1_GLOBAL_INT_VEND_MASK_GLOBAL3 | + VEND1_GLOBAL_INT_VEND_MASK_AN : 0); + if (err < 0) + return err; -static int aqr_ack_interrupt(struct phy_device *phydev) -{ - int reg; + if (!en) { + /* Clear any pending interrupts after we have disabled them */ + err = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_TX_VEND_INT_STATUS2); + if (err) + return err; + } - reg = phy_read_mmd(phydev, MDIO_MMD_AN, - MDIO_AN_TX_VEND_INT_STATUS2); - return (reg < 0) ? reg : 0; + return 0; } static irqreturn_t aqr_handle_interrupt(struct phy_device *phydev) @@ -602,7 +611,6 @@ static struct phy_driver aqr_driver[] = { .name = "Aquantia AQ1202", .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, - .ack_interrupt = aqr_ack_interrupt, .handle_interrupt = aqr_handle_interrupt, .read_status = aqr_read_status, }, @@ -611,7 +619,6 @@ static struct phy_driver aqr_driver[] = { .name = "Aquantia AQ2104", .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, - .ack_interrupt = aqr_ack_interrupt, .handle_interrupt = aqr_handle_interrupt, .read_status = aqr_read_status, }, @@ -620,7 +627,6 @@ static struct phy_driver aqr_driver[] = { .name = "Aquantia AQR105", .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, - .ack_interrupt = aqr_ack_interrupt, .handle_interrupt = aqr_handle_interrupt, .read_status = aqr_read_status, .suspend = aqr107_suspend, @@ -631,7 +637,6 @@ static struct phy_driver aqr_driver[] = { .name = "Aquantia AQR106", .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, - .ack_interrupt = aqr_ack_interrupt, .handle_interrupt = aqr_handle_interrupt, .read_status = aqr_read_status, }, @@ -642,7 +647,6 @@ static struct phy_driver aqr_driver[] = { .config_init = aqr107_config_init, .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, - .ack_interrupt = aqr_ack_interrupt, .handle_interrupt = aqr_handle_interrupt, .read_status = aqr107_read_status, .get_tunable = aqr107_get_tunable, @@ -661,7 +665,6 @@ static struct phy_driver aqr_driver[] = { .config_init = aqcs109_config_init, .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, - .ack_interrupt = aqr_ack_interrupt, .handle_interrupt = aqr_handle_interrupt, .read_status = aqr107_read_status, .get_tunable = aqr107_get_tunable, @@ -678,7 +681,6 @@ static struct phy_driver aqr_driver[] = { .name = "Aquantia AQR405", .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, - .ack_interrupt = aqr_ack_interrupt, .handle_interrupt = aqr_handle_interrupt, .read_status = aqr_read_status, }, -- 2.28.0