aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Usyskin <alexander.usyskin@intel.com>2016-05-24 16:03:41 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-08-30 08:35:14 -0400
commitaab3b1a34ae376a80ebb05a217d950df13db5156 (patch)
treea02cab92e752a8958634380c6b456eaa96ce21f2
parent35eda92afa467232ab2a01422b813fa4a14542c5 (diff)
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: Alexander Usyskin <alexander.usyskin@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/misc/mei/client.c32
-rw-r--r--drivers/misc/mei/client.h2
2 files changed, 6 insertions, 28 deletions
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c
index 641c1a566687..6658917be64f 100644
--- a/drivers/misc/mei/client.c
+++ b/drivers/misc/mei/client.c
@@ -420,31 +420,6 @@ static inline void mei_io_list_free(struct mei_cl_cb *list, struct mei_cl *cl)
420} 420}
421 421
422/** 422/**
423 * mei_io_cb_alloc_buf - allocate callback buffer
424 *
425 * @cb: io callback structure
426 * @length: size of the buffer
427 *
428 * Return: 0 on success
429 * -EINVAL if cb is NULL
430 * -ENOMEM if allocation failed
431 */
432int mei_io_cb_alloc_buf(struct mei_cl_cb *cb, size_t length)
433{
434 if (!cb)
435 return -EINVAL;
436
437 if (length == 0)
438 return 0;
439
440 cb->buf.data = kmalloc(length, GFP_KERNEL);
441 if (!cb->buf.data)
442 return -ENOMEM;
443 cb->buf.size = length;
444 return 0;
445}
446
447/**
448 * mei_cl_alloc_cb - a convenient wrapper for allocating read cb 423 * mei_cl_alloc_cb - a convenient wrapper for allocating read cb
449 * 424 *
450 * @cl: host client 425 * @cl: host client
@@ -464,10 +439,15 @@ struct mei_cl_cb *mei_cl_alloc_cb(struct mei_cl *cl, size_t length,
464 if (!cb) 439 if (!cb)
465 return NULL; 440 return NULL;
466 441
467 if (mei_io_cb_alloc_buf(cb, length)) { 442 if (length == 0)
443 return cb;
444
445 cb->buf.data = kmalloc(length, GFP_KERNEL);
446 if (!cb->buf.data) {
468 mei_io_cb_free(cb); 447 mei_io_cb_free(cb);
469 return NULL; 448 return NULL;
470 } 449 }
450 cb->buf.size = length;
471 451
472 return cb; 452 return cb;
473} 453}
diff --git a/drivers/misc/mei/client.h b/drivers/misc/mei/client.h
index 0d7a3a1fef78..16466aa40cbd 100644
--- a/drivers/misc/mei/client.h
+++ b/drivers/misc/mei/client.h
@@ -85,8 +85,6 @@ static inline u8 mei_me_cl_ver(const struct mei_me_client *me_cl)
85struct mei_cl_cb *mei_io_cb_init(struct mei_cl *cl, enum mei_cb_file_ops type, 85struct mei_cl_cb *mei_io_cb_init(struct mei_cl *cl, enum mei_cb_file_ops type,
86 const struct file *fp); 86 const struct file *fp);
87void mei_io_cb_free(struct mei_cl_cb *priv_cb); 87void mei_io_cb_free(struct mei_cl_cb *priv_cb);
88int mei_io_cb_alloc_buf(struct mei_cl_cb *cb, size_t length);
89
90 88
91/** 89/**
92 * mei_io_list_init - Sets up a queue list. 90 * mei_io_list_init - Sets up a queue list.