diff --git a/drivers/staging/greybus/es1.c b/drivers/staging/greybus/es1.c index bf448353b55e..0df7bddbff69 100644 --- a/drivers/staging/greybus/es1.c +++ b/drivers/staging/greybus/es1.c @@ -106,29 +106,11 @@ static void usb_log_disable(struct es1_ap_dev *es1); * 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. - * These constraints are specified by two parameters: the - * headroom; and the maximum buffer size. * - * +------------------+ - * | Host driver | \ - * | reserved area | }- headroom - * | . . . | / - * buffer pointer ---> +------------------+ - * | Buffer space for | \ - * | transferred data | }- buffer size - * | . . . | / (limited to size_max) - * +------------------+ - * - * headroom: Every buffer must have at least this much space - * *before* the buffer pointer, reserved for use by the - * host driver. I.e., ((char *)buffer - headroom) must - * point to valid memory, usable only by the host driver. - * size_max: The maximum size of a buffer (not including the - * headroom) must not exceed this. + * size_max: The maximum size of a buffer */ static void hd_buffer_constraints(struct greybus_host_device *hd) { - hd->buffer_headroom = 0; hd->buffer_size_max = ES1_GBUF_MSG_SIZE_MAX; } diff --git a/drivers/staging/greybus/es2.c b/drivers/staging/greybus/es2.c index 45b6815dc06b..dfadcb4ad93c 100644 --- a/drivers/staging/greybus/es2.c +++ b/drivers/staging/greybus/es2.c @@ -106,29 +106,11 @@ static void usb_log_disable(struct es1_ap_dev *es1); * 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. - * These constraints are specified by two parameters: the - * headroom; and the maximum buffer size. * - * +------------------+ - * | Host driver | \ - * | reserved area | }- headroom - * | . . . | / - * buffer pointer ---> +------------------+ - * | Buffer space for | \ - * | transferred data | }- buffer size - * | . . . | / (limited to size_max) - * +------------------+ - * - * headroom: Every buffer must have at least this much space - * *before* the buffer pointer, reserved for use by the - * host driver. I.e., ((char *)buffer - headroom) must - * point to valid memory, usable only by the host driver. - * size_max: The maximum size of a buffer (not including the - * headroom) must not exceed this. + * size_max: The maximum size of a buffer */ static void hd_buffer_constraints(struct greybus_host_device *hd) { - hd->buffer_headroom = 0; hd->buffer_size_max = ES1_GBUF_MSG_SIZE_MAX; } diff --git a/drivers/staging/greybus/greybus.h b/drivers/staging/greybus/greybus.h index 6f156e5b08c9..8d4bde3815d6 100644 --- a/drivers/staging/greybus/greybus.h +++ b/drivers/staging/greybus/greybus.h @@ -71,14 +71,6 @@ struct greybus_host_device; struct svc_msg; -/* - * When the Greybus code allocates a buffer it sets aside bytes - * prior to the beginning of the payload area for the host device's - * exclusive use. The size is specified by hd->buffer_headroom, and - * which can't be greater than GB_BUFFER_HEADROOM_MAX. - */ -#define GB_BUFFER_HEADROOM_MAX sizeof(u64) - /* Greybus "Host driver" structure, needed by a host controller driver to be * able to handle both SVC control as well as "real" greybus messages */ @@ -103,7 +95,6 @@ struct greybus_host_device { u8 device_id; /* Host device buffer constraints */ - size_t buffer_headroom; size_t buffer_size_max; /* Private data for the host driver */ diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index 4d9e321b9e1d..3639e27e288a 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -230,7 +230,7 @@ static void gb_operation_message_init(struct greybus_host_device *hd, u8 *buffer; buffer = message->buffer; - header = (struct gb_operation_msg_hdr *)(buffer + hd->buffer_headroom); + header = message->buffer; message->header = header; message->payload = payload_size ? header + 1 : NULL; @@ -271,7 +271,6 @@ static void gb_operation_message_init(struct greybus_host_device *hd, * they'll be filled in by arriving data. * * Our message buffers have the following layout: - * headroom * message header \_ these combined are * message payload / the message size */ @@ -282,7 +281,6 @@ gb_operation_message_alloc(struct greybus_host_device *hd, u8 type, struct gb_message *message; struct gb_operation_msg_hdr *header; size_t message_size = payload_size + sizeof(*header); - size_t size; if (hd->buffer_size_max > GB_OPERATION_MESSAGE_SIZE_MAX) { pr_warn("limiting buffer size to %u\n", @@ -301,8 +299,7 @@ gb_operation_message_alloc(struct greybus_host_device *hd, u8 type, if (!message) return NULL; - size = hd->buffer_headroom + message_size; - message->buffer = kzalloc(size, gfp_flags); + message->buffer = kzalloc(message_size, gfp_flags); if (!message->buffer) goto err_free_message;