[PATCH 3/3] usb gadget: mark usb_composite_drivers with __refdata

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

 



The .bind callbacks usually live in .init.text.  This is OK as it is only
called at register time.  A proper fix would remove the bind member from
struct usb_composite_driver, but that doesn't work without much
reorganization, so mark them as refdata for now.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
Cc: Michał Nazarewicz <m.nazarewicz@xxxxxxxxxxx>
---
Hello,

there are still some section mismatches, e.g. 

	WARNING: drivers/usb/gadget/g_serial.o(.text+0x2b48): Section mismatch in reference from the function acm_bind() to the function .devinit.text:usb_ep_autoconfig()
	The function acm_bind() references
	the function __devinit usb_ep_autoconfig().
	This is often because acm_bind lacks a __devinit 
	annotation or the annotation of usb_ep_autoconfig is wrong.

didn't look into these yet and they existed before, too.

 drivers/usb/gadget/audio.c        |    7 ++++++-
 drivers/usb/gadget/cdc2.c         |    7 ++++++-
 drivers/usb/gadget/ether.c        |    7 ++++++-
 drivers/usb/gadget/hid.c          |    8 ++++++--
 drivers/usb/gadget/mass_storage.c |    7 ++++++-
 drivers/usb/gadget/serial.c       |    7 ++++++-
 drivers/usb/gadget/webcam.c       |    7 ++++++-
 drivers/usb/gadget/zero.c         |    7 ++++++-
 8 files changed, 48 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/gadget/audio.c b/drivers/usb/gadget/audio.c
index eeff9b2..a9b2123 100644
--- a/drivers/usb/gadget/audio.c
+++ b/drivers/usb/gadget/audio.c
@@ -161,7 +161,12 @@ static int __exit audio_unbind(struct usb_composite_dev *cdev)
 	return 0;
 }
 
-static struct usb_composite_driver audio_driver = {
+/*
+ * audio_bind is in .init.text.  It's not optimal that audio_driver needs to
+ * reference it, but OK for now as it's not called anymore after
+ * usb_composite_register returns.
+ */
+static struct usb_composite_driver audio_driver __refdata = {
 	.name		= "g_audio",
 	.dev		= &device_desc,
 	.strings	= audio_strings,
diff --git a/drivers/usb/gadget/cdc2.c b/drivers/usb/gadget/cdc2.c
index c3d2c86..7a8ea5c 100644
--- a/drivers/usb/gadget/cdc2.c
+++ b/drivers/usb/gadget/cdc2.c
@@ -240,7 +240,12 @@ static int __exit cdc_unbind(struct usb_composite_dev *cdev)
 	return 0;
 }
 
-static struct usb_composite_driver cdc_driver = {
+/*
+ * cdc_bind is in .init.text.  It's not optimal that cdc_driver needs to
+ * reference it, but OK for now as it's not called anymore after
+ * usb_composite_register returns.
+ */
+static struct usb_composite_driver cdc_driver __refdata = {
 	.name		= "g_cdc",
 	.dev		= &device_desc,
 	.strings	= dev_strings,
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index cd03bea..b2ef7c8 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -397,7 +397,12 @@ static int __exit eth_unbind(struct usb_composite_dev *cdev)
 	return 0;
 }
 
-static struct usb_composite_driver eth_driver = {
+/*
+ * eth_bind is in .init.text.  It's not optimal that eth_driver needs to
+ * reference it, but OK for now as it's not called anymore after
+ * usb_composite_register returns.
+ */
+static struct usb_composite_driver eth_driver __refdata = {
 	.name		= "g_ether",
 	.dev		= &device_desc,
 	.strings	= dev_strings,
diff --git a/drivers/usb/gadget/hid.c b/drivers/usb/gadget/hid.c
index 2ce69c6..bf22fa3 100644
--- a/drivers/usb/gadget/hid.c
+++ b/drivers/usb/gadget/hid.c
@@ -250,8 +250,12 @@ static int __devexit hidg_plat_driver_remove(struct platform_device *pdev)
 
 /****************************** Some noise ******************************/
 
-
-static struct usb_composite_driver hidg_driver = {
+/*
+ * hid_bind is in .init.text.  It's not optimal that hidg_driver needs to
+ * reference it, but OK for now as it's not called anymore after
+ * usb_composite_register returns.
+ */
+static struct usb_composite_driver hidg_driver __refdata = {
 	.name		= "g_hid",
 	.dev		= &device_desc,
 	.strings	= dev_strings,
diff --git a/drivers/usb/gadget/mass_storage.c b/drivers/usb/gadget/mass_storage.c
index 21a65a2..35a28af 100644
--- a/drivers/usb/gadget/mass_storage.c
+++ b/drivers/usb/gadget/mass_storage.c
@@ -220,7 +220,12 @@ static int __init msg_bind(struct usb_composite_dev *cdev)
 /****************************** Some noise ******************************/
 
 
-static struct usb_composite_driver msg_driver = {
+/*
+ * msg_bind is in .init.text.  It's not optimal that msg_driver needs to
+ * reference it, but OK for now as it's not called anymore after
+ * usb_composite_register returns.
+ */
+static struct usb_composite_driver msg_driver __refdata = {
 	.name		= "g_mass_storage",
 	.dev		= &msg_device_desc,
 	.strings	= dev_strings,
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c
index 8838f03..94296ad 100644
--- a/drivers/usb/gadget/serial.c
+++ b/drivers/usb/gadget/serial.c
@@ -238,7 +238,12 @@ fail:
 	return status;
 }
 
-static struct usb_composite_driver gserial_driver = {
+/*
+ * gs_bind is in .init.text.  It's not optimal that gserial_driver needs to
+ * reference it, but OK for now as it's not called anymore after
+ * usb_composite_register returns.
+ */
+static struct usb_composite_driver gserial_driver __refdata = {
 	.name		= "g_serial",
 	.dev		= &device_desc,
 	.strings	= dev_strings,
diff --git a/drivers/usb/gadget/webcam.c b/drivers/usb/gadget/webcam.c
index bfea319..2f5d05a 100644
--- a/drivers/usb/gadget/webcam.c
+++ b/drivers/usb/gadget/webcam.c
@@ -369,7 +369,12 @@ error:
  * Driver
  */
 
-static struct usb_composite_driver webcam_driver = {
+/*
+ * webcam_bind is in .init.text.  It's not optimal that webcam_driver needs to
+ * reference it, but OK for now as it's not called anymore after
+ * usb_composite_register returns.
+ */
+static struct usb_composite_driver webcam_driver __refdata = {
 	.name		= "g_webcam",
 	.dev		= &webcam_device_descriptor,
 	.strings	= webcam_device_strings,
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
index 807280d..89870b8 100644
--- a/drivers/usb/gadget/zero.c
+++ b/drivers/usb/gadget/zero.c
@@ -336,7 +336,12 @@ static int zero_unbind(struct usb_composite_dev *cdev)
 	return 0;
 }
 
-static struct usb_composite_driver zero_driver = {
+/*
+ * zero_bind is in .init.text.  It's not optimal that zero_driver needs to
+ * reference it, but OK for now as it's not called anymore after
+ * usb_composite_register returns.
+ */
+static struct usb_composite_driver zero_driver __refdata = {
 	.name		= "zero",
 	.dev		= &device_desc,
 	.strings	= dev_strings,
-- 
1.7.1

--
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