From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Perches Subject: Re: [PATCH] sfp: allow cotsworks modules Date: Wed, 28 Mar 2018 10:05:34 -0700 Message-ID: <1522256734.12357.116.camel@perches.com> References: <1522233237.12357.96.camel@perches.com> <20180328104147.GO10980@n2100.armlinux.org.uk> <1522253941.12357.109.camel@perches.com> <20180328165154.GQ10980@n2100.armlinux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Cc: Andrew Lunn , Florian Fainelli , netdev@vger.kernel.org To: Russell King - ARM Linux Return-path: Received: from smtprelay0217.hostedemail.com ([216.40.44.217]:40783 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752622AbeC1RFi (ORCPT ); Wed, 28 Mar 2018 13:05:38 -0400 In-Reply-To: <20180328165154.GQ10980@n2100.armlinux.org.uk> Sender: netdev-owner@vger.kernel.org List-ID: On Wed, 2018-03-28 at 17:51 +0100, Russell King - ARM Linux wrote: > On Wed, Mar 28, 2018 at 09:19:01AM -0700, Joe Perches wrote: > > On Wed, 2018-03-28 at 11:41 +0100, Russell King - ARM Linux wrote: > > > On Wed, Mar 28, 2018 at 03:33:57AM -0700, Joe Perches wrote: > > > > On Wed, 2018-03-28 at 11:18 +0100, Russell King wrote: > > > > > Cotsworks modules fail the checksums - it appears that Cotsworks > > > > > reprograms the EEPROM at the end of production with the final product > > > > > information (serial, date code, and exact part number for module > > > > > options) and fails to update the checksum. > > > > > > > > trivia: > > > > > > > > > diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c > > > > > > > > [] > > > > > @@ -574,23 +575,43 @@ static int sfp_sm_mod_probe(struct sfp *sfp) > > > > > > > > [] > > > > > + if (cotsworks) { > > > > > + dev_warn(sfp->dev, > > > > > + "EEPROM base structure checksum failure (0x%02x != 0x%02x)\n", > > > > > + check, id.base.cc_base); > > > > > + } else { > > > > > + dev_err(sfp->dev, > > > > > + "EEPROM base structure checksum failure: 0x%02x != 0x%02x\n", > > > > > > > > It'd be better to move this above the if and > > > > use only a single format string instead of > > > > using 2 slightly different formats. > > > > > > No. I think you've missed the fact that one is a _warning_ the other is > > > an _error_ and they are emitted at the appropriate severity. It's not > > > just that the format strings are slightly different. > > > > Right. Still nicer to use the same formats. > > I'll stick a "Warning:" and "Error:" tag before them if you really > want the rest of the message to be identically formatted - otherwise, > when seeing reports from people's dmesg, there will be nothing to > indicate which message was printed. Not necessary. It was just a trivial size saving from the format deduplication. There is another dmesg info line dev_info(sfp->dev, "module %.*s %.*s rev %.*s sn %.*s dc %.*s\n", (int)sizeof(id.base.vendor_name), id.base.vendor_name, (int)sizeof(id.base.vendor_pn), id.base.vendor_pn, (int)sizeof(id.base.vendor_rev), id.base.vendor_rev, (int)sizeof(id.ext.vendor_sn), id.ext.vendor_sn, (int)sizeof(id.ext.datecode), id.ext.datecode); the next line later which shows that it's a "COTSWORKS ".