From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756892AbcBCMkp (ORCPT ); Wed, 3 Feb 2016 07:40:45 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:60660 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753705AbcBCMkm (ORCPT ); Wed, 3 Feb 2016 07:40:42 -0500 X-AuditID: cbfee61a-f79266d000003652-c6-56b1f5411469 From: Robert Baldyga To: balbi@ti.com Cc: gregkh@linuxfoundation.org, andrzej.p@samsung.com, m.szyprowski@samsung.com, b.zolnierkie@samsung.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Robert Baldyga Subject: [PATCH v4 08/43] usb: gadget: composite: introduce new USB function ops Date: Wed, 03 Feb 2016 13:39:16 +0100 Message-id: <1454503191-11796-9-git-send-email-r.baldyga@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1454503191-11796-1-git-send-email-r.baldyga@samsung.com> References: <1454503191-11796-1-git-send-email-r.baldyga@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprGLMWRmVeSWpSXmKPExsVy+t9jQV3HrxvDDF60yFvMetnOYrFxxnpW i4P36y2aF69ns7i8aw6bxaJlrcwWa4/cZbd4cHgnuwOHx/65a9g9+rasYvQ4fmM7k8fnTXIB LFFcNimpOZllqUX6dglcGTsPbmQraBOsuLHwElsDYxNfFyMnh4SAiUTrzGYmCFtM4sK99Wxd jFwcQgKzGCX+/WhkhXB+MkrcWjWZBaSKTUBHYsv3CYwgtoiAgMT6F5fYQYqYBc4xSjy80waW EBYIkHi9pAvMZhFQldjypYMNxOYVcJXYOvso1Do5iZPHJgNt4ODgFHCTeHjMASQsBFSyq/U7 4wRG3gWMDKsYJVILkguKk9JzDfNSy/WKE3OLS/PS9ZLzczcxgkPrmdQOxoO73A8xCnAwKvHw MvzYECbEmlhWXJl7iFGCg1lJhNfo88YwId6UxMqq1KL8+KLSnNTiQ4zSHCxK4ryP/68LExJI TyxJzU5NLUgtgskycXBKNTByHI3/s/uF7PeVHx5HfU0L7U5eJ7/+EI+6tWS46vPYaKV53Wb8 51Ve3jpk8cfb7OnaitaTNaK6HB6Sj7KvT1nLyFC7+JO4CXdJ/QnZuQ7lBpachoWPFffo3JQV 1rfZURd0TlW2wHjH3zNN5ZNtkzvvWFp9j1k14SbXXIGo06+eL5vmf+F9RYASS3FGoqEWc1Fx IgA6DHOyKQIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce two new USB function operations: 1. prep_descs() prepares and assigns entity (interface and endpoint) descriptors to USB function. It's mandatory, in the new function API, as each USB function should have at least minimalistic set of entity descriptors. The minimum is single inferface with one altsetting with no endpoins (ep0 only). Descriptors assigned to function in prep_descs() callback are used during bind procedure. 2. prep_vendor_descs() - prepares and assigns class and vendor specific descriptors to function. This function is called after binding function to UDC hardware, which means that interface numbers and endpoint addresses are already assigned so that function can use these values to prepare class or vendor specific descriptors and attach them to function. Signed-off-by: Robert Baldyga --- include/linux/usb/composite.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 91948c7..7ede101 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h @@ -293,6 +293,10 @@ struct usb_os_desc_table { * can expose more than one interface. If an interface is a member of * an IAD, only the first interface of IAD has its entry in the table. * @os_desc_n: Number of entries in os_desc_table + * @prep_descs: Returns standard function descriptors (interface and endpoint + * descritptors). + * @prep_vendor_descs: Attaches vendor or class specific descriptors to + * standard descriptors. * @bind: Before the gadget can register, all of its functions bind() to the * available resources including string and interface identifiers used * in interface or class descriptors; endpoints; I/O buffers; and so on. @@ -361,6 +365,10 @@ struct usb_function { * Related: unbind() may kfree() but bind() won't... */ + /* new function API*/ + int (*prep_descs)(struct usb_function *); + int (*prep_vendor_descs)(struct usb_function *); + /* configuration management: bind/unbind */ int (*bind)(struct usb_configuration *, struct usb_function *); -- 1.9.1