From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Chen Subject: Re: [PATCH v10 13/14] usb: gadget: udc: adapt to OTG core Date: Mon, 13 Jun 2016 15:20:19 +0800 Message-ID: <20160613072019.GB19728@shlinux2> References: <1465564043-27163-1-git-send-email-rogerq@ti.com> <1465564043-27163-14-git-send-email-rogerq@ti.com> <20160612113655.GC32615@shlinux2> <575E5D57.7010700@ti.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <575E5D57.7010700-l0cyMroinI0@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Roger Quadros Cc: peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org, balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org, dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org, mathias.nyman-VuQAYsv1563Yd54FQh9/CA@public.gmane.org, Joao.Pinto-HKixBCOQz3hWk0Htik3J/w@public.gmane.org, sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org, jun.li-KZfg59tc24xl57MIdRCFDg@public.gmane.org, grygorii.strashko-l0cyMroinI0@public.gmane.org, yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org, robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, nsekhar-l0cyMroinI0@public.gmane.org, b-liu-l0cyMroinI0@public.gmane.org, joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org, linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-omap@vger.kernel.org On Mon, Jun 13, 2016 at 10:14:31AM +0300, Roger Quadros wrote: > On 12/06/16 14:36, Peter Chen wrote: > > On Fri, Jun 10, 2016 at 04:07:22PM +0300, Roger Quadros wrote: > >> > >> +/** > >> + * usb_otg_add_gadget_udc - adds a new gadget to the udc class driver list > >> + * @parent: the parent device to this udc. Usually the controller > >> + * driver's device. > > > > It seems it should be udc device > > Parent and udc->dev are not the same right? Sure, udc's parent is otg device. > > I guess i'll omit the second statement to avoid confusion. So. > > @parent: the parent device to this udc. Where you call below APIs? It seems to be a udc driver, right? So, when you try to get "otg-controller" from the node, this node should be udc. /** * usb_otg_add_gadget_udc - adds a new gadget to the udc class driver list * @parent: the parent device to this udc. Usually the controller * driver's device. * @gadget: the gadget to be added to the list * @otg_dev: the OTG controller device * * If otg_dev is NULL then device tree node is checked * for OTG controller via the otg-controller property. * Returns zero on success, negative errno otherwise. */ int usb_otg_add_gadget_udc(struct device *parent, struct usb_gadget *gadget, struct device *otg_dev) { if (!otg_dev) { gadget->otg_dev = of_usb_get_otg(parent->of_node); if (!gadget->otg_dev) return -ENODEV; } else { gadget->otg_dev = otg_dev; } return usb_add_gadget_udc_release(parent, gadget, NULL); } EXPORT_SYMBOL_GPL(usb_otg_add_gadget_udc); -- Best Regards, Peter Chen -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965021AbcFMH0b (ORCPT ); Mon, 13 Jun 2016 03:26:31 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:34537 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964923AbcFMH03 (ORCPT ); Mon, 13 Jun 2016 03:26:29 -0400 Date: Mon, 13 Jun 2016 15:20:19 +0800 From: Peter Chen To: Roger Quadros Cc: peter.chen@freescale.com, balbi@kernel.org, tony@atomide.com, gregkh@linuxfoundation.org, dan.j.williams@intel.com, mathias.nyman@linux.intel.com, Joao.Pinto@synopsys.com, sergei.shtylyov@cogentembedded.com, jun.li@freescale.com, grygorii.strashko@ti.com, yoshihiro.shimoda.uh@renesas.com, robh@kernel.org, nsekhar@ti.com, b-liu@ti.com, joe@perches.com, linux-usb@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v10 13/14] usb: gadget: udc: adapt to OTG core Message-ID: <20160613072019.GB19728@shlinux2> References: <1465564043-27163-1-git-send-email-rogerq@ti.com> <1465564043-27163-14-git-send-email-rogerq@ti.com> <20160612113655.GC32615@shlinux2> <575E5D57.7010700@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <575E5D57.7010700@ti.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 13, 2016 at 10:14:31AM +0300, Roger Quadros wrote: > On 12/06/16 14:36, Peter Chen wrote: > > On Fri, Jun 10, 2016 at 04:07:22PM +0300, Roger Quadros wrote: > >> > >> +/** > >> + * usb_otg_add_gadget_udc - adds a new gadget to the udc class driver list > >> + * @parent: the parent device to this udc. Usually the controller > >> + * driver's device. > > > > It seems it should be udc device > > Parent and udc->dev are not the same right? Sure, udc's parent is otg device. > > I guess i'll omit the second statement to avoid confusion. So. > > @parent: the parent device to this udc. Where you call below APIs? It seems to be a udc driver, right? So, when you try to get "otg-controller" from the node, this node should be udc. /** * usb_otg_add_gadget_udc - adds a new gadget to the udc class driver list * @parent: the parent device to this udc. Usually the controller * driver's device. * @gadget: the gadget to be added to the list * @otg_dev: the OTG controller device * * If otg_dev is NULL then device tree node is checked * for OTG controller via the otg-controller property. * Returns zero on success, negative errno otherwise. */ int usb_otg_add_gadget_udc(struct device *parent, struct usb_gadget *gadget, struct device *otg_dev) { if (!otg_dev) { gadget->otg_dev = of_usb_get_otg(parent->of_node); if (!gadget->otg_dev) return -ENODEV; } else { gadget->otg_dev = otg_dev; } return usb_add_gadget_udc_release(parent, gadget, NULL); } EXPORT_SYMBOL_GPL(usb_otg_add_gadget_udc); -- Best Regards, Peter Chen