Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp2632014pxx; Sun, 1 Nov 2020 04:56:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJxjPko59O20NjwhisAQowKcGBEYjBUDTvgnlHPsJtVZddqnkQk4moNDo7PTmytobJbxrwhC X-Received: by 2002:a17:906:2512:: with SMTP id i18mr5532327ejb.184.1604235362914; Sun, 01 Nov 2020 04:56:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604235362; cv=none; d=google.com; s=arc-20160816; b=hWFS3Ge3ea6CaieW1UqjmZpR2a+tOdCgZ4y18wvHbhYQ7SuYIo8mQhEUbqrD7fPW5h gJlO+pqfiApH0nFgxx2SMQJRld1Z8nV1Yv396dhSI35E1nd1N1uA1RU1WhgqXKbGSUZj lFuqKiE1Ix1nBmdVz1vuf9614tx0dsag2AWRBTGN7OIKBACp5MPcqKAAdbTLaS5jQ1ow lLsXzRy8+rQg0WabmR6TGEBQZwhbYswlXguw4Elc/plp1faiPd8Xqt/Q3NKiuHHGRkTh 7LqAb6gXfqYbsT2Ls07H4xErtTgWUrJJLw148wIH9+km5X9vT5Qdu58ppVxN4ZVUmM0y cLtQ== 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=PnJLOEQTKLqjGEvrG6MYX2BGzArZcrHWdrn4+Hna4UY=; b=VrrIegLs69chHnCpZxdTH0jaepq//KAgu7nxvoDoGCQVeb/s7hL8MsEoE7XGA3g3mr bCkpszIYLi5GYabZf20vDFlRVb+Ow78oHZ1Iw8KZxIT6jI+fqtwrIsG+PnkJ9iqrwvBI +7iqSqKald5OIyWQd6ZNxL209mbMyyqPVgbsKpZ8ugW+20q6vGuLap9Ni6wAYDv8fnz+ h5TwoFNgVKT8sWMM3NleQ8emTYKmWDzAgMAPuKlHFgmD21kZZenV7cnaHZQsQ4VE6zWY jNg1ax5IzfZbs3RpliLvBwPAQf4g0gcJAzzHKEMuQyAAuOfIAOcp1jmWtc0Kvub9cEnr u1Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hP+KxPtn; 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 a91si3896819edf.472.2020.11.01.04.55.40; Sun, 01 Nov 2020 04:56:02 -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=hP+KxPtn; 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 S1727071AbgKAMxV (ORCPT + 99 others); Sun, 1 Nov 2020 07:53:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726942AbgKAMwn (ORCPT ); Sun, 1 Nov 2020 07:52:43 -0500 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 027F5C0617A6; Sun, 1 Nov 2020 04:52:43 -0800 (PST) Received: by mail-ed1-x544.google.com with SMTP id l24so11347676edj.8; Sun, 01 Nov 2020 04:52:42 -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=PnJLOEQTKLqjGEvrG6MYX2BGzArZcrHWdrn4+Hna4UY=; b=hP+KxPtnoByVASH9YQCPOaJeBz9XrZ/1IlIF4fiH4c65HO5qyO4M3KIOMvhr3uDoBD UrasPa0G/0Dzjo6Jr9lbzTVKLflQaSAELz9S6qq1bsYDL1IJ1Ubj7aECXiyWEVp/XcN6 yN6jK92tFRfhc/aiKGSZxxfMgK01ykchhrnKLyPv+F+zc+Gelj5qqucIP3BHAKLuSnYa SoyvAEu4EzDtOrkFBlRb9LKh2o0EHuhUgeu76xhAwjfIh0urC5Vk5qWURk98VfujVHWX i/7rWTVSYYhs3x1qLy7NvxcDfu7pCKATgak8h/Gl79B9swsxrKyJNh1pbW34tRGxqm+7 qUdg== 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=PnJLOEQTKLqjGEvrG6MYX2BGzArZcrHWdrn4+Hna4UY=; b=esJA7pAB8YhxCjyaYDoeSRuuoEH9EPMW0mqMvnEAHRaIaj0ZJHLqH0WBQ535hqfvx0 vvVg77PK32i0VGthlN7ybv8HR5Q73XWCPWCL7wzeUg1A4wS944CFLsgOpW3ugShhrszy pAhNMEFH7zPl6wPwPJcwrXi0CQvgcShxh7c/rQ5/USUrcKeYr/6aCfOZMOw3g/XHrT7C Fm7y4gfPkeGx4VtvL836TSALSJFmiumI3FlZbYeTWIjfBa2RBwDbkrw6YRWD1Y0C95Ox 0kaQXrYUOokKLc2mzCLVJSbSc4Yc5e8nmqUh8MFSo3sNPK3ZJ2S40LHK7tCpiKL3dGw/ Zp3w== X-Gm-Message-State: AOAM533j00A5aZhzfzL+CendzxrQNH+oRsobFQUSSc2+7ddpwL70odpY /NVEknEyfFwyj7Erz6+GzBw= X-Received: by 2002:aa7:d843:: with SMTP id f3mr12173304eds.354.1604235161716; Sun, 01 Nov 2020 04:52:41 -0800 (PST) Received: from yoga-910.localhost ([188.25.2.177]) by smtp.gmail.com with ESMTPSA id c5sm8133603edx.58.2020.11.01.04.52.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Nov 2020 04:52:41 -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 Subject: [PATCH net-next v2 16/19] net: phy: davicom: remove the use of .ack_interrupt() Date: Sun, 1 Nov 2020 14:51:11 +0200 Message-Id: <20201101125114.1316879-17-ciorneiioana@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201101125114.1316879-1-ciorneiioana@gmail.com> References: <20201101125114.1316879-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. Signed-off-by: Ioana Ciornei --- Changes in v2: - none drivers/net/phy/davicom.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/drivers/net/phy/davicom.c b/drivers/net/phy/davicom.c index bfa6c835070f..a3b3842c67e5 100644 --- a/drivers/net/phy/davicom.c +++ b/drivers/net/phy/davicom.c @@ -61,24 +61,40 @@ MODULE_AUTHOR("Andy Fleming"); MODULE_LICENSE("GPL"); +static int dm9161_ack_interrupt(struct phy_device *phydev) +{ + int err = phy_read(phydev, MII_DM9161_INTR); + + return (err < 0) ? err : 0; +} + #define DM9161_DELAY 1 static int dm9161_config_intr(struct phy_device *phydev) { - int temp; + int temp, err; temp = phy_read(phydev, MII_DM9161_INTR); if (temp < 0) return temp; - if (PHY_INTERRUPT_ENABLED == phydev->interrupts) + if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { + err = dm9161_ack_interrupt(phydev); + if (err) + return err; + temp &= ~(MII_DM9161_INTR_STOP); - else + err = phy_write(phydev, MII_DM9161_INTR, temp); + } else { temp |= MII_DM9161_INTR_STOP; + err = phy_write(phydev, MII_DM9161_INTR, temp); + if (err) + return err; - temp = phy_write(phydev, MII_DM9161_INTR, temp); + err = dm9161_ack_interrupt(phydev); + } - return temp; + return err; } static irqreturn_t dm9161_handle_interrupt(struct phy_device *phydev) @@ -154,13 +170,6 @@ static int dm9161_config_init(struct phy_device *phydev) return phy_write(phydev, MII_BMCR, BMCR_ANENABLE); } -static int dm9161_ack_interrupt(struct phy_device *phydev) -{ - int err = phy_read(phydev, MII_DM9161_INTR); - - return (err < 0) ? err : 0; -} - static struct phy_driver dm91xx_driver[] = { { .phy_id = 0x0181b880, @@ -169,7 +178,6 @@ static struct phy_driver dm91xx_driver[] = { /* PHY_BASIC_FEATURES */ .config_init = dm9161_config_init, .config_aneg = dm9161_config_aneg, - .ack_interrupt = dm9161_ack_interrupt, .config_intr = dm9161_config_intr, .handle_interrupt = dm9161_handle_interrupt, }, { @@ -179,7 +187,6 @@ static struct phy_driver dm91xx_driver[] = { /* PHY_BASIC_FEATURES */ .config_init = dm9161_config_init, .config_aneg = dm9161_config_aneg, - .ack_interrupt = dm9161_ack_interrupt, .config_intr = dm9161_config_intr, .handle_interrupt = dm9161_handle_interrupt, }, { @@ -189,7 +196,6 @@ static struct phy_driver dm91xx_driver[] = { /* PHY_BASIC_FEATURES */ .config_init = dm9161_config_init, .config_aneg = dm9161_config_aneg, - .ack_interrupt = dm9161_ack_interrupt, .config_intr = dm9161_config_intr, .handle_interrupt = dm9161_handle_interrupt, }, { @@ -197,7 +203,6 @@ static struct phy_driver dm91xx_driver[] = { .name = "Davicom DM9131", .phy_id_mask = 0x0ffffff0, /* PHY_BASIC_FEATURES */ - .ack_interrupt = dm9161_ack_interrupt, .config_intr = dm9161_config_intr, .handle_interrupt = dm9161_handle_interrupt, } }; -- 2.28.0