Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1664925

RE: [char-misc-next 3/3] mei: me: use an index instead of a pointer for private data

From "Winkler, Tomas" <tomas.winkler@intel.com>
Newsgroups linux.kernel
Subject RE: [char-misc-next 3/3] mei: me: use an index instead of a pointer for private data
Date 2017-06-13 16:40 +0200
Message-ID <tRV97-Fy-1@gated-at.bofh.it> (permalink)
References <tRtFU-fr-19@gated-at.bofh.it> <tRtFU-fr-17@gated-at.bofh.it> <tRUmJ-ap-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



> -----Original Message-----
> From: Greg Kroah-Hartman [mailto:gregkh@linuxfoundation.org]
> Sent: Tuesday, June 13, 2017 16:46
> To: Winkler, Tomas <tomas.winkler@intel.com>
> Cc: Usyskin, Alexander <alexander.usyskin@intel.com>; linux-
> kernel@vger.kernel.org
> Subject: Re: [char-misc-next 3/3] mei: me: use an index instead of a pointer
> for private data
> 
> 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.

Do you mean 'designated Initializers'?  I didn't know it's supported.. neat feature. 

> At the very least, document the heck out of this...

Will do

Thanks
Tomas

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[char-misc-next 3/3] mei: me: use an index instead of a pointer for private data Tomas Winkler <tomas.winkler@intel.com> - 2017-06-12 11:20 +0200
  Re: [char-misc-next 3/3] mei: me: use an index instead of a pointer  for private data Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-13 15:50 +0200
    RE: [char-misc-next 3/3] mei: me: use an index instead of a pointer  for private data "Winkler, Tomas" <tomas.winkler@intel.com> - 2017-06-13 16:40 +0200

csiph-web