Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp116926pxb; Wed, 4 Nov 2020 16:31:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJyplflVLxQFu7QptPf2bWAL/2KClYOS6VQkAd/60+sbKsiOwGnQTc5HJZZ565hs5dlSg+07 X-Received: by 2002:a17:906:74c5:: with SMTP id z5mr635690ejl.227.1604536262613; Wed, 04 Nov 2020 16:31:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604536262; cv=none; d=google.com; s=arc-20160816; b=E2+kBT3k0qddDUn2zuCiqFyNlef5/yl2GH73NkeSS9PDMQ/E3uqEfVHUWTmigcYS2W IjXuLjejbqtGW1NU1kTiudCH2WIFDb+rMb5UfLsPQAVMJSukPIZ7zOLTp3LJbVRbSwPJ UqsO9+yoa4X54IyNusOzw58s4M871xnkJ/4sr573vNFgEgR5BwQNk35uOzhWqhc97aTc rbjTjMnBeqhuFFv3YTYFhlexGhK7RwB6at2eygi30Cxe58G8pippgVUgwrlx/ZSbcz+C YGOv+T5W71VyldScaSY7xZmK+d/MpvfvzJr4/DWf+W3Qnx5E4Ho3/Fty2C6xPDGT9GSa f7KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=aPha0o1V6wfpOLyrpLLsipiMZXO6fCO5cz+lkpoAcxU=; b=Gmzce+roG2VucVYtfuM1lvgI8A01OvBEZR+dSVaBqgMBf6Ln/VaWPR4L8i1XnPeyjs IYgwhiZBp+XYlNqakdAoL1QthuJxm493E+1/++gKsa6eARqXWR6hgSHVoWlY8OIB2KZM rRiT01bvA7BhU2KzivkSSMVfzVIv8V7kGXPNV2yNgejVTUxrcHuGQY1eOIgIMSzljMIJ 7Wj0IvOstM4iQnov8TH9h7rUyd6p/9mX8HwXpE4IuXAQGoHmYZduK1S5L7J++F0imbXy rAmFLDWEcoWpU+AlCU3TyoQyPn4JufhwFsYMClTHHlSMer0jE8wP5R8VpFAudJjN77wY VN2g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u15si5818edx.51.2020.11.04.16.30.40; Wed, 04 Nov 2020 16:31: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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730440AbgKDSJm (ORCPT + 99 others); Wed, 4 Nov 2020 13:09:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728403AbgKDSJl (ORCPT ); Wed, 4 Nov 2020 13:09:41 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8C27C0613D3 for ; Wed, 4 Nov 2020 10:09:41 -0800 (PST) Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kaNDk-0007Ga-Ve; Wed, 04 Nov 2020 19:09:20 +0100 Received: from ore by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1kaNDj-00049W-SI; Wed, 04 Nov 2020 19:09:19 +0100 Date: Wed, 4 Nov 2020 19:09:19 +0100 From: Oleksij Rempel To: Ioana Ciornei Cc: Andrew Lunn , Heiner Kallweit , Russell King , Florian Fainelli , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ioana Ciornei , Michael Walle Subject: Re: [PATCH net-next v2 04/19] net: phy: at803x: implement generic .handle_interrupt() callback Message-ID: <20201104180919.ytvsekksjcldpkqd@pengutronix.de> References: <20201101125114.1316879-1-ciorneiioana@gmail.com> <20201101125114.1316879-5-ciorneiioana@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20201101125114.1316879-5-ciorneiioana@gmail.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 19:08:44 up 355 days, 9:27, 376 users, load average: 0.07, 0.06, 0.01 User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Nov 01, 2020 at 02:50:59PM +0200, Ioana Ciornei wrote: > 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: Oleksij Rempel > Cc: Michael Walle > Signed-off-by: Ioana Ciornei Tested-by: Oleksij Rempel > --- > Changes in v2: > - adjust .handle_interrupt() so that we only take into account the > enabled IRQs. > > drivers/net/phy/at803x.c | 31 +++++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > > diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c > index ed601a7e46a0..c7f91934cf82 100644 > --- a/drivers/net/phy/at803x.c > +++ b/drivers/net/phy/at803x.c > @@ -628,6 +628,32 @@ static int at803x_config_intr(struct phy_device *phydev) > return err; > } > > +static irqreturn_t at803x_handle_interrupt(struct phy_device *phydev) > +{ > + int irq_status, int_enabled; > + > + irq_status = phy_read(phydev, AT803X_INTR_STATUS); > + if (irq_status < 0) { > + phy_error(phydev); > + return IRQ_NONE; > + } > + > + /* Read the current enabled interrupts */ > + int_enabled = phy_read(phydev, AT803X_INTR_ENABLE); > + if (int_enabled < 0) { > + phy_error(phydev); > + return IRQ_NONE; > + } > + > + /* See if this was one of our enabled interrupts */ > + if (!(irq_status & int_enabled)) > + return IRQ_NONE; > + > + phy_trigger_machine(phydev); > + > + return IRQ_HANDLED; > +} > + > static void at803x_link_change_notify(struct phy_device *phydev) > { > /* > @@ -1064,6 +1090,7 @@ static struct phy_driver at803x_driver[] = { > .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, > .set_tunable = at803x_set_tunable, > .cable_test_start = at803x_cable_test_start, > @@ -1084,6 +1111,7 @@ static struct phy_driver at803x_driver[] = { > /* PHY_BASIC_FEATURES */ > .ack_interrupt = at803x_ack_interrupt, > .config_intr = at803x_config_intr, > + .handle_interrupt = at803x_handle_interrupt, > }, { > /* Qualcomm Atheros AR8031/AR8033 */ > PHY_ID_MATCH_EXACT(ATH8031_PHY_ID), > @@ -1102,6 +1130,7 @@ static struct phy_driver at803x_driver[] = { > .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, > .set_tunable = at803x_set_tunable, > .cable_test_start = at803x_cable_test_start, > @@ -1122,6 +1151,7 @@ static struct phy_driver at803x_driver[] = { > /* 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, > .cable_test_get_status = at803x_cable_test_get_status, > }, { > @@ -1134,6 +1164,7 @@ static struct phy_driver at803x_driver[] = { > /* 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, > .cable_test_get_status = at803x_cable_test_get_status, > .read_status = at803x_read_status, > -- > 2.28.0 > > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |