[PATCH 7/9] staging/ccg: Allow to overwrite composite's setup function

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

 



I'm not going to swear here. The Android gadget includes composite.c
from the main tree and overwrites functions. This would still work if I
rename it and remove the const attribute but the problem rises again
once we stop including composite.c and use it as a library function.

Cc: devel@xxxxxxxxxxxxxxxxxxxx
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
---
 drivers/staging/ccg/ccg.c      |    4 ----
 drivers/usb/gadget/composite.c |   11 ++++++++++-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/ccg/ccg.c b/drivers/staging/ccg/ccg.c
index 8fb8663..1904e5e 100644
--- a/drivers/staging/ccg/ccg.c
+++ b/drivers/staging/ccg/ccg.c
@@ -1272,10 +1272,6 @@ static int __init init(void)
 
 	_ccg_dev = dev;
 
-	/* Override composite driver functions */
-	composite_driver.setup = ccg_setup;
-	composite_driver.disconnect = ccg_disconnect;
-
 	err = usb_composite_probe(&ccg_usb_driver);
 	if (err) {
 		class_destroy(ccg_class);
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 598df69..6d2fc65 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1598,9 +1598,18 @@ static const struct usb_gadget_driver composite_driver_template = {
 
 	.bind		= composite_bind,
 	.unbind		= composite_unbind,
-
+#if defined(CONFIG_USB_G_CCG) || defined(CONFIG_USB_G_CCG_MODULE)
+	/*
+	 * This is to keep the Android code in staging working. The current
+	 * Kconfig dependencies don't allow any other gadgets besides the
+	 * Android one so it is not even a limitation.
+	 */
+	.setup		= ccg_setup,
+	.disconnect	= ccg_disconnect,
+#else
 	.setup		= composite_setup,
 	.disconnect	= composite_disconnect,
+#endif
 
 	.suspend	= composite_suspend,
 	.resume		= composite_resume,
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux