Re: [RFC/PATCH] Introduce USB Gadget Class

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

 



Hi,

On Thu, Sep 09, 2010 at 09:53:18PM -0500, Michał Nazarewicz wrote:
+int usb_gadget_register_driver(struct usb_gadget_driver *driver)
+{
+	struct usb_gadget	*gadget = NULL;
+	unsigned long		flags;
+	int			ret;
+
+	if (!driver || !driver->bind || !driver->setup)
+		return -EINVAL;
+
+	spin_lock_irqsave(&gadget_lock, flags);
+	list_for_each_entry(gadget, &gadget_list, list) {
+		if (gadget->busy)
+			continue;
+
+		dev_vdbg(gadget->dev, "registering driver [%s]\n",
+			       driver->function);
+
+		gadget->busy = true;
+		gadget->driver = driver;
+		gadget->dev->driver = &driver->driver;

You need to break.

true.

This would allow for named UDCs which I mentioned when commenting on
Matthieu's code.  So the idea would be that gadget drivers would declare
a module parameter and user space would be able to specify UDC gadget
should bind to if that was required on given system.

I think that's subject for a seprate patch which will add such
parameter.

+static ssize_t usb_gadget_softconn_store(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t n)
+{
+	struct usb_gadget	*gadget = dev_get_drvdata(dev);
+
+	if (sysfs_streq(buf, "connect"))
+		usb_gadget_connect(gadget);
+	else if (sysfs_streq(buf, "disconnect"))
+		usb_gadget_disconnect(gadget);
+	else
+		dev_err(dev, "unknown value\n");

Shouldn't it return -EINVAL here?

will fix.

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