|
@@ -320,6 +320,47 @@ static inline bool mei_cl_cmp_id(const struct mei_cl *cl1,
|
|
|
(cl1->me_client_id == cl2->me_client_id);
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * mei_io_cb_free - free mei_cb_private related memory
|
|
|
+ *
|
|
|
+ * @cb: mei callback struct
|
|
|
+ */
|
|
|
+void mei_io_cb_free(struct mei_cl_cb *cb)
|
|
|
+{
|
|
|
+ if (cb == NULL)
|
|
|
+ return;
|
|
|
+
|
|
|
+ list_del(&cb->list);
|
|
|
+ kfree(cb->buf.data);
|
|
|
+ kfree(cb);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * mei_io_cb_init - allocate and initialize io callback
|
|
|
+ *
|
|
|
+ * @cl: mei client
|
|
|
+ * @type: operation type
|
|
|
+ * @fp: pointer to file structure
|
|
|
+ *
|
|
|
+ * Return: mei_cl_cb pointer or NULL;
|
|
|
+ */
|
|
|
+struct mei_cl_cb *mei_io_cb_init(struct mei_cl *cl, enum mei_cb_file_ops type,
|
|
|
+ struct file *fp)
|
|
|
+{
|
|
|
+ struct mei_cl_cb *cb;
|
|
|
+
|
|
|
+ cb = kzalloc(sizeof(struct mei_cl_cb), GFP_KERNEL);
|
|
|
+ if (!cb)
|
|
|
+ return NULL;
|
|
|
+
|
|
|
+ INIT_LIST_HEAD(&cb->list);
|
|
|
+ cb->file_object = fp;
|
|
|
+ cb->cl = cl;
|
|
|
+ cb->buf_idx = 0;
|
|
|
+ cb->fop_type = type;
|
|
|
+ return cb;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* __mei_io_list_flush - removes and frees cbs belonging to cl.
|
|
|
*
|
|
@@ -330,13 +371,12 @@ static inline bool mei_cl_cmp_id(const struct mei_cl *cl1,
|
|
|
static void __mei_io_list_flush(struct mei_cl_cb *list,
|
|
|
struct mei_cl *cl, bool free)
|
|
|
{
|
|
|
- struct mei_cl_cb *cb;
|
|
|
- struct mei_cl_cb *next;
|
|
|
+ struct mei_cl_cb *cb, *next;
|
|
|
|
|
|
/* enable removing everything if no cl is specified */
|
|
|
list_for_each_entry_safe(cb, next, &list->list, list) {
|
|
|
if (!cl || mei_cl_cmp_id(cl, cb->cl)) {
|
|
|
- list_del(&cb->list);
|
|
|
+ list_del_init(&cb->list);
|
|
|
if (free)
|
|
|
mei_io_cb_free(cb);
|
|
|
}
|
|
@@ -354,7 +394,6 @@ void mei_io_list_flush(struct mei_cl_cb *list, struct mei_cl *cl)
|
|
|
__mei_io_list_flush(list, cl, false);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* mei_io_list_free - removes cb belonging to cl and free them
|
|
|
*
|
|
@@ -366,47 +405,6 @@ static inline void mei_io_list_free(struct mei_cl_cb *list, struct mei_cl *cl)
|
|
|
__mei_io_list_flush(list, cl, true);
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * mei_io_cb_free - free mei_cb_private related memory
|
|
|
- *
|
|
|
- * @cb: mei callback struct
|
|
|
- */
|
|
|
-void mei_io_cb_free(struct mei_cl_cb *cb)
|
|
|
-{
|
|
|
- if (cb == NULL)
|
|
|
- return;
|
|
|
-
|
|
|
- kfree(cb->buf.data);
|
|
|
- kfree(cb);
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * mei_io_cb_init - allocate and initialize io callback
|
|
|
- *
|
|
|
- * @cl: mei client
|
|
|
- * @type: operation type
|
|
|
- * @fp: pointer to file structure
|
|
|
- *
|
|
|
- * Return: mei_cl_cb pointer or NULL;
|
|
|
- */
|
|
|
-struct mei_cl_cb *mei_io_cb_init(struct mei_cl *cl, enum mei_cb_file_ops type,
|
|
|
- struct file *fp)
|
|
|
-{
|
|
|
- struct mei_cl_cb *cb;
|
|
|
-
|
|
|
- cb = kzalloc(sizeof(struct mei_cl_cb), GFP_KERNEL);
|
|
|
- if (!cb)
|
|
|
- return NULL;
|
|
|
-
|
|
|
- mei_io_list_init(cb);
|
|
|
-
|
|
|
- cb->file_object = fp;
|
|
|
- cb->cl = cl;
|
|
|
- cb->buf_idx = 0;
|
|
|
- cb->fop_type = type;
|
|
|
- return cb;
|
|
|
-}
|
|
|
-
|
|
|
/**
|
|
|
* mei_io_cb_alloc_buf - allocate callback buffer
|
|
|
*
|