Skip to content

Commit 025fb79

Browse files
ausyskingregkh
authored andcommitted
mei: split amthif client init from end of clients enumeration
The amthif FW client can appear after the end of client enumeration. Amthif host client initialization is done now at FW client discovery time. Signed-off-by: Alexander Usyskin <[email protected]> Signed-off-by: Tomas Winkler <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 27f476e commit 025fb79

File tree

7 files changed

+15
-23
lines changed

7 files changed

+15
-23
lines changed

drivers/misc/mei/amthif.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ int mei_amthif_host_init(struct mei_device *dev, struct mei_me_client *me_cl)
6767
struct mei_cl *cl = &dev->iamthif_cl;
6868
int ret;
6969

70+
if (mei_cl_is_connected(cl))
71+
return 0;
72+
7073
dev->iamthif_state = MEI_IAMTHIF_IDLE;
7174

7275
mei_cl_init(cl, dev);
@@ -79,8 +82,6 @@ int mei_amthif_host_init(struct mei_device *dev, struct mei_me_client *me_cl)
7982

8083
ret = mei_cl_connect(cl, me_cl, NULL);
8184

82-
dev->iamthif_state = MEI_IAMTHIF_IDLE;
83-
8485
return ret;
8586
}
8687

drivers/misc/mei/bus.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,14 @@ void mei_cl_bus_rescan_work(struct work_struct *work)
981981
{
982982
struct mei_device *bus =
983983
container_of(work, struct mei_device, bus_rescan_work);
984+
struct mei_me_client *me_cl;
985+
986+
mutex_lock(&bus->device_lock);
987+
me_cl = mei_me_cl_by_uuid(bus, &mei_amthif_guid);
988+
if (me_cl)
989+
mei_amthif_host_init(bus, me_cl);
990+
mei_me_cl_put(me_cl);
991+
mutex_unlock(&bus->device_lock);
984992

985993
mei_cl_bus_rescan(bus);
986994
}

drivers/misc/mei/client.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -666,25 +666,12 @@ int mei_cl_unlink(struct mei_cl *cl)
666666
return 0;
667667
}
668668

669-
670-
void mei_host_client_init(struct work_struct *work)
669+
void mei_host_client_init(struct mei_device *dev)
671670
{
672-
struct mei_device *dev =
673-
container_of(work, struct mei_device, init_work);
674-
struct mei_me_client *me_cl;
675-
676-
mutex_lock(&dev->device_lock);
677-
678-
me_cl = mei_me_cl_by_uuid(dev, &mei_amthif_guid);
679-
if (me_cl)
680-
mei_amthif_host_init(dev, me_cl);
681-
mei_me_cl_put(me_cl);
682-
683671
dev->dev_state = MEI_DEV_ENABLED;
684672
dev->reset_count = 0;
685-
mutex_unlock(&dev->device_lock);
686673

687-
mei_cl_bus_rescan(dev);
674+
schedule_work(&dev->bus_rescan_work);
688675

689676
pm_runtime_mark_last_busy(dev->dev);
690677
dev_dbg(dev->dev, "rpm: autosuspend\n");

drivers/misc/mei/client.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
226226

227227
void mei_cl_complete(struct mei_cl *cl, struct mei_cl_cb *cb);
228228

229-
void mei_host_client_init(struct work_struct *work);
229+
void mei_host_client_init(struct mei_device *dev);
230230

231231
u8 mei_cl_notify_fop2req(enum mei_cb_file_ops fop);
232232
enum mei_cb_file_ops mei_cl_notify_req2fop(u8 request);

drivers/misc/mei/hbm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ static int mei_hbm_prop_req(struct mei_device *dev)
549549
/* We got all client properties */
550550
if (next_client_index == MEI_CLIENTS_MAX) {
551551
dev->hbm_state = MEI_HBM_STARTED;
552-
schedule_work(&dev->init_work);
552+
mei_host_client_init(dev);
553553

554554
return 0;
555555
}

drivers/misc/mei/init.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ EXPORT_SYMBOL_GPL(mei_fw_status2str);
9191
*/
9292
void mei_cancel_work(struct mei_device *dev)
9393
{
94-
cancel_work_sync(&dev->init_work);
9594
cancel_work_sync(&dev->reset_work);
9695
cancel_work_sync(&dev->bus_rescan_work);
9796

@@ -393,7 +392,6 @@ void mei_device_init(struct mei_device *dev,
393392
mei_io_list_init(&dev->ctrl_rd_list);
394393

395394
INIT_DELAYED_WORK(&dev->timer_work, mei_timer);
396-
INIT_WORK(&dev->init_work, mei_host_client_init);
397395
INIT_WORK(&dev->reset_work, mei_reset_work);
398396
INIT_WORK(&dev->bus_rescan_work, mei_cl_bus_rescan_work);
399397

drivers/misc/mei/mei_dev.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,6 @@ const char *mei_pg_state_str(enum mei_pg_state state);
410410
* @iamthif_state : amthif processor state
411411
* @iamthif_canceled : current amthif command is canceled
412412
*
413-
* @init_work : work item for the device init
414413
* @reset_work : work item for the device reset
415414
* @bus_rescan_work : work item for the bus rescan
416415
*
@@ -503,7 +502,6 @@ struct mei_device {
503502
enum iamthif_states iamthif_state;
504503
bool iamthif_canceled;
505504

506-
struct work_struct init_work;
507505
struct work_struct reset_work;
508506
struct work_struct bus_rescan_work;
509507

0 commit comments

Comments
 (0)