greybus: es2: remove svc endpoint message handling

We have switched over to use the "new" svc messages, no more need to
have a special USB endpoint to handle them, they come through the normal
CPort messages.

Based on a patch from Viresh.

Tested-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman 2015-07-24 17:09:48 -07:00
parent 972e84a8dc
commit 939799057e

View file

@ -18,7 +18,6 @@
#include "kernel_ver.h"
/* Memory sizes for the buffers sent to/from the ES1 controller */
#define ES1_SVC_MSG_SIZE (sizeof(struct svc_msg) + SZ_64K)
#define ES1_GBUF_MSG_SIZE_MAX 2048
static const struct usb_device_id id_table[] = {
@ -85,10 +84,7 @@ struct es1_cport_out {
* @usb_intf: pointer to the USB interface we are bound to.
* @hd: pointer to our greybus_host_device structure
* @control_endpoint: endpoint to send data to SVC
* @svc_endpoint: endpoint for SVC data in
* @svc_buffer: buffer for SVC messages coming in on @svc_endpoint
* @svc_urb: urb for SVC messages coming in on @svc_endpoint
* @cport_in: endpoint, urbs and buffer for cport in messages
* @cport_out: endpoint for for cport out messages
* @cport_out_urb: array of urbs for the CPort out messages
@ -104,10 +100,6 @@ struct es1_ap_dev {
struct greybus_host_device *hd;
__u8 control_endpoint;
__u8 svc_endpoint;
u8 *svc_buffer;
struct urb *svc_urb;
struct es1_cport_in cport_in[NUM_BULKS];
struct es1_cport_out cport_out[NUM_BULKS];
@ -467,12 +459,6 @@ static void ap_disconnect(struct usb_interface *interface)
}
}
usb_kill_urb(es1->svc_urb);
usb_free_urb(es1->svc_urb);
es1->svc_urb = NULL;
kfree(es1->svc_buffer);
es1->svc_buffer = NULL;
usb_set_intfdata(interface, NULL);
udev = es1->usb_dev;
greybus_remove_hd(es1->hd);
@ -480,33 +466,6 @@ static void ap_disconnect(struct usb_interface *interface)
usb_put_dev(udev);
}
/* Callback for when we get a SVC message */
static void svc_in_callback(struct urb *urb)
{
struct greybus_host_device *hd = urb->context;
struct device *dev = &urb->dev->dev;
int status = check_urb_status(urb);
int retval;
if (status) {
if ((status == -EAGAIN) || (status == -EPROTO))
goto exit;
dev_err(dev, "urb svc in error %d (dropped)\n", status);
return;
}
/* We have a message, create a new message structure, add it to the
* list, and wake up our thread that will process the messages.
*/
greybus_svc_in(hd, urb->transfer_buffer, urb->actual_length);
exit:
/* resubmit the urb to get more messages */
retval = usb_submit_urb(urb, GFP_ATOMIC);
if (retval)
dev_err(dev, "Can not submit urb for AP data: %d\n", retval);
}
static void cport_in_callback(struct urb *urb)
{
struct greybus_host_device *hd = urb->context;
@ -710,12 +669,10 @@ static int ap_probe(struct usb_interface *interface,
struct usb_device *udev;
struct usb_host_interface *iface_desc;
struct usb_endpoint_descriptor *endpoint;
bool int_in_found = false;
int bulk_in = 0;
int bulk_out = 0;
int retval = -ENOMEM;
int i;
u8 svc_interval = 0;
/* We need to fit a CPort ID in one byte of a message header */
BUILD_BUG_ON(CPORT_ID_MAX > U8_MAX);
@ -744,11 +701,7 @@ static int ap_probe(struct usb_interface *interface,
for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
endpoint = &iface_desc->endpoint[i].desc;
if (usb_endpoint_is_int_in(endpoint)) {
es1->svc_endpoint = endpoint->bEndpointAddress;
svc_interval = endpoint->bInterval;
int_in_found = true;
} else if (usb_endpoint_is_bulk_in(endpoint)) {
if (usb_endpoint_is_bulk_in(endpoint)) {
es1->cport_in[bulk_in++].endpoint =
endpoint->bEndpointAddress;
} else if (usb_endpoint_is_bulk_out(endpoint)) {
@ -760,27 +713,12 @@ static int ap_probe(struct usb_interface *interface,
endpoint->bEndpointAddress);
}
}
if ((int_in_found == false) ||
(bulk_in == 0) ||
if ((bulk_in == 0) ||
(bulk_out == 0)) {
dev_err(&udev->dev, "Not enough endpoints found in device, aborting!\n");
goto error;
}
/* Create our buffer and URB to get SVC messages, and start it up */
es1->svc_buffer = kmalloc(ES1_SVC_MSG_SIZE, GFP_KERNEL);
if (!es1->svc_buffer)
goto error;
es1->svc_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!es1->svc_urb)
goto error;
usb_fill_int_urb(es1->svc_urb, udev,
usb_rcvintpipe(udev, es1->svc_endpoint),
es1->svc_buffer, ES1_SVC_MSG_SIZE, svc_in_callback,
hd, svc_interval);
/* Allocate buffers for our cport in messages and start them up */
for (bulk_in = 0; bulk_in < NUM_BULKS; bulk_in++) {
struct es1_cport_in *cport_in = &es1->cport_in[bulk_in];
@ -826,11 +764,6 @@ static int ap_probe(struct usb_interface *interface,
goto error;
}
/* Start up our svc urb, which allows events to start flowing */
retval = usb_submit_urb(es1->svc_urb, GFP_KERNEL);
if (retval)
goto error;
apb1_log_enable_dentry = debugfs_create_file("apb1_log_enable",
(S_IWUSR | S_IRUGO),
gb_debugfs_get(), es1,