summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/es1.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2015-05-19 11:22:43 +0200
committerGreg Kroah-Hartman <gregkh@google.com>2015-05-20 22:51:05 -0700
commitd933667a1e44be0d3fa137ec31686303c42c16fc (patch)
treed2d1b50293a4f4e5d40a4b9ac491f74c93be0f15 /drivers/staging/greybus/es1.c
parentd966820f2c28c621d4912a8277fa43a69242e8d5 (diff)
greybus: fix host-device buffer constraints
Host devices impose buffer-size constraints on Greybus core which are taken into account when allocating messages. Make sure to verify these constraints when the host device is allocated, rather than when the first message is allocated. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/es1.c')
-rw-r--r--drivers/staging/greybus/es1.c21
1 files changed, 1 insertions, 20 deletions
diff --git a/drivers/staging/greybus/es1.c b/drivers/staging/greybus/es1.c
index 4bba5d558e84..e0fae26d8ba3 100644
--- a/drivers/staging/greybus/es1.c
+++ b/drivers/staging/greybus/es1.c
@@ -98,22 +98,6 @@ static void cport_out_callback(struct urb *urb);
static void usb_log_enable(struct es1_ap_dev *es1);
static void usb_log_disable(struct es1_ap_dev *es1);
-/*
- * Buffer constraints for the host driver.
- *
- * A "buffer" is used to hold data to be transferred for Greybus by
- * the host driver. A buffer is represented by a "buffer pointer",
- * which defines a region of memory used by the host driver for
- * transferring the data. When Greybus allocates a buffer, it must
- * do so subject to the constraints associated with the host driver.
- *
- * size_max: The maximum size of a buffer
- */
-static void hd_buffer_constraints(struct greybus_host_device *hd)
-{
- hd->buffer_size_max = ES1_GBUF_MSG_SIZE_MAX;
-}
-
#define ES1_TIMEOUT 500 /* 500 ms for the SVC to do something */
static int submit_svc(struct svc_msg *svc_msg, struct greybus_host_device *hd)
{
@@ -571,15 +555,12 @@ static int ap_probe(struct usb_interface *interface,
udev = usb_get_dev(interface_to_usbdev(interface));
- hd = greybus_create_hd(&es1_driver, &udev->dev);
+ hd = greybus_create_hd(&es1_driver, &udev->dev, ES1_GBUF_MSG_SIZE_MAX);
if (!hd) {
usb_put_dev(udev);
return -ENOMEM;
}
- /* Fill in the buffer allocation constraints */
- hd_buffer_constraints(hd);
-
es1 = hd_to_es1(hd);
es1->hd = hd;
es1->usb_intf = interface;