lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1454503191-11796-19-git-send-email-r.baldyga@samsung.com>
Date:	Wed, 03 Feb 2016 13:39:26 +0100
From:	Robert Baldyga <r.baldyga@...sung.com>
To:	balbi@...com
Cc:	gregkh@...uxfoundation.org, andrzej.p@...sung.com,
	m.szyprowski@...sung.com, b.zolnierkie@...sung.com,
	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
	Robert Baldyga <r.baldyga@...sung.com>
Subject: [PATCH v4 18/43] usb: gadget: composite: usb_get_endpoint_address()
 function

Introduce function returning address of given endpoint within the function.
This value can be useful during preparation of class or vendor specific
descriptors in prep_vendor_descs() callback. It can be also necessary
to handle some class or vendor specific setup requests.

Signed-off-by: Robert Baldyga <r.baldyga@...sung.com>
---
 drivers/usb/gadget/composite.c | 20 ++++++++++++++++++++
 include/linux/usb/composite.h  |  2 ++
 2 files changed, 22 insertions(+)

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 7e3721d..417e2f9 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -688,6 +688,26 @@ int usb_get_interface_id(struct usb_function *f, int i)
 }
 EXPORT_SYMBOL_GPL(usb_get_interface_id);
 
+int usb_get_endpoint_address(struct usb_function *f, int i, int a, int e)
+{
+	struct usb_composite_ep *ep;
+
+	if (!f->descs)
+		return -ENODEV;
+	if (f->descs->intfs_num <= i)
+		return -ENODEV;
+	if (f->descs->intfs[i]->altsets_num <= a)
+		return -ENODEV;
+	if (f->descs->intfs[i]->altsets[a]->eps_num <= e)
+		return -ENODEV;
+	ep = f->descs->intfs[i]->altsets[a]->eps[e];
+	if (!ep->ep)
+		return -ENODEV;
+
+	return ep->ep->address;
+}
+EXPORT_SYMBOL_GPL(usb_get_endpoint_address);
+
 /**
  * usb_function_get_ep - obtains endpoint of given index from active
  *	altsetting of given interface
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index b2fb260..b6f1e0cc 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -427,6 +427,8 @@ int usb_ep_add_vendor_desc(struct usb_function *f, int i, int a, int e,
 
 int usb_get_interface_id(struct usb_function *f, int i);
 
+int usb_get_endpoint_address(struct usb_function *f, int i, int a, int e);
+
 struct usb_ep *usb_function_get_ep(struct usb_function *f, int intf, int ep);
 
 int usb_interface_id(struct usb_configuration *, struct usb_function *);
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