From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Fainelli Subject: Re: [PATCH net-next 3/4] net: phy: sfp: Separate enumerations and states Date: Thu, 9 Nov 2017 20:40:41 -0800 Message-ID: <5d42cec6-bf8c-d3b7-2c4e-ee3a66711cc2@gmail.com> References: <20171108034911.16382-1-f.fainelli@gmail.com> <20171108034911.16382-4-f.fainelli@gmail.com> <20171108085804.GP9463@n2100.armlinux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, davem@davemloft.net, andrew@lunn.ch To: Russell King - ARM Linux Return-path: Received: from mail-qt0-f196.google.com ([209.85.216.196]:54079 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755582AbdKJEko (ORCPT ); Thu, 9 Nov 2017 23:40:44 -0500 Received: by mail-qt0-f196.google.com with SMTP id n61so10445611qte.10 for ; Thu, 09 Nov 2017 20:40:44 -0800 (PST) In-Reply-To: <20171108085804.GP9463@n2100.armlinux.org.uk> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 11/08/2017 12:58 AM, Russell King - ARM Linux wrote: > On Tue, Nov 07, 2017 at 07:49:10PM -0800, Florian Fainelli wrote: >> Create separate enumerations for the SFP physical state (computed from GPIOs), >> device state, module state, and actual state machine. This will make it easier >> to make sure the correct states are used, and also pretty print those to help >> debugging. > > The compiler does no type checking of these, so I don't see how it > makes it any "easier to make sure the correct states are used". The types currently used (unsigned char, unsigned short) do not make it easy to spot what the enumeration is about and what values could be valid. Overall it seems to me like this improves code readability if nothing else. -- Florian