diff options
Diffstat (limited to 'drivers/misc/mei/bus.c')
| -rw-r--r-- | drivers/misc/mei/bus.c | 32 | 
1 files changed, 24 insertions, 8 deletions
diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c index 6d0282c08a0..0e993ef28b9 100644 --- a/drivers/misc/mei/bus.c +++ b/drivers/misc/mei/bus.c @@ -26,7 +26,6 @@  #include <linux/mei_cl_bus.h>  #include "mei_dev.h" -#include "hw-me.h"  #include "client.h"  #define to_mei_cl_driver(d) container_of(d, struct mei_cl_driver, driver) @@ -145,9 +144,9 @@ static struct device_type mei_cl_device_type = {  static struct mei_cl *mei_bus_find_mei_cl_by_uuid(struct mei_device *dev,  						uuid_le uuid)  { -	struct mei_cl *cl, *next; +	struct mei_cl *cl; -	list_for_each_entry_safe(cl, next, &dev->device_list, device_link) { +	list_for_each_entry(cl, &dev->device_list, device_link) {  		if (!uuid_le_cmp(uuid, cl->device_uuid))  			return cl;  	} @@ -245,10 +244,10 @@ static int ___mei_cl_send(struct mei_cl *cl, u8 *buf, size_t length,  	/* Check if we have an ME client device */  	id = mei_me_cl_by_id(dev, cl->me_client_id);  	if (id < 0) -		return -ENODEV; +		return id;  	if (length > dev->me_clients[id].props.max_msg_length) -		return -EINVAL; +		return -EFBIG;  	cb = mei_io_cb_init(cl, NULL);  	if (!cb) @@ -297,10 +296,13 @@ int __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length)  	if (cl->reading_state != MEI_READ_COMPLETE &&  	    !waitqueue_active(&cl->rx_wait)) { +  		mutex_unlock(&dev->device_lock);  		if (wait_event_interruptible(cl->rx_wait, -				(MEI_READ_COMPLETE == cl->reading_state))) { +				cl->reading_state == MEI_READ_COMPLETE  || +				mei_cl_is_transitioning(cl))) { +  			if (signal_pending(current))  				return -EINTR;  			return -ERESTARTSYS; @@ -425,8 +427,6 @@ int mei_cl_enable_device(struct mei_cl_device *device)  	mutex_lock(&dev->device_lock); -	cl->state = MEI_FILE_CONNECTING; -  	err = mei_cl_connect(cl, NULL);  	if (err < 0) {  		mutex_unlock(&dev->device_lock); @@ -521,6 +521,22 @@ void mei_cl_bus_rx_event(struct mei_cl *cl)  	schedule_work(&device->event_work);  } +void mei_cl_bus_remove_devices(struct mei_device *dev) +{ +	struct mei_cl *cl, *next; + +	mutex_lock(&dev->device_lock); +	list_for_each_entry_safe(cl, next, &dev->device_list, device_link) { +		if (cl->device) +			mei_cl_remove_device(cl->device); + +		list_del(&cl->device_link); +		mei_cl_unlink(cl); +		kfree(cl); +	} +	mutex_unlock(&dev->device_lock); +} +  int __init mei_cl_bus_init(void)  {  	return bus_register(&mei_cl_bus_type);  | 
