2011-06-29 12:35:29

by Tanya Brokhman

[permalink] [raw]
Subject: [PATCH v2 1/2] usb: gadget: add max_speed to usb_composite_driver

This field is used by the Gadget drivers to specify
the maximum speed they support, meaning: the maximum
speed they can provide descriptors for.

The driver speed will be set in consideration of this
value.

Signed-off-by: Tatyana Brokhman <[email protected]>

---
drivers/usb/gadget/audio.c | 1 +
drivers/usb/gadget/cdc2.c | 1 +
drivers/usb/gadget/composite.c | 2 ++
drivers/usb/gadget/ether.c | 1 +
drivers/usb/gadget/g_ffs.c | 1 +
drivers/usb/gadget/hid.c | 1 +
drivers/usb/gadget/mass_storage.c | 1 +
drivers/usb/gadget/multi.c | 1 +
drivers/usb/gadget/ncm.c | 1 +
drivers/usb/gadget/nokia.c | 1 +
drivers/usb/gadget/serial.c | 1 +
drivers/usb/gadget/webcam.c | 1 +
drivers/usb/gadget/zero.c | 1 +
include/linux/usb/composite.h | 2 ++
14 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/gadget/audio.c b/drivers/usb/gadget/audio.c
index 93b999e..9d89ae47 100644
--- a/drivers/usb/gadget/audio.c
+++ b/drivers/usb/gadget/audio.c
@@ -165,6 +165,7 @@ static struct usb_composite_driver audio_driver = {
.name = "g_audio",
.dev = &device_desc,
.strings = audio_strings,
+ .max_speed = USB_SPEED_HIGH,
.unbind = __exit_p(audio_unbind),
};

