Re: [PATCH v2 02/15] usb: gadget: make config_item_type structures const

From: Julia Lawall
Date: Fri Oct 20 2017 - 04:03:04 EST




On Thu, 19 Oct 2017, Laurent Pinchart wrote:

> Hi Christoph,
>
> On Thursday, 19 October 2017 17:06:57 EEST Christoph Hellwig wrote:
> > > Now we have 9 const instances of the config_item_type structure that are
> > > identical, with only the .ct_owner field set. Should they be all merged
> > > into a single structure ?
> >
> > I think that's a good idea.
> >
> > But I'm about to slurp up this whole series into my tree, how about making
> > that an incremental patch?
>
> I'm fine with that.
>
> Bhumika, would you like to submit an incremental patch, or should I do it ?

For various types, there seem to be a few hundred of these, eg:

static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
};

static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
};

Would it be desirable to remove them? I guess one would have to check
that there are not any pointer equality checks on these values. Would it
be useful to put a #define to keep the orignal names?

julia