From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Fainelli Subject: Re: [PATCH net-next 1/2] net: phy: use phy_id_mask value zero for exact match Date: Thu, 8 Nov 2018 15:06:28 -0800 Message-ID: <1bf2d057-4152-cc7c-095c-ce0eadb6aa5e@gmail.com> References: <08d52675-f308-4ebb-4ec4-f6c7ac0b6b06@gmail.com> <827c53cd-c9f5-7b1c-84fd-af1a49317fe7@gmail.com> <072cad0e-f5c0-2f40-b18d-8801834e2676@gmail.com> <20181108205349.GG5259@lunn.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: David Miller , "netdev@vger.kernel.org" To: Andrew Lunn , Heiner Kallweit Return-path: Received: from mail-wm1-f67.google.com ([209.85.128.67]:37322 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725922AbeKIIo2 (ORCPT ); Fri, 9 Nov 2018 03:44:28 -0500 Received: by mail-wm1-f67.google.com with SMTP id p2-v6so311264wmc.2 for ; Thu, 08 Nov 2018 15:06:38 -0800 (PST) In-Reply-To: <20181108205349.GG5259@lunn.ch> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 11/8/18 12:53 PM, Andrew Lunn wrote: >>> Maybe we can find a clever way with a macro to specify only the PHY OUI >>> and compute a suitable mask automatically? >>> >> I don't think so. For Realtek each driver is specific even to a model >> revision (therefore mask 0xffffffff). Same applies to intel-xway. >> In broadcom.c we have masks 0xfffffff0, so for each model, independent >> of revision number. There is no general rule. >> Also we can't simply check for the first-bit-set to derive a mask. > > I'm crystal ball gazing, but i think Florian was meaning something like > > #define PHY_ID_UNIQUE(_id) \ > .phy_id = _id_; \ > .phy_id_mask = 0xffffffff; > > It is the boilerplate setting .phy_id_mask which you don't like. This removes that boilerplate. Your crystal ball gazing skills are good, that is what I meant, we could also define another macro which does not match the revision bits, and that would likely cover everything that is already out there. -- Florian