From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758596AbbEaVZr (ORCPT ); Sun, 31 May 2015 17:25:47 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45818 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751282AbbEaVZi (ORCPT ); Sun, 31 May 2015 17:25:38 -0400 Date: Mon, 1 Jun 2015 06:01:57 +0900 From: Greg KH To: Joe Perches Cc: Nikhil Badola , linux-kernel@vger.kernel.org, stern@rowland.harvard.edu, linux-usb@vger.kernel.org Subject: Re: [PATCH 3/5] drivers:usb:fsl: Replace macros with enumerated type Message-ID: <20150531210157.GA4007@kroah.com> References: <1432640748-18657-1-git-send-email-nikhil.badola@freescale.com> <20150531065035.GB17795@kroah.com> <1433056278.2984.16.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1433056278.2984.16.camel@perches.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 31, 2015 at 12:11:18AM -0700, Joe Perches wrote: > On Sun, 2015-05-31 at 15:50 +0900, Greg KH wrote: > > On Tue, May 26, 2015 at 05:15:48PM +0530, Nikhil Badola wrote: > > > Replace macros with enumerated type to represent usb ip > > > controller version > > > > > > Signed-off-by: Nikhil Badola > > > --- > > > include/linux/fsl_devices.h | 13 ++++++++----- > > > 1 file changed, 8 insertions(+), 5 deletions(-) > > > > > > diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h > [] > > > +enum fsl_usb2_controller_ver { > > > + FSL_USB_VER_OLD = 0, > > > + FSL_USB_VER_1_6, > > > + FSL_USB_VER_2_2, > > > + FSL_USB_VER_2_4, > > > + FSL_USB_VER_2_5, > > > +}; > > > > Don't you want to change that function that uses these to return the > > enumerated type and not an integer? > > > > Also, I don't think the C standard forces the non-numberd values to be > > sequential, > > Then you haven't read the standard in awhile and you likely forgot. > > 6.7.2.2 > If the first enumerator has no =, the value of its enumeration constant > is 0. Each subsequent enumerator with no = defines its enumeration > constant as the value of the constant expression obtained by adding 1 to > the value of the previous enumeration constant. Ah, you are right, I did forget. But if you are wanting to use the "numerical" value of these, please be explicit when defining it. Otherwise someone might think it was just fine to put a new entry in the middle of the list. thanks, greg k-h