Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753767AbbGOGiQ (ORCPT ); Wed, 15 Jul 2015 02:38:16 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:54838 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753735AbbGOGiM (ORCPT ); Wed, 15 Jul 2015 02:38:12 -0400 X-AuditID: cbfee61a-f79516d000006302-e9-55a5ffd13d6b From: Robert Baldyga To: gregkh@linuxfoundation.org, balbi@ti.com Cc: Peter.Chen@freescale.com, johnyoun@synopsys.com, dahlmann.thomas@arcor.de, nicolas.ferre@atmel.com, cernekee@gmail.com, leoli@freescale.com, daniel@zonque.org, haojian.zhuang@gmail.com, robert.jarzmik@free.fr, michal.simek@xilinx.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-omap@vger.kernel.org, linux-geode@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, andrzej.p@samsung.com, m.szyprowski@samsung.com, Robert Baldyga Subject: [PATCH v3 41/46] usb: gadget: add 'ep_match' callback to usb_gadget_ops Date: Wed, 15 Jul 2015 08:32:28 +0200 Message-id: <1436941953-1327-42-git-send-email-r.baldyga@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1436941953-1327-1-git-send-email-r.baldyga@samsung.com> References: <1436941953-1327-1-git-send-email-r.baldyga@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmkeLIzCtJLcpLzFFi42I5/e+xoO7F/0tDDTZOFLCY9bKdxeLg/XqL vQvuMlp03j/MbNH09xWLxZ4zv9gtmhevZ7O4sM7cYvfpS4wWvx4IWWx6fI3Vov/caRaLy7vm sFnMXtLPYrFoWSuzxe/v/1gt1h65y27x7mWExbfLzewWx2b/ZbJ4cHgnu8WsN8IOYh6Tn2xk 8ljwayuLx719h1k8+td9ZvX4d7ifyWPnrLvsHvvnrmH32Lyk3uP8jIWMHn1bVjF6bNn/mdHj +I3tTB6fN8l57P38m8Vj++7lLAH8UVw2Kak5mWWpRfp2CVwZ+x+tYyu4wVPR1/eNsYFxL1cX IyeHhICJxLovi9khbDGJC/fWs3UxcnEICUxnlLjY3cAIkhAS+Mko0fJaGsRmE9CR2PJ9Alhc BMhe93cHWAOzwFoWiVtvFrCAJIQFAiQmd05nA7FZBFQl+pY8A2vgFXCVWLpnCwvENjmJk8cm s4LYnEDx6T2/mCGWuUg83fWBaQIj7wJGhlWMoqkFyQXFSem5hnrFibnFpXnpesn5uZsYwVH0 TGoH48oGi0OMAhyMSjy8N5csDRViTSwrrsw9xCjBwawkwjv7I1CINyWxsiq1KD++qDQntfgQ ozQHi5I478l8n1AhgfTEktTs1NSC1CKYLBMHp1QDo/GbQOELCorlhypfu2dOXTjt0Jszj16c WOa2kZ213H+x1sqABeKlX+01/B+WN0y9UKeyM2tm1fyoIF7rIGM+heNF/xVe/+Q4N1nm4kfN LU6zzJaenfLuw+VZlpxyZyWteQv/LZunof9LMXNufNf0ZZc08hO+2XqcmZK6W7duc/Q1fibt wIf3lyuxFGckGmoxFxUnAgDVGcn0ngIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1820 Lines: 54 Add callback that is called by epautoconf to allow UDC driver match the best endpoint for specific descriptor. It's intended to supply mechanism which allows to get rid of chip-specific endpoint matching code from epautoconf. If gadget has set 'ep_match' callback we prefer to call it first, and if it fails to find matching endpoint, then we try to use default matching algorithm. Signed-off-by: Robert Baldyga --- drivers/usb/gadget/epautoconf.c | 6 ++++++ include/linux/usb/gadget.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index 4fa6f5d..1b1fee0 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c @@ -165,6 +165,12 @@ struct usb_ep *usb_ep_autoconfig_ss( type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; + if (gadget->ops->match_ep) { + ep = gadget->ops->match_ep(gadget, desc, ep_comp); + if (ep) + goto found_ep; + } + /* First, apply chip-specific "best usage" knowledge. * This might make a good usb_gadget_ops hook ... */ diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index e6cbc25..0041bb9 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -534,6 +534,9 @@ struct usb_gadget_ops { int (*udc_start)(struct usb_gadget *, struct usb_gadget_driver *); int (*udc_stop)(struct usb_gadget *); + struct usb_ep *(*match_ep)(struct usb_gadget *, + struct usb_endpoint_descriptor *, + struct usb_ss_ep_comp_descriptor *); }; /** -- 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/