usb: gadget: remove incorrect __init/__exit annotations
A recent change introduced a link error for the composite printer gadget driver: `printer_unbind' referenced in section `.ref.data' of drivers/built-in.o: defined in discarded section `.exit.text' of drivers/built-in.o Evidently the unbind function should not be marked __exit here, because it is called through a callback pointer that is not necessarily discarded, __composite_unbind() is indeed called from the error path of composite_bind(), which can never work for a built-in driver. Looking at the surrounding code, I found the same problem in all other composite gadget drivers in both the bind and unbind functions, as well as the udc platform driver 'remove' functions. Those will break if anyone uses the 'unbind' sysfs attribute to detach a device from a built-in driver. This patch removes the incorrect annotations from all the gadget drivers. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:

committed by
Felipe Balbi

parent
197d0bdf8b
commit
c94e289f19
@@ -118,7 +118,7 @@ static struct usb_gadget_strings *dev_strings[] = {
|
||||
static struct usb_function_instance *fi_midi;
|
||||
static struct usb_function *f_midi;
|
||||
|
||||
static int __exit midi_unbind(struct usb_composite_dev *dev)
|
||||
static int midi_unbind(struct usb_composite_dev *dev)
|
||||
{
|
||||
usb_put_function(f_midi);
|
||||
usb_put_function_instance(fi_midi);
|
||||
@@ -133,7 +133,7 @@ static struct usb_configuration midi_config = {
|
||||
.MaxPower = CONFIG_USB_GADGET_VBUS_DRAW,
|
||||
};
|
||||
|
||||
static int __init midi_bind_config(struct usb_configuration *c)
|
||||
static int midi_bind_config(struct usb_configuration *c)
|
||||
{
|
||||
int status;
|
||||
|
||||
@@ -150,7 +150,7 @@ static int __init midi_bind_config(struct usb_configuration *c)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __init midi_bind(struct usb_composite_dev *cdev)
|
||||
static int midi_bind(struct usb_composite_dev *cdev)
|
||||
{
|
||||
struct f_midi_opts *midi_opts;
|
||||
int status;
|
||||
@@ -185,13 +185,13 @@ put:
|
||||
return status;
|
||||
}
|
||||
|
||||
static __refdata struct usb_composite_driver midi_driver = {
|
||||
static struct usb_composite_driver midi_driver = {
|
||||
.name = (char *) longname,
|
||||
.dev = &device_desc,
|
||||
.strings = dev_strings,
|
||||
.max_speed = USB_SPEED_HIGH,
|
||||
.bind = midi_bind,
|
||||
.unbind = __exit_p(midi_unbind),
|
||||
.unbind = midi_unbind,
|
||||
};
|
||||
|
||||
module_usb_composite_driver(midi_driver);
|
||||
|
Reference in New Issue
Block a user