usb: gadget: make config_item_type structures const
Subsystems (2)
PATCH 1/1 usb: gadget: make config_item_type structures const
This is a followup patch for:
https://patchwork.kernel.org/patch/9999649/
Make these structures const as they are only passed to the const argument of the functions config_{group/item}_init_type_name.
Done using Coccinelle:
@rule1 disable optional_qualifier @
identifier x;
@@
static struct config_item_type x={...};
@ref@
position p;
identifier rule1.x;
@@
x@p
@good1@
position ref.p;
identifier rule1.x;
@@
(config_group_init_type_name(...,&x@p,...)
|config_item_init_type_name(...,&x@p,...)
|configfs_register_default_group(...,&x@p,...)
)
@bad depends on !good1@
position ref.p;
identifier rule1.x;
@@
x@p
@depends on forall !bad disable optional_qualifier@ identifier rule1.x;
@@
static
+ const
struct config_item_type x={...};
--- 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(-)
drivers/usb/gadget/function/f_acm.c +1 -1
@@ -786,7 +786,7 @@ static ssize_t f_acm_port_num_show(struct config_item *item, char *page) NULL, }; -static struct config_item_type acm_func_type = { +static const struct config_item_type acm_func_type = { .ct_item_ops = &acm_item_ops, .ct_attrs = acm_attrs, .ct_owner =THIS_MODULE ,
drivers/usb/gadget/function/f_ecm.c +1 -1
@@ -845,7 +845,7 @@ static inline struct f_ecm_opts *to_f_ecm_opts(struct config_item *item) NULL, }; -static struct config_item_type ecm_func_type = { +static const struct config_item_type ecm_func_type = { .ct_item_ops = &ecm_item_ops, .ct_attrs = ecm_attrs, .ct_owner =THIS_MODULE ,
drivers/usb/gadget/function/f_eem.c +1 -1
@@ -556,7 +556,7 @@ static inline struct f_eem_opts *to_f_eem_opts(struct config_item *item) NULL, }; -static struct config_item_type eem_func_type = { +static const struct config_item_type eem_func_type = { .ct_item_ops = &eem_item_ops, .ct_attrs = eem_attrs, .ct_owner =THIS_MODULE ,
drivers/usb/gadget/function/f_fs.c +1 -1
@@ -3385,7 +3385,7 @@ static void ffs_attr_release(struct config_item *item) .release = ffs_attr_release, }; -static struct config_item_type ffs_func_type = { +static const struct config_item_type ffs_func_type = { .ct_item_ops = &ffs_item_ops, .ct_owner =THIS_MODULE , };
drivers/usb/gadget/function/f_hid.c +1 -1
@@ -992,7 +992,7 @@ static ssize_t f_hid_opts_dev_show(struct config_item *item, char *page) NULL, }; -static struct config_item_type hid_func_type = { +static const struct config_item_type hid_func_type = { .ct_item_ops = &hidg_item_ops, .ct_attrs = hid_attrs, .ct_owner =THIS_MODULE ,
drivers/usb/gadget/function/f_loopback.c +1 -1
@@ -556,7 +556,7 @@ static ssize_t f_lb_opts_bulk_buflen_store(struct config_item *item, NULL, }; -static struct config_item_type lb_func_type = { +static const struct config_item_type lb_func_type = { .ct_item_ops = &lb_item_ops, .ct_attrs = lb_attrs, .ct_owner =THIS_MODULE ,
drivers/usb/gadget/function/f_mass_storage.c +2 -2
@@ -3140,7 +3140,7 @@ static ssize_t fsg_lun_opts_inquiry_string_store(struct config_item *item, NULL, }; -static struct config_item_type fsg_lun_type = { +static const struct config_item_type fsg_lun_type = { .ct_item_ops = &fsg_lun_item_ops, .ct_attrs = fsg_lun_attrs, .ct_owner =THIS_MODULE ,
@@ -3331,7 +3331,7 @@ static ssize_t fsg_opts_num_buffers_store(struct config_item *item, .drop_item = fsg_lun_drop, }; -static struct config_item_type fsg_func_type = { +static const struct config_item_type fsg_func_type = { .ct_item_ops = &fsg_item_ops, .ct_group_ops = &fsg_group_ops, .ct_attrs = fsg_attrs,
drivers/usb/gadget/function/f_midi.c +1 -1
@@ -1189,7 +1189,7 @@ static ssize_t f_midi_opts_id_store(struct config_item *item, NULL, }; -static struct config_item_type midi_func_type = { +static const struct config_item_type midi_func_type = { .ct_item_ops = &midi_item_ops, .ct_attrs = midi_attrs, .ct_owner =THIS_MODULE ,
drivers/usb/gadget/function/f_ncm.c +1 -1
@@ -1568,7 +1568,7 @@ static inline struct f_ncm_opts *to_f_ncm_opts(struct config_item *item) NULL, }; -static struct config_item_type ncm_func_type = { +static const struct config_item_type ncm_func_type = { .ct_item_ops = &ncm_item_ops, .ct_attrs = ncm_attrs, .ct_owner =THIS_MODULE ,
drivers/usb/gadget/function/f_obex.c +1 -1
@@ -411,7 +411,7 @@ static ssize_t f_obex_port_num_show(struct config_item *item, char *page) NULL, }; -static struct config_item_type obex_func_type = { +static const struct config_item_type obex_func_type = { .ct_item_ops = &obex_item_ops, .ct_attrs = acm_attrs, .ct_owner =THIS_MODULE ,
drivers/usb/gadget/function/f_phonet.c +1 -1
@@ -599,7 +599,7 @@ static ssize_t f_phonet_ifname_show(struct config_item *item, char *page) NULL, }; -static struct config_item_type phonet_func_type = { +static const struct config_item_type phonet_func_type = { .ct_item_ops = &phonet_item_ops, .ct_attrs = phonet_attrs, .ct_owner =THIS_MODULE ,
drivers/usb/gadget/function/f_printer.c +1 -1
@@ -1261,7 +1261,7 @@ static ssize_t f_printer_opts_q_len_store(struct config_item *item, NULL, }; -static struct config_item_type printer_func_type = { +static const struct config_item_type printer_func_type = { .ct_item_ops = &printer_item_ops, .ct_attrs = printer_attrs, .ct_owner =THIS_MODULE ,
drivers/usb/gadget/function/f_rndis.c +1 -1
@@ -890,7 +890,7 @@ static inline struct f_rndis_opts *to_f_rndis_opts(struct config_item *item) NULL, }; -static struct config_item_type rndis_func_type = { +static const struct config_item_type rndis_func_type = { .ct_item_ops = &rndis_item_ops, .ct_attrs = rndis_attrs, .ct_owner =THIS_MODULE ,
drivers/usb/gadget/function/f_serial.c +1 -1
@@ -281,7 +281,7 @@ static ssize_t f_serial_port_num_show(struct config_item *item, char *page) NULL, }; -static struct config_item_type serial_func_type = { +static const struct config_item_type serial_func_type = { .ct_item_ops = &serial_item_ops, .ct_attrs = acm_attrs, .ct_owner =THIS_MODULE ,
drivers/usb/gadget/function/f_sourcesink.c +1 -1
@@ -1230,7 +1230,7 @@ static ssize_t f_ss_opts_iso_qlen_store(struct config_item *item, NULL, }; -static struct config_item_type ss_func_type = { +static const struct config_item_type ss_func_type = { .ct_item_ops = &ss_item_ops, .ct_attrs = ss_attrs, .ct_owner =THIS_MODULE ,
drivers/usb/gadget/function/f_subset.c +1 -1
@@ -412,7 +412,7 @@ static inline struct f_gether_opts *to_f_gether_opts(struct config_item *item) NULL, }; -static struct config_item_type gether_func_type = { +static const struct config_item_type gether_func_type = { .ct_item_ops = &gether_item_ops, .ct_attrs = gether_attrs, .ct_owner =THIS_MODULE ,
drivers/usb/gadget/function/f_tcm.c +1 -1
@@ -2166,7 +2166,7 @@ static void tcm_attr_release(struct config_item *item) .release = tcm_attr_release, }; -static struct config_item_type tcm_func_type = { +static const struct config_item_type tcm_func_type = { .ct_item_ops = &tcm_item_ops, .ct_owner =THIS_MODULE , };
drivers/usb/gadget/function/f_uac1.c +1 -1
@@ -709,7 +709,7 @@ static void f_uac1_attr_release(struct config_item *item) NULL, }; -static struct config_item_type f_uac1_func_type = { +static const struct config_item_type f_uac1_func_type = { .ct_item_ops = &f_uac1_item_ops, .ct_attrs = f_uac1_attrs, .ct_owner =THIS_MODULE ,
drivers/usb/gadget/function/f_uac1_legacy.c +1 -1
@@ -921,7 +921,7 @@ static void f_uac1_attr_release(struct config_item *item) NULL, }; -static struct config_item_type f_uac1_func_type = { +static const struct config_item_type f_uac1_func_type = { .ct_item_ops = &f_uac1_item_ops, .ct_attrs = f_uac1_attrs, .ct_owner =THIS_MODULE ,
drivers/usb/gadget/function/f_uac2.c +1 -1
@@ -921,7 +921,7 @@ static void f_uac2_attr_release(struct config_item *item) NULL, }; -static struct config_item_type f_uac2_func_type = { +static const struct config_item_type f_uac2_func_type = { .ct_item_ops = &f_uac2_item_ops, .ct_attrs = f_uac2_attrs, .ct_owner =THIS_MODULE ,
drivers/usb/gadget/function/uvc_configfs.c +25 -25
200 lines not on this page · raw message
Signature · 1 line
1.9.1