Hi,
On 10/27/2010 12:48 PM, ext Li, Jiebing wrote:
From 7f7df6e39160e0c5ff7e186b74df108b4db67569 Mon Sep 17 00:00:00 2001
From: JiebingLi<[email protected]>
Date: Wed, 27 Oct 2010 17:42:43 +0800
Subject: [PATCH] usb gadget: add support for medfield composite gadget
For Medfield platform, number of endpoints is not enough to support
all the functions in this composite gadget. This patch ensures the
enabled functions will not be impacted by the failing case.
Change-Id: Ib423c2545677ca575e05da0eb720e53ae4b455ab
Signed-off-by: JiebingLi<[email protected]>
---
drivers/usb/gadget/nokia.c | 25 ++++++++++++++++++++-----
1 files changed, 20 insertions(+), 5 deletions(-)
Why is this not sent on linux-usb mailing list?
diff --git a/drivers/usb/gadget/nokia.c b/drivers/usb/gadget/nokia.c
index f1c2647..76fee91 100644
--- a/drivers/usb/gadget/nokia.c
+++ b/drivers/usb/gadget/nokia.c
@@ -124,24 +124,39 @@ static int __init nokia_bind_config(struct
usb_configuration *c)
printk(KERN_DEBUG "could not bind phonet config\n");
status = obex_bind_config(c, 0);
- if (status)
+ if (status == -ENODEV) {
+ printk(KERN_DEBUG "no ep/if for obex %d\n", 0);
If all interfaces for g_nokia are not allocated then g_nokia will not be
fully functional, so it might make sense to print a warning instead of
debug message to indicate it to the user.
+ return 0;
+ } else if (status)
printk(KERN_DEBUG "could not bind obex config %d\n", 0);
status = obex_bind_config(c, 1);
- if (status)
+ if (status == -ENODEV) {
+ printk(KERN_DEBUG "no ep/if for obex %d\n", 1);
+ return 0;
+ } else if (status)
printk(KERN_DEBUG "could not bind obex config %d\n", 0);
status = acm_bind_config(c, 2);
- if (status)
+ if (status == -ENODEV) {
+ printk(KERN_DEBUG "no ep/if for acm %d\n", 0);
+ return 0;
Lets say the earlier obex_bind_configs failed due to some other reason
than insufficient endpoints. so status was not -ENODEV earlier. now
acm_bind_config failed due to insufficient endpoints and your return 0.
So your return value is not consistent. The logic is all messed up.
+ } else if (status)
printk(KERN_DEBUG "could not bind acm config\n");
if (use_eem) {
status = eem_bind_config(c);
- if (status)
+ if (status == -ENODEV) {
+ printk(KERN_DEBUG "no ep/if for eem %d\n", 0);
+ return 0;
+ } else if (status)
printk(KERN_DEBUG "could not bind eem config\n");
} else {
status = ecm_bind_config(c, hostaddr);
- if (status)
+ if (status == -ENODEV) {
+ printk(KERN_DEBUG "no ep/if for ecm %d\n", 0);
+ return 0;
+ } else if (status)
printk(KERN_DEBUG "could not bind ecm config\n");
}
--
regards,
-roger
_______________________________________________
Meego-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel