Commit 6d658cb2 authored by Aaro Koskinen's avatar Aaro Koskinen Committed by Greg Kroah-Hartman

staging: octeon-usb: cvmx-usb: utilize Linux error codes

Use generic Linux error codes to replace cvmx_usb_status_t.

The conversion table:

	Before				After
	cvmx_usb_status_t		int
	CVMX_USB_SUCCESS		0
	CVMX_USB_INVALID_PARAM		-EINVAL
	CVMX_USB_NO_MEMORY		-ENOMEM
	CVMX_USB_BUSY			-EBUSY
	CVMX_USB_TIMEOUT		-ETIMEDOUT
	CVMX_USB_INCORRECT_MODE		Deleted (was never used)
Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 684f94cc
This diff is collapsed.
...@@ -241,21 +241,6 @@ ...@@ -241,21 +241,6 @@
#ifndef __CVMX_USB_H__ #ifndef __CVMX_USB_H__
#define __CVMX_USB_H__ #define __CVMX_USB_H__
/**
* Enumerations representing the status of function calls.
*/
typedef enum
{
CVMX_USB_SUCCESS = 0, /**< There were no errors */
CVMX_USB_INVALID_PARAM = -1, /**< A parameter to the function was invalid */
CVMX_USB_NO_MEMORY = -2, /**< Insufficient resources were available for the request */
CVMX_USB_BUSY = -3, /**< The resource is busy and cannot service the request */
CVMX_USB_TIMEOUT = -4, /**< Waiting for an action timed out */
CVMX_USB_INCORRECT_MODE = -5, /**< The function call doesn't work in the current USB
mode. This happens when host only functions are
called in device mode or vice versa */
} cvmx_usb_status_t;
/** /**
* Enumerations representing the possible USB device speeds * Enumerations representing the possible USB device speeds
*/ */
...@@ -451,12 +436,10 @@ extern int cvmx_usb_get_num_ports(void); ...@@ -451,12 +436,10 @@ extern int cvmx_usb_get_num_ports(void);
* cvmx_usb_initialize_flags_t for the flag * cvmx_usb_initialize_flags_t for the flag
* definitions. Some flags are mandatory. * definitions. Some flags are mandatory.
* *
* @return CVMX_USB_SUCCESS or a negative error code defined in * @return 0 or a negative error code.
* cvmx_usb_status_t.
*/ */
extern cvmx_usb_status_t cvmx_usb_initialize(cvmx_usb_state_t *state, extern int cvmx_usb_initialize(cvmx_usb_state_t *state, int usb_port_number,
int usb_port_number, cvmx_usb_initialize_flags_t flags);
cvmx_usb_initialize_flags_t flags);
/** /**
* Shutdown a USB port after a call to cvmx_usb_initialize(). * Shutdown a USB port after a call to cvmx_usb_initialize().
...@@ -466,10 +449,9 @@ extern cvmx_usb_status_t cvmx_usb_initialize(cvmx_usb_state_t *state, ...@@ -466,10 +449,9 @@ extern cvmx_usb_status_t cvmx_usb_initialize(cvmx_usb_state_t *state,
* @param state USB device state populated by * @param state USB device state populated by
* cvmx_usb_initialize(). * cvmx_usb_initialize().
* *
* @return CVMX_USB_SUCCESS or a negative error code defined in * @return 0 or a negative error code.
* cvmx_usb_status_t.
*/ */
extern cvmx_usb_status_t cvmx_usb_shutdown(cvmx_usb_state_t *state); extern int cvmx_usb_shutdown(cvmx_usb_state_t *state);
/** /**
* Enable a USB port. After this call succeeds, the USB port is * Enable a USB port. After this call succeeds, the USB port is
...@@ -478,10 +460,9 @@ extern cvmx_usb_status_t cvmx_usb_shutdown(cvmx_usb_state_t *state); ...@@ -478,10 +460,9 @@ extern cvmx_usb_status_t cvmx_usb_shutdown(cvmx_usb_state_t *state);
* @param state USB device state populated by * @param state USB device state populated by
* cvmx_usb_initialize(). * cvmx_usb_initialize().
* *
* @return CVMX_USB_SUCCESS or a negative error code defined in * @return 0 or a negative error code.
* cvmx_usb_status_t.
*/ */
extern cvmx_usb_status_t cvmx_usb_enable(cvmx_usb_state_t *state); extern int cvmx_usb_enable(cvmx_usb_state_t *state);
/** /**
* Disable a USB port. After this call the USB port will not * Disable a USB port. After this call the USB port will not
...@@ -492,10 +473,9 @@ extern cvmx_usb_status_t cvmx_usb_enable(cvmx_usb_state_t *state); ...@@ -492,10 +473,9 @@ extern cvmx_usb_status_t cvmx_usb_enable(cvmx_usb_state_t *state);
* @param state USB device state populated by * @param state USB device state populated by
* cvmx_usb_initialize(). * cvmx_usb_initialize().
* *
* @return CVMX_USB_SUCCESS or a negative error code defined in * @return 0 or a negative error code.
* cvmx_usb_status_t.
*/ */
extern cvmx_usb_status_t cvmx_usb_disable(cvmx_usb_state_t *state); extern int cvmx_usb_disable(cvmx_usb_state_t *state);
/** /**
* Get the current state of the USB port. Use this call to * Get the current state of the USB port. Use this call to
...@@ -581,7 +561,7 @@ extern void cvmx_usb_set_status(cvmx_usb_state_t *state, cvmx_usb_port_status_t ...@@ -581,7 +561,7 @@ extern void cvmx_usb_set_status(cvmx_usb_state_t *state, cvmx_usb_port_status_t
* devices behind a high speed hub. * devices behind a high speed hub.
* *
* @return A non negative value is a pipe handle. Negative * @return A non negative value is a pipe handle. Negative
* values are failure codes from cvmx_usb_status_t. * values are error codes.
*/ */
extern int cvmx_usb_open_pipe(cvmx_usb_state_t *state, extern int cvmx_usb_open_pipe(cvmx_usb_state_t *state,
cvmx_usb_pipe_flags_t flags, cvmx_usb_pipe_flags_t flags,
...@@ -620,8 +600,7 @@ extern int cvmx_usb_open_pipe(cvmx_usb_state_t *state, ...@@ -620,8 +600,7 @@ extern int cvmx_usb_open_pipe(cvmx_usb_state_t *state,
* callback in not NULL. * callback in not NULL.
* *
* @return A submitted transaction handle or negative on * @return A submitted transaction handle or negative on
* failure. Negative values are failure codes from * failure. Negative values are error codes.
* cvmx_usb_status_t.
*/ */
extern int cvmx_usb_submit_bulk(cvmx_usb_state_t *state, int pipe_handle, extern int cvmx_usb_submit_bulk(cvmx_usb_state_t *state, int pipe_handle,
uint64_t buffer, int buffer_length, uint64_t buffer, int buffer_length,
...@@ -656,8 +635,7 @@ extern int cvmx_usb_submit_bulk(cvmx_usb_state_t *state, int pipe_handle, ...@@ -656,8 +635,7 @@ extern int cvmx_usb_submit_bulk(cvmx_usb_state_t *state, int pipe_handle,
* callback in not NULL. * callback in not NULL.
* *
* @return A submitted transaction handle or negative on * @return A submitted transaction handle or negative on
* failure. Negative values are failure codes from * failure. Negative values are error codes.
* cvmx_usb_status_t.
*/ */
extern int cvmx_usb_submit_interrupt(cvmx_usb_state_t *state, int pipe_handle, extern int cvmx_usb_submit_interrupt(cvmx_usb_state_t *state, int pipe_handle,
uint64_t buffer, int buffer_length, uint64_t buffer, int buffer_length,
...@@ -696,8 +674,7 @@ extern int cvmx_usb_submit_interrupt(cvmx_usb_state_t *state, int pipe_handle, ...@@ -696,8 +674,7 @@ extern int cvmx_usb_submit_interrupt(cvmx_usb_state_t *state, int pipe_handle,
* callback in not NULL. * callback in not NULL.
* *
* @return A submitted transaction handle or negative on * @return A submitted transaction handle or negative on
* failure. Negative values are failure codes from * failure. Negative values are error codes.
* cvmx_usb_status_t.
*/ */
extern int cvmx_usb_submit_control(cvmx_usb_state_t *state, int pipe_handle, extern int cvmx_usb_submit_control(cvmx_usb_state_t *state, int pipe_handle,
uint64_t control_header, uint64_t control_header,
...@@ -756,8 +733,7 @@ typedef enum ...@@ -756,8 +733,7 @@ typedef enum
* callback in not NULL. * callback in not NULL.
* *
* @return A submitted transaction handle or negative on * @return A submitted transaction handle or negative on
* failure. Negative values are failure codes from * failure. Negative values are error codes.
* cvmx_usb_status_t.
*/ */
extern int cvmx_usb_submit_isochronous(cvmx_usb_state_t *state, int pipe_handle, extern int cvmx_usb_submit_isochronous(cvmx_usb_state_t *state, int pipe_handle,
int start_frame, int flags, int start_frame, int flags,
...@@ -781,11 +757,10 @@ extern int cvmx_usb_submit_isochronous(cvmx_usb_state_t *state, int pipe_handle, ...@@ -781,11 +757,10 @@ extern int cvmx_usb_submit_isochronous(cvmx_usb_state_t *state, int pipe_handle,
* @param submit_handle * @param submit_handle
* Handle to transaction to cancel, returned by the submit function. * Handle to transaction to cancel, returned by the submit function.
* *
* @return CVMX_USB_SUCCESS or a negative error code defined in * @return 0 or a negative error code.
* cvmx_usb_status_t.
*/ */
extern cvmx_usb_status_t cvmx_usb_cancel(cvmx_usb_state_t *state, extern int cvmx_usb_cancel(cvmx_usb_state_t *state, int pipe_handle,
int pipe_handle, int submit_handle); int submit_handle);
/** /**
...@@ -797,11 +772,9 @@ extern cvmx_usb_status_t cvmx_usb_cancel(cvmx_usb_state_t *state, ...@@ -797,11 +772,9 @@ extern cvmx_usb_status_t cvmx_usb_cancel(cvmx_usb_state_t *state,
* @param pipe_handle * @param pipe_handle
* Pipe handle to cancel requests in. * Pipe handle to cancel requests in.
* *
* @return CVMX_USB_SUCCESS or a negative error code defined in * @return 0 or a negative error code.
* cvmx_usb_status_t.
*/ */
extern cvmx_usb_status_t cvmx_usb_cancel_all(cvmx_usb_state_t *state, extern int cvmx_usb_cancel_all(cvmx_usb_state_t *state, int pipe_handle);
int pipe_handle);
/** /**
* Close a pipe created with cvmx_usb_open_pipe(). * Close a pipe created with cvmx_usb_open_pipe().
...@@ -811,12 +784,10 @@ extern cvmx_usb_status_t cvmx_usb_cancel_all(cvmx_usb_state_t *state, ...@@ -811,12 +784,10 @@ extern cvmx_usb_status_t cvmx_usb_cancel_all(cvmx_usb_state_t *state,
* @param pipe_handle * @param pipe_handle
* Pipe handle to close. * Pipe handle to close.
* *
* @return CVMX_USB_SUCCESS or a negative error code defined in * @return 0 or a negative error code. EBUSY is returned if the pipe has
* cvmx_usb_status_t. CVMX_USB_BUSY is returned if the * outstanding transfers.
* pipe has outstanding transfers.
*/ */
extern cvmx_usb_status_t cvmx_usb_close_pipe(cvmx_usb_state_t *state, extern int cvmx_usb_close_pipe(cvmx_usb_state_t *state, int pipe_handle);
int pipe_handle);
/** /**
* Register a function to be called when various USB events occur. * Register a function to be called when various USB events occur.
...@@ -827,13 +798,12 @@ extern cvmx_usb_status_t cvmx_usb_close_pipe(cvmx_usb_state_t *state, ...@@ -827,13 +798,12 @@ extern cvmx_usb_status_t cvmx_usb_close_pipe(cvmx_usb_state_t *state,
* @param callback Function to call when the event occurs. * @param callback Function to call when the event occurs.
* @param user_data User data parameter to the function. * @param user_data User data parameter to the function.
* *
* @return CVMX_USB_SUCCESS or a negative error code defined in * @return 0 or a negative error code.
* cvmx_usb_status_t.
*/ */
extern cvmx_usb_status_t cvmx_usb_register_callback(cvmx_usb_state_t *state, extern int cvmx_usb_register_callback(cvmx_usb_state_t *state,
cvmx_usb_callback_t reason, cvmx_usb_callback_t reason,
cvmx_usb_callback_func_t callback, cvmx_usb_callback_func_t callback,
void *user_data); void *user_data);
/** /**
* Get the current USB protocol level frame number. The frame * Get the current USB protocol level frame number. The frame
...@@ -855,9 +825,8 @@ extern int cvmx_usb_get_frame_number(cvmx_usb_state_t *state); ...@@ -855,9 +825,8 @@ extern int cvmx_usb_get_frame_number(cvmx_usb_state_t *state);
* @param state USB device state populated by * @param state USB device state populated by
* cvmx_usb_initialize(). * cvmx_usb_initialize().
* *
* @return CVMX_USB_SUCCESS or a negative error code defined in * @return 0 or a negative error code.
* cvmx_usb_status_t.
*/ */
extern cvmx_usb_status_t cvmx_usb_poll(cvmx_usb_state_t *state); extern int cvmx_usb_poll(cvmx_usb_state_t *state);
#endif /* __CVMX_USB_H__ */ #endif /* __CVMX_USB_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment