From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753434AbdFMNqV (ORCPT ); Tue, 13 Jun 2017 09:46:21 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57036 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752695AbdFMNqU (ORCPT ); Tue, 13 Jun 2017 09:46:20 -0400 Date: Tue, 13 Jun 2017 15:46:07 +0200 From: Greg Kroah-Hartman To: Tomas Winkler Cc: Alexander Usyskin , linux-kernel@vger.kernel.org Subject: Re: [char-misc-next 3/3] mei: me: use an index instead of a pointer for private data Message-ID: <20170613134607.GA5042@kroah.com> References: <20170612091557.30287-1-tomas.winkler@intel.com> <20170612091557.30287-3-tomas.winkler@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170612091557.30287-3-tomas.winkler@intel.com> User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 12, 2017 at 12:15:57PM +0300, Tomas Winkler wrote: > +static const struct mei_cfg *const mei_cfg_list[] = { > + NULL, > + &mei_me_legacy_cfg, > + &mei_me_ich_cfg, > + &mei_me_pch_cfg, > + &mei_me_pch_cpt_pbg_cfg, > + &mei_me_pch8_cfg, > + &mei_me_pch8_sps_cfg, > +}; Does this structure have to keep in sync with: > +enum mei_cfg_idx { > + MEI_ME_UNDEF_CFG, > + MEI_ME_LEGACY_CFG, > + MEI_ME_ICH_CFG, > + MEI_ME_PCH_CFG, > + MEI_ME_PCH_CPT_PBG_CFG, > + MEI_ME_PCH8_CFG, > + MEI_ME_PCH8_SPS_CFG, > + MEI_ME_NUM_CFG, > +}; That value? If so, why not make it automatic and have the array use the enum values? That way you know you get it right. At the very least, document the heck out of this... thanks, greg k-h