Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1200676
| Path | csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Robert Baldyga <r.baldyga@samsung.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH v6 2/8] usb: gadget: add 'ep_match' callback to usb_gadget_ops |
| Date | Wed, 05 Aug 2015 14:10:02 +0200 |
| Message-ID | <pU5Ga-P2-23@gated-at.bofh.it> (permalink) |
| References | <pU5G9-P2-9@gated-at.bofh.it> |
| X-Original-To | balbi@ti.com |
| X-Auditid | cbfee61a-f79a06d000005c6f-b8-55c1fb54fbd5 |
| X-Mailer | git-send-email 1.9.1 |
| X-Brightmail-Tracker | H4sIAAAAAAAAA+NgFmpnluLIzCtJLcpLzFFi42I5/e+xgG7I74OhBt9WKVkcvF9v0bx4PZvF 5V1z2CwWLWtltnhweCe7A6vH/rlr2D36tqxi9Dh+YzuTx+dNcgEsUVw2Kak5mWWpRfp2CVwZ K+a/Zyq4wVPxuu0GWwPjXq4uRk4OCQETiQt73rBC2GISF+6tZ+ti5OIQEljKKHHr9wRWCOcn o8S6o+sZQarYBHQktnyfAGaLCAhIrH9xiR2kiFmgkVHi0cN2oA4ODmEBP4k/K8xAalgEVCUe t/1hArF5BVwlWmfPhtomJ3Hy2GQwm1PATeLgs7NsILYQUM2vtttsExh5FzAyrGKUSC1ILihO Ss81zEst1ytOzC0uzUvXS87P3cQIDp5nUjsYD+5yP8QowMGoxMP7wflgqBBrYllxZe4hRgkO ZiUR3nU/gEK8KYmVValF+fFFpTmpxYcYpTlYlMR5ZTdsDhUSSE8sSc1OTS1ILYLJMnFwSjUw GjrkhW88w1aZnJehZSytwzCLd59b2JZbEovvNXW81r3Dv9bR65zvtf8ZL8WXCFyz756mm/u0 VGF+peSb0urmUPkFZpmdO6dqL5z5WT+Btf/WpUeMHDerukKfGTT8eX/4vsvMjSrnNWdY1zUa /I8u9XArlJjwQmd260LLq0+u6P99YOYr+7dfiaU4I9FQi7moOBEA138saBoCAAA= |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 54 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Robert Baldyga <r.baldyga@samsung.com> |
| X-Original-Date | Wed, 05 Aug 2015 14:02:04 +0200 |
| X-Original-Message-ID | <1438776130-29716-3-git-send-email-r.baldyga@samsung.com> |
| X-Original-References | <1438776130-29716-1-git-send-email-r.baldyga@samsung.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1200676 |
Show key headers only | View raw
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 <r.baldyga@samsung.com>
---
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 95e1275..f000c73 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 82b5bcb..303214b 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/
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH v6 2/8] usb: gadget: add 'ep_match' callback to usb_gadget_ops Robert Baldyga <r.baldyga@samsung.com> - 2015-08-05 14:10 +0200
csiph-web