diff --git a/drivers/usb/gadget/cdc2.c b/drivers/usb/gadget/cdc2.c
index 2720ab0..b1c1afb 100644
--- a/drivers/usb/gadget/cdc2.c
+++ b/drivers/usb/gadget/cdc2.c
@@ -244,6 +244,7 @@ static struct usb_composite_driver cdc_driver = {
.name = "g_cdc",
.dev = &device_desc,
.strings = dev_strings,
+ .max_speed = USB_SPEED_HIGH,
.unbind = __exit_p(cdc_unbind),
};

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index ed8a70f..0009916 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1386,6 +1386,8 @@ int usb_composite_probe(struct usb_composite_driver *driver,
driver->iProduct = driver->name;
composite_driver.function = (char *) driver->name;
composite_driver.driver.name = driver->name;
+ composite_driver.speed = min_t(u8, composite_driver.speed,
+ driver->max_speed);
composite = driver;
composite_gadget_bind = bind;

diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 1690c9d..ac41858 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -401,6 +401,7 @@ static struct usb_composite_driver eth_driver = {
.name = "g_ether",
.dev = &device_desc,
.strings = dev_strings,
+ .max_speed = USB_SPEED_HIGH,
.unbind = __exit_p(eth_unbind),
};

diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c
index ebf6970..704c280 100644
--- a/drivers/usb/gadget/g_ffs.c
+++ b/drivers/usb/gadget/g_ffs.c
@@ -162,6 +162,7 @@ static struct usb_composite_driver gfs_driver = {
.name = DRIVER_NAME,
.dev = &gfs_dev_desc,
.strings = gfs_dev_strings,
+ .max_speed = USB_SPEED_HIGH,
.unbind = gfs_unbind,
.iProduct = DRIVER_DESC,
};
diff --git a/drivers/usb/gadget/hid.c b/drivers/usb/gadget/hid.c
index 2523e54..9fb5750 100644
--- a/drivers/usb/gadget/hid.c
+++ b/drivers/usb/gadget/hid.c
@@ -255,6 +255,7 @@ static struct usb_composite_driver hidg_driver = {
.name = "g_hid",
.dev = &device_desc,
.strings = dev_strings,
+ .max_speed = USB_SPEED_HIGH,
.unbind = __exit_p(hid_unbind),
};

diff --git a/drivers/usb/gadget/mass_storage.c b/drivers/usb/gadget/mass_storage.c
index 0182242..d3eb274 100644
--- a/drivers/usb/gadget/mass_storage.c
+++ b/drivers/usb/gadget/mass_storage.c
@@ -169,6 +169,7 @@ static struct usb_composite_driver msg_driver = {
.name = "g_mass_storage",
.dev = &msg_device_desc,
.iProduct = DRIVER_DESC,
+ .max_speed = USB_SPEED_HIGH,
.needs_serial = 1,
};

diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c
index d9feced..8c7b747 100644
--- a/drivers/usb/gadget/multi.c
+++ b/drivers/usb/gadget/multi.c
@@ -351,6 +351,7 @@ static struct usb_composite_driver multi_driver = {
.name = "g_multi",
.dev = &device_desc,
.strings = dev_strings,
+ .max_speed = USB_SPEED_HIGH,
.unbind = __exit_p(multi_unbind),
.iProduct = DRIVER_DESC,
.needs_serial = 1,
diff --git a/drivers/usb/gadget/ncm.c b/drivers/usb/gadget/ncm.c
index 99c179a..62ee508 100644
--- a/drivers/usb/gadget/ncm.c
+++ b/drivers/usb/gadget/ncm.c
@@ -228,6 +228,7 @@ static struct usb_composite_driver ncm_driver = {
.name = "g_ncm",
.dev = &device_desc,
.strings = dev_strings,
+ .max_speed = USB_SPEED_HIGH,
.unbind = __exit_p(gncm_unbind),
};

diff --git a/drivers/usb/gadget/nokia.c b/drivers/usb/gadget/nokia.c
index 55ca63a..c7fb772 100644
--- a/drivers/usb/gadget/nokia.c
+++ b/drivers/usb/gadget/nokia.c
@@ -241,6 +241,7 @@ static struct usb_composite_driver nokia_driver = {
.name = "g_nokia",
.dev = &device_desc,
.strings = dev_strings,
+ .max_speed = USB_SPEED_HIGH,
.unbind = __exit_p(nokia_unbind),
};

diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c
index 1ac57a9..ed1b816 100644
--- a/drivers/usb/gadget/serial.c
+++ b/drivers/usb/gadget/serial.c
@@ -242,6 +242,7 @@ static struct usb_composite_driver gserial_driver = {
.name = "g_serial",
.dev = &device_desc,
.strings = dev_strings,
+ .max_speed = USB_SPEED_HIGH,
};

static int __init init(void)
diff --git a/drivers/usb/gadget/webcam.c b/drivers/usb/gadget/webcam.c
index a5a0fdb..df6882d 100644
--- a/drivers/usb/gadget/webcam.c
+++ b/drivers/usb/gadget/webcam.c
@@ -373,6 +373,7 @@ static struct usb_composite_driver webcam_driver = {
.name = "g_webcam",
.dev = &webcam_device_descriptor,
.strings = webcam_device_strings,
+ .max_speed = USB_SPEED_HIGH,
.unbind = webcam_unbind,
};

diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
index 6d16db9..af7e7c3 100644
--- a/drivers/usb/gadget/zero.c
+++ b/drivers/usb/gadget/zero.c
@@ -340,6 +340,7 @@ static struct usb_composite_driver zero_driver = {
.name = "zero",
.dev = &device_desc,
.strings = dev_strings,
+ .max_speed = USB_SPEED_HIGH,
.unbind = zero_unbind,
.suspend = zero_suspend,
.resume = zero_resume,
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 99830d6..a3e72df 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -240,6 +240,7 @@ int usb_add_config(struct usb_composite_dev *,
* identifiers.
* @strings: tables of strings, keyed by identifiers assigned during bind()
* and language IDs provided in control requests
+ * @max_speed: Highest speed the driver supports.
* @needs_serial: set to 1 if the gadget needs userspace to provide
* a serial number. If one is not provided, warning will be printed.
* @unbind: Reverses bind; called as a side effect of unregistering
@@ -267,6 +268,7 @@ struct usb_composite_driver {
const char *iManufacturer;
const struct usb_device_descriptor *dev;
struct usb_gadget_strings **strings;
+ enum usb_device_speed max_speed;
unsigned needs_serial:1;

int (*unbind)(struct usb_composite_dev *);
--
1.7.3.3

--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.


2011-06-29 12:38:34

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] usb: gadget: add max_speed to usb_composite_driver

On Wed, Jun 29, 2011 at 03:34:55PM +0300, Tatyana Brokhman wrote:
> This field is used by the Gadget drivers to specify
> the maximum speed they support, meaning: the maximum
> speed they can provide descriptors for.
>
> The driver speed will be set in consideration of this
> value.
>
> Signed-off-by: Tatyana Brokhman <[email protected]>

I have already fixed this one myself ;-)

--
balbi


Attachments:
(No filename) (400.00 B)
signature.asc (490.00 B)
Digital signature
Download all attachments

2011-06-29 12:45:42

by Tanya Brokhman

[permalink] [raw]
Subject: RE: [PATCH v2 1/2] usb: gadget: add max_speed to usb_composite_driver

>
> I have already fixed this one myself ;-)
>

Oh, ok :) Thank you!


Thanks,
Tanya Brokhman
---
Sent by an consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.



2011-06-29 12:48:35

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] usb: gadget: add max_speed to usb_composite_driver

Hi,

On Wed, Jun 29, 2011 at 03:45:35PM +0300, Tanya Brokhman wrote:
> > I have already fixed this one myself ;-)
> >
>
> Oh, ok :) Thank you!

it might take a while for kernel.org to replicate things, maybe that's
why you didn't see before ;-)

give it a few more minutes and check my gadget branch to see if it's all
good, I'm going to test it again on beagleboard to be sure nothing is
broken.

--
balbi


Attachments:
(No filename) (410.00 B)
signature.asc (490.00 B)
Digital signature
Download all attachments

