Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp934809pxu; Mon, 23 Nov 2020 07:43:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJzH8NmL5dm+fOxHbNam2qZ50uty5XdijlDUyRJ3lWWw/vIAzxV0hmUj9RUg+lcHC44BlUJL X-Received: by 2002:a17:907:420f:: with SMTP id oh23mr159388ejb.237.1606146202503; Mon, 23 Nov 2020 07:43:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606146202; cv=none; d=google.com; s=arc-20160816; b=funi5HFc1UVfrvmuYSm9qlry9OQBSVK91JSPcIi7N1IuL4xVvBMOZ3sXZKee0Y4hS5 C/cnJcoLOaLAeJ77b+XkF8bPapsfn/3WYs82vXT7sLqCgKrkbOBC7Y+YWtHr40BoVO0T iBjfYnLoimFyjj66TaZGTtaTUHOhpX3hV3G7VSnHKjSf2V02nPzqj8Sd9X4EDkc/8Wtc mStoJDASB96hbzMenHlAERS2cmamjieQlM7jkLEooi61P28rina4tlToIpykYWpj+KCO duvcggoS9+q1P1yJJ4RzGRuqBcVCRQncOLcHEJDFrkfdMEfmIa6LvxfaHyAkWOQ0bayO qmlQ== 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=uEhSuCuWwfzMW+QeM5P/cCH9mtQg5NrGbw5n/aF/ziI=; b=c6wRUMljuuEz+mFuiION+AnQ1dm4PRUD5xeGFItFgT7uXoonu2aah//xHJD5kHChaH gBNbAuJxp8OjKlgyaw6DQEfsK012Jd6bzkuxElDRIaFJpF8A2k0kv39KAucrM3NbBvXM nkuQBYl8LffSeJwuSWczZaAkzP00MBSoH8Z6PeXBCir7OhLxqSLV3ABgWzfZXqazYJc1 G6EVlyyKBvGxEZ0KocXBbsh2WBvzvzQnCGbST29qQfZ40K3RBYHdHreW84sA76AqvQHe f8eml5YnXPlqy5J6FJWLVD++jwEnEZgUhPvGY3LIYMxaaqeIDyBcqpDyCnfa2A0myBbK a+DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lOQoRZPm; 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 j27si6792644eje.30.2020.11.23.07.42.58; Mon, 23 Nov 2020 07:43:22 -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=lOQoRZPm; 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 S2389768AbgKWPjp (ORCPT + 99 others); Mon, 23 Nov 2020 10:39:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389608AbgKWPis (ORCPT ); Mon, 23 Nov 2020 10:38:48 -0500 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1A76C0613CF; Mon, 23 Nov 2020 07:38:46 -0800 (PST) Received: by mail-ej1-x644.google.com with SMTP id mc24so2812809ejb.6; Mon, 23 Nov 2020 07:38:46 -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=uEhSuCuWwfzMW+QeM5P/cCH9mtQg5NrGbw5n/aF/ziI=; b=lOQoRZPmZGsy53rhdRaudNiRXggmb2wtjqeqVnfntbddSO1S1xtU6Cbfiq3SmZBkKr 6BBdo5NufbMdm3OAVdowDA/lANLAgrrAi1eLFMbT0C+VZeQpZeXWQOrgSFFKJ8rLT9pV k9TOVWNvhuey2BxHNDr4fW5jw8n63K20CRszBtxjAJWpgpsWZWDdeRu0ynDIbryOQlyg f/p7JMa+KouiWKEz3Aj/EUrK4O5EFl9io9hfiwUJNzTs0QW7Vb+L3uY/+FuvUp2m+YCd 7ZWFVkTs+7nkUpauj7a0HiP6y2i0Bnm/7mM3qXY/llr3DyuA0oPbI7DxNjyx/7xokOZ2 KSBQ== 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=uEhSuCuWwfzMW+QeM5P/cCH9mtQg5NrGbw5n/aF/ziI=; b=mwCKGLh+pL3i0DkH9x14Z39wFxLcD9U00tNJpr7VFXR4kq1yvmrS5b6PiTzlVZH/Tm 1w0f087s8upCEAB8scBt0jHHE+t/8i0si5knoP0n3O+atk0eiZypByG2owdIxQxdLcJ5 vGXpG4b1DWkTv/TmJREVcW8jtv6IL78pJJRXxzCSkv8awQ/jwRl+bqV3KnmRC7iC9rX4 x0Jn3hDBwbPlAWUNX7vNG5mc4GEk4Ob9F0NM/tAKI/7WUa1SEsEtOdOoySHal2KSlMvD 6HXWWBIRbdlCGAwyQysXxtQ4aRaGwrvchyMNxesEbJXWH0f1lx9YfgDYTEJg0NJYCDLk CHcw== X-Gm-Message-State: AOAM530sYRBLELo0jwifD0BhVCC4jfkbHA8ypdQcjWjvIpCB6EA+Hj3C YGLP0WUrS8jh52SLgjpCmTxON47M2Upaxg== X-Received: by 2002:a17:906:5955:: with SMTP id g21mr152380ejr.271.1606145925503; Mon, 23 Nov 2020 07:38:45 -0800 (PST) Received: from yoga-910.localhost ([188.25.2.177]) by smtp.gmail.com with ESMTPSA id c6sm4800126edy.62.2020.11.23.07.38.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Nov 2020 07:38:44 -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 , Martin Blumenstingl Subject: [PATCH net-next 04/15] net: phy: icplus: remove the use .ack_interrupt() Date: Mon, 23 Nov 2020 17:38:06 +0200 Message-Id: <20201123153817.1616814-5-ciorneiioana@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201123153817.1616814-1-ciorneiioana@gmail.com> References: <20201123153817.1616814-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: Martin Blumenstingl Signed-off-by: Ioana Ciornei --- drivers/net/phy/icplus.c | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c index a74ff45fa99c..b632947cbcdf 100644 --- a/drivers/net/phy/icplus.c +++ b/drivers/net/phy/icplus.c @@ -272,17 +272,39 @@ static int ip101a_g_config_init(struct phy_device *phydev) return phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c); } +static int ip101a_g_ack_interrupt(struct phy_device *phydev) +{ + int err = phy_read(phydev, IP101A_G_IRQ_CONF_STATUS); + + if (err < 0) + return err; + + return 0; +} + static int ip101a_g_config_intr(struct phy_device *phydev) { u16 val; + int err; + + if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { + err = ip101a_g_ack_interrupt(phydev); + if (err) + return err; - if (phydev->interrupts == PHY_INTERRUPT_ENABLED) /* INTR pin used: Speed/link/duplex will cause an interrupt */ val = IP101A_G_IRQ_PIN_USED; - else + err = phy_write(phydev, IP101A_G_IRQ_CONF_STATUS, val); + } else { val = IP101A_G_IRQ_ALL_MASK; + err = phy_write(phydev, IP101A_G_IRQ_CONF_STATUS, val); + if (err) + return err; + + err = ip101a_g_ack_interrupt(phydev); + } - return phy_write(phydev, IP101A_G_IRQ_CONF_STATUS, val); + return err; } static irqreturn_t ip101a_g_handle_interrupt(struct phy_device *phydev) @@ -305,15 +327,6 @@ static irqreturn_t ip101a_g_handle_interrupt(struct phy_device *phydev) return IRQ_HANDLED; } -static int ip101a_g_ack_interrupt(struct phy_device *phydev) -{ - int err = phy_read(phydev, IP101A_G_IRQ_CONF_STATUS); - if (err < 0) - return err; - - return 0; -} - static struct phy_driver icplus_driver[] = { { .phy_id = 0x02430d80, @@ -340,7 +353,6 @@ static struct phy_driver icplus_driver[] = { /* PHY_BASIC_FEATURES */ .probe = ip101a_g_probe, .config_intr = ip101a_g_config_intr, - .ack_interrupt = ip101a_g_ack_interrupt, .handle_interrupt = ip101a_g_handle_interrupt, .config_init = &ip101a_g_config_init, .suspend = genphy_suspend, -- 2.28.0