Commit 8991eb30 authored by Srinivas Pandruvada's avatar Srinivas Pandruvada Committed by Jiri Kosina

HID: intel-ish-hid: Move the common functions from client.h

Move the interface functions in client.h to common include. These are
already abstracted well to use as is. Also move any associated structures
used by these functions.
Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 9a0bc1a6
......@@ -19,15 +19,6 @@
#include <linux/types.h>
#include "ishtp-dev.h"
/* Client state */
enum cl_state {
ISHTP_CL_INITIALIZING = 0,
ISHTP_CL_CONNECTING,
ISHTP_CL_CONNECTED,
ISHTP_CL_DISCONNECTING,
ISHTP_CL_DISCONNECTED
};
/* Tx and Rx ring size */
#define CL_DEF_RX_RING_SIZE 2
#define CL_DEF_TX_RING_SIZE 2
......@@ -169,19 +160,4 @@ static inline bool ishtp_cl_cmp_id(const struct ishtp_cl *cl1,
(cl1->fw_client_id == cl2->fw_client_id);
}
/* exported functions from ISHTP under client management scope */
struct ishtp_cl *ishtp_cl_allocate(struct ishtp_cl_device *cl_device);
void ishtp_cl_free(struct ishtp_cl *cl);
int ishtp_cl_link(struct ishtp_cl *cl);
void ishtp_cl_unlink(struct ishtp_cl *cl);
int ishtp_cl_disconnect(struct ishtp_cl *cl);
int ishtp_cl_connect(struct ishtp_cl *cl);
int ishtp_cl_send(struct ishtp_cl *cl, uint8_t *buf, size_t length);
int ishtp_cl_flush_queues(struct ishtp_cl *cl);
/* exported functions from ISHTP client buffer management scope */
int ishtp_cl_io_rb_recycle(struct ishtp_cl_rb *rb);
bool ishtp_cl_tx_empty(struct ishtp_cl *cl);
struct ishtp_cl_rb *ishtp_cl_rx_get_rb(struct ishtp_cl *cl);
#endif /* _ISHTP_CLIENT_H_ */
......@@ -79,32 +79,6 @@ struct ishtp_fw_client {
uint8_t client_id;
};
/**
* struct ishtp_msg_data - ISHTP message data struct
* @size: Size of data in the *data
* @data: Pointer to data
*/
struct ishtp_msg_data {
uint32_t size;
unsigned char *data;
};
/*
* struct ishtp_cl_rb - request block structure
* @list: Link to list members
* @cl: ISHTP client instance
* @buffer: message header
* @buf_idx: Index into buffer
* @read_time: unused at this time
*/
struct ishtp_cl_rb {
struct list_head list;
struct ishtp_cl *cl;
struct ishtp_msg_data buffer;
unsigned long buf_idx;
unsigned long read_time;
};
/*
* Control info for IPC messages ISHTP/IPC sending FIFO -
* list with inline data buffer
......
......@@ -9,6 +9,16 @@
#define _INTEL_ISH_CLIENT_IF_H_
struct ishtp_cl_device;
struct ishtp_cl;
/* Client state */
enum cl_state {
ISHTP_CL_INITIALIZING = 0,
ISHTP_CL_CONNECTING,
ISHTP_CL_CONNECTED,
ISHTP_CL_DISCONNECTING,
ISHTP_CL_DISCONNECTED
};
/**
* struct ishtp_cl_device - ISHTP device handle
......@@ -29,6 +39,32 @@ struct ishtp_cl_driver {
const struct dev_pm_ops *pm;
};
/**
* struct ishtp_msg_data - ISHTP message data struct
* @size: Size of data in the *data
* @data: Pointer to data
*/
struct ishtp_msg_data {
uint32_t size;
unsigned char *data;
};
/*
* struct ishtp_cl_rb - request block structure
* @list: Link to list members
* @cl: ISHTP client instance
* @buffer: message header
* @buf_idx: Index into buffer
* @read_time: unused at this time
*/
struct ishtp_cl_rb {
struct list_head list;
struct ishtp_cl *cl;
struct ishtp_msg_data buffer;
unsigned long buf_idx;
unsigned long read_time;
};
int ishtp_cl_driver_register(struct ishtp_cl_driver *driver,
struct module *owner);
void ishtp_cl_driver_unregister(struct ishtp_cl_driver *driver);
......@@ -40,4 +76,16 @@ struct device *ishtp_device(struct ishtp_cl_device *cl_device);
/* Trace interface for clients */
void *ishtp_trace_callback(struct ishtp_cl_device *cl_device);
struct ishtp_cl *ishtp_cl_allocate(struct ishtp_cl_device *cl_device);
void ishtp_cl_free(struct ishtp_cl *cl);
int ishtp_cl_link(struct ishtp_cl *cl);
void ishtp_cl_unlink(struct ishtp_cl *cl);
int ishtp_cl_disconnect(struct ishtp_cl *cl);
int ishtp_cl_connect(struct ishtp_cl *cl);
int ishtp_cl_send(struct ishtp_cl *cl, uint8_t *buf, size_t length);
int ishtp_cl_flush_queues(struct ishtp_cl *cl);
int ishtp_cl_io_rb_recycle(struct ishtp_cl_rb *rb);
bool ishtp_cl_tx_empty(struct ishtp_cl *cl);
struct ishtp_cl_rb *ishtp_cl_rx_get_rb(struct ishtp_cl *cl);
#endif /* _INTEL_ISH_CLIENT_IF_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