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

mei: replace callback structures used as list head by list_head

mei_dev structure used struct mei_cl_cb type variables as for holding
callbacks list heads.  Replace them by the actual struct list_head
as there is no other info that is handled. This slims down
the mei_dev structure and mostly streamline the code.
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 9ecdbc58
...@@ -132,8 +132,7 @@ int mei_amthif_run_next_cmd(struct mei_device *dev) ...@@ -132,8 +132,7 @@ int mei_amthif_run_next_cmd(struct mei_device *dev)
dev_dbg(dev->dev, "complete amthif cmd_list cb.\n"); dev_dbg(dev->dev, "complete amthif cmd_list cb.\n");
cb = list_first_entry_or_null(&dev->amthif_cmd_list.list, cb = list_first_entry_or_null(&dev->amthif_cmd_list, typeof(*cb), list);
typeof(*cb), list);
if (!cb) { if (!cb) {
dev->iamthif_state = MEI_IAMTHIF_IDLE; dev->iamthif_state = MEI_IAMTHIF_IDLE;
cl->fp = NULL; cl->fp = NULL;
...@@ -167,7 +166,7 @@ int mei_amthif_write(struct mei_cl *cl, struct mei_cl_cb *cb) ...@@ -167,7 +166,7 @@ int mei_amthif_write(struct mei_cl *cl, struct mei_cl_cb *cb)
struct mei_device *dev = cl->dev; struct mei_device *dev = cl->dev;
list_add_tail(&cb->list, &dev->amthif_cmd_list.list); list_add_tail(&cb->list, &dev->amthif_cmd_list);
/* /*
* The previous request is still in processing, queue this one. * The previous request is still in processing, queue this one.
...@@ -211,7 +210,7 @@ unsigned int mei_amthif_poll(struct file *file, poll_table *wait) ...@@ -211,7 +210,7 @@ unsigned int mei_amthif_poll(struct file *file, poll_table *wait)
* Return: 0, OK; otherwise, error. * Return: 0, OK; otherwise, error.
*/ */
int mei_amthif_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb, int mei_amthif_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
struct mei_cl_cb *cmpl_list) struct list_head *cmpl_list)
{ {
int ret; int ret;
...@@ -237,7 +236,7 @@ int mei_amthif_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb, ...@@ -237,7 +236,7 @@ int mei_amthif_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
*/ */
int mei_amthif_irq_read_msg(struct mei_cl *cl, int mei_amthif_irq_read_msg(struct mei_cl *cl,
struct mei_msg_hdr *mei_hdr, struct mei_msg_hdr *mei_hdr,
struct mei_cl_cb *cmpl_list) struct list_head *cmpl_list)
{ {
struct mei_device *dev; struct mei_device *dev;
int ret; int ret;
...@@ -354,7 +353,7 @@ int mei_amthif_release(struct mei_device *dev, struct file *file) ...@@ -354,7 +353,7 @@ int mei_amthif_release(struct mei_device *dev, struct file *file)
} }
/* Don't clean ctrl_rd_list here, the reads has to be completed */ /* Don't clean ctrl_rd_list here, the reads has to be completed */
mei_clear_list(file, &dev->amthif_cmd_list.list); mei_clear_list(file, &dev->amthif_cmd_list);
mei_clear_list(file, &cl->rd_completed); mei_clear_list(file, &cl->rd_completed);
return 0; return 0;
......
...@@ -379,17 +379,17 @@ static struct mei_cl_cb *mei_io_cb_init(struct mei_cl *cl, ...@@ -379,17 +379,17 @@ static struct mei_cl_cb *mei_io_cb_init(struct mei_cl *cl,
/** /**
* __mei_io_list_flush - removes and frees cbs belonging to cl. * __mei_io_list_flush - removes and frees cbs belonging to cl.
* *
* @list: an instance of our list structure * @head: an instance of our list structure
* @cl: host client, can be NULL for flushing the whole list * @cl: host client, can be NULL for flushing the whole list
* @free: whether to free the cbs * @free: whether to free the cbs
*/ */
static void __mei_io_list_flush(struct mei_cl_cb *list, static void __mei_io_list_flush(struct list_head *head,
struct mei_cl *cl, bool free) struct mei_cl *cl, bool free)
{ {
struct mei_cl_cb *cb, *next; struct mei_cl_cb *cb, *next;
/* enable removing everything if no cl is specified */ /* enable removing everything if no cl is specified */
list_for_each_entry_safe(cb, next, &list->list, list) { list_for_each_entry_safe(cb, next, head, list) {
if (!cl || mei_cl_cmp_id(cl, cb->cl)) { if (!cl || mei_cl_cmp_id(cl, cb->cl)) {
list_del_init(&cb->list); list_del_init(&cb->list);
if (free) if (free)
...@@ -401,23 +401,23 @@ static void __mei_io_list_flush(struct mei_cl_cb *list, ...@@ -401,23 +401,23 @@ static void __mei_io_list_flush(struct mei_cl_cb *list,
/** /**
* mei_io_list_flush - removes list entry belonging to cl. * mei_io_list_flush - removes list entry belonging to cl.
* *
* @list: An instance of our list structure * @head: An instance of our list structure
* @cl: host client * @cl: host client
*/ */
static inline void mei_io_list_flush(struct mei_cl_cb *list, struct mei_cl *cl) static inline void mei_io_list_flush(struct list_head *head, struct mei_cl *cl)
{ {
__mei_io_list_flush(list, cl, false); __mei_io_list_flush(head, cl, false);
} }
/** /**
* mei_io_list_free - removes cb belonging to cl and free them * mei_io_list_free - removes cb belonging to cl and free them
* *
* @list: An instance of our list structure * @head: An instance of our list structure
* @cl: host client * @cl: host client
*/ */
static inline void mei_io_list_free(struct mei_cl_cb *list, struct mei_cl *cl) static inline void mei_io_list_free(struct list_head *head, struct mei_cl *cl)
{ {
__mei_io_list_flush(list, cl, true); __mei_io_list_flush(head, cl, true);
} }
/** /**
...@@ -479,7 +479,7 @@ struct mei_cl_cb *mei_cl_enqueue_ctrl_wr_cb(struct mei_cl *cl, size_t length, ...@@ -479,7 +479,7 @@ struct mei_cl_cb *mei_cl_enqueue_ctrl_wr_cb(struct mei_cl *cl, size_t length,
if (!cb) if (!cb)
return NULL; return NULL;
list_add_tail(&cb->list, &cl->dev->ctrl_wr_list.list); list_add_tail(&cb->list, &cl->dev->ctrl_wr_list);
return cb; return cb;
} }
...@@ -831,7 +831,7 @@ static int mei_cl_send_disconnect(struct mei_cl *cl, struct mei_cl_cb *cb) ...@@ -831,7 +831,7 @@ static int mei_cl_send_disconnect(struct mei_cl *cl, struct mei_cl_cb *cb)
return ret; return ret;
} }
list_move_tail(&cb->list, &dev->ctrl_rd_list.list); list_move_tail(&cb->list, &dev->ctrl_rd_list);
cl->timer_count = MEI_CONNECT_TIMEOUT; cl->timer_count = MEI_CONNECT_TIMEOUT;
mei_schedule_stall_timer(dev); mei_schedule_stall_timer(dev);
...@@ -849,7 +849,7 @@ static int mei_cl_send_disconnect(struct mei_cl *cl, struct mei_cl_cb *cb) ...@@ -849,7 +849,7 @@ static int mei_cl_send_disconnect(struct mei_cl *cl, struct mei_cl_cb *cb)
* Return: 0, OK; otherwise, error. * Return: 0, OK; otherwise, error.
*/ */
int mei_cl_irq_disconnect(struct mei_cl *cl, struct mei_cl_cb *cb, int mei_cl_irq_disconnect(struct mei_cl *cl, struct mei_cl_cb *cb,
struct mei_cl_cb *cmpl_list) struct list_head *cmpl_list)
{ {
struct mei_device *dev = cl->dev; struct mei_device *dev = cl->dev;
u32 msg_slots; u32 msg_slots;
...@@ -864,7 +864,7 @@ int mei_cl_irq_disconnect(struct mei_cl *cl, struct mei_cl_cb *cb, ...@@ -864,7 +864,7 @@ int mei_cl_irq_disconnect(struct mei_cl *cl, struct mei_cl_cb *cb,
ret = mei_cl_send_disconnect(cl, cb); ret = mei_cl_send_disconnect(cl, cb);
if (ret) if (ret)
list_move_tail(&cb->list, &cmpl_list->list); list_move_tail(&cb->list, cmpl_list);
return ret; return ret;
} }
...@@ -986,7 +986,7 @@ static bool mei_cl_is_other_connecting(struct mei_cl *cl) ...@@ -986,7 +986,7 @@ static bool mei_cl_is_other_connecting(struct mei_cl *cl)
dev = cl->dev; dev = cl->dev;
list_for_each_entry(cb, &dev->ctrl_rd_list.list, list) { list_for_each_entry(cb, &dev->ctrl_rd_list, list) {
if (cb->fop_type == MEI_FOP_CONNECT && if (cb->fop_type == MEI_FOP_CONNECT &&
mei_cl_me_id(cl) == mei_cl_me_id(cb->cl)) mei_cl_me_id(cl) == mei_cl_me_id(cb->cl))
return true; return true;
...@@ -1017,7 +1017,7 @@ static int mei_cl_send_connect(struct mei_cl *cl, struct mei_cl_cb *cb) ...@@ -1017,7 +1017,7 @@ static int mei_cl_send_connect(struct mei_cl *cl, struct mei_cl_cb *cb)
return ret; return ret;
} }
list_move_tail(&cb->list, &dev->ctrl_rd_list.list); list_move_tail(&cb->list, &dev->ctrl_rd_list);
cl->timer_count = MEI_CONNECT_TIMEOUT; cl->timer_count = MEI_CONNECT_TIMEOUT;
mei_schedule_stall_timer(dev); mei_schedule_stall_timer(dev);
return 0; return 0;
...@@ -1033,7 +1033,7 @@ static int mei_cl_send_connect(struct mei_cl *cl, struct mei_cl_cb *cb) ...@@ -1033,7 +1033,7 @@ static int mei_cl_send_connect(struct mei_cl *cl, struct mei_cl_cb *cb)
* Return: 0, OK; otherwise, error. * Return: 0, OK; otherwise, error.
*/ */
int mei_cl_irq_connect(struct mei_cl *cl, struct mei_cl_cb *cb, int mei_cl_irq_connect(struct mei_cl *cl, struct mei_cl_cb *cb,
struct mei_cl_cb *cmpl_list) struct list_head *cmpl_list)
{ {
struct mei_device *dev = cl->dev; struct mei_device *dev = cl->dev;
u32 msg_slots; u32 msg_slots;
...@@ -1051,7 +1051,7 @@ int mei_cl_irq_connect(struct mei_cl *cl, struct mei_cl_cb *cb, ...@@ -1051,7 +1051,7 @@ int mei_cl_irq_connect(struct mei_cl *cl, struct mei_cl_cb *cb,
rets = mei_cl_send_connect(cl, cb); rets = mei_cl_send_connect(cl, cb);
if (rets) if (rets)
list_move_tail(&cb->list, &cmpl_list->list); list_move_tail(&cb->list, cmpl_list);
return rets; return rets;
} }
...@@ -1276,7 +1276,7 @@ enum mei_cb_file_ops mei_cl_notify_req2fop(u8 req) ...@@ -1276,7 +1276,7 @@ enum mei_cb_file_ops mei_cl_notify_req2fop(u8 req)
* Return: 0 on such and error otherwise. * Return: 0 on such and error otherwise.
*/ */
int mei_cl_irq_notify(struct mei_cl *cl, struct mei_cl_cb *cb, int mei_cl_irq_notify(struct mei_cl *cl, struct mei_cl_cb *cb,
struct mei_cl_cb *cmpl_list) struct list_head *cmpl_list)
{ {
struct mei_device *dev = cl->dev; struct mei_device *dev = cl->dev;
u32 msg_slots; u32 msg_slots;
...@@ -1294,11 +1294,11 @@ int mei_cl_irq_notify(struct mei_cl *cl, struct mei_cl_cb *cb, ...@@ -1294,11 +1294,11 @@ int mei_cl_irq_notify(struct mei_cl *cl, struct mei_cl_cb *cb,
ret = mei_hbm_cl_notify_req(dev, cl, request); ret = mei_hbm_cl_notify_req(dev, cl, request);
if (ret) { if (ret) {
cl->status = ret; cl->status = ret;
list_move_tail(&cb->list, &cmpl_list->list); list_move_tail(&cb->list, cmpl_list);
return ret; return ret;
} }
list_move_tail(&cb->list, &dev->ctrl_rd_list.list); list_move_tail(&cb->list, &dev->ctrl_rd_list);
return 0; return 0;
} }
...@@ -1353,7 +1353,7 @@ int mei_cl_notify_request(struct mei_cl *cl, ...@@ -1353,7 +1353,7 @@ int mei_cl_notify_request(struct mei_cl *cl,
rets = -ENODEV; rets = -ENODEV;
goto out; goto out;
} }
list_move_tail(&cb->list, &dev->ctrl_rd_list.list); list_move_tail(&cb->list, &dev->ctrl_rd_list);
} }
mutex_unlock(&dev->device_lock); mutex_unlock(&dev->device_lock);
...@@ -1533,7 +1533,7 @@ int mei_cl_read_start(struct mei_cl *cl, size_t length, const struct file *fp) ...@@ -1533,7 +1533,7 @@ int mei_cl_read_start(struct mei_cl *cl, size_t length, const struct file *fp)
* Return: 0, OK; otherwise error. * Return: 0, OK; otherwise error.
*/ */
int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb, int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
struct mei_cl_cb *cmpl_list) struct list_head *cmpl_list)
{ {
struct mei_device *dev; struct mei_device *dev;
struct mei_msg_data *buf; struct mei_msg_data *buf;
...@@ -1605,13 +1605,13 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb, ...@@ -1605,13 +1605,13 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
} }
if (mei_hdr.msg_complete) if (mei_hdr.msg_complete)
list_move_tail(&cb->list, &dev->write_waiting_list.list); list_move_tail(&cb->list, &dev->write_waiting_list);
return 0; return 0;
err: err:
cl->status = rets; cl->status = rets;
list_move_tail(&cb->list, &cmpl_list->list); list_move_tail(&cb->list, cmpl_list);
return rets; return rets;
} }
...@@ -1701,9 +1701,9 @@ int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb) ...@@ -1701,9 +1701,9 @@ int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb)
out: out:
if (mei_hdr.msg_complete) if (mei_hdr.msg_complete)
list_add_tail(&cb->list, &dev->write_waiting_list.list); list_add_tail(&cb->list, &dev->write_waiting_list);
else else
list_add_tail(&cb->list, &dev->write_list.list); list_add_tail(&cb->list, &dev->write_list);
cb = NULL; cb = NULL;
if (blocking && cl->writing_state != MEI_WRITE_COMPLETE) { if (blocking && cl->writing_state != MEI_WRITE_COMPLETE) {
......
...@@ -84,16 +84,6 @@ static inline u8 mei_me_cl_ver(const struct mei_me_client *me_cl) ...@@ -84,16 +84,6 @@ static inline u8 mei_me_cl_ver(const struct mei_me_client *me_cl)
*/ */
void mei_io_cb_free(struct mei_cl_cb *priv_cb); void mei_io_cb_free(struct mei_cl_cb *priv_cb);
/**
* mei_io_list_init - Sets up a queue list.
*
* @list: An instance cl callback structure
*/
static inline void mei_io_list_init(struct mei_cl_cb *list)
{
INIT_LIST_HEAD(&list->list);
}
/* /*
* MEI Host Client Functions * MEI Host Client Functions
*/ */
...@@ -209,17 +199,17 @@ static inline u8 mei_cl_host_addr(const struct mei_cl *cl) ...@@ -209,17 +199,17 @@ static inline u8 mei_cl_host_addr(const struct mei_cl *cl)
int mei_cl_disconnect(struct mei_cl *cl); int mei_cl_disconnect(struct mei_cl *cl);
int mei_cl_irq_disconnect(struct mei_cl *cl, struct mei_cl_cb *cb, int mei_cl_irq_disconnect(struct mei_cl *cl, struct mei_cl_cb *cb,
struct mei_cl_cb *cmpl_list); struct list_head *cmpl_list);
int mei_cl_connect(struct mei_cl *cl, struct mei_me_client *me_cl, int mei_cl_connect(struct mei_cl *cl, struct mei_me_client *me_cl,
const struct file *file); const struct file *file);
int mei_cl_irq_connect(struct mei_cl *cl, struct mei_cl_cb *cb, int mei_cl_irq_connect(struct mei_cl *cl, struct mei_cl_cb *cb,
struct mei_cl_cb *cmpl_list); struct list_head *cmpl_list);
int mei_cl_read_start(struct mei_cl *cl, size_t length, const struct file *fp); int mei_cl_read_start(struct mei_cl *cl, size_t length, const struct file *fp);
int mei_cl_irq_read_msg(struct mei_cl *cl, struct mei_msg_hdr *hdr, int mei_cl_irq_read_msg(struct mei_cl *cl, struct mei_msg_hdr *hdr,
struct mei_cl_cb *cmpl_list); struct list_head *cmpl_list);
int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb); int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb);
int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb, int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
struct mei_cl_cb *cmpl_list); struct list_head *cmpl_list);
void mei_cl_complete(struct mei_cl *cl, struct mei_cl_cb *cb); void mei_cl_complete(struct mei_cl *cl, struct mei_cl_cb *cb);
...@@ -230,7 +220,7 @@ enum mei_cb_file_ops mei_cl_notify_req2fop(u8 request); ...@@ -230,7 +220,7 @@ enum mei_cb_file_ops mei_cl_notify_req2fop(u8 request);
int mei_cl_notify_request(struct mei_cl *cl, int mei_cl_notify_request(struct mei_cl *cl,
const struct file *file, u8 request); const struct file *file, u8 request);
int mei_cl_irq_notify(struct mei_cl *cl, struct mei_cl_cb *cb, int mei_cl_irq_notify(struct mei_cl *cl, struct mei_cl_cb *cb,
struct mei_cl_cb *cmpl_list); struct list_head *cmpl_list);
int mei_cl_notify_get(struct mei_cl *cl, bool block, bool *notify_ev); int mei_cl_notify_get(struct mei_cl *cl, bool block, bool *notify_ev);
void mei_cl_notify(struct mei_cl *cl); void mei_cl_notify(struct mei_cl *cl);
......
...@@ -815,7 +815,7 @@ static void mei_hbm_cl_res(struct mei_device *dev, ...@@ -815,7 +815,7 @@ static void mei_hbm_cl_res(struct mei_device *dev,
struct mei_cl_cb *cb, *next; struct mei_cl_cb *cb, *next;
cl = NULL; cl = NULL;
list_for_each_entry_safe(cb, next, &dev->ctrl_rd_list.list, list) { list_for_each_entry_safe(cb, next, &dev->ctrl_rd_list, list) {
cl = cb->cl; cl = cb->cl;
......
...@@ -1189,7 +1189,7 @@ irqreturn_t mei_me_irq_quick_handler(int irq, void *dev_id) ...@@ -1189,7 +1189,7 @@ irqreturn_t mei_me_irq_quick_handler(int irq, void *dev_id)
irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id) irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)
{ {
struct mei_device *dev = (struct mei_device *) dev_id; struct mei_device *dev = (struct mei_device *) dev_id;
struct mei_cl_cb complete_list; struct list_head cmpl_list;
s32 slots; s32 slots;
u32 hcsr; u32 hcsr;
int rets = 0; int rets = 0;
...@@ -1201,7 +1201,7 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id) ...@@ -1201,7 +1201,7 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)
hcsr = mei_hcsr_read(dev); hcsr = mei_hcsr_read(dev);
me_intr_clear(dev, hcsr); me_intr_clear(dev, hcsr);
mei_io_list_init(&complete_list); INIT_LIST_HEAD(&cmpl_list);
/* check if ME wants a reset */ /* check if ME wants a reset */
if (!mei_hw_is_ready(dev) && dev->dev_state != MEI_DEV_RESETTING) { if (!mei_hw_is_ready(dev) && dev->dev_state != MEI_DEV_RESETTING) {
...@@ -1227,7 +1227,7 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id) ...@@ -1227,7 +1227,7 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)
slots = mei_count_full_read_slots(dev); slots = mei_count_full_read_slots(dev);
while (slots > 0) { while (slots > 0) {
dev_dbg(dev->dev, "slots to read = %08x\n", slots); dev_dbg(dev->dev, "slots to read = %08x\n", slots);
rets = mei_irq_read_handler(dev, &complete_list, &slots); rets = mei_irq_read_handler(dev, &cmpl_list, &slots);
/* There is a race between ME write and interrupt delivery: /* There is a race between ME write and interrupt delivery:
* Not all data is always available immediately after the * Not all data is always available immediately after the
* interrupt, so try to read again on the next interrupt. * interrupt, so try to read again on the next interrupt.
...@@ -1252,11 +1252,11 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id) ...@@ -1252,11 +1252,11 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)
*/ */
if (dev->pg_event != MEI_PG_EVENT_WAIT && if (dev->pg_event != MEI_PG_EVENT_WAIT &&
dev->pg_event != MEI_PG_EVENT_RECEIVED) { dev->pg_event != MEI_PG_EVENT_RECEIVED) {
rets = mei_irq_write_handler(dev, &complete_list); rets = mei_irq_write_handler(dev, &cmpl_list);
dev->hbuf_is_ready = mei_hbuf_is_ready(dev); dev->hbuf_is_ready = mei_hbuf_is_ready(dev);
} }
mei_irq_compl_handler(dev, &complete_list); mei_irq_compl_handler(dev, &cmpl_list);
end: end:
dev_dbg(dev->dev, "interrupt thread end ret = %d\n", rets); dev_dbg(dev->dev, "interrupt thread end ret = %d\n", rets);
......
...@@ -1057,7 +1057,7 @@ irqreturn_t mei_txe_irq_thread_handler(int irq, void *dev_id) ...@@ -1057,7 +1057,7 @@ irqreturn_t mei_txe_irq_thread_handler(int irq, void *dev_id)
{ {
struct mei_device *dev = (struct mei_device *) dev_id; struct mei_device *dev = (struct mei_device *) dev_id;
struct mei_txe_hw *hw = to_txe_hw(dev); struct mei_txe_hw *hw = to_txe_hw(dev);
struct mei_cl_cb complete_list; struct list_head cmpl_list;
s32 slots; s32 slots;
int rets = 0; int rets = 0;
...@@ -1069,7 +1069,7 @@ irqreturn_t mei_txe_irq_thread_handler(int irq, void *dev_id) ...@@ -1069,7 +1069,7 @@ irqreturn_t mei_txe_irq_thread_handler(int irq, void *dev_id)
/* initialize our complete list */ /* initialize our complete list */
mutex_lock(&dev->device_lock); mutex_lock(&dev->device_lock);
mei_io_list_init(&complete_list); INIT_LIST_HEAD(&cmpl_list);
if (pci_dev_msi_enabled(to_pci_dev(dev->dev))) if (pci_dev_msi_enabled(to_pci_dev(dev->dev)))
mei_txe_check_and_ack_intrs(dev, true); mei_txe_check_and_ack_intrs(dev, true);
...@@ -1126,7 +1126,7 @@ irqreturn_t mei_txe_irq_thread_handler(int irq, void *dev_id) ...@@ -1126,7 +1126,7 @@ irqreturn_t mei_txe_irq_thread_handler(int irq, void *dev_id)
slots = mei_count_full_read_slots(dev); slots = mei_count_full_read_slots(dev);
if (test_and_clear_bit(TXE_INTR_OUT_DB_BIT, &hw->intr_cause)) { if (test_and_clear_bit(TXE_INTR_OUT_DB_BIT, &hw->intr_cause)) {
/* Read from TXE */ /* Read from TXE */
rets = mei_irq_read_handler(dev, &complete_list, &slots); rets = mei_irq_read_handler(dev, &cmpl_list, &slots);
if (rets && dev->dev_state != MEI_DEV_RESETTING) { if (rets && dev->dev_state != MEI_DEV_RESETTING) {
dev_err(dev->dev, dev_err(dev->dev,
"mei_irq_read_handler ret = %d.\n", rets); "mei_irq_read_handler ret = %d.\n", rets);
...@@ -1144,14 +1144,14 @@ irqreturn_t mei_txe_irq_thread_handler(int irq, void *dev_id) ...@@ -1144,14 +1144,14 @@ irqreturn_t mei_txe_irq_thread_handler(int irq, void *dev_id)
if (hw->aliveness && dev->hbuf_is_ready) { if (hw->aliveness && dev->hbuf_is_ready) {
/* get the real register value */ /* get the real register value */
dev->hbuf_is_ready = mei_hbuf_is_ready(dev); dev->hbuf_is_ready = mei_hbuf_is_ready(dev);
rets = mei_irq_write_handler(dev, &complete_list); rets = mei_irq_write_handler(dev, &cmpl_list);
if (rets && rets != -EMSGSIZE) if (rets && rets != -EMSGSIZE)
dev_err(dev->dev, "mei_irq_write_handler ret = %d.\n", dev_err(dev->dev, "mei_irq_write_handler ret = %d.\n",
rets); rets);
dev->hbuf_is_ready = mei_hbuf_is_ready(dev); dev->hbuf_is_ready = mei_hbuf_is_ready(dev);
} }
mei_irq_compl_handler(dev, &complete_list); mei_irq_compl_handler(dev, &cmpl_list);
end: end:
dev_dbg(dev->dev, "interrupt thread end ret = %d\n", rets); dev_dbg(dev->dev, "interrupt thread end ret = %d\n", rets);
......
...@@ -349,16 +349,16 @@ EXPORT_SYMBOL_GPL(mei_stop); ...@@ -349,16 +349,16 @@ EXPORT_SYMBOL_GPL(mei_stop);
bool mei_write_is_idle(struct mei_device *dev) bool mei_write_is_idle(struct mei_device *dev)
{ {
bool idle = (dev->dev_state == MEI_DEV_ENABLED && bool idle = (dev->dev_state == MEI_DEV_ENABLED &&
list_empty(&dev->ctrl_wr_list.list) && list_empty(&dev->ctrl_wr_list) &&
list_empty(&dev->write_list.list) && list_empty(&dev->write_list) &&
list_empty(&dev->write_waiting_list.list)); list_empty(&dev->write_waiting_list));
dev_dbg(dev->dev, "write pg: is idle[%d] state=%s ctrl=%01d write=%01d wwait=%01d\n", dev_dbg(dev->dev, "write pg: is idle[%d] state=%s ctrl=%01d write=%01d wwait=%01d\n",
idle, idle,
mei_dev_state_str(dev->dev_state), mei_dev_state_str(dev->dev_state),
list_empty(&dev->ctrl_wr_list.list), list_empty(&dev->ctrl_wr_list),
list_empty(&dev->write_list.list), list_empty(&dev->write_list),
list_empty(&dev->write_waiting_list.list)); list_empty(&dev->write_waiting_list));
return idle; return idle;
} }
...@@ -388,17 +388,17 @@ void mei_device_init(struct mei_device *dev, ...@@ -388,17 +388,17 @@ void mei_device_init(struct mei_device *dev,
dev->dev_state = MEI_DEV_INITIALIZING; dev->dev_state = MEI_DEV_INITIALIZING;
dev->reset_count = 0; dev->reset_count = 0;
mei_io_list_init(&dev->write_list); INIT_LIST_HEAD(&dev->write_list);
mei_io_list_init(&dev->write_waiting_list); INIT_LIST_HEAD(&dev->write_waiting_list);
mei_io_list_init(&dev->ctrl_wr_list); INIT_LIST_HEAD(&dev->ctrl_wr_list);
mei_io_list_init(&dev->ctrl_rd_list); INIT_LIST_HEAD(&dev->ctrl_rd_list);
INIT_DELAYED_WORK(&dev->timer_work, mei_timer); INIT_DELAYED_WORK(&dev->timer_work, mei_timer);
INIT_WORK(&dev->reset_work, mei_reset_work); INIT_WORK(&dev->reset_work, mei_reset_work);
INIT_WORK(&dev->bus_rescan_work, mei_cl_bus_rescan_work); INIT_WORK(&dev->bus_rescan_work, mei_cl_bus_rescan_work);
INIT_LIST_HEAD(&dev->iamthif_cl.link); INIT_LIST_HEAD(&dev->iamthif_cl.link);
mei_io_list_init(&dev->amthif_cmd_list); INIT_LIST_HEAD(&dev->amthif_cmd_list);
bitmap_zero(dev->host_clients_map, MEI_CLIENTS_MAX); bitmap_zero(dev->host_clients_map, MEI_CLIENTS_MAX);
dev->open_handle_count = 0; dev->open_handle_count = 0;
......
...@@ -35,14 +35,14 @@ ...@@ -35,14 +35,14 @@
* for the completed callbacks * for the completed callbacks
* *
* @dev: mei device * @dev: mei device
* @compl_list: list of completed cbs * @cmpl_list: list of completed cbs
*/ */
void mei_irq_compl_handler(struct mei_device *dev, struct mei_cl_cb *compl_list) void mei_irq_compl_handler(struct mei_device *dev, struct list_head *cmpl_list)
{ {
struct mei_cl_cb *cb, *next; struct mei_cl_cb *cb, *next;
struct mei_cl *cl; struct mei_cl *cl;
list_for_each_entry_safe(cb, next, &compl_list->list, list) { list_for_each_entry_safe(cb, next, cmpl_list, list) {
cl = cb->cl; cl = cb->cl;
list_del_init(&cb->list); list_del_init(&cb->list);
...@@ -92,13 +92,13 @@ void mei_irq_discard_msg(struct mei_device *dev, struct mei_msg_hdr *hdr) ...@@ -92,13 +92,13 @@ void mei_irq_discard_msg(struct mei_device *dev, struct mei_msg_hdr *hdr)
* *
* @cl: reading client * @cl: reading client
* @mei_hdr: header of mei client message * @mei_hdr: header of mei client message
* @complete_list: completion list * @cmpl_list: completion list
* *
* Return: always 0 * Return: always 0
*/ */
int mei_cl_irq_read_msg(struct mei_cl *cl, int mei_cl_irq_read_msg(struct mei_cl *cl,
struct mei_msg_hdr *mei_hdr, struct mei_msg_hdr *mei_hdr,
struct mei_cl_cb *complete_list) struct list_head *cmpl_list)
{ {
struct mei_device *dev = cl->dev; struct mei_device *dev = cl->dev;
struct mei_cl_cb *cb; struct mei_cl_cb *cb;
...@@ -144,7 +144,7 @@ int mei_cl_irq_read_msg(struct mei_cl *cl, ...@@ -144,7 +144,7 @@ int mei_cl_irq_read_msg(struct mei_cl *cl,
if (mei_hdr->msg_complete) { if (mei_hdr->msg_complete) {
cl_dbg(dev, cl, "completed read length = %zu\n", cb->buf_idx); cl_dbg(dev, cl, "completed read length = %zu\n", cb->buf_idx);
list_move_tail(&cb->list, &complete_list->list); list_move_tail(&cb->list, cmpl_list);
} else { } else {
pm_runtime_mark_last_busy(dev->dev); pm_runtime_mark_last_busy(dev->dev);
pm_request_autosuspend(dev->dev); pm_request_autosuspend(dev->dev);
...@@ -154,7 +154,7 @@ int mei_cl_irq_read_msg(struct mei_cl *cl, ...@@ -154,7 +154,7 @@ int mei_cl_irq_read_msg(struct mei_cl *cl,
discard: discard:
if (cb) if (cb)
list_move_tail(&cb->list, &complete_list->list); list_move_tail(&cb->list, cmpl_list);
mei_irq_discard_msg(dev, mei_hdr); mei_irq_discard_msg(dev, mei_hdr);
return 0; return 0;
} }
...@@ -169,7 +169,7 @@ int mei_cl_irq_read_msg(struct mei_cl *cl, ...@@ -169,7 +169,7 @@ int mei_cl_irq_read_msg(struct mei_cl *cl,
* Return: 0, OK; otherwise, error. * Return: 0, OK; otherwise, error.
*/ */
static int mei_cl_irq_disconnect_rsp(struct mei_cl *cl, struct mei_cl_cb *cb, static int mei_cl_irq_disconnect_rsp(struct mei_cl *cl, struct mei_cl_cb *cb,
struct mei_cl_cb *cmpl_list) struct list_head *cmpl_list)
{ {
struct mei_device *dev = cl->dev; struct mei_device *dev = cl->dev;
u32 msg_slots; u32 msg_slots;
...@@ -183,7 +183,7 @@ static int mei_cl_irq_disconnect_rsp(struct mei_cl *cl, struct mei_cl_cb *cb, ...@@ -183,7 +183,7 @@ static int mei_cl_irq_disconnect_rsp(struct mei_cl *cl, struct mei_cl_cb *cb,
return -EMSGSIZE; return -EMSGSIZE;
ret = mei_hbm_cl_disconnect_rsp(dev, cl); ret = mei_hbm_cl_disconnect_rsp(dev, cl);
list_move_tail(&cb->list, &cmpl_list->list); list_move_tail(&cb->list, cmpl_list);
return ret; return ret;
} }
...@@ -199,7 +199,7 @@ static int mei_cl_irq_disconnect_rsp(struct mei_cl *cl, struct mei_cl_cb *cb, ...@@ -199,7 +199,7 @@ static int mei_cl_irq_disconnect_rsp(struct mei_cl *cl, struct mei_cl_cb *cb,
* Return: 0, OK; otherwise, error. * Return: 0, OK; otherwise, error.
*/ */
static int mei_cl_irq_read(struct mei_cl *cl, struct mei_cl_cb *cb, static int mei_cl_irq_read(struct mei_cl *cl, struct mei_cl_cb *cb,
struct mei_cl_cb *cmpl_list) struct list_head *cmpl_list)
{ {
struct mei_device *dev = cl->dev; struct mei_device *dev = cl->dev;
u32 msg_slots; u32 msg_slots;
...@@ -219,7 +219,7 @@ static int mei_cl_irq_read(struct mei_cl *cl, struct mei_cl_cb *cb, ...@@ -219,7 +219,7 @@ static int mei_cl_irq_read(struct mei_cl *cl, struct mei_cl_cb *cb,
if (ret) { if (ret) {
cl->status = ret; cl->status = ret;
cb->buf_idx = 0; cb->buf_idx = 0;
list_move_tail(&cb->list, &cmpl_list->list); list_move_tail(&cb->list, cmpl_list);
return ret; return ret;
} }
...@@ -249,7 +249,7 @@ static inline bool hdr_is_fixed(struct mei_msg_hdr *mei_hdr) ...@@ -249,7 +249,7 @@ static inline bool hdr_is_fixed(struct mei_msg_hdr *mei_hdr)
* Return: 0 on success, <0 on failure. * Return: 0 on success, <0 on failure.
*/ */
int mei_irq_read_handler(struct mei_device *dev, int mei_irq_read_handler(struct mei_device *dev,
struct mei_cl_cb *cmpl_list, s32 *slots) struct list_head *cmpl_list, s32 *slots)
{ {
struct mei_msg_hdr *mei_hdr; struct mei_msg_hdr *mei_hdr;
struct mei_cl *cl; struct mei_cl *cl;
...@@ -347,12 +347,11 @@ EXPORT_SYMBOL_GPL(mei_irq_read_handler); ...@@ -347,12 +347,11 @@ EXPORT_SYMBOL_GPL(mei_irq_read_handler);
* *
* Return: 0 on success, <0 on failure. * Return: 0 on success, <0 on failure.
*/ */
int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list) int mei_irq_write_handler(struct mei_device *dev, struct list_head *cmpl_list)
{ {
struct mei_cl *cl; struct mei_cl *cl;
struct mei_cl_cb *cb, *next; struct mei_cl_cb *cb, *next;
struct mei_cl_cb *list;
s32 slots; s32 slots;
int ret; int ret;
...@@ -367,19 +366,18 @@ int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list) ...@@ -367,19 +366,18 @@ int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list)
/* complete all waiting for write CB */ /* complete all waiting for write CB */
dev_dbg(dev->dev, "complete all waiting for write cb.\n"); dev_dbg(dev->dev, "complete all waiting for write cb.\n");
list = &dev->write_waiting_list; list_for_each_entry_safe(cb, next, &dev->write_waiting_list, list) {
list_for_each_entry_safe(cb, next, &list->list, list) {
cl = cb->cl; cl = cb->cl;
cl->status = 0; cl->status = 0;
cl_dbg(dev, cl, "MEI WRITE COMPLETE\n"); cl_dbg(dev, cl, "MEI WRITE COMPLETE\n");
cl->writing_state = MEI_WRITE_COMPLETE; cl->writing_state = MEI_WRITE_COMPLETE;
list_move_tail(&cb->list, &cmpl_list->list); list_move_tail(&cb->list, cmpl_list);
} }
/* complete control write list CB */ /* complete control write list CB */
dev_dbg(dev->dev, "complete control write list cb.\n"); dev_dbg(dev->dev, "complete control write list cb.\n");
list_for_each_entry_safe(cb, next, &dev->ctrl_wr_list.list, list) { list_for_each_entry_safe(cb, next, &dev->ctrl_wr_list, list) {
cl = cb->cl; cl = cb->cl;
switch (cb->fop_type) { switch (cb->fop_type) {
case MEI_FOP_DISCONNECT: case MEI_FOP_DISCONNECT:
...@@ -423,7 +421,7 @@ int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list) ...@@ -423,7 +421,7 @@ int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list)
} }
/* complete write list CB */ /* complete write list CB */
dev_dbg(dev->dev, "complete write list cb.\n"); dev_dbg(dev->dev, "complete write list cb.\n");
list_for_each_entry_safe(cb, next, &dev->write_list.list, list) { list_for_each_entry_safe(cb, next, &dev->write_list, list) {
cl = cb->cl; cl = cb->cl;
if (cl == &dev->iamthif_cl) if (cl == &dev->iamthif_cl)
ret = mei_amthif_irq_write(cl, cb, cmpl_list); ret = mei_amthif_irq_write(cl, cb, cmpl_list);
......
...@@ -441,10 +441,10 @@ struct mei_device { ...@@ -441,10 +441,10 @@ struct mei_device {
struct cdev cdev; struct cdev cdev;
int minor; int minor;
struct mei_cl_cb write_list; struct list_head write_list;
struct mei_cl_cb write_waiting_list; struct list_head write_waiting_list;
struct mei_cl_cb ctrl_wr_list; struct list_head ctrl_wr_list;
struct mei_cl_cb ctrl_rd_list; struct list_head ctrl_rd_list;
struct list_head file_list; struct list_head file_list;
long open_handle_count; long open_handle_count;
...@@ -501,7 +501,7 @@ struct mei_device { ...@@ -501,7 +501,7 @@ struct mei_device {
bool override_fixed_address; bool override_fixed_address;
/* amthif list for cmd waiting */ /* amthif list for cmd waiting */
struct mei_cl_cb amthif_cmd_list; struct list_head amthif_cmd_list;
struct mei_cl iamthif_cl; struct mei_cl iamthif_cl;
long iamthif_open_count; long iamthif_open_count;
u32 iamthif_stall_timer; u32 iamthif_stall_timer;
...@@ -573,10 +573,10 @@ void mei_cancel_work(struct mei_device *dev); ...@@ -573,10 +573,10 @@ void mei_cancel_work(struct mei_device *dev);
void mei_timer(struct work_struct *work); void mei_timer(struct work_struct *work);
void mei_schedule_stall_timer(struct mei_device *dev); void mei_schedule_stall_timer(struct mei_device *dev);
int mei_irq_read_handler(struct mei_device *dev, int mei_irq_read_handler(struct mei_device *dev,
struct mei_cl_cb *cmpl_list, s32 *slots); struct list_head *cmpl_list, s32 *slots);
int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list); int mei_irq_write_handler(struct mei_device *dev, struct list_head *cmpl_list);
void mei_irq_compl_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list); void mei_irq_compl_handler(struct mei_device *dev, struct list_head *cmpl_list);
/* /*
* AMTHIF - AMT Host Interface Functions * AMTHIF - AMT Host Interface Functions
...@@ -592,12 +592,12 @@ int mei_amthif_release(struct mei_device *dev, struct file *file); ...@@ -592,12 +592,12 @@ int mei_amthif_release(struct mei_device *dev, struct file *file);
int mei_amthif_write(struct mei_cl *cl, struct mei_cl_cb *cb); int mei_amthif_write(struct mei_cl *cl, struct mei_cl_cb *cb);
int mei_amthif_run_next_cmd(struct mei_device *dev); int mei_amthif_run_next_cmd(struct mei_device *dev);
int mei_amthif_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb, int mei_amthif_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
struct mei_cl_cb *cmpl_list); struct list_head *cmpl_list);
void mei_amthif_complete(struct mei_cl *cl, struct mei_cl_cb *cb); void mei_amthif_complete(struct mei_cl *cl, struct mei_cl_cb *cb);
int mei_amthif_irq_read_msg(struct mei_cl *cl, int mei_amthif_irq_read_msg(struct mei_cl *cl,
struct mei_msg_hdr *mei_hdr, struct mei_msg_hdr *mei_hdr,
struct mei_cl_cb *complete_list); struct list_head *cmpl_list);
int mei_amthif_irq_read(struct mei_device *dev, s32 *slots); int mei_amthif_irq_read(struct mei_device *dev, s32 *slots);
/* /*
......
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