Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3829872pxv; Mon, 19 Jul 2021 09:44:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzir98ONuE/rTdQtiWyli3v+0VWfBAxd/GJHvqdzcAw9DqkRA9AMPmo/C2IDcWetoxO2AtM X-Received: by 2002:aa7:d5c8:: with SMTP id d8mr35314486eds.165.1626713044717; Mon, 19 Jul 2021 09:44:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626713044; cv=none; d=google.com; s=arc-20160816; b=ZKIrc5Qrt+t7JlNiRiNau+n9bkxFoIF0uzTsRE3tcrbHPpoNfZ3JB/rEL311uGNNmK Fi/Fa71zZsHdf4+0j/hzhgpMVd6/1jpZhYl6yoKDkINNH0fFXrL+5onI67FF9S0Fwsih q+XJ7H0o3arWRj8zqtQar2ufQVL/NhomjntRMPEOgM4QkOir0i3QKq/H47TarQh7C/xA mdamh5mIfVpq6a+FQfsDgZGwkCBPid3lg7XMx3bRze8FP6Zz8ak6JQaVPdf3WnKumuQe VGDX+3xJwNxCUyF5VYP0Eb7R/K3sNFIo6Yu3o0hTnaM5JPXoiAQ6jih5bxAzNaF82UKg oU9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=5EyuyxdB0VvwZpwllRkhj4XH997vuxgnqyXnXfI5mIM=; b=kYMtAKpGiF6+qe2ydYp0IYvBuQz/kFGgrSWMMHZMu9KbngXiOWQRj9Xil5f783fLwb jnY/gi4AM82zJk4HaLVADjMIIsjc7S6dVxSeq070RXA4j4raf0RFfz0ToCJ1e/kfWdAi clEd4EUTL7a0xRBKRHXf8s6JfZqBpwA0wXoWBsfL+bG9Or/YijGVsdpD/11KTCODTpC0 gmvGQOLA01ywgV2ktUBm3D3p08lhFYdEERZNUvDNtRSofAGr+w+j7jnO9Zcfr0GKPddM 3bhYrbcWmqoC08Eh13KfvrSdD74dpW8vNUZW2kVRAfqhDWq4dcTBH29nRSlJhophyiu0 tjmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=d9QCOPub; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w15si21852440edv.312.2021.07.19.09.43.42; Mon, 19 Jul 2021 09:44:04 -0700 (PDT) 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=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=d9QCOPub; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348394AbhGSPzd (ORCPT + 99 others); Mon, 19 Jul 2021 11:55:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345883AbhGSPFF (ORCPT ); Mon, 19 Jul 2021 11:05:05 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABF79C0613E9; Mon, 19 Jul 2021 08:01:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=5EyuyxdB0VvwZpwllRkhj4XH997vuxgnqyXnXfI5mIM=; b=d9QCOPubEyU4uUIQOX2S/b+lN cyYYjwmQtBxiI0sEBU3hGOo60r1lMy0G98AYbImwpqG18SoRY91gtSm8CltgX0yzYObjohiQStrun 8u/eSdErIbntp+XTmYQ7iq6s+ggWPLqR7vEuX32AW3qrjXuoncc4n59H7Vha+N3v7lAqXaBncJZzu RYa5mQsSrTDYCIX35dWHudxbVLJqmeuFufTxwnPHow1cBNv0f62Ydyi9QdfDnabBeYUV3WJtjqww3 vsd4ExjpzHr8xgYXoFjA3fhG3G+MC+MZEIffC9CheUjzIkqzHuSAOr16cz7XAOqrN0szdb13nTTkl R70Db1mew==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:46328) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m5VDE-00052Y-8K; Mon, 19 Jul 2021 16:29:44 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1m5VDC-00064u-OO; Mon, 19 Jul 2021 16:29:42 +0100 Date: Mon, 19 Jul 2021 16:29:42 +0100 From: "Russell King (Oracle)" To: "Ivan T. Ivanov" Cc: Andrew Lunn , Heiner Kallweit , "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: phy: leds: Trigger leds only if PHY speed is known Message-ID: <20210719152942.GQ22278@shell.armlinux.org.uk> References: <20210716141142.12710-1-iivanov@suse.de> <162646032060.16633.4902744414139431224@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <162646032060.16633.4902744414139431224@localhost> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 16, 2021 at 09:32:00PM +0300, Ivan T. Ivanov wrote: > Hi, > > Quoting Andrew Lunn (2021-07-16 18:19:58) > > On Fri, Jul 16, 2021 at 05:11:42PM +0300, Ivan T. Ivanov wrote: > > > This prevents "No phy led trigger registered for speed(-1)" > > > alert message which is coused by phy_led_trigger_chage_speed() > > > being called during attaching phy to net_device where phy device > > > speed could be still unknown. > > > > Hi Ivan > > > > It seems odd that when attaching the PHY we have link, but not the > > speed. What PHY is this? > > This is lan78xx on RPi3B+ > > > > > > - if (phy->speed == 0) > > > + if (phy->speed == 0 || phy->speed == SPEED_UNKNOWN) > > > return; > > > > This change makes sense. But i'm wondering if the original logic is > > sound. We have link, but no speed information. > > Well, probably my interpretation was not correct. The most probable > call to phy_led_trigger_change_speed() which couses this alert is > phy_attach_direct() -> phy_led_triggers_register(), I think. I am > not sure that we have link at this stage or not. This does sound weird. When a phy_device is allocated, it's explicitly initialised with: dev->speed = SPEED_UNKNOWN; dev->duplex = DUPLEX_UNKNOWN; dev->link = 0; dev->state = PHY_DOWN; so, unless something is causing state to be read before we've attached the phy to a network device, this is how this state should remain. I wonder why you are seeing dev->link be non-zero. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!