Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755210AbbLKL0L (ORCPT ); Fri, 11 Dec 2015 06:26:11 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:56326 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755145AbbLKL0B (ORCPT ); Fri, 11 Dec 2015 06:26:01 -0500 X-AuditID: cbfee61b-f793c6d00000236c-a0-566ab2c7ecae 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 v3 10/36] usb: gadget: composite: handle vendor descs Date: Fri, 11 Dec 2015 12:24:49 +0100 Message-id: <1449833115-24065-11-git-send-email-r.baldyga@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1449833115-24065-1-git-send-email-r.baldyga@samsung.com> References: <1449833115-24065-1-git-send-email-r.baldyga@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprKLMWRmVeSWpSXmKPExsVy+t9jQd3jm7LCDFrbLS1mvWxnsdg4Yz2r xcH79RbNi9ezWVzeNYfNYtGyVmaLtUfusls8OLyT3YHDY//cNewefVtWMXocv7GdyePzJrkA ligum5TUnMyy1CJ9uwSujOnzAwq+CVacW5nVwNjK38XIySEhYCKx5fgndghbTOLCvfVsXYxc HEICsxglNtyezATh/GSUWHrpKRNIFZuAjsSW7xMYQWwRAQGJ9S8usYMUMQucY5R4eKcNLCEs 4CrxYtk+sLEsAqoS35+eZgaxeQXcJK5tOcsIsU5O4uSxyawgNidQfPLJS2A1QkC9b16vY5zA yLuAkWEVo0RqQXJBcVJ6rlFearlecWJucWleul5yfu4mRnBgPZPewXh4l/shRgEORiUe3gUc WWFCrIllxZW5hxglOJiVRHh/bQAK8aYkVlalFuXHF5XmpBYfYpTmYFES5913KTJMSCA9sSQ1 OzW1ILUIJsvEwSnVwOgSMtv9s+hEN89EnfIzhcxMs5f+NNU4mKtatJch0mOLuG389J4lsz98 yYsK15FOL5k4J2zOz3imVwuvaXcmTNucY2fovd94q5Bm6vELaUb3p8l89pW+te7O5frajyxT 26ZfTY876nd6t3SOqMHXJLN8j7VTbLqiHVn5j9zx0i+YsnrVFrGJwkosxRmJhlrMRcWJAP3I UZEoAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2465 Lines: 79 After binding all configurations in gadget, call prep_vendor_descs() for each function which uses new API and implements this callback. Signed-off-by: Robert Baldyga --- drivers/usb/gadget/composite.c | 31 +++++++++++++++++++++++++++++++ include/linux/usb/composite.h | 2 ++ 2 files changed, 33 insertions(+) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 324bf81..1b8e204 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -2569,6 +2569,33 @@ int usb_config_do_bind(struct usb_configuration *c) } EXPORT_SYMBOL_GPL(usb_config_do_bind); +/** + * composite_prep_vendor_descs - for each function in each configuration call + * prep_vendor_descs() callback. + * @cdev: composite device + */ +int composite_prep_vendor_descs(struct usb_composite_dev *cdev) +{ + struct usb_configuration *c; + struct usb_function *f; + int ret; + + list_for_each_entry(c, &cdev->configs, list) + list_for_each_entry(f, &c->functions, list) { + if (!usb_function_is_new_api(f)) + continue; + if (f->prep_vendor_descs) { + ret = f->prep_vendor_descs(f); + if (ret) + return ret; + } + + } + + return 0; +} +EXPORT_SYMBOL_GPL(composite_prep_vendor_descs); + static int composite_bind(struct usb_gadget *gadget, struct usb_gadget_driver *gdriver) { @@ -2598,6 +2625,10 @@ static int composite_bind(struct usb_gadget *gadget, if (status < 0) goto fail; + status = composite_prep_vendor_descs(cdev); + if (status < 0) + goto fail; + if (cdev->use_os_string) { status = composite_os_desc_req_prepare(cdev, gadget->ep0); if (status) diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index a92da38..dc0ac28c 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h @@ -592,6 +592,8 @@ extern int composite_os_desc_req_prepare(struct usb_composite_dev *cdev, struct usb_ep *ep0); void composite_dev_cleanup(struct usb_composite_dev *cdev); +int composite_prep_vendor_descs(struct usb_composite_dev *cdev); + void composite_free_descs(struct usb_composite_dev *cdev); void composite_free_vendor_descs(struct usb_composite_dev *cdev); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/