HID: intel-ish-hid: Move the common functions from client.h
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Mon, 18 Mar 2019 19:14:24 +0000 (12:14 -0700)
committerJiri Kosina <jkosina@suse.cz>
Tue, 19 Mar 2019 10:57:23 +0000 (11:57 +0100)
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: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/intel-ish-hid/ishtp/client.h
drivers/hid/intel-ish-hid/ishtp/ishtp-dev.h
include/linux/intel-ish-client-if.h

index afa8b1f..6ed0094 100644 (file)
 #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_ */
index e54ce1e..e0a320e 100644 (file)
@@ -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
index abc0b81..7ce172f 100644 (file)
@@ -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_ */