Re: [PATCH v2 02/15] usb: gadget: make config_item_type structures const
On Thu, Oct 19, 2017 at 5:05 PM, Laurent Pinchartwrote: > 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 ? > I will submit a patch for merging these structures. But should I make a separate patch for this particular change or send a v3 for the whole series? Thanks, Bhumika > -- > Regards, > > Laurent Pinchart >
Re: [PATCH v2 02/15] usb: gadget: make config_item_type structures const
On Thu, Oct 19, 2017 at 5:05 PM, 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 ? > I will submit a patch for merging these structures. But should I make a separate patch for this particular change or send a v3 for the whole series? Thanks, Bhumika > -- > Regards, > > Laurent Pinchart >
Re: [PATCH v2 02/15] usb: gadget: make config_item_type structures const
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
Re: [PATCH v2 02/15] usb: gadget: make config_item_type structures const
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
Re: [PATCH v2 02/15] usb: gadget: make config_item_type structures const
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 ? -- Regards, Laurent Pinchart
Re: [PATCH v2 02/15] usb: gadget: make config_item_type structures const
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 ? -- Regards, Laurent Pinchart
Re: [PATCH v2 02/15] usb: gadget: make config_item_type structures const
> > 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?
Re: [PATCH v2 02/15] usb: gadget: make config_item_type structures const
> > 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?
Re: [PATCH v2 02/15] usb: gadget: make config_item_type structures const
Hi Bhumika, Thank you for the patch. On Monday, 16 October 2017 18:18:41 EEST Bhumika Goyal wrote: > Make these structures const as they are only passed to the const > argument of the functions config_{group/item}_init_type_name. > > Signed-off-by: Bhumika Goyal> --- > * Changes in v2- Combine all the followup patches and the constification > patches into a series. > > drivers/usb/gadget/function/f_acm.c | 2 +- > drivers/usb/gadget/function/f_ecm.c | 2 +- > drivers/usb/gadget/function/f_eem.c | 2 +- > drivers/usb/gadget/function/f_fs.c | 2 +- > drivers/usb/gadget/function/f_hid.c | 2 +- > drivers/usb/gadget/function/f_loopback.c | 2 +- > drivers/usb/gadget/function/f_mass_storage.c | 4 +-- > drivers/usb/gadget/function/f_midi.c | 2 +- > drivers/usb/gadget/function/f_ncm.c | 2 +- > drivers/usb/gadget/function/f_obex.c | 2 +- > drivers/usb/gadget/function/f_phonet.c | 2 +- > drivers/usb/gadget/function/f_printer.c | 2 +- > drivers/usb/gadget/function/f_rndis.c| 2 +- > drivers/usb/gadget/function/f_serial.c | 2 +- > drivers/usb/gadget/function/f_sourcesink.c | 2 +- > drivers/usb/gadget/function/f_subset.c | 2 +- > drivers/usb/gadget/function/f_tcm.c | 2 +- > drivers/usb/gadget/function/f_uac1.c | 2 +- > drivers/usb/gadget/function/f_uac1_legacy.c | 2 +- > drivers/usb/gadget/function/f_uac2.c | 2 +- > drivers/usb/gadget/function/uvc_configfs.c | 50 > 21 files changed, 46 insertions(+), 46 deletions(-) [snip] > diff --git a/drivers/usb/gadget/function/uvc_configfs.c > b/drivers/usb/gadget/function/uvc_configfs.c index 844cb73..f76619f 100644 > --- a/drivers/usb/gadget/function/uvc_configfs.c > +++ b/drivers/usb/gadget/function/uvc_configfs.c > @@ -127,7 +127,7 @@ static struct uvcg_control_header > *to_uvcg_control_header(struct config_item *it NULL, > }; > > -static struct config_item_type uvcg_control_header_type = { > +static const struct config_item_type uvcg_control_header_type = { > .ct_attrs = uvcg_control_header_attrs, > .ct_owner = THIS_MODULE, > }; > @@ -170,7 +170,7 @@ static void uvcg_control_header_drop(struct config_group > *group, .drop_item= uvcg_control_header_drop, > }; > > -static struct config_item_type uvcg_control_header_grp_type = { > +static const struct config_item_type uvcg_control_header_grp_type = { > .ct_group_ops = _control_header_grp_ops, > .ct_owner = THIS_MODULE, > }; > @@ -265,7 +265,7 @@ static ssize_t uvcg_default_processing_bm_controls_show( > NULL, > }; > > -static struct config_item_type uvcg_default_processing_type = { > +static const struct config_item_type uvcg_default_processing_type = { > .ct_attrs = uvcg_default_processing_attrs, > .ct_owner = THIS_MODULE, > }; > @@ -277,7 +277,7 @@ static ssize_t uvcg_default_processing_bm_controls_show( > struct config_group group; > } uvcg_processing_grp; > > -static struct config_item_type uvcg_processing_grp_type = { > +static const struct config_item_type uvcg_processing_grp_type = { > .ct_owner = THIS_MODULE, > }; > > @@ -382,7 +382,7 @@ static ssize_t uvcg_default_camera_bm_controls_show( > NULL, > }; > > -static struct config_item_type uvcg_default_camera_type = { > +static const struct config_item_type uvcg_default_camera_type = { > .ct_attrs = uvcg_default_camera_attrs, > .ct_owner = THIS_MODULE, > }; > @@ -394,7 +394,7 @@ static ssize_t uvcg_default_camera_bm_controls_show( > struct config_group group; > } uvcg_camera_grp; > > -static struct config_item_type uvcg_camera_grp_type = { > +static const struct config_item_type uvcg_camera_grp_type = { > .ct_owner = THIS_MODULE, > }; > > @@ -460,7 +460,7 @@ static ssize_t uvcg_default_camera_bm_controls_show( > NULL, > }; > > -static struct config_item_type uvcg_default_output_type = { > +static const struct config_item_type uvcg_default_output_type = { > .ct_attrs = uvcg_default_output_attrs, > .ct_owner = THIS_MODULE, > }; > @@ -472,7 +472,7 @@ static ssize_t uvcg_default_camera_bm_controls_show( > struct config_group group; > } uvcg_output_grp; > > -static struct config_item_type uvcg_output_grp_type = { > +static const struct config_item_type uvcg_output_grp_type = { > .ct_owner = THIS_MODULE, > }; > > @@ -481,7 +481,7 @@ static ssize_t uvcg_default_camera_bm_controls_show( > struct config_group group; > } uvcg_terminal_grp; > > -static struct config_item_type uvcg_terminal_grp_type = { > +static const struct config_item_type uvcg_terminal_grp_type = { > .ct_owner = THIS_MODULE, > }; > > @@ -586,7 +586,7 @@ static void uvcg_control_class_drop_link(struct > config_item *src, .drop_link = uvcg_control_class_drop_link, > };
Re: [PATCH v2 02/15] usb: gadget: make config_item_type structures const
Hi Bhumika, Thank you for the patch. On Monday, 16 October 2017 18:18:41 EEST Bhumika Goyal wrote: > Make these structures const as they are only passed to the const > argument of the functions config_{group/item}_init_type_name. > > Signed-off-by: Bhumika Goyal > --- > * Changes in v2- Combine all the followup patches and the constification > patches into a series. > > drivers/usb/gadget/function/f_acm.c | 2 +- > drivers/usb/gadget/function/f_ecm.c | 2 +- > drivers/usb/gadget/function/f_eem.c | 2 +- > drivers/usb/gadget/function/f_fs.c | 2 +- > drivers/usb/gadget/function/f_hid.c | 2 +- > drivers/usb/gadget/function/f_loopback.c | 2 +- > drivers/usb/gadget/function/f_mass_storage.c | 4 +-- > drivers/usb/gadget/function/f_midi.c | 2 +- > drivers/usb/gadget/function/f_ncm.c | 2 +- > drivers/usb/gadget/function/f_obex.c | 2 +- > drivers/usb/gadget/function/f_phonet.c | 2 +- > drivers/usb/gadget/function/f_printer.c | 2 +- > drivers/usb/gadget/function/f_rndis.c| 2 +- > drivers/usb/gadget/function/f_serial.c | 2 +- > drivers/usb/gadget/function/f_sourcesink.c | 2 +- > drivers/usb/gadget/function/f_subset.c | 2 +- > drivers/usb/gadget/function/f_tcm.c | 2 +- > drivers/usb/gadget/function/f_uac1.c | 2 +- > drivers/usb/gadget/function/f_uac1_legacy.c | 2 +- > drivers/usb/gadget/function/f_uac2.c | 2 +- > drivers/usb/gadget/function/uvc_configfs.c | 50 > 21 files changed, 46 insertions(+), 46 deletions(-) [snip] > diff --git a/drivers/usb/gadget/function/uvc_configfs.c > b/drivers/usb/gadget/function/uvc_configfs.c index 844cb73..f76619f 100644 > --- a/drivers/usb/gadget/function/uvc_configfs.c > +++ b/drivers/usb/gadget/function/uvc_configfs.c > @@ -127,7 +127,7 @@ static struct uvcg_control_header > *to_uvcg_control_header(struct config_item *it NULL, > }; > > -static struct config_item_type uvcg_control_header_type = { > +static const struct config_item_type uvcg_control_header_type = { > .ct_attrs = uvcg_control_header_attrs, > .ct_owner = THIS_MODULE, > }; > @@ -170,7 +170,7 @@ static void uvcg_control_header_drop(struct config_group > *group, .drop_item= uvcg_control_header_drop, > }; > > -static struct config_item_type uvcg_control_header_grp_type = { > +static const struct config_item_type uvcg_control_header_grp_type = { > .ct_group_ops = _control_header_grp_ops, > .ct_owner = THIS_MODULE, > }; > @@ -265,7 +265,7 @@ static ssize_t uvcg_default_processing_bm_controls_show( > NULL, > }; > > -static struct config_item_type uvcg_default_processing_type = { > +static const struct config_item_type uvcg_default_processing_type = { > .ct_attrs = uvcg_default_processing_attrs, > .ct_owner = THIS_MODULE, > }; > @@ -277,7 +277,7 @@ static ssize_t uvcg_default_processing_bm_controls_show( > struct config_group group; > } uvcg_processing_grp; > > -static struct config_item_type uvcg_processing_grp_type = { > +static const struct config_item_type uvcg_processing_grp_type = { > .ct_owner = THIS_MODULE, > }; > > @@ -382,7 +382,7 @@ static ssize_t uvcg_default_camera_bm_controls_show( > NULL, > }; > > -static struct config_item_type uvcg_default_camera_type = { > +static const struct config_item_type uvcg_default_camera_type = { > .ct_attrs = uvcg_default_camera_attrs, > .ct_owner = THIS_MODULE, > }; > @@ -394,7 +394,7 @@ static ssize_t uvcg_default_camera_bm_controls_show( > struct config_group group; > } uvcg_camera_grp; > > -static struct config_item_type uvcg_camera_grp_type = { > +static const struct config_item_type uvcg_camera_grp_type = { > .ct_owner = THIS_MODULE, > }; > > @@ -460,7 +460,7 @@ static ssize_t uvcg_default_camera_bm_controls_show( > NULL, > }; > > -static struct config_item_type uvcg_default_output_type = { > +static const struct config_item_type uvcg_default_output_type = { > .ct_attrs = uvcg_default_output_attrs, > .ct_owner = THIS_MODULE, > }; > @@ -472,7 +472,7 @@ static ssize_t uvcg_default_camera_bm_controls_show( > struct config_group group; > } uvcg_output_grp; > > -static struct config_item_type uvcg_output_grp_type = { > +static const struct config_item_type uvcg_output_grp_type = { > .ct_owner = THIS_MODULE, > }; > > @@ -481,7 +481,7 @@ static ssize_t uvcg_default_camera_bm_controls_show( > struct config_group group; > } uvcg_terminal_grp; > > -static struct config_item_type uvcg_terminal_grp_type = { > +static const struct config_item_type uvcg_terminal_grp_type = { > .ct_owner = THIS_MODULE, > }; > > @@ -586,7 +586,7 @@ static void uvcg_control_class_drop_link(struct > config_item *src, .drop_link = uvcg_control_class_drop_link, > }; > > -static struct
Re: [PATCH v2 02/15] usb: gadget: make config_item_type structures const
Hi, Bhumika Goyalwrites: > Make these structures const as they are only passed to the const > argument of the functions config_{group/item}_init_type_name. > > Signed-off-by: Bhumika Goyal > --- > * Changes in v2- Combine all the followup patches and the constification > patches into a series. I'm assuming this depends on patch 1 of the series. In that case: Acked-by: Felipe Balbi -- balbi signature.asc Description: PGP signature
Re: [PATCH v2 02/15] usb: gadget: make config_item_type structures const
Hi, Bhumika Goyal writes: > Make these structures const as they are only passed to the const > argument of the functions config_{group/item}_init_type_name. > > Signed-off-by: Bhumika Goyal > --- > * Changes in v2- Combine all the followup patches and the constification > patches into a series. I'm assuming this depends on patch 1 of the series. In that case: Acked-by: Felipe Balbi -- balbi signature.asc Description: PGP signature