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 X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E4F4C55191 for ; Fri, 24 Apr 2020 14:56:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DE85F21582 for ; Fri, 24 Apr 2020 14:56:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="iGp9a3vl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727886AbgDXO4t (ORCPT ); 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