Re: [RFC v2] usb/gadget: the start of the configfs interface

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

 



On 11/29/2012 06:26 PM, Michal Nazarewicz wrote:

+#define MAX_NAME_LEN	40
+static struct config_group *function_make(
+		struct config_group *group,
+		const char *name)
+{
+	struct usb_function *f;
+	char buf[MAX_NAME_LEN];
+	char *func_name;
+	char *instance_name;
+	int ret;
+
+	ret = snprintf(buf, MAX_NAME_LEN, "%s", name);
+	if (ret>= MAX_NAME_LEN)
+		ERR_PTR(-ENAMETOOLONG);

This copying is a bit pointless at the moment, but I'm assuming that's
because this is just RFC, right?

no. I replace the '.' by \0 and have in buf two strings (pointed by
func_name and instance_name). I can't do this replacement "name"
because it is const.

+	func_name = buf;
+	instance_name = strstr(func_name, ".");

strchr(func_name, '.')

done

@@ -512,12 +518,30 @@ static int __init usb_udc_init(void)
  	}

  	udc_class->dev_uevent = usb_udc_uevent;
+#ifndef MODULE
  	return 0;
+#else
+	ret = gadget_cfs_init();
+	if (ret)
+		class_destroy(udc_class);
+	return ret;
+#endif

Could the ifdef logic be reversed?  Ie. have #ifdef rather than #ifndef?

done.

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