mei: consolidate repeating code in mei_cl_irq_read_msg
Subsystems (2)
PATCH 1/3 mei: consolidate repeating code in mei_cl_irq_read_msg
A cb is always placed on the completion queue during discarding queue. Hence this can be performed upon discard.
Signed-off-by Tomas Winkler <[email protected]>
--- drivers/misc/mei/interrupt.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/misc/mei/interrupt.c +2 -5
@@ -118,7 +118,6 @@ int mei_cl_irq_read_msg(struct mei_cl *cl,if (!mei_cl_is_connected (cl)) {cl_dbg (dev, cl,"not connected\n" ); -list_move_tail (&cb->list, &complete_list->list); cb->status = -ENODEV ; goto discard; }
@@ -128,8 +127,6 @@ int mei_cl_irq_read_msg(struct mei_cl *cl,if (buf_sz < cb->buf_idx) {cl_err (dev, cl,"message is too big len %d idx %zu\n" , mei_hdr->length, cb->buf_idx); - -list_move_tail (&cb->list, &complete_list->list); cb->status = -EMSGSIZE ; goto discard; }
@@ -137,8 +134,6 @@ int mei_cl_irq_read_msg(struct mei_cl *cl,if (cb->buf.size < buf_sz) {cl_dbg (dev, cl,"message overflow. size %zu len %d idx %zu\n" , cb->buf.size, mei_hdr->length, cb->buf_idx); - -list_move_tail (&cb->list, &complete_list->list); cb->status = -EMSGSIZE ; goto discard; }
@@ -158,6 +153,8 @@ int mei_cl_irq_read_msg(struct mei_cl *cl,return 0 ; discard: +if (cb) +list_move_tail (&cb->list, &complete_list->list);mei_irq_discard_msg (dev, mei_hdr);return 0 ; }
Signature · 1 line
2.7.4
PATCH 2/3 mei: constify buffer in the write functions calls
The write buffer should not by modified so make it constant. Also hitchhike some style fixes on the way in the interface and rename mei_me_write_message to mei_me_hbuf_write for consistency.
Signed-off-by Tomas Winkler <[email protected]>
--- drivers/misc/mei/hw-me.c | 10 +++++----- drivers/misc/mei/hw-txe.c | 3 ++- drivers/misc/mei/mei_dev.h | 5 ++--- 3 files changed, 9 insertions(+), 9 deletions(-)
drivers/misc/mei/hw-me.c +5 -5
@@ -450,7 +450,7 @@ static size_t mei_me_hbuf_max_len(const struct mei_device *dev)/** -* mei_me_write_message - writes a message to mei device. +* mei_me_hbuf_write - writes a message to host hw buffer. * * @dev: the device structure * @header: mei HECI header of message
@@ -458,9 +458,9 @@ static size_t mei_me_hbuf_max_len(const struct mei_device *dev)* * Return: -EIO if write has failed */ -static int mei_me_write_message (struct mei_device *dev, -struct mei_msg_hdr *header, -unsigned char *buf) +static int mei_me_hbuf_write (struct mei_device *dev, +struct mei_msg_hdr *header, +const unsigned char *buf) {unsigned long rem;unsigned long length = header->length;
@@ -1243,7 +1243,7 @@ static const struct mei_hw_ops mei_me_hw_ops = { .hbuf_is_ready = mei_me_hbuf_is_empty, .hbuf_max_len = mei_me_hbuf_max_len, - .write = mei_me_write_message, + .write = mei_me_hbuf_write, .rdbuf_full_slots = mei_me_count_full_read_slots, .read_hdr = mei_me_mecbrw_read,
drivers/misc/mei/hw-txe.c +2 -1
@@ -691,7 +691,8 @@ static void mei_txe_hw_config(struct mei_device *dev)*/ static int mei_txe_write (struct mei_device *dev, -struct mei_msg_hdr *header,unsigned char *buf) +struct mei_msg_hdr *header, +const unsigned char *buf) {struct mei_txe_hw *hw =to_txe_hw (dev);unsigned long rem;
drivers/misc/mei/mei_dev.h +2 -3
@@ -300,10 +300,9 @@ struct mei_hw_ops {int (*hbuf_free_slots)(struct mei_device *dev);bool (*hbuf_is_ready)(struct mei_device *dev);size_t (*hbuf_max_len)(const struct mei_device *dev); -int (*write)(struct mei_device *dev,struct mei_msg_hdr *hdr, -unsigned char *buf); +const unsigned char *buf);int (*rdbuf_full_slots)(struct mei_device *dev);
@@ -665,7 +664,7 @@ static inline size_t mei_hbuf_max_len(const struct mei_device *dev) }static inline int mei_write_message (struct mei_device *dev, -struct mei_msg_hdr *hdr,void *buf) +struct mei_msg_hdr *hdr,const void *buf) {return dev->ops->write (dev, hdr, buf); }
Signature · 1 line
2.7.4
PATCH 3/3 mei: fix parameter rename KDoc
In reply to Tomas WinklerFrom: Alexander Usyskin <[email protected]>
Parameter renaming to fop_type was not reflected in KDoc
Fixes 3030dc0564594 (mei: add wrapper for queuing control commands)
Signed-off-by Alexander Usyskin <[email protected]>
Signed-off-by Tomas Winkler <[email protected]>
--- drivers/misc/mei/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/mei/client.c +2 -2
@@ -425,7 +425,7 @@ static inline void mei_io_list_free(struct mei_cl_cb *list, struct mei_cl *cl)* * @cl: host client * @length: size of the buffer -* @type: operation type +* @fop_type: operation type * @fp: associated file pointer (might be NULL) * * Return: cb on success and NULL on failure
@@ -459,7 +459,7 @@ struct mei_cl_cb *mei_cl_alloc_cb(struct mei_cl *cl, size_t length,* * @cl: host client * @length: size of the buffer -* @type: operation type +* @fop_type: operation type * @fp: associated file pointer (might be NULL) * * Return: cb on success and NULL on failure
Signature · 1 line
2.7.4