2011-06-29 17:27:30

by Tanya Brokhman

[permalink] [raw]
Subject: RE: [PATCH v2 1/2] usb: gadget: add max_speed to usb_composite_driver


> it might take a while for kernel.org to replicate things, maybe that's
> why you didn't see before ;-)
>
> give it a few more minutes and check my gadget branch to see if it's
> all good, I'm going to test it again on beagleboard to be sure nothing
> is broken.
>

Hi Felipe

I went over the emails and all is ok. Thanks!
One question: Greg/Alan mentioned that the compilation warning should be
fixed by __maybe_unused. I wasn't aware such thing existed. Just looked it
up.
Do you want me to send you a patch that fixes that or have you done it
already and I missed it again :) ?


Thanks,
Tanya Brokhman
---
Sent by an consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.




2011-06-29 19:41:34

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] usb: gadget: add max_speed to usb_composite_driver

Hi,

On Wed, Jun 29, 2011 at 08:27:17PM +0300, Tanya Brokhman wrote:
> > it might take a while for kernel.org to replicate things, maybe that's
> > why you didn't see before ;-)
> >
> > give it a few more minutes and check my gadget branch to see if it's
> > all good, I'm going to test it again on beagleboard to be sure nothing
> > is broken.
> >
>
> I went over the emails and all is ok. Thanks!
> One question: Greg/Alan mentioned that the compilation warning should be
> fixed by __maybe_unused. I wasn't aware such thing existed. Just looked it
> up.
> Do you want me to send you a patch that fixes that or have you done it
> already and I missed it again :) ?

Oops, I didn't. You can send a differential patch (just this change in
particular) and I'll merge into the original.

--
balbi


Attachments:
(No filename) (800.00 B)
signature.asc (490.00 B)
Digital signature
Download all attachments

2011-06-30 05:14:26

by Tanya Brokhman

[permalink] [raw]
Subject: RE: [PATCH v2 1/2] usb: gadget: add max_speed to usb_composite_driver

Good morning Felipe,

> > I went over the emails and all is ok. Thanks!
> > One question: Greg/Alan mentioned that the compilation warning should
> > be fixed by __maybe_unused. I wasn't aware such thing existed. Just
> > looked it up.
> > Do you want me to send you a patch that fixes that or have you done
> it
> > already and I missed it again :) ?
>
> Oops, I didn't. You can send a differential patch (just this change in
> particular) and I'll merge into the original.

Just emailed you the fixing patch.
Just one thing. Greg already merged the patch that caused the compilation
warning into his tree so perhaps you can't merge the fix into the original
patch and need to post the fix as a different patch....


Thanks,
Tanya Brokhman
---
Sent by an consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.



2011-06-30 05:22:23

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] usb: gadget: add max_speed to usb_composite_driver

On Thu, Jun 30, 2011 at 08:14:15AM +0300, Tanya Brokhman wrote:
> Good morning Felipe,
>
> > > I went over the emails and all is ok. Thanks!
> > > One question: Greg/Alan mentioned that the compilation warning should
> > > be fixed by __maybe_unused. I wasn't aware such thing existed. Just
> > > looked it up.
> > > Do you want me to send you a patch that fixes that or have you done
> > it
> > > already and I missed it again :) ?
> >
> > Oops, I didn't. You can send a differential patch (just this change in
> > particular) and I'll merge into the original.
>
> Just emailed you the fixing patch.
> Just one thing. Greg already merged the patch that caused the compilation
> warning into his tree so perhaps you can't merge the fix into the original
> patch and need to post the fix as a different patch....

Nope, you can't, I need just a single patch that resolves this. I'll
queue up the patch you just sent, thanks.

greg k-h

2011-06-30 05:41:11

by Tanya Brokhman

[permalink] [raw]
Subject: RE: [PATCH v2 1/2] usb: gadget: add max_speed to usb_composite_driver

> >
> > Just emailed you the fixing patch.
> > Just one thing. Greg already merged the patch that caused the
> compilation
> > warning into his tree so perhaps you can't merge the fix into the
> original
> > patch and need to post the fix as a different patch....
>
> Nope, you can't, I need just a single patch that resolves this. I'll
> queue up the patch you just sent, thanks.
>

One sec! I just found out that I was running checkpatch.pl from a wrong
location. There is a checkpatch warning. I'll send you the fix in a few
minutes.
Sorry.


Thanks,
Tanya Brokhman
---
Sent by an consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.



2011-06-30 05:47:00

by Tanya Brokhman

[permalink] [raw]
Subject: RE: [PATCH v2 1/2] usb: gadget: add max_speed to usb_composite_driver

>
> One sec! I just found out that I was running checkpatch.pl from a wrong
> location. There is a checkpatch warning. I'll send you the fix in a few
> minutes.
> Sorry.
>


Done! Please pick up "[PATCH v2] usb: gadget: Compilation warning fix".
Sorry for the trouble...


Thanks,
Tanya Brokhman
---
Sent by an consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.