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=-5.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 34762C43332 for ; Wed, 30 Dec 2020 19:13:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EFEB222242 for ; Wed, 30 Dec 2020 19:13:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726735AbgL3TNk (ORCPT ); Wed, 30 Dec 2020 14:13:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726305AbgL3TNk (ORCPT ); Wed, 30 Dec 2020 14:13:40 -0500 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 69053C061573; Wed, 30 Dec 2020 11:12:44 -0800 (PST) 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-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To: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=375e4YxYTm0FF5RfAlPr3QpppBYCWWAfCx/myiWk9aE=; b=R9tUBgUMK6SgV2DTDEFZbkSmw /+3mwuqVYJdpva4pZYDnPutmWlIj7BZArJBm/AxQExQtNSrG2bdyBHWk19HMKW8uxr01/KLZ5cJee 3EX+zn+C7r7AHyNEP2y/bRv6LQi9m9kelncNUC1d2+XbtHuqbSZ3JeguecwezK0SRH9neP2895W3h Pnob3axSu9nkA8ZP0v/KD5tlx1VAQqQpORpLc45sxTc4sJrLOY4H0OlaOBvPrl/C+dijG9v7hVsuw Uomx9iPhJeWHvMapCzZHSJvJk+x/ADk1K5Yc58nTCtIDoQYQPwjdgArLnlpp6Z4968o00tQmaOcYp OrdOvZgkQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:44928) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kugtk-0005tJ-Ty; Wed, 30 Dec 2020 19:12:40 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1kugtk-0002R8-Ni; Wed, 30 Dec 2020 19:12:40 +0000 Date: Wed, 30 Dec 2020 19:12:40 +0000 From: Russell King - ARM Linux admin To: Marek =?iso-8859-1?Q?Beh=FAn?= Cc: Pali =?iso-8859-1?Q?Roh=E1r?= , Andrew Lunn , Heiner Kallweit , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] net: sfp: allow to use also SFP modules which are detected as SFF Message-ID: <20201230191240.GX1551@shell.armlinux.org.uk> References: <20201230154755.14746-1-pali@kernel.org> <20201230154755.14746-3-pali@kernel.org> <20201230161151.GS1551@shell.armlinux.org.uk> <20201230170652.of3m226tidtunslm@pali> <20201230182707.4a8b13d0@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20201230182707.4a8b13d0@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: Russell King - ARM Linux admin Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, Dec 30, 2020 at 06:27:07PM +0100, Marek Behún wrote: > On Wed, 30 Dec 2020 18:06:52 +0100 > Pali Rohár wrote: > > > if (!sfp->type->module_supported(&id) && > > (memcmp(id.base.vendor_name, "UBNT ", 16) || > > memcmp(id.base.vendor_pn, "UF-INSTANT ", 16))) > > I would rather add a quirk member (bitfield) to the sfp structure and do > something like this > > if (!sfp->type->module_supported(&id) && > !(sfp->quirks & SFP_QUIRK_BAD_PHYS_ID)) > > or maybe put this check into the module_supported method. Sorry, definitely not. If you've ever looked at the SDHCI driver with its multiple "quirks" bitfields, doing this is a recipe for creating a very horrid hard to understand mess. What you suggest just results in yet more complexity. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!