Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp10775758pxu; Wed, 30 Dec 2020 11:15:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJxTrCYa8/e9axRx6hByJkBaRdL1LtMtqQSSSpQTlP0plmZ4trzX4tpklth79ps9tlkCUcQJ X-Received: by 2002:aa7:d297:: with SMTP id w23mr51962888edq.374.1609355735729; Wed, 30 Dec 2020 11:15:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609355735; cv=none; d=google.com; s=arc-20160816; b=qFTV/HyYPujj+5izi+OGFPTHDZLF52BMqJnaWUGpbJhULdsX/QSDd5rp+m3VC7d+Yl fdiNjYSZWdqdiZlv3HWwBDDMXQeGU6tJQKchfePM8xiewcjS4eovmmwTI3wm5UBP2A/7 yNiAo10Uw/1RnWZzqkBJXACPukMl1N/IzXFufEVxTfOEAHS1UZpZdBg63VbBSrsPm7hN 7JPCzzfbbytqd7iKlCCxTJmQxDJE++OoQ/A8kDIknXHtSnU3XOvnpOEheGidP9TwTqmR VvUPENuh6SXdd1zLnweWLA/UhApoxY4ZPCOJc07YXFQsrhLFVWuTzebIwPZ8GDFccgI9 Bahw== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=375e4YxYTm0FF5RfAlPr3QpppBYCWWAfCx/myiWk9aE=; b=Y+7UwadlJxnqvcZkydpHWAdOnB0dqdNb3RJRK2UPhUp4P7PMUkJ26znE625N1llABy VcB6ctfhqvX9PT+9tL9VCFvF6eCdb9TM9xfzD7Qo+2GXSCJGn+lBzWJ0ZGnZ+/ii5gd2 GaPjr9DZ1hdtk4QbcCI4cbjmdBqvwABlxHFmRP0MezZELFjEEVAP1mazaApjZM/svBc0 UwlYaHahxHuG+0PZG7Q2NH2WnluUqrRmfUId0Ig9O5qHarQQk9vsVclpwKqhiiGHbtPi uxsd6wbA/8YpQZSYwW3MU1N8l646W1l4T9oHaMs1JvWQ51BYCeXmjLRhPBoNBXKxnZfi EnNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=R9tUBgUM; 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 f24si23338634edq.247.2020.12.30.11.15.12; Wed, 30 Dec 2020 11:15:35 -0800 (PST) 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=R9tUBgUM; 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 S1726734AbgL3TNk (ORCPT + 99 others); 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: linux-kernel@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!