Skip to content

Commit

Permalink
staging: octeon-usb: replace generic transfer callback data with urb
Browse files Browse the repository at this point in the history
URB is always passed, so we can use strong typing here.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Aaro Koskinen authored and Greg Kroah-Hartman committed Oct 7, 2013
1 parent 75ee512 commit 0cce100
Showing 1 changed file with 19 additions and 24 deletions.
43 changes: 19 additions & 24 deletions drivers/staging/octeon-usb/octeon-hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ enum cvmx_usb_stage {
* @iso_packets: For ISO transactions, the sub packets in the request.
* @actual_bytes: Actual bytes transfer for this transaction.
* @stage: For control transactions, the current stage.
* @callback_data: User's data.
* @urb: URB.
*/
struct cvmx_usb_transaction {
struct cvmx_usb_transaction *prev;
Expand All @@ -352,7 +352,7 @@ struct cvmx_usb_transaction {
int retries;
int actual_bytes;
enum cvmx_usb_stage stage;
void *callback_data;
struct urb *urb;
};

/**
Expand Down Expand Up @@ -2144,12 +2144,11 @@ static void octeon_usb_urb_complete_callback(struct cvmx_usb_state *usb,
int pipe_handle,
int submit_handle,
int bytes_transferred,
void *user_data)
struct urb *urb)
{
struct octeon_hcd *priv = cvmx_usb_to_octeon(usb);
struct usb_hcd *hcd = octeon_to_hcd(priv);
struct device *dev = hcd->self.controller;
struct urb *urb = user_data;

urb->actual_length = bytes_transferred;
urb->hcpriv = NULL;
Expand Down Expand Up @@ -2300,7 +2299,7 @@ static void __cvmx_usb_perform_complete(struct cvmx_usb_state *usb,
octeon_usb_urb_complete_callback(usb, complete_code, pipe_handle,
submit_handle,
transaction->actual_bytes,
transaction->callback_data);
transaction->urb);
__cvmx_usb_free_transaction(usb, transaction);
done:
return;
Expand All @@ -2326,7 +2325,7 @@ static void __cvmx_usb_perform_complete(struct cvmx_usb_state *usb,
* For ISO, the number of packet in the transaction.
* @iso_packets:
* A description of each ISO packet
* @user_data: User's data for the callback
* @urb: URB for the callback
*
* Returns: Submit handle or negative on failure. Matches the result
* in the external API.
Expand All @@ -2340,7 +2339,7 @@ static int __cvmx_usb_submit_transaction(struct cvmx_usb_state *usb,
int iso_start_frame,
int iso_number_packets,
struct cvmx_usb_iso_packet *iso_packets,
void *user_data)
struct urb *urb)
{
int submit_handle;
struct cvmx_usb_transaction *transaction;
Expand All @@ -2366,7 +2365,7 @@ static int __cvmx_usb_submit_transaction(struct cvmx_usb_state *usb,
transaction->iso_start_frame = iso_start_frame;
transaction->iso_number_packets = iso_number_packets;
transaction->iso_packets = iso_packets;
transaction->callback_data = user_data;
transaction->urb = urb;
if (transaction->type == CVMX_USB_TRANSFER_CONTROL)
transaction->stage = CVMX_USB_STAGE_SETUP;
else
Expand Down Expand Up @@ -2410,15 +2409,14 @@ static int __cvmx_usb_submit_transaction(struct cvmx_usb_state *usb,
* zero.
* @buffer_length:
* Length of buffer in bytes.
* @user_data: User supplied data returned when the
* callback is called.
* @urb: URB returned when the callback is called.
*
* Returns: A submitted transaction handle or negative on
* failure. Negative values are error codes.
*/
static int cvmx_usb_submit_bulk(struct cvmx_usb_state *usb, int pipe_handle,
uint64_t buffer, int buffer_length,
void *user_data)
struct urb *urb)
{
int submit_handle;

Expand All @@ -2436,7 +2434,7 @@ static int cvmx_usb_submit_bulk(struct cvmx_usb_state *usb, int pipe_handle,
0, /* iso_start_frame */
0, /* iso_number_packets */
NULL, /* iso_packets */
user_data);
urb);
return submit_handle;
}

Expand All @@ -2454,15 +2452,14 @@ static int cvmx_usb_submit_bulk(struct cvmx_usb_state *usb, int pipe_handle,
* zero.
* @buffer_length:
* Length of buffer in bytes.
* @user_data: User supplied data returned when the
* callback is called.
* @urb: URB returned when the callback is called.
*
* Returns: A submitted transaction handle or negative on
* failure. Negative values are error codes.
*/
static int cvmx_usb_submit_interrupt(struct cvmx_usb_state *usb,
int pipe_handle, uint64_t buffer,
int buffer_length, void *user_data)
int buffer_length, struct urb *urb)
{
int submit_handle;

Expand All @@ -2480,7 +2477,7 @@ static int cvmx_usb_submit_interrupt(struct cvmx_usb_state *usb,
0, /* iso_start_frame */
0, /* iso_number_packets */
NULL, /* iso_packets */
user_data);
urb);
return submit_handle;
}

Expand All @@ -2502,16 +2499,15 @@ static int cvmx_usb_submit_interrupt(struct cvmx_usb_state *usb,
* zero.
* @buffer_length:
* Length of buffer in bytes.
* @user_data: User supplied data returned when the
* callback is called.
* @urb: URB returned when the callback is called.
*
* Returns: A submitted transaction handle or negative on
* failure. Negative values are error codes.
*/
static int cvmx_usb_submit_control(struct cvmx_usb_state *usb,
int pipe_handle, uint64_t control_header,
uint64_t buffer, int buffer_length,
void *user_data)
struct urb *urb)
{
int submit_handle;
union cvmx_usb_control_header *header =
Expand All @@ -2536,7 +2532,7 @@ static int cvmx_usb_submit_control(struct cvmx_usb_state *usb,
0, /* iso_start_frame */
0, /* iso_number_packets */
NULL, /* iso_packets */
user_data);
urb);
return submit_handle;
}

Expand Down Expand Up @@ -2565,8 +2561,7 @@ static int cvmx_usb_submit_control(struct cvmx_usb_state *usb,
* zero.
* @buffer_length:
* Length of buffer in bytes.
* @user_data: User supplied data returned when the
* callback is called.
* @urb: URB returned when the callback is called.
*
* Returns: A submitted transaction handle or negative on
* failure. Negative values are error codes.
Expand All @@ -2576,7 +2571,7 @@ static int cvmx_usb_submit_isochronous(struct cvmx_usb_state *usb,
int number_packets, struct
cvmx_usb_iso_packet packets[],
uint64_t buffer, int buffer_length,
void *user_data)
struct urb *urb)
{
int submit_handle;

Expand All @@ -2600,7 +2595,7 @@ static int cvmx_usb_submit_isochronous(struct cvmx_usb_state *usb,
start_frame,
number_packets,
packets,
user_data);
urb);
return submit_handle;
}

Expand Down

0 comments on commit 0cce100

Please sign in to comment.