From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72C1CC43334 for ; Mon, 20 Jun 2022 19:33:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234318AbiFTTd0 (ORCPT ); Mon, 20 Jun 2022 15:33:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233184AbiFTTdW (ORCPT ); Mon, 20 Jun 2022 15:33:22 -0400 Received: from bmailout3.hostsharing.net (bmailout3.hostsharing.net [IPv6:2a01:4f8:150:2161:1:b009:f23e:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E07BA1C128; Mon, 20 Jun 2022 12:33:20 -0700 (PDT) Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL TLS DV RSA Mixed SHA256 2020 CA-1" (verified OK)) by bmailout3.hostsharing.net (Postfix) with ESMTPS id DAFE3100D9414; Mon, 20 Jun 2022 21:33:18 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id B0E9D8943BB; Mon, 20 Jun 2022 21:33:18 +0200 (CEST) Date: Mon, 20 Jun 2022 21:33:18 +0200 From: Lukas Wunner To: Florian Fainelli Cc: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , netdev@vger.kernel.org, linux-usb@vger.kernel.org, Steve Glendinning , UNGLinuxDriver@microchip.com, Oliver Neukum , Andre Edich , Oleksij Rempel , Martyn Welch , Gabriel Hojda , Christoph Fritz , Lino Sanfilippo , Philipp Rosenberger , Simon Han , Heiner Kallweit , Andrew Lunn , Russell King , Ferry Toth , Marek Szyprowski , Krzysztof Kozlowski , linux-samsung-soc@vger.kernel.org Subject: Re: [PATCH net] net: phy: smsc: Disable Energy Detect Power-Down in interrupt mode Message-ID: <20220620193318.GA15322@wunner.de> References: <439a3f3168c2f9d44b5fd9bb8d2b551711316be6.1655714438.git.lukas@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org On Mon, Jun 20, 2022 at 10:03:26AM -0700, Florian Fainelli wrote: > On 6/20/22 04:04, Lukas Wunner wrote: > > --- a/drivers/net/phy/smsc.c > > +++ b/drivers/net/phy/smsc.c > > @@ -110,7 +110,7 @@ static int smsc_phy_config_init(struct phy_device *phydev) > > struct smsc_phy_priv *priv = phydev->priv; > > int rc; > > - if (!priv->energy_enable) > > + if (!priv->energy_enable || phydev->irq != PHY_POLL) > > phy_interrupt_is_valid() may be more appropriate, since you are assuming > that you either have PHY_POLL or valid "external" PHY interrupt but there is > also the special case of PHY_MAC_INTERRUPT that is not dealt with. I deliberately disable EDPD for PHY_MAC_INTERRUPT as well. That's a proper interrupt, i.e. the PHY signals interrupts to the MAC (e.g. through an interrupt pin on the MAC), which forwards the interrupts to phylib. EDPD cannot be used in that situation either. > > @@ -217,7 +219,7 @@ static int lan87xx_read_status(struct phy_device *phydev) > > int err = genphy_read_status(phydev); > > - if (!phydev->link && priv->energy_enable) { > > + if (!phydev->link && priv->energy_enable && phydev->irq == PHY_POLL) { > > phy_polling_mode()? Personally I think checking for PHY_POLL is succinct, but if you or anyone else feels strongly about it I'll be happy to add such a static inline to include/linux/phy.h. Thanks, Lukas