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=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS autolearn=ham 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 86C1BC169C4 for ; Fri, 8 Feb 2019 18:34:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4D92C20863 for ; Fri, 8 Feb 2019 18:34:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TnJLlebB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727873AbfBHSec (ORCPT ); Fri, 8 Feb 2019 13:34:32 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:53819 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727115AbfBHSec (ORCPT ); Fri, 8 Feb 2019 13:34:32 -0500 Received: by mail-wm1-f67.google.com with SMTP id d15so4739113wmb.3 for ; Fri, 08 Feb 2019 10:34:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=1kzGHuwT2GURIkAQegelhqECF0GjKU1dytUU7+BSfVg=; b=TnJLlebBJEwVnaSteuwKfGH1QPRPthZnBeRIC4koFhjmS+fRW7A+O9ckyYRzT0q9KE vLkFCNZpJwwRAWggvpT/yxQjd/wvYqq78OX54UpTAePgUJfENnui1YntyjxcIGkAUOlR S6XTkqmKnNCJsefqnPld7ISDs7OKxoJWMZdz5pcv4QS6bjuilccplWXKUCodVMU+hhzb rmhToi57V1kgeEmwVUOJsS0zLI7W1Kces6NtuEnDCEWLVoXHCk9bNZMKNoD++d3LXq2h Wm+AvuIcApe0++kfWGDAg+Jw0bORQ6V5cx3GOIx8cPI7HAlJHB+MR4Plrlb/S1FNQIXF IuAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=1kzGHuwT2GURIkAQegelhqECF0GjKU1dytUU7+BSfVg=; b=NWysG0BD2UJM46mJMv4XaFENbfjN9rDRZUmchpQg2Y5pWioi2I1gEFsw2wBzVOCPVk iRZS9sG94aYXi8Q8PfYjVhOmkzeLk0AKkHcSpo3kF+lzRsGQegBX8axZoIkXmZaz+tpz G0OegR9fdXIF+zREEPXMPkG3B+bguYVpluohAVaWmjKHK8mu3HErrzosPlYU4o0AFu8+ VsQisBX7kS9aKDrjpK3g/+W2SdfOzlR0STKVpnIb70aVZfANYNv25sZgupPoIWVFr06y W0fq0Xd8ikmYpptEuxNjvQYgarcmm2r/A5ikLsKwffmG6U0f7BuHr5MF0Ht5EJiYNoCg eJEg== X-Gm-Message-State: AHQUAuY592kxbpM0q5fduaAfTIaOQxBdFtlkpm8DroD3lIULIxx9grLM u6oC5JFB25AhKA2WJIOCfKYw0iFi X-Google-Smtp-Source: AHgI3IblAdVYDJ6OJZ8YHqaFi1k9DXCrM2fmUWUnUe/LJeKvcpFWdlX6crP9mGpwjILvFOD6+JxS7Q== X-Received: by 2002:a1c:e343:: with SMTP id a64mr12956489wmh.46.1549650869578; Fri, 08 Feb 2019 10:34:29 -0800 (PST) Received: from ?IPv6:2003:ea:8bf1:e200:7cef:f5e9:d82c:bb62? (p200300EA8BF1E2007CEFF5E9D82CBB62.dip0.t-ipconnect.de. [2003:ea:8bf1:e200:7cef:f5e9:d82c:bb62]) by smtp.googlemail.com with ESMTPSA id 129sm4116138wmd.18.2019.02.08.10.34.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Feb 2019 10:34:28 -0800 (PST) Subject: Re: [PATCH net-next] net: phy: disregard "Clause 22 registers present" bit in get_phy_c45_devs_in_pkg To: Andrew Lunn Cc: Florian Fainelli , David Miller , "netdev@vger.kernel.org" References: <47ec59c0-27c0-32e3-c75e-7bdfa99551c9@gmail.com> <20190208140206.GE26594@lunn.ch> <467d5d6b-86d9-2f81-836c-52e17f28bc6c@gmail.com> <20190208182750.GH1853@lunn.ch> From: Heiner Kallweit Message-ID: Date: Fri, 8 Feb 2019 19:34:21 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <20190208182750.GH1853@lunn.ch> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 08.02.2019 19:27, Andrew Lunn wrote: >>>> - *devices_in_package |= (phy_reg & 0xffff); >>>> + /* Bit 0 doesn't represent a device, it indicates c22 regs presence */ >>>> + *devices_in_package |= (phy_reg & 0xfffe); >>> >>> Hi Heiner >>> >>> Just for readability, can we use BIT(0) in there somehow? >>> >> You think 0xfffe together with the comment is still not clear enough? > > Hi Heiner > > It is more i was wondering why the 0xffff was there in the first > place. PHY registers are 16 bits. Is this because of a compiler > warning? If the use of 0xffff is not obvious, why would 0xfffe be any > better. > I think there are more places where this masking is used, most likely to make clearer that we care about the lower 16 bits of the int only. And I also wondered when seeing such code whether it's technically needed. >>>> /* Device present registers. */ >>>> #define MDIO_DEVS_PRESENT(devad) (1 << (devad)) >>>> +#define MDIO_DEVS_C22PRESENT MDIO_DEVS_PRESENT(0) >>> >>> Err. The commit message says you did not add this... >>> >> Maybe I'm not clear enough in the commit message. Typically we have two >> constants for a device: >> >> MDIO_MMD_XXX (for the device) >> MDIO_DEVS_XXX (for the bit of the device in the device list bitmap) >> >> For the C22PRESENT flag I don't define the first one (because it's >> not a device) but the second one (because it uses a bit in the device >> list bitmap). > > This would be better as a separate patch. It is not used here, and the > explanation can then be made clearer. > OK. Definition of this constant is more meant as a favor to developers who may want to check this flag in the future. > Andrew > Heiner