Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp935454pxu; Mon, 23 Nov 2020 07:44:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHrkCWySBEpbqgRZvIrV2HchKqHago6tnoYmfEroNO7I52xHGuPWyl5jOC+UmvsK0vCddD X-Received: by 2002:a17:906:4c41:: with SMTP id d1mr153894ejw.485.1606146266188; Mon, 23 Nov 2020 07:44:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606146266; cv=none; d=google.com; s=arc-20160816; b=fjc1vse5K6JklZ+GIQyrZBrhqJihXvg+DTDfOfrAj/SPSpRxN0jG/ZNHhjG8EYLkdE iYXLUxodO2ZV5CB1AD9YVAP1725ANH8RofmRLQnCGVCQyuoQbMp3nRMav0HcHz0P6JHZ r0ByAU+BWJ6LVCruRXLf6Pz834qTgUV4JuplK2P7Zj3JNrTp7Xwb/bqpcw6ye4V9Tzlk +Q1uAotdnlq423Uv3xy+5HnlnUnGnkYCTpuYiXrJONXRE/sIw1G3MHWzQTdLPbNRHdkJ oAxqvu9ETlHFnOqLsXjknhZwQ/SY8x+TergEZD4PIanmBq1TRZ1CXoQgV1dnOiAGykfC qTeA== 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=ylL9xOBdQF/BS35q7ZH2N3c9DEUDL4zcBQVyTtlRMoU=; b=fOR0AXKfxNoaPQSS6H/PWBgKqFhcooGtgMdn2P4JK39/tqH/jtnlO1JvdEU2C8eGrD Dro7GhvqE3/G/9H8LeA9SJDuRrLwlKcrlhPqB8Sh/qN5WisQXiY7VWtiUYscII52P4nV GyHidZCPSQAgPmXtAfZ15f53gujiEJJ54kW/RRq9nwxwUf8ZYe+aJ1C4u68FFz1q3ZBS RpIIpiVZtxnytjwXYANIke5/ZNJCCKs8k2uWlox0fJLvm/JOk9ueT6s2wTfpvs8m0mBe rRtWhxxqBI3C8anZqY0kuBp+exUqZbPgDLR+pheURbfuvOAP0n9+ydOsXpeR91RbzvC0 c8cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="T+/gEFeZ"; 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 dr10si7948010ejc.306.2020.11.23.07.44.00; Mon, 23 Nov 2020 07:44:26 -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="T+/gEFeZ"; 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 S2389609AbgKWPit (ORCPT + 99 others); Mon, 23 Nov 2020 10:38:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728858AbgKWPiq (ORCPT ); Mon, 23 Nov 2020 10:38:46 -0500 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C75BFC0613CF; Mon, 23 Nov 2020 07:38:45 -0800 (PST) Received: by mail-ej1-x641.google.com with SMTP id o9so23951026ejg.1; Mon, 23 Nov 2020 07:38:45 -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=ylL9xOBdQF/BS35q7ZH2N3c9DEUDL4zcBQVyTtlRMoU=; b=T+/gEFeZQ9gUcq3M5cLhO9XfSb7UuiqFAjxoFqRWwi8kg20Sn2eMds0VfeErmH8YWI JkWAv0ZZpGwH6GM5WbM5eOQ8XWa0h6MNkdd+SH+503CAk1M/+rKLteKKOl//Q2haWgdy OWx3sTFnSWQGwYcPQGy+QdENtrHkHqAbob4MaEhXaGwFAZKQMNbpP4Sus8qnZYc3yK4B 96PvYqYlsLwXCeym5IR6CSXTGRyshuyCDsMsoHkFawwLTfKRDB/bXJAKx8ap2mz3KpGd 8KaCRtzJvxXpq+f14W3njdGY+WzKt/CADnDgPK3CpiYTehK9/GtuyWZatbFOyG/x61Vz iMIw== 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=ylL9xOBdQF/BS35q7ZH2N3c9DEUDL4zcBQVyTtlRMoU=; b=mmQfm+TCBfsu1qz6YJgoGKoCJvtQOrO8yQpLwXNxHJJaB9jvonzO7r6qF1vtCb1a+4 +ktupKgzHun9ouXNkzSNjvLSvLeWr76iddeYqOuY9+NUhXzDZOwR3TCE87xEKBL2/LuS +cwIwzy1beeTbyD6shqfLW+QdW/jB5oXBeSs4sZnIFOHZAoNRX1NTVExBKsTA1UV8xTw TtMDwbQb088zCTjcMam2g2duTZYk7EhovFDd0/gf42esF59UGjfA76YZ1MMiCBSdCjGw mfyyFjROgC6eZhdgh5mVDfUcGI15Aq6idGQTH2R0sTYL2xWrg+V23IIFF/kluhZMVGf+ yD4w== X-Gm-Message-State: AOAM533uRs5AuTyS1Zhl/uyNUloymql6Rxpgt6g8pt0cnAz0ixRsFiRC f8jaLV4qpme9D/U3eu93rMc= X-Received: by 2002:a17:906:c51:: with SMTP id t17mr127094ejf.523.1606145922408; Mon, 23 Nov 2020 07:38:42 -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.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Nov 2020 07:38: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 , Martin Blumenstingl Subject: [PATCH net-next 03/15] net: phy: icplus: implement generic .handle_interrupt() callback Date: Mon, 23 Nov 2020 17:38:05 +0200 Message-Id: <20201123153817.1616814-4-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 an attempt to actually support shared IRQs in phylib, we now move the responsibility of triggering the phylib state machine or just returning IRQ_NONE, based on the IRQ status register, to the PHY driver. Having 3 different IRQ handling callbacks (.handle_interrupt(), .did_interrupt() and .ack_interrupt() ) is confusing so let the PHY driver implement directly an IRQ handler like any other device driver. Make this driver follow the new convention. Cc: Martin Blumenstingl Signed-off-by: Ioana Ciornei --- drivers/net/phy/icplus.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c index d6e8516cd146..a74ff45fa99c 100644 --- a/drivers/net/phy/icplus.c +++ b/drivers/net/phy/icplus.c @@ -285,16 +285,24 @@ static int ip101a_g_config_intr(struct phy_device *phydev) return phy_write(phydev, IP101A_G_IRQ_CONF_STATUS, val); } -static int ip101a_g_did_interrupt(struct phy_device *phydev) +static irqreturn_t ip101a_g_handle_interrupt(struct phy_device *phydev) { - int val = phy_read(phydev, IP101A_G_IRQ_CONF_STATUS); + int irq_status; - if (val < 0) - return 0; + irq_status = phy_read(phydev, IP101A_G_IRQ_CONF_STATUS); + if (irq_status < 0) { + phy_error(phydev); + return IRQ_NONE; + } + + if (!(irq_status & (IP101A_G_IRQ_SPEED_CHANGE | + IP101A_G_IRQ_DUPLEX_CHANGE | + IP101A_G_IRQ_LINK_CHANGE))) + return IRQ_NONE; + + phy_trigger_machine(phydev); - return val & (IP101A_G_IRQ_SPEED_CHANGE | - IP101A_G_IRQ_DUPLEX_CHANGE | - IP101A_G_IRQ_LINK_CHANGE); + return IRQ_HANDLED; } static int ip101a_g_ack_interrupt(struct phy_device *phydev) @@ -332,8 +340,8 @@ static struct phy_driver icplus_driver[] = { /* PHY_BASIC_FEATURES */ .probe = ip101a_g_probe, .config_intr = ip101a_g_config_intr, - .did_interrupt = ip101a_g_did_interrupt, .ack_interrupt = ip101a_g_ack_interrupt, + .handle_interrupt = ip101a_g_handle_interrupt, .config_init = &ip101a_g_config_init, .suspend = genphy_suspend, .resume = genphy_resume, -- 2.28.0