Re: [PATCH 1/1] usb gadget: modify the handling of function binding return value

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

 



On Mon, 01 Nov 2010 12:39:46 +0100, Greg KH <greg@xxxxxxxxx> wrote:

On Mon, Nov 01, 2010 at 07:22:35PM +0800, Li, Jiebing wrote:
From: JiebingLi <jiebing.li@xxxxxxxxx>

This patch makes the composite gadget more flexible in case that
any of the functions fails to be bound.

Signed-off-by: JiebingLi <jiebing.li@xxxxxxxxx>
---
 drivers/usb/gadget/nokia.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/nokia.c b/drivers/usb/gadget/nokia.c
index f1c2647..d99a67c 100644
--- a/drivers/usb/gadget/nokia.c
+++ b/drivers/usb/gadget/nokia.c
@@ -117,35 +117,48 @@ static u8 hostaddr[ETH_ALEN];

 static int __init nokia_bind_config(struct usb_configuration *c)
 {
-	int status = 0;
+	int	status = 0;
+	int	ret = -ENODEV;

 	status = phonet_bind_config(c);
 	if (status)
 		printk(KERN_DEBUG "could not bind phonet config\n");
+	else
+		ret = 0;

Ick, no, just set ret to 0 at the beginning and then set it to an error
if that happens.

I think that Jiebing's idea is to return ENODEV only if all *_bind_config()
failes.  Not sure if this makes sense though since it would create total of
47 valid versions of the gadget.

Much smaller patch and easier to read and understand.

Actually, the diff would be bigger. ;)

--
Best regards,                                        _     _
| Humble Liege of Serenely Enlightened Majesty of  o' \,=./ `o
| Computer Science,  MichaÅ "mina86" Nazarewicz       (o o)
+----[mina86*mina86.com]---[mina86*jabber.org]----ooO--(_)--Ooo--
--
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