Re: [RFC/RFT/NOT-FOR-MERGING 2/3] usb: gadget: introduce UDC Class

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

 



On Wed, 22 Sep 2010 11:28:12 +0200, Felipe Balbi <balbi@xxxxxx> wrote:

On Wed, Sep 22, 2010 at 04:24:59AM -0500, MichaÅ Nazarewicz wrote:
On Tue, 21 Sep 2010 11:34:13 +0200, Felipe Balbi <balbi@xxxxxx> wrote:
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c

+static inline int usb_gadget_start(struct usb_gadget *gadget)
+{
+	if (!gadget->ops->start)
+		return -EOPNOTSUPP;

So EOPNOTSUPP after all?  Omission or have you decided to leave it that way
after all?

I have decided to keep it since it's a required method to supply. Or I
can remove the check and let it oops if it's NULL.

Ah, OK,  I haven't noticed that it's checked in usb_add_udc().
Disregard my comment then.  Personally, I'd skip the check than
but it's your code. ;)

+int usb_add_udc(struct device *parent, struct usb_udc *udc)
+{
+	struct device		*dev;
+	unsigned long		flags;
+	int			ret;
+
+	if (!udc->gadget || !udc->gadget->ops ||
+			!udc->gadget->ops->start) {
+		dev_dbg(parent, "unitializaed gadget\n");
+		return -EINVAL;
+	}
+
+	dev_vdbg(parent, "registering UDC\n");
+
+	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+	if (!dev) {
+		ret = -ENOMEM;
+		goto err1;
+	}
+
+	device_initialize(dev);
+
+	dev->class = udc_class;
+	dev->type = &udc_device_type;
+	dev->parent = parent;
+	dev->release = usb_udc_release;
+	dev_set_drvdata(dev, udc);
+	udc->dev = dev;
+	udc->gadget->dev.parent = udc->dev;
+	udc->gadget->dev.release = usb_udc_nop_release;
+	udc->gadget->dev.dma_mask = parent->dma_mask;
+
+	ret = dev_set_name(dev, "%s", udc->name);
+	if (ret)
+		goto err2;
+
+	ret = dev_set_name(&udc->gadget->dev, udc->name);

Still with no "%s"?

I didn't quite get what you meant here and forgot to reply on previous
mail, you mean:

dev_set_name(&udc->gadget->dev, "%s", udc->name) ??

Yep.  It strikes me as odd that few lines above you have:

	ret = dev_set_name(dev, "%s", udc->name);

and here you have:

	ret = dev_set_name(&udc->gadget->dev, udc->name);

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