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

mei: bus: run rescan on me_clients list change

Since clients can be now added and removed during runtime
we need to run bus rescan whenever me_clients list is modified.
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 7851e008
...@@ -977,6 +977,14 @@ void mei_cl_bus_rescan(struct mei_device *bus) ...@@ -977,6 +977,14 @@ void mei_cl_bus_rescan(struct mei_device *bus)
dev_dbg(bus->dev, "rescan end"); dev_dbg(bus->dev, "rescan end");
} }
void mei_cl_bus_rescan_work(struct work_struct *work)
{
struct mei_device *bus =
container_of(work, struct mei_device, bus_rescan_work);
mei_cl_bus_rescan(bus);
}
int __mei_cldev_driver_register(struct mei_cl_driver *cldrv, int __mei_cldev_driver_register(struct mei_cl_driver *cldrv,
struct module *owner) struct module *owner)
{ {
......
...@@ -401,6 +401,9 @@ static int mei_hbm_fw_add_cl_req(struct mei_device *dev, ...@@ -401,6 +401,9 @@ static int mei_hbm_fw_add_cl_req(struct mei_device *dev,
if (ret) if (ret)
status = !MEI_HBMS_SUCCESS; status = !MEI_HBMS_SUCCESS;
if (dev->dev_state == MEI_DEV_ENABLED)
schedule_work(&dev->bus_rescan_work);
return mei_hbm_add_cl_resp(dev, req->me_addr, status); return mei_hbm_add_cl_resp(dev, req->me_addr, status);
} }
...@@ -789,8 +792,11 @@ static void mei_hbm_cl_connect_res(struct mei_device *dev, struct mei_cl *cl, ...@@ -789,8 +792,11 @@ static void mei_hbm_cl_connect_res(struct mei_device *dev, struct mei_cl *cl,
cl->state = MEI_FILE_CONNECTED; cl->state = MEI_FILE_CONNECTED;
else { else {
cl->state = MEI_FILE_DISCONNECT_REPLY; cl->state = MEI_FILE_DISCONNECT_REPLY;
if (rs->status == MEI_CL_CONN_NOT_FOUND) if (rs->status == MEI_CL_CONN_NOT_FOUND) {
mei_me_cl_del(dev, cl->me_cl); mei_me_cl_del(dev, cl->me_cl);
if (dev->dev_state == MEI_DEV_ENABLED)
schedule_work(&dev->bus_rescan_work);
}
} }
cl->status = mei_cl_conn_status_to_errno(rs->status); cl->status = mei_cl_conn_status_to_errno(rs->status);
} }
......
...@@ -93,6 +93,7 @@ void mei_cancel_work(struct mei_device *dev) ...@@ -93,6 +93,7 @@ void mei_cancel_work(struct mei_device *dev)
{ {
cancel_work_sync(&dev->init_work); cancel_work_sync(&dev->init_work);
cancel_work_sync(&dev->reset_work); cancel_work_sync(&dev->reset_work);
cancel_work_sync(&dev->bus_rescan_work);
cancel_delayed_work(&dev->timer_work); cancel_delayed_work(&dev->timer_work);
} }
...@@ -394,6 +395,7 @@ void mei_device_init(struct mei_device *dev, ...@@ -394,6 +395,7 @@ void mei_device_init(struct mei_device *dev,
INIT_DELAYED_WORK(&dev->timer_work, mei_timer); INIT_DELAYED_WORK(&dev->timer_work, mei_timer);
INIT_WORK(&dev->init_work, mei_host_client_init); INIT_WORK(&dev->init_work, mei_host_client_init);
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_LIST_HEAD(&dev->iamthif_cl.link); INIT_LIST_HEAD(&dev->iamthif_cl.link);
mei_io_list_init(&dev->amthif_cmd_list); mei_io_list_init(&dev->amthif_cmd_list);
......
...@@ -304,6 +304,7 @@ struct mei_hw_ops { ...@@ -304,6 +304,7 @@ struct mei_hw_ops {
/* MEI bus API*/ /* MEI bus API*/
void mei_cl_bus_rescan(struct mei_device *bus); void mei_cl_bus_rescan(struct mei_device *bus);
void mei_cl_bus_rescan_work(struct work_struct *work);
void mei_cl_bus_dev_fixup(struct mei_cl_device *dev); void mei_cl_bus_dev_fixup(struct mei_cl_device *dev);
ssize_t __mei_cl_send(struct mei_cl *cl, u8 *buf, size_t length, ssize_t __mei_cl_send(struct mei_cl *cl, u8 *buf, size_t length,
bool blocking); bool blocking);
...@@ -410,6 +411,7 @@ const char *mei_pg_state_str(enum mei_pg_state state); ...@@ -410,6 +411,7 @@ const char *mei_pg_state_str(enum mei_pg_state state);
* *
* @init_work : work item for the device init * @init_work : work item for the device init
* @reset_work : work item for the device reset * @reset_work : work item for the device reset
* @bus_rescan_work : work item for the bus rescan
* *
* @device_list : mei client bus list * @device_list : mei client bus list
* @cl_bus_lock : client bus list lock * @cl_bus_lock : client bus list lock
...@@ -501,6 +503,7 @@ struct mei_device { ...@@ -501,6 +503,7 @@ struct mei_device {
struct work_struct init_work; struct work_struct init_work;
struct work_struct reset_work; struct work_struct reset_work;
struct work_struct bus_rescan_work;
/* List of bus devices */ /* List of bus devices */
struct list_head device_list; struct list_head device_list;
......
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