Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: gadget: legacy: remove left-over __ref annotations

These were added in commit 780cc0f370 ("usb: gadget: add '__ref' for
rndis_config_register() and cdc_config_register()") to silence
modpost, but they didn't fix the real problem - that was fixed later
by removing wrong __init annotations in commit c94e289f195e ("usb:
gadget: remove incorrect __init/__exit annotations").

It really never makes sense for a function to be marked __ref unless
it (1) has some conditional that chooses whether to call an __init
function (or access __initdata) or not and (2) has a comment
explaining why the __ref is there and why it is safe.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Link: https://lore.kernel.org/r/20210323081607.405904-1-linux@rasmusvillemoes.dk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Rasmus Villemoes and committed by
Greg Kroah-Hartman
6fcf1129 d23922fc

+5 -5
+5 -5
drivers/usb/gadget/legacy/multi.c
··· 182 182 return ret; 183 183 } 184 184 185 - static __ref int rndis_config_register(struct usb_composite_dev *cdev) 185 + static int rndis_config_register(struct usb_composite_dev *cdev) 186 186 { 187 187 static struct usb_configuration config = { 188 188 .bConfigurationValue = MULTI_RNDIS_CONFIG_NUM, ··· 197 197 198 198 #else 199 199 200 - static __ref int rndis_config_register(struct usb_composite_dev *cdev) 200 + static int rndis_config_register(struct usb_composite_dev *cdev) 201 201 { 202 202 return 0; 203 203 } ··· 265 265 return ret; 266 266 } 267 267 268 - static __ref int cdc_config_register(struct usb_composite_dev *cdev) 268 + static int cdc_config_register(struct usb_composite_dev *cdev) 269 269 { 270 270 static struct usb_configuration config = { 271 271 .bConfigurationValue = MULTI_CDC_CONFIG_NUM, ··· 280 280 281 281 #else 282 282 283 - static __ref int cdc_config_register(struct usb_composite_dev *cdev) 283 + static int cdc_config_register(struct usb_composite_dev *cdev) 284 284 { 285 285 return 0; 286 286 } ··· 291 291 292 292 /****************************** Gadget Bind ******************************/ 293 293 294 - static int __ref multi_bind(struct usb_composite_dev *cdev) 294 + static int multi_bind(struct usb_composite_dev *cdev) 295 295 { 296 296 struct usb_gadget *gadget = cdev->gadget; 297 297 #ifdef CONFIG_USB_G_MULTI_CDC