Patch 'usb: gadget: move bind() callback back to struct usb_composite_driver' applied to my tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

This is a note to let you know that the patch:

	usb: gadget: move bind() callback back to struct usb_composite_driver

has been applied to my tree and can be found at:

	http://bit.ly/QeJLZn

If you have any concerns, please let me know by replying to this mail.

>From 03e42bd5937c4c24e411690ab165627e93c258b5 Mon Sep 17 00:00:00 2001
From: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
Date: Thu, 6 Sep 2012 20:11:04 +0200
Subject: [PATCH] usb: gadget: move bind() callback back to struct
 usb_composite_driver

This partly reverts 07a18bd7 ("usb gadget: don't save bind callback in
struct usb_composite_driver") and fixes new drivers. The section missmatch
problems was solved by whitelisting structs in question via __ref.

Cc: devel@xxxxxxxxxxxxxxxxxxxx
Acked-by: Michal Nazarewicz <mina86@xxxxxxxxxx>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
Signed-off-by: Felipe Balbi <balbi@xxxxxx>
---
 drivers/staging/ccg/ccg.c           | 3 ++-
 drivers/usb/gadget/acm_ms.c         | 3 ++-
 drivers/usb/gadget/audio.c          | 3 ++-
 drivers/usb/gadget/cdc2.c           | 3 ++-
 drivers/usb/gadget/composite.c      | 9 ++-------
 drivers/usb/gadget/ether.c          | 3 ++-
 drivers/usb/gadget/g_ffs.c          | 3 ++-
 drivers/usb/gadget/gmidi.c          | 3 ++-
 drivers/usb/gadget/hid.c            | 3 ++-
 drivers/usb/gadget/mass_storage.c   | 3 ++-
 drivers/usb/gadget/multi.c          | 3 ++-
 drivers/usb/gadget/ncm.c            | 3 ++-
 drivers/usb/gadget/nokia.c          | 3 ++-
 drivers/usb/gadget/printer.c        | 3 ++-
 drivers/usb/gadget/serial.c         | 3 ++-
 drivers/usb/gadget/tcm_usb_gadget.c | 3 ++-
 drivers/usb/gadget/webcam.c         | 3 ++-
 drivers/usb/gadget/zero.c           | 3 ++-
 include/linux/usb/composite.h       | 3 +--
 19 files changed, 37 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/ccg/ccg.c b/drivers/staging/ccg/ccg.c
index 6a7aab8..eadda55 100644
--- a/drivers/staging/ccg/ccg.c
+++ b/drivers/staging/ccg/ccg.c
@@ -1162,6 +1162,7 @@ static int ccg_usb_unbind(struct usb_composite_dev *cdev)
 static struct usb_composite_driver ccg_usb_driver = {
 	.name		= "configurable_usb",
 	.dev		= &device_desc,
+	.bind		= ccg_bind,
 	.unbind		= ccg_usb_unbind,
 	.needs_serial	= true,
 	.iManufacturer	= "Linux Foundation",
@@ -1275,7 +1276,7 @@ static int __init init(void)
 	composite_driver.setup = ccg_setup;
 	composite_driver.disconnect = ccg_disconnect;
 
-	err = usb_composite_probe(&ccg_usb_driver, ccg_bind);
+	err = usb_composite_probe(&ccg_usb_driver);
 	if (err) {
 		class_destroy(ccg_class);
 		kfree(dev);
diff --git a/drivers/usb/gadget/acm_ms.c b/drivers/usb/gadget/acm_ms.c
index dc5cd51..65a2f3c 100644
--- a/drivers/usb/gadget/acm_ms.c
+++ b/drivers/usb/gadget/acm_ms.c
@@ -237,6 +237,7 @@ static __refdata struct usb_composite_driver acm_ms_driver = {
 	.dev		= &device_desc,
 	.max_speed	= USB_SPEED_SUPER,
 	.strings	= dev_strings,
+	.bind		= acm_ms_bind,
 	.unbind		= __exit_p(acm_ms_unbind),
 };
 
@@ -246,7 +247,7 @@ MODULE_LICENSE("GPL v2");
 
 static int __init init(void)
 {
-	return usb_composite_probe(&acm_ms_driver, acm_ms_bind);
+	return usb_composite_probe(&acm_ms_driver);
 }
 module_init(init);
 
diff --git a/drivers/usb/gadget/audio.c b/drivers/usb/gadget/audio.c
index e539490..dd339bc 100644
--- a/drivers/usb/gadget/audio.c
+++ b/drivers/usb/gadget/audio.c
@@ -203,12 +203,13 @@ static __refdata struct usb_composite_driver audio_driver = {
 	.dev		= &device_desc,
 	.strings	= audio_strings,
 	.max_speed	= USB_SPEED_HIGH,
+	.bind		= audio_bind,
 	.unbind		= __exit_p(audio_unbind),
 };
 
 static int __init init(void)
 {
-	return usb_composite_probe(&audio_driver, audio_bind);
+	return usb_composite_probe(&audio_driver);
 }
 module_init(init);
 
diff --git a/drivers/usb/gadget/cdc2.c b/drivers/usb/gadget/cdc2.c
index 00b65ac..b7d984b 100644
--- a/drivers/usb/gadget/cdc2.c
+++ b/drivers/usb/gadget/cdc2.c
@@ -237,6 +237,7 @@ static __refdata struct usb_composite_driver cdc_driver = {
 	.dev		= &device_desc,
 	.strings	= dev_strings,
 	.max_speed	= USB_SPEED_HIGH,
+	.bind		= cdc_bind,
 	.unbind		= __exit_p(cdc_unbind),
 };
 
@@ -246,7 +247,7 @@ MODULE_LICENSE("GPL");
 
 static int __init init(void)
 {
-	return usb_composite_probe(&cdc_driver, cdc_bind);
+	return usb_composite_probe(&cdc_driver);
 }
 module_init(init);
 
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 402e5bd..071d15c 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1617,12 +1617,9 @@ static struct usb_gadget_driver composite_driver = {
  * while it was binding.  That would usually be done in order to wait for
  * some userspace participation.
  */
-int usb_composite_probe(struct usb_composite_driver *driver,
-			       int (*bind)(struct usb_composite_dev *cdev))
+int usb_composite_probe(struct usb_composite_driver *driver)
 {
-	if (!driver || !driver->dev || composite)
-		return -EINVAL;
-	if (!bind && !driver->bind)
+	if (!driver || !driver->dev || composite || !driver->bind)
 		return -EINVAL;
 
 	if (!driver->name)
@@ -1633,8 +1630,6 @@ int usb_composite_probe(struct usb_composite_driver *driver,
 	composite_driver.driver.name = driver->name;
 	composite_driver.max_speed = driver->max_speed;
 	composite = driver;
-	if (!driver->bind)
-		driver->bind = bind;
 
 	return usb_gadget_probe_driver(&composite_driver, composite_bind);
 }
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 49a7dac..4580ec0 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -393,6 +393,7 @@ static __refdata struct usb_composite_driver eth_driver = {
 	.dev		= &device_desc,
 	.strings	= dev_strings,
 	.max_speed	= USB_SPEED_SUPER,
+	.bind		= eth_bind,
 	.unbind		= __exit_p(eth_unbind),
 };
 
@@ -402,7 +403,7 @@ MODULE_LICENSE("GPL");
 
 static int __init init(void)
 {
-	return usb_composite_probe(&eth_driver, eth_bind);
+	return usb_composite_probe(&eth_driver);
 }
 module_init(init);
 
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c
index d1312c4..da9809f 100644
--- a/drivers/usb/gadget/g_ffs.c
+++ b/drivers/usb/gadget/g_ffs.c
@@ -168,6 +168,7 @@ static __refdata struct usb_composite_driver gfs_driver = {
 	.dev		= &gfs_dev_desc,
 	.strings	= gfs_dev_strings,
 	.max_speed	= USB_SPEED_HIGH,
+	.bind		= gfs_bind,
 	.unbind		= gfs_unbind,
 	.iProduct	= DRIVER_DESC,
 };
@@ -268,7 +269,7 @@ static int functionfs_ready_callback(struct ffs_data *ffs)
 	}
 	gfs_registered = true;
 
-	ret = usb_composite_probe(&gfs_driver, gfs_bind);
+	ret = usb_composite_probe(&gfs_driver);
 	if (unlikely(ret < 0))
 		gfs_registered = false;
 
diff --git a/drivers/usb/gadget/gmidi.c b/drivers/usb/gadget/gmidi.c
index ae46f69..1e3cd37 100644
--- a/drivers/usb/gadget/gmidi.c
+++ b/drivers/usb/gadget/gmidi.c
@@ -189,12 +189,13 @@ static __refdata struct usb_composite_driver midi_driver = {
 	.dev		= &device_desc,
 	.strings	= dev_strings,
 	.max_speed	= USB_SPEED_HIGH,
+	.bind		= midi_bind,
 	.unbind		= __exit_p(midi_unbind),
 };
 
 static int __init midi_init(void)
 {
-	return usb_composite_probe(&midi_driver, midi_bind);
+	return usb_composite_probe(&midi_driver);
 }
 module_init(midi_init);
 
diff --git a/drivers/usb/gadget/hid.c b/drivers/usb/gadget/hid.c
index 34e139e..8502e56 100644
--- a/drivers/usb/gadget/hid.c
+++ b/drivers/usb/gadget/hid.c
@@ -247,6 +247,7 @@ static __refdata struct usb_composite_driver hidg_driver = {
 	.dev		= &device_desc,
 	.strings	= dev_strings,
 	.max_speed	= USB_SPEED_HIGH,
+	.bind		= hid_bind,
 	.unbind		= __exit_p(hid_unbind),
 };
 
@@ -272,7 +273,7 @@ static int __init hidg_init(void)
 	if (status < 0)
 		return status;
 
-	status = usb_composite_probe(&hidg_driver, hid_bind);
+	status = usb_composite_probe(&hidg_driver);
 	if (status < 0)
 		platform_driver_unregister(&hidg_plat_driver);
 
diff --git a/drivers/usb/gadget/mass_storage.c b/drivers/usb/gadget/mass_storage.c
index 5df117e..480edbc 100644
--- a/drivers/usb/gadget/mass_storage.c
+++ b/drivers/usb/gadget/mass_storage.c
@@ -162,6 +162,7 @@ static __refdata struct usb_composite_driver msg_driver = {
 	.iProduct	= DRIVER_DESC,
 	.max_speed	= USB_SPEED_SUPER,
 	.needs_serial	= 1,
+	.bind		= msg_bind,
 };
 
 MODULE_DESCRIPTION(DRIVER_DESC);
@@ -170,7 +171,7 @@ MODULE_LICENSE("GPL");
 
 static int __init msg_init(void)
 {
-	return usb_composite_probe(&msg_driver, msg_bind);
+	return usb_composite_probe(&msg_driver);
 }
 module_init(msg_init);
 
diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c
index 7e5852a..13db7cc 100644
--- a/drivers/usb/gadget/multi.c
+++ b/drivers/usb/gadget/multi.c
@@ -343,6 +343,7 @@ static __refdata struct usb_composite_driver multi_driver = {
 	.dev		= &device_desc,
 	.strings	= dev_strings,
 	.max_speed	= USB_SPEED_HIGH,
+	.bind		= multi_bind,
 	.unbind		= __exit_p(multi_unbind),
 	.iProduct	= DRIVER_DESC,
 	.needs_serial	= 1,
@@ -351,7 +352,7 @@ static __refdata struct usb_composite_driver multi_driver = {
 
 static int __init multi_init(void)
 {
-	return usb_composite_probe(&multi_driver, multi_bind);
+	return usb_composite_probe(&multi_driver);
 }
 module_init(multi_init);
 
diff --git a/drivers/usb/gadget/ncm.c b/drivers/usb/gadget/ncm.c
index 5079bf6..9a20057 100644
--- a/drivers/usb/gadget/ncm.c
+++ b/drivers/usb/gadget/ncm.c
@@ -220,6 +220,7 @@ static __refdata struct usb_composite_driver ncm_driver = {
 	.dev		= &device_desc,
 	.strings	= dev_strings,
 	.max_speed	= USB_SPEED_HIGH,
+	.bind		= gncm_bind,
 	.unbind		= __exit_p(gncm_unbind),
 };
 
@@ -229,7 +230,7 @@ MODULE_LICENSE("GPL");
 
 static int __init init(void)
 {
-	return usb_composite_probe(&ncm_driver, gncm_bind);
+	return usb_composite_probe(&ncm_driver);
 }
 module_init(init);
 
diff --git a/drivers/usb/gadget/nokia.c b/drivers/usb/gadget/nokia.c
index 936d0af..a5b5e71 100644
--- a/drivers/usb/gadget/nokia.c
+++ b/drivers/usb/gadget/nokia.c
@@ -242,12 +242,13 @@ static __refdata struct usb_composite_driver nokia_driver = {
 	.dev		= &device_desc,
 	.strings	= dev_strings,
 	.max_speed	= USB_SPEED_HIGH,
+	.bind		= nokia_bind,
 	.unbind		= __exit_p(nokia_unbind),
 };
 
 static int __init nokia_init(void)
 {
-	return usb_composite_probe(&nokia_driver, nokia_bind);
+	return usb_composite_probe(&nokia_driver);
 }
 module_init(nokia_init);
 
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c
index 0aab517..33c0c07 100644
--- a/drivers/usb/gadget/printer.c
+++ b/drivers/usb/gadget/printer.c
@@ -1274,6 +1274,7 @@ static __refdata struct usb_composite_driver printer_driver = {
 	.dev            = &device_desc,
 	.strings        = dev_strings,
 	.max_speed      = USB_SPEED_HIGH,
+	.bind		= printer_bind,
 	.unbind		= printer_unbind,
 };
 
@@ -1297,7 +1298,7 @@ init(void)
 		return status;
 	}
 
-	status = usb_composite_probe(&printer_driver, printer_bind);
+	status = usb_composite_probe(&printer_driver);
 	if (status) {
 		class_destroy(usb_gadget_class);
 		unregister_chrdev_region(g_printer_devno, 1);
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c
index 7b0b6f4..ea3f8e9 100644
--- a/drivers/usb/gadget/serial.c
+++ b/drivers/usb/gadget/serial.c
@@ -243,6 +243,7 @@ static __refdata struct usb_composite_driver gserial_driver = {
 	.dev		= &device_desc,
 	.strings	= dev_strings,
 	.max_speed	= USB_SPEED_SUPER,
+	.bind		= gs_bind,
 };
 
 static int __init init(void)
@@ -271,7 +272,7 @@ static int __init init(void)
 	}
 	strings_dev[STRING_DESCRIPTION_IDX].s = serial_config_driver.label;
 
-	return usb_composite_probe(&gserial_driver, gs_bind);
+	return usb_composite_probe(&gserial_driver);
 }
 module_init(init);
 
diff --git a/drivers/usb/gadget/tcm_usb_gadget.c b/drivers/usb/gadget/tcm_usb_gadget.c
index 28fef84..35ca09a 100644
--- a/drivers/usb/gadget/tcm_usb_gadget.c
+++ b/drivers/usb/gadget/tcm_usb_gadget.c
@@ -2441,12 +2441,13 @@ static __refdata struct usb_composite_driver usbg_driver = {
 	.dev            = &usbg_device_desc,
 	.strings        = usbg_strings,
 	.max_speed      = USB_SPEED_SUPER,
+	.bind		= usb_target_bind,
 	.unbind         = guas_unbind,
 };
 
 static int usbg_attach(struct usbg_tpg *tpg)
 {
-	return usb_composite_probe(&usbg_driver, usb_target_bind);
+	return usb_composite_probe(&usbg_driver);
 }
 
 static void usbg_detach(struct usbg_tpg *tpg)
diff --git a/drivers/usb/gadget/webcam.c b/drivers/usb/gadget/webcam.c
index d946f19..2a617c3 100644
--- a/drivers/usb/gadget/webcam.c
+++ b/drivers/usb/gadget/webcam.c
@@ -395,13 +395,14 @@ static __refdata struct usb_composite_driver webcam_driver = {
 	.dev		= &webcam_device_descriptor,
 	.strings	= webcam_device_strings,
 	.max_speed	= USB_SPEED_SUPER,
+	.bind		= webcam_bind,
 	.unbind		= webcam_unbind,
 };
 
 static int __init
 webcam_init(void)
 {
-	return usb_composite_probe(&webcam_driver, webcam_bind);
+	return usb_composite_probe(&webcam_driver);
 }
 
 static void __exit
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
index 5db33cb..90df613 100644
--- a/drivers/usb/gadget/zero.c
+++ b/drivers/usb/gadget/zero.c
@@ -339,6 +339,7 @@ static __refdata struct usb_composite_driver zero_driver = {
 	.dev		= &device_desc,
 	.strings	= dev_strings,
 	.max_speed	= USB_SPEED_SUPER,
+	.bind		= zero_bind,
 	.unbind		= zero_unbind,
 	.suspend	= zero_suspend,
 	.resume		= zero_resume,
@@ -349,7 +350,7 @@ MODULE_LICENSE("GPL");
 
 static int __init init(void)
 {
-	return usb_composite_probe(&zero_driver, zero_bind);
+	return usb_composite_probe(&zero_driver);
 }
 module_init(init);
 
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 3153f73..19a5adf 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -305,8 +305,7 @@ struct usb_composite_driver {
 	void			(*resume)(struct usb_composite_dev *);
 };
 
-extern int usb_composite_probe(struct usb_composite_driver *driver,
-			       int (*bind)(struct usb_composite_dev *cdev));
+extern int usb_composite_probe(struct usb_composite_driver *driver);
 extern void usb_composite_unregister(struct usb_composite_driver *driver);
 extern void usb_composite_setup_continue(struct usb_composite_dev *cdev);
 
-- 
1.7.12.rc3

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux