Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp708881ybz; Fri, 24 Apr 2020 08:01:02 -0700 (PDT) X-Google-Smtp-Source: APiQypLhZ6IH2mypStE+HFoP4nVCPiHQzmO+XQDjujHMdqJ5q37G7cyZg+4u5ukrc8DxnJARfo7C X-Received: by 2002:a1c:2392:: with SMTP id j140mr10477527wmj.136.1587740461898; Fri, 24 Apr 2020 08:01:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587740461; cv=none; d=google.com; s=arc-20160816; b=ioU8HxdBiqZRzTDBB+ObX6y/8ZZB/m2imZaOIJxoZ/HZQtTCfObpUB/bEIlt3QKQZ+ CWRW7lzQcXFKKh3806D/truZ4eADFvlDHUmQsqA9/jQKcUPMPvgA9UvyjmSYkF6PLjvV elpiH69jLHevYGsicx1Wef2kckPZotQVQS0TaRWtwOLMGwFJK3BeDJx+bbfaoBqgo4EA NUA0Qyu7ae9w+T07YOL1Bb285Gq/ob8V9cw0gOFCBWerkZVMgGuHjyv//cRf5JK6hE8x wd+gENe3mtEbNN1JO6z7Efopt/I8MnbpuiVe50k7O1qAf8Vyk8J0s+ziIvOA0Pfar0Pf Jgqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=i8T8P91+yzcMB/IYq4PEZyj+h3cSZcj0sTJ9rKQhaaY=; b=EUhLuvbyxLhXI8B897LZh6nrkAZ67YOMhSc1wfyezwmBlUDWbmZzjTRGMZUSHB1OsM mXH1tukiFYx7csHZFjBXKd+dyua7+5CoxJhAQ5cIBOC/qIvV7hlw31usy7Oq1Es33IB1 1Lqy+OwqQTj994T1zKYShUalCeCXIe6Qgb1XPZ3OuI3hkS9UoVUD5nNI3a8KFgHWH7JK X0rHIbffYtI38KudUIaquY+konEZb+dRpobVNSYKOFz0rppqtQz5U57YHaTYSPm6QUUg q/9omOF4d5gIQYu8eqK8kLZ+RpJkBYQZZARzV4Cn9UI/Mc7DNoUgerbzUSGgXN5+w90M gApA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b=iGp9a3vl; 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 k26si3372698ejc.127.2020.04.24.08.00.34; Fri, 24 Apr 2020 08:01:01 -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 header.i=@lunn.ch header.s=20171124 header.b=iGp9a3vl; 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 S1727872AbgDXO4t (ORCPT + 99 others); Fri, 24 Apr 2020 10:56:49 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:32838 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726698AbgDXO4t (ORCPT ); Fri, 24 Apr 2020 10:56:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender: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=i8T8P91+yzcMB/IYq4PEZyj+h3cSZcj0sTJ9rKQhaaY=; b=iGp9a3vlmwA0+2N3ar/5vj/na/ ZazxDH05VDYsLFC+x395RWF8pI2wxVPWtby8BnVnCoaFv/77qGF99D4QPfirjkwi4POEhx49cg8WE n/3e7HiOOu6xNUarECxAjKcAtobNKax6eXFRFl2svjY4RX4WND5aWUzDeTWpsoyV5fzg=; Received: from andrew by vps0.lunn.ch with local (Exim 4.93) (envelope-from ) id 1jRzkp-004ZXA-Qh; Fri, 24 Apr 2020 16:56:35 +0200 Date: Fri, 24 Apr 2020 16:56:35 +0200 From: Andrew Lunn To: Florinel Iordache Cc: "davem@davemloft.net" , "netdev@vger.kernel.org" , "f.fainelli@gmail.com" , "hkallweit1@gmail.com" , "linux@armlinux.org.uk" , "devicetree@vger.kernel.org" , "linux-doc@vger.kernel.org" , "robh+dt@kernel.org" , "mark.rutland@arm.com" , "kuba@kernel.org" , "corbet@lwn.net" , "shawnguo@kernel.org" , Leo Li , "Madalin Bucur (OSS)" , Ioana Ciornei , "linux-kernel@vger.kernel.org" Subject: Re: Re: [PATCH net-next v2 6/9] net: phy: add backplane kr driver support Message-ID: <20200424145635.GB1088354@lunn.ch> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 24, 2020 at 02:39:54PM +0000, Florinel Iordache wrote: > > > +/* Backplane custom logging */ > > > +#define bpdev_fn(fn) \ > > > +void bpdev_##fn(struct phy_device *phydev, char *fmt, ...) \ > > > +{ \ > > > + struct va_format vaf = { \ > > > + .fmt = fmt, \ > > > + }; \ > > > + va_list args; \ > > > + va_start(args, fmt); \ > > > + vaf.va = &args; \ > > > + if (!phydev->attached_dev) \ > > > + dev_##fn(&phydev->mdio.dev, "%pV", &vaf); \ > > > + else \ > > > + dev_##fn(&phydev->mdio.dev, "%s: %pV", \ > > > + netdev_name(phydev->attached_dev), &vaf); \ > > > + va_end(args); \ > > > +} > > > + > > > +bpdev_fn(err) > > > +EXPORT_SYMBOL(bpdev_err); > > > + > > > +bpdev_fn(warn) > > > +EXPORT_SYMBOL(bpdev_warn); > > > + > > > +bpdev_fn(info) > > > +EXPORT_SYMBOL(bpdev_info); > > > + > > > +bpdev_fn(dbg) > > > +EXPORT_SYMBOL(bpdev_dbg); > > > > Didn't i say something about just using phydev_{err|warn|info|dbg}? > > > > Andrew > > Hi Andrew, > > I used this custom logging in order to be able to add any kind of useful information we might need to all prints (err/warn/info/dbg). > For example all these bpdev_ functions are equivalent with phydev_ but only in the case when there is no attached device: phydev->attached_dev == NULL. > Otherwise, if there is a device attached, then we also want to add its name to all these prints in order to know to which device the information refers to. > For example in this case the print looks like this: > [ 50.853515] backplane_qoriq 8c13000:00: eth1: 10gbase-kr link trained, Tx equalization: C(-1)=0x0, C(0)=0x29, C(+1)=0x5 > This is very useful because we can see very easy to which interface the information printed is related to: in this case the link was trained for interface: eth1 > This information (the name of attached device: eth1) is not printed by phydev_ functions. > I'm sorry I have not explained all this earlier, the first time when you asked about it. So why not argue that the phydev_* functions should be extended to include this information? Is this extra information only valuable for link training, or for anything a PHY does? If the core does not do something, fix the core, rather than work around it in your driver. Andrew