cl->mei_flow_ctrl_creds = 0;
cl->timer_count = 0;
+ if (!cl->me_cl)
+ return;
+
+ if (!WARN_ON(cl->me_cl->connect_count == 0))
+ cl->me_cl->connect_count--;
+
+ if (cl->me_cl->connect_count == 0)
+ cl->me_cl->mei_flow_ctrl_creds = 0;
+
mei_me_cl_put(cl->me_cl);
cl->me_cl = NULL;
}
+static int mei_cl_set_connecting(struct mei_cl *cl, struct mei_me_client *me_cl)
+{
+ cl->me_cl = mei_me_cl_get(me_cl);
+ if (!cl->me_cl)
+ return -ENOENT;
+
+ cl->state = MEI_FILE_CONNECTING;
+ cl->me_cl->connect_count++;
+
+ return 0;
+}
+
/*
* mei_cl_send_disconnect - send disconnect request
*
if (rets)
goto out;
- cl->me_cl = mei_me_cl_get(me_cl);
- if (!cl->me_cl) {
- rets = -ENODEV;
+ rets = mei_cl_set_connecting(cl, me_cl);
+ if (rets)
goto out;
- }
-
- cl->state = MEI_FILE_CONNECTING;
list_add_tail(&cb->list, &dev->ctrl_wr_list.list);
/* run hbuf acquire last so we don't have to undo */
* @props: client properties
* @client_id: me client id
* @mei_flow_ctrl_creds: flow control credits
+ * @connect_count: number connections to this client
+ * @reserved: reserved
*/
struct mei_me_client {
struct list_head list;
struct mei_client_properties props;
u8 client_id;
u8 mei_flow_ctrl_creds;
+ u8 connect_count;
+ u8 reserved;
};