Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp308968pxx; Thu, 29 Oct 2020 03:15:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMcfsg6pjLybBqqdYuiXdLwpKxb511vZ7i1POTWLR2cgM9NZGUUMA6j1fJWh3eAK3zhw4s X-Received: by 2002:aa7:c694:: with SMTP id n20mr3288490edq.160.1603966508989; Thu, 29 Oct 2020 03:15:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603966508; cv=none; d=google.com; s=arc-20160816; b=GLX6HWlLAV9CapRW2cqANIZKBK241rqEsR9FDwXCBxBH13fXdH5szyg/T9+MEsbizG hLlIEs7+SgawZCOd29oSx1zFcW8UQHRBDTx0VPkIKhf/JKvkf5pplmluUVo+UkGYGn06 47ABnpeIKmoVYewwTn9ijHvcTq1lVwRgAwbwbd3T2u44d4vudY7Y3hgzH4T8ZsgiJ31B VFdG1SFWOYZZG6pDbY7tqZkvc5WybczD0D+IBUHGNpdfrzQqGG8yPlXxVcKXGnwVrxEa PEpb9MYLzi6H7rBFPZjhlBOU1y2FJp1JRndzDc4mNHQ9mAUqB5Mp1CPyKHO4aG46p51p v/3w== 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=k4WnBvovvLFTUdht9hn8p81ikp0RDpqPhZr8zUzQUcw=; b=nif0gmslownWJ479Mwb4enXHXwDdLkrZGoe2wuW0IBpx5VvtlLarDCfaMWiIcrW4Z2 Mo+buG0GqXPtLL/JICL6Pr6S6IvdpHELV6O/HFFYBY5eVA6rR7YwKFou6/zyKnS3QEyt JwSAckvntndTA7dxQY8WUG6Wxk4aJhu1XjleYFr0ytQVLcHn/bmPeyYgLHilMpMVELkY hZP7GncKM6uiX92sls8koV0oxhUA2arg8IfmQvKd2Z1gDossL8+02f2gosivpBfYpJoE CxmsUOMhNcf+ScAC7P1rIxFmlgca5HocKWAbnzs2hPAWlb8ceridaK8talLtq4uIga9x JycQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=F6GFePrx; 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 r11si1612474edi.348.2020.10.29.03.14.46; Thu, 29 Oct 2020 03:15:08 -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=F6GFePrx; 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 S1726408AbgJ2KKc (ORCPT + 99 others); Thu, 29 Oct 2020 06:10:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726572AbgJ2KIs (ORCPT ); Thu, 29 Oct 2020 06:08:48 -0400 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A81E8C0613CF; Thu, 29 Oct 2020 03:08:47 -0700 (PDT) Received: by mail-ed1-x542.google.com with SMTP id p93so2429931edd.7; Thu, 29 Oct 2020 03:08:47 -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=k4WnBvovvLFTUdht9hn8p81ikp0RDpqPhZr8zUzQUcw=; b=F6GFePrxKyv3OOTtfhs8hn53MnxFU0Qicp0kfSW+0/rbLkN1VP81jvfCND3EORVEM/ vR66XySL2opqFPsmWrbVjL/nfip3+YGgLjH4dBtZ5oDBWLXKPeP6uyXR9f8Ap371ktoF POtIetILShwyaVTOotSAw+GhlLSLkrT75QyKRsl87GekgnMnbHP9Z7xmNfOcBweMB8Ij MqgoPgZp/zvBtI2MExymEUoZLXixBa7zb6nHNTdCvH3KQAWQb63zW6BEkDwbPo94/fvH fqaulQLb9xgijCYTirvWIDl9hPDeoIX91qvLrImWJ1gFB52BiGqZ6DDo2DuuFcoke59p Q6Bg== 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=k4WnBvovvLFTUdht9hn8p81ikp0RDpqPhZr8zUzQUcw=; b=IHNySXFPkMHgIkm8uZ/PVixS00J+PD+c/Viisme0vsEEqr+prbbQkWPvwVBKa+TQVl p86FaevlFxWari2AjI3xy7tX1ONKnoZaliHgcaqQu9wWuuDjTei1fGQQzBWYwnEsBj0+ wCd030oqVIzL4tcrKqHOGgqes+mgr6gQKbclYPjWP6r9wGN8ysYTB5yWlSF2/uxStV2S 7nMjActziagCQcGeb0oaMhxLx2/r/7ZjNU8HmXb+Cp48912V3Dx52nK+8mjLzRT1Ijcx ONDpKsSa0fMAdd6D7KeEYY8ar22JsfLyZA/GxGLL6dO5H8Tgpp7WIqJuutP8jCq/sblE /n+g== X-Gm-Message-State: AOAM530fGyx3JbFZ259pqLVi/PD9HEtOJToOQ5x2+fOI6nt5Mw8nhr2v 0BMPd1t6mU3mbBZVNQ/jaJQ= X-Received: by 2002:aa7:dd49:: with SMTP id o9mr1495982edw.143.1603966126415; Thu, 29 Oct 2020 03:08:46 -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.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 03:08:45 -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 , Oleksij Rempel , Michael Walle Subject: [PATCH net-next 05/19] net: phy: at803x: remove the use of .ack_interrupt() Date: Thu, 29 Oct 2020 12:07:27 +0200 Message-Id: <20201029100741.462818-6-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: Oleksij Rempel Cc: Michael Walle Signed-off-by: Ioana Ciornei --- drivers/net/phy/at803x.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 106c6f53755f..aba198adf62d 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -614,6 +614,11 @@ static int at803x_config_intr(struct phy_device *phydev) value = phy_read(phydev, AT803X_INTR_ENABLE); if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { + /* Clear any pending interrupts */ + err = at803x_ack_interrupt(phydev); + if (err) + return err; + value |= AT803X_INTR_ENABLE_AUTONEG_ERR; value |= AT803X_INTR_ENABLE_SPEED_CHANGED; value |= AT803X_INTR_ENABLE_DUPLEX_CHANGED; @@ -621,9 +626,14 @@ static int at803x_config_intr(struct phy_device *phydev) value |= AT803X_INTR_ENABLE_LINK_SUCCESS; err = phy_write(phydev, AT803X_INTR_ENABLE, value); - } - else + } else { err = phy_write(phydev, AT803X_INTR_ENABLE, 0); + if (err) + return err; + + /* Clear any pending interrupts */ + err = at803x_ack_interrupt(phydev); + } return err; } @@ -1080,7 +1090,6 @@ static struct phy_driver at803x_driver[] = { .resume = at803x_resume, /* PHY_GBIT_FEATURES */ .read_status = at803x_read_status, - .ack_interrupt = at803x_ack_interrupt, .config_intr = at803x_config_intr, .handle_interrupt = at803x_handle_interrupt, .get_tunable = at803x_get_tunable, @@ -1101,7 +1110,6 @@ static struct phy_driver at803x_driver[] = { .suspend = at803x_suspend, .resume = at803x_resume, /* PHY_BASIC_FEATURES */ - .ack_interrupt = at803x_ack_interrupt, .config_intr = at803x_config_intr, .handle_interrupt = at803x_handle_interrupt, }, { @@ -1120,7 +1128,6 @@ static struct phy_driver at803x_driver[] = { /* PHY_GBIT_FEATURES */ .read_status = at803x_read_status, .aneg_done = at803x_aneg_done, - .ack_interrupt = &at803x_ack_interrupt, .config_intr = &at803x_config_intr, .handle_interrupt = at803x_handle_interrupt, .get_tunable = at803x_get_tunable, @@ -1141,7 +1148,6 @@ static struct phy_driver at803x_driver[] = { .suspend = at803x_suspend, .resume = at803x_resume, /* PHY_BASIC_FEATURES */ - .ack_interrupt = at803x_ack_interrupt, .config_intr = at803x_config_intr, .handle_interrupt = at803x_handle_interrupt, .cable_test_start = at803x_cable_test_start, @@ -1154,7 +1160,6 @@ static struct phy_driver at803x_driver[] = { .resume = at803x_resume, .flags = PHY_POLL_CABLE_TEST, /* PHY_BASIC_FEATURES */ - .ack_interrupt = &at803x_ack_interrupt, .config_intr = &at803x_config_intr, .handle_interrupt = at803x_handle_interrupt, .cable_test_start = at803x_cable_test_start, -- 2.28.0