Commit aab3b1a3 authored by Alexander Usyskin's avatar Alexander Usyskin Committed by Greg Kroah-Hartman

mei: drop mei_io_cb_alloc_buf

mei_io_cb_alloc_buf have a single caller :mei_cl_alloc_cb. After amthif
stopped using it, the code can be integrated into the caller and the
function can be dropped.
Signed-off-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 35eda92a
...@@ -419,31 +419,6 @@ static inline void mei_io_list_free(struct mei_cl_cb *list, struct mei_cl *cl) ...@@ -419,31 +419,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_list_flush(list, cl, true);
} }
/**
* mei_io_cb_alloc_buf - allocate callback buffer
*
* @cb: io callback structure
* @length: size of the buffer
*
* Return: 0 on success
* -EINVAL if cb is NULL
* -ENOMEM if allocation failed
*/
int mei_io_cb_alloc_buf(struct mei_cl_cb *cb, size_t length)
{
if (!cb)
return -EINVAL;
if (length == 0)
return 0;
cb->buf.data = kmalloc(length, GFP_KERNEL);
if (!cb->buf.data)
return -ENOMEM;
cb->buf.size = length;
return 0;
}
/** /**
* mei_cl_alloc_cb - a convenient wrapper for allocating read cb * mei_cl_alloc_cb - a convenient wrapper for allocating read cb
* *
...@@ -464,10 +439,15 @@ struct mei_cl_cb *mei_cl_alloc_cb(struct mei_cl *cl, size_t length, ...@@ -464,10 +439,15 @@ struct mei_cl_cb *mei_cl_alloc_cb(struct mei_cl *cl, size_t length,
if (!cb) if (!cb)
return NULL; return NULL;
if (mei_io_cb_alloc_buf(cb, length)) { if (length == 0)
return cb;
cb->buf.data = kmalloc(length, GFP_KERNEL);
if (!cb->buf.data) {
mei_io_cb_free(cb); mei_io_cb_free(cb);
return NULL; return NULL;
} }
cb->buf.size = length;
return cb; return cb;
} }
......
...@@ -85,8 +85,6 @@ static inline u8 mei_me_cl_ver(const struct mei_me_client *me_cl) ...@@ -85,8 +85,6 @@ static inline u8 mei_me_cl_ver(const struct mei_me_client *me_cl)
struct mei_cl_cb *mei_io_cb_init(struct mei_cl *cl, enum mei_cb_file_ops type, struct mei_cl_cb *mei_io_cb_init(struct mei_cl *cl, enum mei_cb_file_ops type,
const struct file *fp); const struct file *fp);
void mei_io_cb_free(struct mei_cl_cb *priv_cb); void mei_io_cb_free(struct mei_cl_cb *priv_cb);
int mei_io_cb_alloc_buf(struct mei_cl_cb *cb, size_t length);
/** /**
* mei_io_list_init - Sets up a queue list. * mei_io_list_init - Sets up a queue list.
......
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