/* vendor request APB1 log */
#define REQUEST_LOG 0x02
+/*
+ * @endpoint: bulk in endpoint for CPort data
+ * @urb: array of urbs for the CPort in messages
+ * @buffer: array of buffers for the @cport_in_urb urbs
+ */
+struct es1_cport_in {
+ __u8 endpoint;
+ struct urb *urb[NUM_CPORT_IN_URB];
+ u8 *buffer[NUM_CPORT_IN_URB];
+};
+
+/*
+ * @endpoint: bulk out endpoint for CPort data
+ */
+struct es1_cport_out {
+ __u8 endpoint;
+};
+
/**
* es1_ap_dev - ES1 USB Bridge to AP structure
* @usb_dev: pointer to the USB device we are.
* @hd: pointer to our greybus_host_device structure
* @control_endpoint: endpoint to send data to SVC
* @svc_endpoint: endpoint for SVC data in
- * @cport_in_endpoint: bulk in endpoint for CPort data
- * @cport-out_endpoint: bulk out endpoint for CPort data
+
* @svc_buffer: buffer for SVC messages coming in on @svc_endpoint
* @svc_urb: urb for SVC messages coming in on @svc_endpoint
- * @cport_in_urb: array of urbs for the CPort in messages
- * @cport_in_buffer: array of buffers for the @cport_in_urb urbs
+ * @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
* @cport_out_urb_busy: array of flags to see if the @cport_out_urb is busy or
* not.
__u8 control_endpoint;
__u8 svc_endpoint;
- __u8 cport_in_endpoint;
- __u8 cport_out_endpoint;
u8 *svc_buffer;
struct urb *svc_urb;
- struct urb *cport_in_urb[NUM_CPORT_IN_URB];
- u8 *cport_in_buffer[NUM_CPORT_IN_URB];
+ struct es1_cport_in cport_in;
+ struct es1_cport_out cport_out;
struct urb *cport_out_urb[NUM_CPORT_OUT_URB];
bool cport_out_urb_busy[NUM_CPORT_OUT_URB];
spinlock_t cport_out_urb_lock;
put_unaligned_le16(cport_id, message->header->pad);
usb_fill_bulk_urb(urb, udev,
- usb_sndbulkpipe(udev, es1->cport_out_endpoint),
+ usb_sndbulkpipe(udev, es1->cport_out.endpoint),
buffer, buffer_size,
cport_out_callback, message);
retval = usb_submit_urb(urb, gfp_mask);
}
for (i = 0; i < NUM_CPORT_IN_URB; ++i) {
- struct urb *urb = es1->cport_in_urb[i];
+ struct urb *urb = es1->cport_in.urb[i];
if (!urb)
break;
usb_kill_urb(urb);
usb_free_urb(urb);
- kfree(es1->cport_in_buffer[i]);
- es1->cport_in_buffer[i] = NULL;
+ kfree(es1->cport_in.buffer[i]);
+ es1->cport_in.buffer[i] = NULL;
}
usb_kill_urb(es1->svc_urb);
svc_interval = endpoint->bInterval;
int_in_found = true;
} else if (usb_endpoint_is_bulk_in(endpoint)) {
- es1->cport_in_endpoint = endpoint->bEndpointAddress;
+ es1->cport_in.endpoint = endpoint->bEndpointAddress;
bulk_in_found = true;
} else if (usb_endpoint_is_bulk_out(endpoint)) {
- es1->cport_out_endpoint = endpoint->bEndpointAddress;
+ es1->cport_out.endpoint = endpoint->bEndpointAddress;
bulk_out_found = true;
} else {
dev_err(&udev->dev,
goto error;
usb_fill_bulk_urb(urb, udev,
- usb_rcvbulkpipe(udev, es1->cport_in_endpoint),
+ usb_rcvbulkpipe(udev, es1->cport_in.endpoint),
buffer, ES1_GBUF_MSG_SIZE_MAX,
cport_in_callback, hd);
- es1->cport_in_urb[i] = urb;
- es1->cport_in_buffer[i] = buffer;
+ es1->cport_in.urb[i] = urb;
+ es1->cport_in.buffer[i] = buffer;
retval = usb_submit_urb(urb, GFP_KERNEL);
if (retval)
goto error;