revamp mei bus
Subsystems (2)
v2 cover revamp mei bus
MEI bus was designed around nfc and was hard to extend. Instead of hard coded way of adding the devices on the mei bus we scan whole me client list and create a device for each eligible me client
V2: Rephrase the commit message of most of the patches
Remove few patches that didn't bring substantial changes. Split few patches to follow single change per patch policy.
Tomas Winkler (15):
mei: bus: fix drivers and devices names confusion
mei: bus: rename nfc.c to bus-fixup.c
mei: bus: move driver api functions at the start of the file
mei: bus: rename uevent handler to mei_cl_device_uevent
mei: bus: don't enable events implicitly in device enable
mei: bus: report if event registration failed
mei: bus: revamp device matching
mei: bus: revamp probe and remove functions
mei: bus: add reference to bus device in struct mei_cl_client
mei: bus: add me client device list infrastructure
mei: bus: enable running fixup routines before device registration
mei: bus: blacklist nfc info client
mei: bus: blacklist clients by number of connections
mei: bus: simplify how we build nfc bus name
mei: bus: link client devices instead of host clients
drivers/misc/mei/Makefile | 2 +- drivers/misc/mei/bus-fixup.c | 306 ++++++++++++++ drivers/misc/mei/bus.c | 967 ++++++++++++++++++++++++++++--------------- drivers/misc/mei/client.c | 9 +- drivers/misc/mei/init.c | 3 +- drivers/misc/mei/mei_dev.h | 25 +- drivers/misc/mei/nfc.c | 414 ------------------ include/linux/mei_cl_bus.h | 11 + 8 files changed, 955 insertions(+), 782 deletions(-) create mode 100644 drivers/misc/mei/bus-fixup.c delete mode 100644 drivers/misc/mei/nfc.c
Signature · 1 line
2.4.3
PATCH v2 1/15 mei: bus: fix drivers and devices names confusion
In the mei bus layer there is use of different variables of driver and device types with no clear naming convention. There are generic struct device and struct driver, then mei_cl_{device, driver}, and finally mei_device which in this context serves as a bus device.
The patch sets following naming convention:
the variables of type struct device remains dev the variables of type struct driver remains drv the variables of type struct mei_cl_device are now cldev the variables of type struct mei_cl_driver are now cldrv the variables of type struct mei_device are now bus, in bus layer context
---
V2: fix the commit message
drivers/misc/mei/bus.c | 272 ++++++++++++++++++++++----------------------- drivers/misc/mei/mei_dev.h | 12 +- drivers/misc/mei/nfc.c | 80 ++++++------- 3 files changed, 182 insertions(+), 182 deletions(-)
drivers/misc/mei/bus.c +136 -136
@@ -32,22 +32,22 @@static int mei_cl_device_match (struct device *dev,struct device_driver *drv) { -struct mei_cl_device *device =to_mei_cl_device (dev); -struct mei_cl_driver *driver =to_mei_cl_driver (drv); +struct mei_cl_device *cldev =to_mei_cl_device (dev); +struct mei_cl_driver *cldrv =to_mei_cl_driver (drv);const struct mei_cl_device_id *id;const uuid_le *uuid;const char *name; -if (!device) +if (!cldev)return 0 ; - uuid =mei_me_cl_uuid (device->me_cl); - name = device->name; + uuid =mei_me_cl_uuid (cldev->me_cl); + name = cldev->name; -if (!driver || !driver->id_table) +if (!cldrv || !cldrv->id_table)return 0 ; - id = driver->id_table; + id = cldrv->id_table;while (uuid_le_cmp (NULL_UUID_LE , id->uuid)) {
@@ -68,54 +68,54 @@ static int mei_cl_device_match(struct device *dev, struct device_driver *drv)static int mei_cl_device_probe (struct device *dev) { -struct mei_cl_device *device =to_mei_cl_device (dev); -struct mei_cl_driver *driver; +struct mei_cl_device *cldev =to_mei_cl_device (dev); +struct mei_cl_driver *cldrv;struct mei_cl_device_id id; -if (!device) +if (!cldev)return 0 ; - driver =to_mei_cl_driver (dev->driver); -if (!driver || !driver->probe) + cldrv =to_mei_cl_driver (dev->driver); +if (!cldrv || !cldrv->probe)return -ENODEV ;dev_dbg (dev,"Device probe\n" ); -strlcpy (id.name, device->name,sizeof (id.name)); +strlcpy (id.name, cldev->name,sizeof (id.name)); -return driver->probe (device, &id); +return cldrv->probe (cldev, &id); }static int mei_cl_device_remove (struct device *dev) { -struct mei_cl_device *device =to_mei_cl_device (dev); -struct mei_cl_driver *driver; +struct mei_cl_device *cldev =to_mei_cl_device (dev); +struct mei_cl_driver *cldrv; -if (!device || !dev->driver) +if (!cldev || !dev->driver)return 0 ; -if (device->event_cb) { - device->event_cb =NULL ; -cancel_work_sync (&device->event_work); +if (cldev->event_cb) { + cldev->event_cb =NULL ; +cancel_work_sync (&cldev->event_work); } - driver =to_mei_cl_driver (dev->driver); -if (!driver->remove) { + cldrv =to_mei_cl_driver (dev->driver); +if (!cldrv->remove) { dev->driver =NULL ;return 0 ; } -return driver->remove (device); +return cldrv->remove (cldev); }static ssize_t name_show (struct device *dev,struct device_attribute *a,char *buf) { -struct mei_cl_device *device =to_mei_cl_device (dev); +struct mei_cl_device *cldev =to_mei_cl_device (dev);size_t len; - len =snprintf (buf,PAGE_SIZE ,"%s" , device->name); + len =snprintf (buf,PAGE_SIZE ,"%s" , cldev->name);return (len >=PAGE_SIZE ) ? (PAGE_SIZE -1 ) : len; }
@@ -124,8 +124,8 @@ static DEVICE_ATTR_RO(name);static ssize_t uuid_show (struct device *dev,struct device_attribute *a,char *buf) { -struct mei_cl_device *device =to_mei_cl_device (dev); -const uuid_le *uuid =mei_me_cl_uuid (device->me_cl); +struct mei_cl_device *cldev =to_mei_cl_device (dev); +const uuid_le *uuid =mei_me_cl_uuid (cldev->me_cl);size_t len; len =snprintf (buf,PAGE_SIZE ,"%pUl" , uuid);
@@ -137,12 +137,12 @@ static DEVICE_ATTR_RO(uuid);static ssize_t modalias_show (struct device *dev,struct device_attribute *a,char *buf) { -struct mei_cl_device *device =to_mei_cl_device (dev); -const uuid_le *uuid =mei_me_cl_uuid (device->me_cl); +struct mei_cl_device *cldev =to_mei_cl_device (dev); +const uuid_le *uuid =mei_me_cl_uuid (cldev->me_cl);size_t len; len =snprintf (buf,PAGE_SIZE ,"mei:%s:" MEI_CL_UUID_FMT ":" , - device->name,MEI_CL_UUID_ARGS (uuid->b)); + cldev->name,MEI_CL_UUID_ARGS (uuid->b));return (len >=PAGE_SIZE ) ? (PAGE_SIZE -1 ) : len; }
@@ -158,17 +158,17 @@ ATTRIBUTE_GROUPS(mei_cl_dev);static int mei_cl_uevent (struct device *dev,struct kobj_uevent_env *env) { -struct mei_cl_device *device =to_mei_cl_device (dev); -const uuid_le *uuid =mei_me_cl_uuid (device->me_cl); +struct mei_cl_device *cldev =to_mei_cl_device (dev); +const uuid_le *uuid =mei_me_cl_uuid (cldev->me_cl);if (add_uevent_var (env,"MEI_CL_UUID=%pUl" , uuid))return -ENOMEM ; -if (add_uevent_var (env,"MEI_CL_NAME=%s" , device->name)) +if (add_uevent_var (env,"MEI_CL_NAME=%s" , cldev->name))return -ENOMEM ;if (add_uevent_var (env,"MODALIAS=mei:%s:" MEI_CL_UUID_FMT ":" , - device->name,MEI_CL_UUID_ARGS (uuid->b))) + cldev->name,MEI_CL_UUID_ARGS (uuid->b)))return -ENOMEM ;return 0 ;
@@ -185,121 +185,121 @@ static struct bus_type mei_cl_bus_type = {static void mei_cl_dev_release (struct device *dev) { -struct mei_cl_device *device =to_mei_cl_device (dev); +struct mei_cl_device *cldev =to_mei_cl_device (dev); -if (!device) +if (!cldev)return ; -mei_me_cl_put (device->me_cl); -kfree (device); +mei_me_cl_put (cldev->me_cl); +kfree (cldev); }static struct device_type mei_cl_device_type = { .release = mei_cl_dev_release, }; -struct mei_cl *mei_cl_bus_find_cl_by_uuid (struct mei_device *dev, +struct mei_cl *mei_cl_bus_find_cl_by_uuid (struct mei_device *bus,uuid_le uuid) {struct mei_cl *cl; -list_for_each_entry (cl, &dev->device_list, device_link) { -if (cl->device && cl->device->me_cl && - !uuid_le_cmp (uuid, *mei_me_cl_uuid (cl->device->me_cl))) +list_for_each_entry (cl, &bus->device_list, device_link) { +if (cl->cldev && cl->cldev->me_cl && + !uuid_le_cmp (uuid, *mei_me_cl_uuid (cl->cldev->me_cl)))return cl; }return NULL ; } -struct mei_cl_device *mei_cl_add_device (struct mei_device *dev, +struct mei_cl_device *mei_cl_add_device (struct mei_device *bus,struct mei_me_client *me_cl,struct mei_cl *cl,char *name) { -struct mei_cl_device *device; +struct mei_cl_device *cldev;int status; - device =kzalloc (sizeof (struct mei_cl_device ),GFP_KERNEL ); -if (!device) + cldev =kzalloc (sizeof (struct mei_cl_device ),GFP_KERNEL ); +if (!cldev)return NULL ; - device->me_cl =mei_me_cl_get (me_cl); -if (!device->me_cl) { -kfree (device); + cldev->me_cl =mei_me_cl_get (me_cl); +if (!cldev->me_cl) { +kfree (cldev);return NULL ; } - device->cl = cl; - device->dev.parent = dev->dev; - device->dev.bus = &mei_cl_bus_type; - device->dev.type = &mei_cl_device_type; + cldev->cl = cl; + cldev->dev.parent = bus->dev; + cldev->dev.bus = &mei_cl_bus_type; + cldev->dev.type = &mei_cl_device_type; -strlcpy (device->name, name,sizeof (device->name)); +strlcpy (cldev->name, name,sizeof (cldev->name)); -dev_set_name (&device->dev,"mei:%s:%pUl" , name,mei_me_cl_uuid (me_cl)); +dev_set_name (&cldev->dev,"mei:%s:%pUl" , name,mei_me_cl_uuid (me_cl)); - status =device_register (&device->dev); + status =device_register (&cldev->dev);if (status) { -dev_err (dev->dev,"Failed to register MEI device\n" ); -mei_me_cl_put (device->me_cl); -kfree (device); +dev_err (bus->dev,"Failed to register MEI device\n" ); +mei_me_cl_put (cldev->me_cl); +kfree (cldev);return NULL ; } - cl->device = device; + cl->cldev = cldev; -dev_dbg (&device->dev,"client %s registered\n" , name); +dev_dbg (&cldev->dev,"client %s registered\n" , name); -return device; +return cldev; }EXPORT_SYMBOL_GPL (mei_cl_add_device); -void mei_cl_remove_device (struct mei_cl_device *device) +void mei_cl_remove_device (struct mei_cl_device *cldev) { -device_unregister (&device->dev); +device_unregister (&cldev->dev); }EXPORT_SYMBOL_GPL (mei_cl_remove_device); -int __mei_cl_driver_register (struct mei_cl_driver *driver,struct module *owner) +int __mei_cl_driver_register (struct mei_cl_driver *cldrv,struct module *owner) {int err; - driver->driver.name = driver->name; - driver->driver.owner = owner; - driver->driver.bus = &mei_cl_bus_type; + cldrv->driver.name = cldrv->name; + cldrv->driver.owner = owner; + cldrv->driver.bus = &mei_cl_bus_type; - err =driver_register (&driver->driver); + err =driver_register (&cldrv->driver);if (err)return err; -pr_debug ("mei: driver [%s] registered\n" , driver->driver.name); +pr_debug ("mei: driver [%s] registered\n" , cldrv->driver.name);return 0 ; }EXPORT_SYMBOL_GPL (__mei_cl_driver_register); -void mei_cl_driver_unregister (struct mei_cl_driver *driver) +void mei_cl_driver_unregister (struct mei_cl_driver *cldrv) { -driver_unregister (&driver->driver); +driver_unregister (&cldrv->driver); -pr_debug ("mei: driver [%s] unregistered\n" , driver->driver.name); +pr_debug ("mei: driver [%s] unregistered\n" , cldrv->driver.name); }EXPORT_SYMBOL_GPL (mei_cl_driver_unregister);ssize_t __mei_cl_send (struct mei_cl *cl,u8 *buf,size_t length,bool blocking) { -struct mei_device *dev; +struct mei_device *bus;struct mei_cl_cb *cb =NULL ;ssize_t rets;if (WARN_ON (!cl || !cl->dev))return -ENODEV ; - dev = cl->dev; + bus = cl->dev; -mutex_lock (&dev->device_lock); +mutex_lock (&bus->device_lock);if (!mei_cl_is_connected (cl)) { rets = -ENODEV ; goto out;
@@ -327,7 +327,7 @@ ssize_t __mei_cl_send(struct mei_cl *cl, u8 *buf, size_t length, rets =mei_cl_write (cl, cb, blocking); out: -mutex_unlock (&dev->device_lock); +mutex_unlock (&bus->device_lock);if (rets <0 )mei_io_cb_free (cb);
@@ -336,7 +336,7 @@ out:ssize_t __mei_cl_recv (struct mei_cl *cl,u8 *buf,size_t length) { -struct mei_device *dev; +struct mei_device *bus;struct mei_cl_cb *cb;size_t r_length;ssize_t rets;
@@ -344,9 +344,9 @@ ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length)if (WARN_ON (!cl || !cl->dev))return -ENODEV ; - dev = cl->dev; + bus = cl->dev; -mutex_lock (&dev->device_lock); +mutex_lock (&bus->device_lock); cb =mei_cl_read_cb (cl,NULL );if (cb)
@@ -358,7 +358,7 @@ ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length)if (list_empty (&cl->rd_completed) && !waitqueue_active (&cl->rx_wait)) { -mutex_unlock (&dev->device_lock); +mutex_unlock (&bus->device_lock); if (wait_event_interruptible(cl->rx_wait, (!list_empty(&cl->rd_completed)) ||
@@ -369,7 +369,7 @@ ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length)return -ERESTARTSYS ; } -mutex_lock (&dev->device_lock); +mutex_lock (&bus->device_lock);if (!mei_cl_is_connected (cl)) { rets = -EBUSY ;
@@ -396,14 +396,14 @@ copy: free:mei_io_cb_free (cb); out: -mutex_unlock (&dev->device_lock); +mutex_unlock (&bus->device_lock);return rets; } -ssize_t mei_cl_send (struct mei_cl_device *device,u8 *buf,size_t length) +ssize_t mei_cl_send (struct mei_cl_device *cldev,u8 *buf,size_t length) { -struct mei_cl *cl = device->cl; +struct mei_cl *cl = cldev->cl;if (cl ==NULL )return -ENODEV ;
@@ -412,9 +412,9 @@ ssize_t mei_cl_send(struct mei_cl_device *device, u8 *buf, size_t length) }EXPORT_SYMBOL_GPL (mei_cl_send); -ssize_t mei_cl_recv (struct mei_cl_device *device,u8 *buf,size_t length) +ssize_t mei_cl_recv (struct mei_cl_device *cldev,u8 *buf,size_t length) { -struct mei_cl *cl = device->cl; +struct mei_cl *cl = cldev->cl;if (cl ==NULL )return -ENODEV ;
@@ -425,108 +425,108 @@ EXPORT_SYMBOL_GPL(mei_cl_recv);static void mei_bus_event_work (struct work_struct *work) { -struct mei_cl_device *device; +struct mei_cl_device *cldev; - device = container_of(work, struct mei_cl_device, event_work); + cldev = container_of(work, struct mei_cl_device, event_work); -if (device->event_cb) - device->event_cb (device, device->events, device->event_context); +if (cldev->event_cb) + cldev->event_cb (cldev, cldev->events, cldev->event_context); - device->events =0 ; + cldev->events =0 ;/* Prepare for the next read */ -mei_cl_read_start (device->cl,0 ,NULL ); +mei_cl_read_start (cldev->cl,0 ,NULL ); } -int mei_cl_register_event_cb (struct mei_cl_device *device, +int mei_cl_register_event_cb (struct mei_cl_device *cldev,mei_cl_event_cb_t event_cb,void *context) { -if (device->event_cb) +if (cldev->event_cb)return -EALREADY ; - device->events =0 ; - device->event_cb = event_cb; - device->event_context = context; -INIT_WORK (&device->event_work, mei_bus_event_work); + cldev->events =0 ; + cldev->event_cb = event_cb; + cldev->event_context = context; +INIT_WORK (&cldev->event_work, mei_bus_event_work); -mei_cl_read_start (device->cl,0 ,NULL ); +mei_cl_read_start (cldev->cl,0 ,NULL );return 0 ; }EXPORT_SYMBOL_GPL (mei_cl_register_event_cb); -void *mei_cl_get_drvdata (const struct mei_cl_device *device) +void *mei_cl_get_drvdata (const struct mei_cl_device *cldev) { -return dev_get_drvdata (&device->dev); +return dev_get_drvdata (&cldev->dev); }EXPORT_SYMBOL_GPL (mei_cl_get_drvdata); -void mei_cl_set_drvdata (struct mei_cl_device *device,void *data) +void mei_cl_set_drvdata (struct mei_cl_device *cldev,void *data) { -dev_set_drvdata (&device->dev, data); +dev_set_drvdata (&cldev->dev, data); }EXPORT_SYMBOL_GPL (mei_cl_set_drvdata); -int mei_cl_enable_device (struct mei_cl_device *device) +int mei_cl_enable_device (struct mei_cl_device *cldev) {int err; -struct mei_device *dev; -struct mei_cl *cl = device->cl; +struct mei_device *bus; +struct mei_cl *cl = cldev->cl;if (cl ==NULL )return -ENODEV ; - dev = cl->dev; + bus = cl->dev; -mutex_lock (&dev->device_lock); +mutex_lock (&bus->device_lock);if (mei_cl_is_connected (cl)) { -mutex_unlock (&dev->device_lock); -dev_warn (dev->dev,"Already connected" ); +mutex_unlock (&bus->device_lock); +dev_warn (bus->dev,"Already connected" );return -EBUSY ; } - err =mei_cl_connect (cl, device->me_cl,NULL ); + err =mei_cl_connect (cl, cldev->me_cl,NULL );if (err <0 ) { -mutex_unlock (&dev->device_lock); -dev_err (dev->dev,"Could not connect to the ME client" ); +mutex_unlock (&bus->device_lock); +dev_err (bus->dev,"Could not connect to the ME client" );return err; } -mutex_unlock (&dev->device_lock); +mutex_unlock (&bus->device_lock); -if (device->event_cb) -mei_cl_read_start (device->cl,0 ,NULL ); +if (cldev->event_cb) +mei_cl_read_start (cldev->cl,0 ,NULL );return 0 ; }EXPORT_SYMBOL_GPL (mei_cl_enable_device); -int mei_cl_disable_device (struct mei_cl_device *device) +int mei_cl_disable_device (struct mei_cl_device *cldev) {int err; -struct mei_device *dev; -struct mei_cl *cl = device->cl; +struct mei_device *bus; +struct mei_cl *cl = cldev->cl;if (cl ==NULL )return -ENODEV ; - dev = cl->dev; + bus = cl->dev; - device->event_cb =NULL ; + cldev->event_cb =NULL ; -mutex_lock (&dev->device_lock); +mutex_lock (&bus->device_lock);if (!mei_cl_is_connected (cl)) { -dev_err (dev->dev,"Already disconnected" ); +dev_err (bus->dev,"Already disconnected" ); err =0 ; goto out; } err =mei_cl_disconnect (cl);if (err <0 ) { -dev_err (dev->dev,"Could not disconnect from the ME client" ); +dev_err (bus->dev,"Could not disconnect from the ME client" ); goto out; }
@@ -534,7 +534,7 @@ int mei_cl_disable_device(struct mei_cl_device *device)mei_cl_flush_queues (cl,NULL ); out: -mutex_unlock (&dev->device_lock); +mutex_unlock (&bus->device_lock);return err; }
@@ -542,30 +542,30 @@ EXPORT_SYMBOL_GPL(mei_cl_disable_device);void mei_cl_bus_rx_event (struct mei_cl *cl) { -struct mei_cl_device *device = cl->device; +struct mei_cl_device *cldev = cl->cldev; -if (!device || !device->event_cb) +if (!cldev || !cldev->event_cb)return ; -set_bit (MEI_CL_EVENT_RX , &device->events); +set_bit (MEI_CL_EVENT_RX , &cldev->events); -schedule_work (&device->event_work); +schedule_work (&cldev->event_work); } -void mei_cl_bus_remove_devices (struct mei_device *dev) +void mei_cl_bus_remove_devices (struct mei_device *bus) {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); +mutex_lock (&bus->device_lock); +list_for_each_entry_safe (cl, next, &bus->device_list, device_link) { +if (cl->cldev) +mei_cl_remove_device (cl->cldev);list_del (&cl->device_link);mei_cl_unlink (cl);kfree (cl); } -mutex_unlock (&dev->device_lock); +mutex_unlock (&bus->device_lock); }int __init mei_cl_bus_init (void )
drivers/misc/mei/mei_dev.h +6 -6
@@ -240,7 +240,7 @@ struct mei_cl_cb {* @rd_pending: pending read credits * @rd_completed: completed read * -* @device: device on the mei client bus +* @cldev: device on the mei client bus * @device_link: link to bus clients */ struct mei_cl {
@@ -261,7 +261,7 @@ struct mei_cl {struct list_head rd_completed;/* MEI CL bus data */ -struct mei_cl_device *device; +struct mei_cl_device *cldev;struct list_head device_link; };
@@ -330,20 +330,20 @@ struct mei_hw_ops {/* MEI bus API*/ -struct mei_cl_device *mei_cl_add_device (struct mei_device *dev, +struct mei_cl_device *mei_cl_add_device (struct mei_device *bus,struct mei_me_client *me_cl,struct mei_cl *cl,char *name); -void mei_cl_remove_device (struct mei_cl_device *device); +void mei_cl_remove_device (struct mei_cl_device *cldev);ssize_t __mei_cl_send (struct mei_cl *cl,u8 *buf,size_t length,bool blocking);ssize_t __mei_cl_recv (struct mei_cl *cl,u8 *buf,size_t length);void mei_cl_bus_rx_event (struct mei_cl *cl); -void mei_cl_bus_remove_devices (struct mei_device *dev); +void mei_cl_bus_remove_devices (struct mei_device *bus);int mei_cl_bus_init (void );void mei_cl_bus_exit (void ); -struct mei_cl *mei_cl_bus_find_cl_by_uuid (struct mei_device *dev,uuid_le uuid); +struct mei_cl *mei_cl_bus_find_cl_by_uuid (struct mei_device *bus,uuid_le uuid);/** * enum mei_pg_event - power gating transition events
drivers/misc/mei/nfc.c +40 -40
239 lines not on this page · raw message
Signature · 1 line
2.4.3
Greg KH
maintainerRe: [char-misc-next 01/15 V2] mei: bus: fix drivers and devices names confusion
Quoted 8 lines · Tomas Winkler
In the mei bus layer there is use of different variables of driver and device types with no clear naming convention. There are generic struct device and struct driver, then mei_cl_{device, driver}, and finally
mei_devicewhich in this context serves as a bus device.The patch sets following naming convention:
Quoted 8 lines
the variables of type struct device remains dev the variables of type struct driver remains drv the variables of type struct
mei_cl_deviceare now cldev the variables of type structmei_cl_driverare now cldrv the variables of type structmei_deviceare now bus, in bus layer contextSigned-off-by Tomas Winkler <[email protected]>
Due to the changes in Linus's tree, this doesn't apply to 4.2-rc3. Can you refresh this series and resend? Same for the other outstanding mei patches you have sent that I haven't applied.
thanks,
greg k-h
PATCH v2 2/15 mei: bus: rename nfc.c to bus-fixup.c
In reply to Tomas WinklerThe bus-fixup.c will be a place for fixups and quirks for all types of me client devices.
As for now it contians only the fixup for setting the nfc device name on the me client bus.
---
drivers/misc/mei/Makefile | 2 +-
drivers/misc/mei/{nfc.c => bus-fixup.c} | 0
2 files changed, 1 insertion(+), 1 deletion(-)
rename drivers/misc/mei/{nfc.c => bus-fixup.c} (100%)drivers/misc/mei/Makefile +1 -1
@@ -11,7 +11,7 @@ mei-objs += main.o mei-objs += amthif.o mei-objs += wd.o mei-objs += bus.o -mei-objs += nfc.o +mei-objs += bus-fixup.o mei-$(CONFIG_DEBUG_FS) += debugfs.o obj-$(CONFIG_INTEL_MEI_ME) += mei-me.o
drivers/misc/mei/bus-fixup.c renamed from drivers/misc/mei/nfc.c +0 -0
Signature · 1 line
2.4.3
PATCH v2 3/15 mei: bus: move driver api functions at the start of the file
In reply to Tomas WinklerTo make the file more organize move mei client driver api to the start of the file and add Kdoc.
There are no functional changes in this patch.
---
V2: Resend
drivers/misc/mei/bus.c | 798 +++++++++++++++++++++++++++---------------------- 1 file changed, 443 insertions(+), 355 deletions(-)
drivers/misc/mei/bus.c +443 -355
@@ -30,527 +30,615 @@#define to_mei_cl_driver (d) container_of(d, struct mei_cl_driver, driver)#define to_mei_cl_device (d) container_of(d, struct mei_cl_device, dev) -static int mei_cl_device_match (struct device *dev,struct device_driver *drv) +/** +* __mei_cl_send - internal client send (write) +* +* @cl: host client +* @buf: buffer to send +* @length: buffer length +* @blocking: wait for write completion +* +* Return: written size bytes or < 0 on error +*/ +ssize_t __mei_cl_send (struct mei_cl *cl,u8 *buf,size_t length, +bool blocking) { -struct mei_cl_device *cldev =to_mei_cl_device (dev); -struct mei_cl_driver *cldrv =to_mei_cl_driver (drv); -const struct mei_cl_device_id *id; -const uuid_le *uuid; -const char *name; - -if (!cldev) -return 0 ; +struct mei_device *bus; +struct mei_cl_cb *cb =NULL ; +ssize_t rets; - uuid =mei_me_cl_uuid (cldev->me_cl); - name = cldev->name; +if (WARN_ON (!cl || !cl->dev)) +return -ENODEV ; -if (!cldrv || !cldrv->id_table) -return 0 ; + bus = cl->dev; - id = cldrv->id_table; +mutex_lock (&bus->device_lock); +if (!mei_cl_is_connected (cl)) { + rets = -ENODEV ; + goto out; + } -while (uuid_le_cmp (NULL_UUID_LE , id->uuid)) { +/* Check if we have an ME client device */ +if (!mei_me_cl_is_active (cl->me_cl)) { + rets = -ENOTTY ; + goto out; + } -if (!uuid_le_cmp (*uuid, id->uuid)) { -if (id->name[0 ]) { -if (!strncmp (name, id->name,sizeof (id->name))) -return 1 ; - }else { -return 1 ; - } - } +if (length >mei_cl_mtu (cl)) { + rets = -EFBIG ; + goto out; + } - id++; + cb =mei_cl_alloc_cb (cl, length,MEI_FOP_WRITE ,NULL ); +if (!cb) { + rets = -ENOMEM ; + goto out; } -return 0 ; +memcpy (cb->buf.data, buf, length); + + rets =mei_cl_write (cl, cb, blocking); + +out: +mutex_unlock (&bus->device_lock); +if (rets <0 ) +mei_io_cb_free (cb); + +return rets; } -static int mei_cl_device_probe (struct device *dev) +/** +* __mei_cl_recv - internal client receive (read) +* +* @cl: host client +* @buf: buffer to send +* @length: buffer length +* +* Return: read size in bytes of < 0 on error +*/ +ssize_t __mei_cl_recv (struct mei_cl *cl,u8 *buf,size_t length) { -struct mei_cl_device *cldev =to_mei_cl_device (dev); -struct mei_cl_driver *cldrv; -struct mei_cl_device_id id; - -if (!cldev) -return 0 ; +struct mei_device *bus; +struct mei_cl_cb *cb; +size_t r_length; +ssize_t rets; - cldrv =to_mei_cl_driver (dev->driver); -if (!cldrv || !cldrv->probe) +if (WARN_ON (!cl || !cl->dev))return -ENODEV ; -dev_dbg (dev,"Device probe\n" ); + bus = cl->dev; -strlcpy (id.name, cldev->name,sizeof (id.name)); +mutex_lock (&bus->device_lock); -return cldrv->probe (cldev, &id); -} + cb =mei_cl_read_cb (cl,NULL ); +if (cb) + goto copy; -static int mei_cl_device_remove (struct device *dev) -{ -struct mei_cl_device *cldev =to_mei_cl_device (dev); -struct mei_cl_driver *cldrv; + rets =mei_cl_read_start (cl, length,NULL ); +if (rets && rets != -EBUSY ) + goto out; -if (!cldev || !dev->driver) -return 0 ; +if (list_empty (&cl->rd_completed) && !waitqueue_active (&cl->rx_wait)) { -if (cldev->event_cb) { - cldev->event_cb =NULL ; -cancel_work_sync (&cldev->event_work); - } +mutex_unlock (&bus->device_lock); - cldrv =to_mei_cl_driver (dev->driver); -if (!cldrv->remove) { - dev->driver =NULL ; +if (wait_event_interruptible (cl->rx_wait, + (!list_empty (&cl->rd_completed)) || + (!mei_cl_is_connected (cl)))) { -return 0 ; +if (signal_pending (current)) +return -EINTR ; +return -ERESTARTSYS ; + } + +mutex_lock (&bus->device_lock); + +if (!mei_cl_is_connected (cl)) { + rets = -EBUSY ; + goto out; + } } -return cldrv->remove (cldev); -} + cb =mei_cl_read_cb (cl,NULL ); +if (!cb) { + rets =0 ; + goto out; + } -static ssize_t name_show (struct device *dev,struct device_attribute *a, -char *buf) -{ -struct mei_cl_device *cldev =to_mei_cl_device (dev); -size_t len; +copy: +if (cb->status) { + rets = cb->status; + goto free; + } - len =snprintf (buf,PAGE_SIZE ,"%s" , cldev->name); + r_length =min_t (size_t, length, cb->buf_idx); +memcpy (buf, cb->buf.data, r_length); + rets = r_length; -return (len >=PAGE_SIZE ) ? (PAGE_SIZE -1 ) : len; +free: +mei_io_cb_free (cb); +out: +mutex_unlock (&bus->device_lock); + +return rets; } -static DEVICE_ATTR_RO (name); -static ssize_t uuid_show (struct device *dev,struct device_attribute *a, -char *buf) +/** +* mei_cl_send - me device send (write) +* +* @cldev: me client device +* @buf: buffer to send +* @length: buffer length +* +* Return: written size in bytes or < 0 on error +*/ +ssize_t mei_cl_send (struct mei_cl_device *cldev,u8 *buf,size_t length) { -struct mei_cl_device *cldev =to_mei_cl_device (dev); -const uuid_le *uuid =mei_me_cl_uuid (cldev->me_cl); -size_t len; +struct mei_cl *cl = cldev->cl; - len =snprintf (buf,PAGE_SIZE ,"%pUl" , uuid); +if (cl ==NULL ) +return -ENODEV ; -return (len >=PAGE_SIZE ) ? (PAGE_SIZE -1 ) : len; +return __mei_cl_send (cl, buf, length,1 ); } -static DEVICE_ATTR_RO (uuid); +EXPORT_SYMBOL_GPL (mei_cl_send); -static ssize_t modalias_show (struct device *dev,struct device_attribute *a, -char *buf) +/** +* mei_cl_recv - client receive (read) +* +* @cldev: me client device +* @buf: buffer to send +* @length: buffer length +* +* Return: read size in bytes of < 0 on error +*/ +ssize_t mei_cl_recv (struct mei_cl_device *cldev,u8 *buf,size_t length) { -struct mei_cl_device *cldev =to_mei_cl_device (dev); -const uuid_le *uuid =mei_me_cl_uuid (cldev->me_cl); -size_t len; +struct mei_cl *cl = cldev->cl; - len =snprintf (buf,PAGE_SIZE ,"mei:%s:" MEI_CL_UUID_FMT ":" , - cldev->name,MEI_CL_UUID_ARGS (uuid->b)); +if (cl ==NULL ) +return -ENODEV ; -return (len >=PAGE_SIZE ) ? (PAGE_SIZE -1 ) : len; +return __mei_cl_recv (cl, buf, length); } -static DEVICE_ATTR_RO (modalias); - -static struct attribute *mei_cl_dev_attrs[] = { - &dev_attr_name.attr, - &dev_attr_uuid.attr, - &dev_attr_modalias.attr, -NULL , -}; -ATTRIBUTE_GROUPS (mei_cl_dev); +EXPORT_SYMBOL_GPL (mei_cl_recv); -static int mei_cl_uevent (struct device *dev,struct kobj_uevent_env *env) +/** +* mei_bus_event_work - dispatch rx event for a bus device +* and schedule new work +* +* @work: work +*/ +static void mei_bus_event_work (struct work_struct *work) { -struct mei_cl_device *cldev =to_mei_cl_device (dev); -const uuid_le *uuid =mei_me_cl_uuid (cldev->me_cl); +struct mei_cl_device *cldev; -if (add_uevent_var (env,"MEI_CL_UUID=%pUl" , uuid)) -return -ENOMEM ; + cldev = container_of(work, struct mei_cl_device, event_work); -if (add_uevent_var (env,"MEI_CL_NAME=%s" , cldev->name)) -return -ENOMEM ; +if (cldev->event_cb) + cldev->event_cb (cldev, cldev->events, cldev->event_context); -if (add_uevent_var (env,"MODALIAS=mei:%s:" MEI_CL_UUID_FMT ":" , - cldev->name,MEI_CL_UUID_ARGS (uuid->b))) -return -ENOMEM ; + cldev->events =0 ; -return 0 ; +/* Prepare for the next read */ +mei_cl_read_start (cldev->cl,0 ,NULL ); } -static struct bus_type mei_cl_bus_type = { - .name ="mei" , - .dev_groups = mei_cl_dev_groups, - .match = mei_cl_device_match, - .probe = mei_cl_device_probe, - .remove = mei_cl_device_remove, - .uevent = mei_cl_uevent, -}; - -static void mei_cl_dev_release (struct device *dev) +/** +* mei_cl_bus_rx_event - schedule rx evenet +* +* @cl: host client +*/ +void mei_cl_bus_rx_event (struct mei_cl *cl) { -struct mei_cl_device *cldev =to_mei_cl_device (dev); +struct mei_cl_device *cldev = cl->cldev; -if (!cldev) +if (!cldev || !cldev->event_cb)return ; -mei_me_cl_put (cldev->me_cl); -kfree (cldev); -} - -static struct device_type mei_cl_device_type = { - .release = mei_cl_dev_release, -}; - -struct mei_cl *mei_cl_bus_find_cl_by_uuid (struct mei_device *bus, -uuid_le uuid) -{ -struct mei_cl *cl; - -list_for_each_entry (cl, &bus->device_list, device_link) { -if (cl->cldev && cl->cldev->me_cl && - !uuid_le_cmp (uuid, *mei_me_cl_uuid (cl->cldev->me_cl))) -return cl; - } +set_bit (MEI_CL_EVENT_RX , &cldev->events); -return NULL ; +schedule_work (&cldev->event_work); } -struct mei_cl_device *mei_cl_add_device (struct mei_device *bus, -struct mei_me_client *me_cl, -struct mei_cl *cl, -char *name) +/** +* mei_cl_register_event_cb - register event callback +* +* @cldev: me client devices +* @event_cb: callback function +* @context: driver context data +* +* Return: 0 on success +* -EALREADY if an callback is already registered +* <0 on other errors +*/ +int mei_cl_register_event_cb (struct mei_cl_device *cldev, +mei_cl_event_cb_t event_cb,void *context) { -struct mei_cl_device *cldev; -int status; - - cldev =kzalloc (sizeof (struct mei_cl_device ),GFP_KERNEL ); -if (!cldev) -return NULL ; - - cldev->me_cl =mei_me_cl_get (me_cl); -if (!cldev->me_cl) { -kfree (cldev); -return NULL ; - } - - cldev->cl = cl; - cldev->dev.parent = bus->dev; - cldev->dev.bus = &mei_cl_bus_type; - cldev->dev.type = &mei_cl_device_type; - -strlcpy (cldev->name, name,sizeof (cldev->name)); - -dev_set_name (&cldev->dev,"mei:%s:%pUl" , name,mei_me_cl_uuid (me_cl)); +if (cldev->event_cb) +return -EALREADY ; - status =device_register (&cldev->dev); -if (status) { -dev_err (bus->dev,"Failed to register MEI device\n" ); -mei_me_cl_put (cldev->me_cl); -kfree (cldev); -return NULL ; - } + cldev->events =0 ; + cldev->event_cb = event_cb; + cldev->event_context = context; +INIT_WORK (&cldev->event_work, mei_bus_event_work); - cl->cldev = cldev; +mei_cl_read_start (cldev->cl,0 ,NULL ); -dev_dbg (&cldev->dev,"client %s registered\n" , name); +return 0 ; +} +EXPORT_SYMBOL_GPL (mei_cl_register_event_cb); -return cldev; +/** +* mei_cl_get_drvdata - driver data getter +* +* @cldev: mei client device +* +* Return: driver private data +*/ +void *mei_cl_get_drvdata (const struct mei_cl_device *cldev) +{ +return dev_get_drvdata (&cldev->dev); } -EXPORT_SYMBOL_GPL (mei_cl_add_device); +EXPORT_SYMBOL_GPL (mei_cl_get_drvdata); -void mei_cl_remove_device (struct mei_cl_device *cldev) +/** +* mei_cl_set_drvdata - driver data setter +* +* @cldev: mei client device +* @data: data to store +*/ +void mei_cl_set_drvdata (struct mei_cl_device *cldev,void *data) { -device_unregister (&cldev->dev); +dev_set_drvdata (&cldev->dev, data); } -EXPORT_SYMBOL_GPL (mei_cl_remove_device); +EXPORT_SYMBOL_GPL (mei_cl_set_drvdata); -int __mei_cl_driver_register (struct mei_cl_driver *cldrv,struct module *owner) +/** +* mei_cl_enable_device - enable me client device +* create connection with me client +* +* @cldev: me client device +* +* Return: 0 on success and < 0 on error +*/ +int mei_cl_enable_device (struct mei_cl_device *cldev) {int err; +struct mei_device *bus; +struct mei_cl *cl = cldev->cl; - cldrv->driver.name = cldrv->name; - cldrv->driver.owner = owner; - cldrv->driver.bus = &mei_cl_bus_type; +if (cl ==NULL ) +return -ENODEV ; - err =driver_register (&cldrv->driver); -if (err) -return err; + bus = cl->dev; -pr_debug ("mei: driver [%s] registered\n" , cldrv->driver.name); +mutex_lock (&bus->device_lock); -return 0 ; -} -EXPORT_SYMBOL_GPL (__mei_cl_driver_register); +if (mei_cl_is_connected (cl)) { +mutex_unlock (&bus->device_lock); +dev_warn (bus->dev,"Already connected" ); +return -EBUSY ; + } -void mei_cl_driver_unregister (struct mei_cl_driver *cldrv) -{ -driver_unregister (&cldrv->driver); + err =mei_cl_connect (cl, cldev->me_cl,NULL ); +if (err <0 ) { +mutex_unlock (&bus->device_lock); +dev_err (bus->dev,"Could not connect to the ME client" ); -pr_debug ("mei: driver [%s] unregistered\n" , cldrv->driver.name); +return err; + } + +mutex_unlock (&bus->device_lock); + +if (cldev->event_cb) +mei_cl_read_start (cldev->cl,0 ,NULL ); + +return 0 ; } -EXPORT_SYMBOL_GPL (mei_cl_driver_unregister); +EXPORT_SYMBOL_GPL (mei_cl_enable_device); -ssize_t __mei_cl_send (struct mei_cl *cl,u8 *buf,size_t length, -bool blocking) +/** +* mei_cl_disable_device - disable me client device +* disconnect form the me client +* +* @cldev: me client device +* +* Return: 0 on success and < 0 on error +*/ +int mei_cl_disable_device (struct mei_cl_device *cldev) { +int err;struct mei_device *bus; -struct mei_cl_cb *cb =NULL ; -ssize_t rets; +struct mei_cl *cl = cldev->cl; -if (WARN_ON (!cl || !cl->dev)) +if (cl ==NULL )return -ENODEV ; bus = cl->dev; -mutex_lock (&bus->device_lock); -if (!mei_cl_is_connected (cl)) { - rets = -ENODEV ; - goto out; - } + cldev->event_cb =NULL ; -/* Check if we have an ME client device */ -if (!mei_me_cl_is_active (cl->me_cl)) { - rets = -ENOTTY ; - goto out; - } +mutex_lock (&bus->device_lock); -if (length >mei_cl_mtu (cl)) { - rets = -EFBIG ; +if (!mei_cl_is_connected (cl)) { +dev_err (bus->dev,"Already disconnected" ); + err =0 ; goto out; } - cb =mei_cl_alloc_cb (cl, length,MEI_FOP_WRITE ,NULL ); -if (!cb) { - rets = -ENOMEM ; + err =mei_cl_disconnect (cl); +if (err <0 ) { +dev_err (bus->dev,"Could not disconnect from the ME client" ); goto out; } -memcpy (cb->buf.data, buf, length); - - rets =mei_cl_write (cl, cb, blocking); +/* Flush queues and remove any pending read */ +mei_cl_flush_queues (cl,NULL ); out:mutex_unlock (&bus->device_lock); -if (rets <0 ) -mei_io_cb_free (cb); +return err; -return rets; } +EXPORT_SYMBOL_GPL (mei_cl_disable_device); -ssize_t __mei_cl_recv (struct mei_cl *cl,u8 *buf,size_t length) +static int mei_cl_device_match (struct device *dev,struct device_driver *drv) { -struct mei_device *bus; -struct mei_cl_cb *cb; -size_t r_length; -ssize_t rets; +struct mei_cl_device *cldev =to_mei_cl_device (dev); +struct mei_cl_driver *cldrv =to_mei_cl_driver (drv); +const struct mei_cl_device_id *id; +const uuid_le *uuid; +const char *name; -if (WARN_ON (!cl || !cl->dev)) -return -ENODEV ; +if (!cldev) +return 0 ; - bus = cl->dev; + uuid =mei_me_cl_uuid (cldev->me_cl); + name = cldev->name; -mutex_lock (&bus->device_lock); +if (!cldrv || !cldrv->id_table) +return 0 ; - cb =mei_cl_read_cb (cl,NULL ); -if (cb) - goto copy; + id = cldrv->id_table; - rets =mei_cl_read_start (cl, length,NULL ); -if (rets && rets != -EBUSY ) - goto out; +while (uuid_le_cmp (NULL_UUID_LE , id->uuid)) { -if (list_empty (&cl->rd_completed) && !waitqueue_active (&cl->rx_wait)) { +if (!uuid_le_cmp (*uuid, id->uuid)) { +if (id->name[0 ]) { +if (!strncmp (name, id->name,sizeof (id->name))) +return 1 ; + }else { +return 1 ; + } + } -mutex_unlock (&bus->device_lock); + id++; + } -if (wait_event_interruptible (cl->rx_wait, - (!list_empty (&cl->rd_completed)) || - (!mei_cl_is_connected (cl)))) { +return 0 ; +} -if (signal_pending (current)) -return -EINTR ; -return -ERESTARTSYS ; - } +static int mei_cl_device_probe (struct device *dev) +{ +struct mei_cl_device *cldev =to_mei_cl_device (dev); +struct mei_cl_driver *cldrv; +struct mei_cl_device_id id; -mutex_lock (&bus->device_lock); +if (!cldev) +return 0 ; -if (!mei_cl_is_connected (cl)) { - rets = -EBUSY ; - goto out; - } - } + cldrv =to_mei_cl_driver (dev->driver); +if (!cldrv || !cldrv->probe) +return -ENODEV ; + +dev_dbg (dev,"Device probe\n" ); + +strlcpy (id.name, cldev->name,sizeof (id.name)); + +return cldrv->probe (cldev, &id); +} - cb =mei_cl_read_cb (cl,NULL ); -if (!cb) { - rets =0 ; - goto out; - } +static int mei_cl_device_remove (struct device *dev) +{ +struct mei_cl_device *cldev =to_mei_cl_device (dev); +struct mei_cl_driver *cldrv; -copy: -if (cb->status) { - rets = cb->status; - goto free; +if (!cldev || !dev->driver) +return 0 ; + +if (cldev->event_cb) { + cldev->event_cb =NULL ; +cancel_work_sync (&cldev->event_work); } - r_length =min_t (size_t, length, cb->buf_idx); -memcpy (buf, cb->buf.data, r_length); - rets = r_length; + cldrv =to_mei_cl_driver (dev->driver); +if (!cldrv->remove) { + dev->driver =NULL ; -free: -mei_io_cb_free (cb); -out: -mutex_unlock (&bus->device_lock); +return 0 ; + } -return rets; +return cldrv->remove (cldev); } -ssize_t mei_cl_send (struct mei_cl_device *cldev,u8 *buf,size_t length) +static ssize_t name_show (struct device *dev,struct device_attribute *a, +char *buf) { -struct mei_cl *cl = cldev->cl; +struct mei_cl_device *cldev =to_mei_cl_device (dev); +size_t len; -if (cl ==NULL ) -return -ENODEV ; + len =snprintf (buf,PAGE_SIZE ,"%s" , cldev->name); -return __mei_cl_send (cl, buf, length,1 ); +return (len >=PAGE_SIZE ) ? (PAGE_SIZE -1 ) : len; } -EXPORT_SYMBOL_GPL (mei_cl_send); +static DEVICE_ATTR_RO (name); -ssize_t mei_cl_recv (struct mei_cl_device *cldev,u8 *buf,size_t length) +static ssize_t uuid_show (struct device *dev,struct device_attribute *a, +char *buf) { -struct mei_cl *cl = cldev->cl; +struct mei_cl_device *cldev =to_mei_cl_device (dev); +const uuid_le *uuid =mei_me_cl_uuid (cldev->me_cl); +size_t len; -if (cl ==NULL ) -return -ENODEV ; + len =snprintf (buf,PAGE_SIZE ,"%pUl" , uuid); -return __mei_cl_recv (cl, buf, length); +return (len >=PAGE_SIZE ) ? (PAGE_SIZE -1 ) : len; } -EXPORT_SYMBOL_GPL (mei_cl_recv); +static DEVICE_ATTR_RO (uuid); -static void mei_bus_event_work (struct work_struct *work) +static ssize_t modalias_show (struct device *dev,struct device_attribute *a, +char *buf) { -struct mei_cl_device *cldev; - - cldev = container_of(work, struct mei_cl_device, event_work); - -if (cldev->event_cb) - cldev->event_cb (cldev, cldev->events, cldev->event_context); +struct mei_cl_device *cldev =to_mei_cl_device (dev); +const uuid_le *uuid =mei_me_cl_uuid (cldev->me_cl); +size_t len; - cldev->events =0 ; + len =snprintf (buf,PAGE_SIZE ,"mei:%s:" MEI_CL_UUID_FMT ":" , + cldev->name,MEI_CL_UUID_ARGS (uuid->b)); -/* Prepare for the next read */ -mei_cl_read_start (cldev->cl,0 ,NULL ); +return (len >=PAGE_SIZE ) ? (PAGE_SIZE -1 ) : len; } +static DEVICE_ATTR_RO (modalias); -int mei_cl_register_event_cb (struct mei_cl_device *cldev, -mei_cl_event_cb_t event_cb,void *context) +static struct attribute *mei_cl_dev_attrs[] = { + &dev_attr_name.attr, + &dev_attr_uuid.attr, + &dev_attr_modalias.attr, +NULL , +}; +ATTRIBUTE_GROUPS (mei_cl_dev); + +static int mei_cl_uevent (struct device *dev,struct kobj_uevent_env *env) { -if (cldev->event_cb) -return -EALREADY ; +struct mei_cl_device *cldev =to_mei_cl_device (dev); +const uuid_le *uuid =mei_me_cl_uuid (cldev->me_cl); - cldev->events =0 ; - cldev->event_cb = event_cb; - cldev->event_context = context; -INIT_WORK (&cldev->event_work, mei_bus_event_work); +if (add_uevent_var (env,"MEI_CL_UUID=%pUl" , uuid)) +return -ENOMEM ; -mei_cl_read_start (cldev->cl,0 ,NULL ); +if (add_uevent_var (env,"MEI_CL_NAME=%s" , cldev->name)) +return -ENOMEM ; + +if (add_uevent_var (env,"MODALIAS=mei:%s:" MEI_CL_UUID_FMT ":" , + cldev->name,MEI_CL_UUID_ARGS (uuid->b))) +return -ENOMEM ;return 0 ; } -EXPORT_SYMBOL_GPL (mei_cl_register_event_cb); -void *mei_cl_get_drvdata (const struct mei_cl_device *cldev) +static struct bus_type mei_cl_bus_type = { + .name ="mei" , + .dev_groups = mei_cl_dev_groups, + .match = mei_cl_device_match, + .probe = mei_cl_device_probe, + .remove = mei_cl_device_remove, + .uevent = mei_cl_uevent, +}; + +static void mei_cl_dev_release (struct device *dev) { -return dev_get_drvdata (&cldev->dev); +struct mei_cl_device *cldev =to_mei_cl_device (dev); + +if (!cldev) +return ; + +mei_me_cl_put (cldev->me_cl); +kfree (cldev); } -EXPORT_SYMBOL_GPL (mei_cl_get_drvdata); -void mei_cl_set_drvdata (struct mei_cl_device *cldev,void *data) +static struct device_type mei_cl_device_type = { + .release = mei_cl_dev_release, +}; + +struct mei_cl *mei_cl_bus_find_cl_by_uuid (struct mei_device *bus, +uuid_le uuid) { -dev_set_drvdata (&cldev->dev, data); +struct mei_cl *cl; + +list_for_each_entry (cl, &bus->device_list, device_link) { +if (cl->cldev && cl->cldev->me_cl && + !uuid_le_cmp (uuid, *mei_me_cl_uuid (cl->cldev->me_cl))) +return cl; + } + +return NULL ; } -EXPORT_SYMBOL_GPL (mei_cl_set_drvdata); -int mei_cl_enable_device (struct mei_cl_device *cldev) +struct mei_cl_device *mei_cl_add_device (struct mei_device *bus, +struct mei_me_client *me_cl, +struct mei_cl *cl, +char *name) { -int err; -struct mei_device *bus; -struct mei_cl *cl = cldev->cl; +struct mei_cl_device *cldev; +int status; -if (cl ==NULL ) -return -ENODEV ; + cldev =kzalloc (sizeof (struct mei_cl_device ),GFP_KERNEL ); +if (!cldev) +return NULL ; - bus = cl->dev; + cldev->me_cl =mei_me_cl_get (me_cl); +if (!cldev->me_cl) { +kfree (cldev); +return NULL ; + } -mutex_lock (&bus->device_lock); + cldev->cl = cl; + cldev->dev.parent = bus->dev; + cldev->dev.bus = &mei_cl_bus_type; + cldev->dev.type = &mei_cl_device_type; -if (mei_cl_is_connected (cl)) { -mutex_unlock (&bus->device_lock); -dev_warn (bus->dev,"Already connected" ); -return -EBUSY ; - } +strlcpy (cldev->name, name,sizeof (cldev->name)); - err =mei_cl_connect (cl, cldev->me_cl,NULL ); -if (err <0 ) { -mutex_unlock (&bus->device_lock); -dev_err (bus->dev,"Could not connect to the ME client" ); +dev_set_name (&cldev->dev,"mei:%s:%pUl" , name,mei_me_cl_uuid (me_cl)); -return err; + status =device_register (&cldev->dev); +if (status) { +dev_err (bus->dev,"Failed to register MEI device\n" ); +mei_me_cl_put (cldev->me_cl); +kfree (cldev); +return NULL ; } -mutex_unlock (&bus->device_lock); + cl->cldev = cldev; -if (cldev->event_cb) -mei_cl_read_start (cldev->cl,0 ,NULL ); +dev_dbg (&cldev->dev,"client %s registered\n" , name); -return 0 ; +return cldev; } -EXPORT_SYMBOL_GPL (mei_cl_enable_device); +EXPORT_SYMBOL_GPL (mei_cl_add_device); -int mei_cl_disable_device (struct mei_cl_device *cldev) +void mei_cl_remove_device (struct mei_cl_device *cldev) { -int err; -struct mei_device *bus; -struct mei_cl *cl = cldev->cl; - -if (cl ==NULL ) -return -ENODEV ; - - bus = cl->dev; - - cldev->event_cb =NULL ; - -mutex_lock (&bus->device_lock); +device_unregister (&cldev->dev); +} +EXPORT_SYMBOL_GPL (mei_cl_remove_device); -if (!mei_cl_is_connected (cl)) { -dev_err (bus->dev,"Already disconnected" ); - err =0 ; - goto out; - } +int __mei_cl_driver_register (struct mei_cl_driver *cldrv,struct module *owner) +{ +int err; - err =mei_cl_disconnect (cl); -if (err <0 ) { -dev_err (bus->dev,"Could not disconnect from the ME client" ); - goto out; - } + cldrv->driver.name = cldrv->name; + cldrv->driver.owner = owner; + cldrv->driver.bus = &mei_cl_bus_type; -/* Flush queues and remove any pending read */ -mei_cl_flush_queues (cl,NULL ); + err =driver_register (&cldrv->driver); +if (err) +return err; -out: -mutex_unlock (&bus->device_lock); -return err; +pr_debug ("mei: driver [%s] registered\n" , cldrv->driver.name); +return 0 ; } -EXPORT_SYMBOL_GPL (mei_cl_disable_device); +EXPORT_SYMBOL_GPL (__mei_cl_driver_register); -void mei_cl_bus_rx_event (struct mei_cl *cl) +void mei_cl_driver_unregister (struct mei_cl_driver *cldrv) { -struct mei_cl_device *cldev = cl->cldev; - -if (!cldev || !cldev->event_cb) -return ; - -set_bit (MEI_CL_EVENT_RX , &cldev->events); +driver_unregister (&cldrv->driver); -schedule_work (&cldev->event_work); +pr_debug ("mei: driver [%s] unregistered\n" , cldrv->driver.name); } +EXPORT_SYMBOL_GPL (mei_cl_driver_unregister);void mei_cl_bus_remove_devices (struct mei_device *bus) {
Signature · 1 line
2.4.3
PATCH v2 4/15 mei: bus: rename uevent handler to mei_cl_device_uevent
In reply to Tomas WinklerRename mei_cl_uevent to mei_cl_device_uevent to match the naming convention of mei_cl_bus_type functions
--- drivers/misc/mei/bus.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/misc/mei/bus.c +10 -2
@@ -509,7 +509,15 @@ static struct attribute *mei_cl_dev_attrs[] = { };ATTRIBUTE_GROUPS (mei_cl_dev); -static int mei_cl_uevent (struct device *dev,struct kobj_uevent_env *env) +/** +* mei_cl_device_uevent - me client bus uevent handler +* +* @dev: device +* @env: uevent kobject +* +* Return: 0 on success -ENOMEM on when add_uevent_var fails +*/ +static int mei_cl_device_uevent (struct device *dev,struct kobj_uevent_env *env) {struct mei_cl_device *cldev =to_mei_cl_device (dev);const uuid_le *uuid =mei_me_cl_uuid (cldev->me_cl);
@@ -533,7 +541,7 @@ static struct bus_type mei_cl_bus_type = { .match = mei_cl_device_match, .probe = mei_cl_device_probe, .remove = mei_cl_device_remove, - .uevent = mei_cl_uevent, + .uevent = mei_cl_device_uevent, };static void mei_cl_dev_release (struct device *dev)
Signature · 1 line
2.4.3
PATCH v2 5/15 mei: bus: don't enable events implicitly in device enable
In reply to Tomas WinklerDo not enable events implicitly in mei_cl_enable_device, it should be done explicitly using mei_cl_register_event_cb so the events are enabled only when needed.
The NFC drivers has been already using it that way so no need for further changes just remove the code from mei_cl_enable_device.
---
V2: fix the commit message
drivers/misc/mei/bus.c | 3 --- 1 file changed, 3 deletions(-)
drivers/misc/mei/bus.c +0 -3
@@ -331,9 +331,6 @@ int mei_cl_enable_device(struct mei_cl_device *cldev)mutex_unlock (&bus->device_lock); -if (cldev->event_cb) -mei_cl_read_start (cldev->cl,0 ,NULL ); -return 0 ; }EXPORT_SYMBOL_GPL (mei_cl_enable_device);
Signature · 1 line
2.4.3
PATCH v2 6/15 mei: bus: report if event registration failed
In reply to Tomas WinklerIf event registeration has failed, the caller should know about it.
---
V2: fix the commit message
drivers/misc/mei/bus.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/misc/mei/bus.c +5 -1
@@ -255,6 +255,8 @@ void mei_cl_bus_rx_event(struct mei_cl *cl)int mei_cl_register_event_cb (struct mei_cl_device *cldev,mei_cl_event_cb_t event_cb,void *context) { +int ret; +if (cldev->event_cb)return -EALREADY ;
@@ -263,7 +265,9 @@ int mei_cl_register_event_cb(struct mei_cl_device *cldev, cldev->event_context = context;INIT_WORK (&cldev->event_work, mei_bus_event_work); -mei_cl_read_start (cldev->cl,0 ,NULL ); + ret =mei_cl_read_start (cldev->cl,0 ,NULL ); +if (ret && ret != -EBUSY ) +return ret;return 0 ; }
Signature · 1 line
2.4.3
PATCH v2 7/15 mei: bus: revamp device matching
In reply to Tomas Winklermei_cl_device_match now calls mei_cl_device_find that returns the matching device id in the device id table.
We will utilize the mei_cl_device_find during probing to locate the matching entry.
---
V2: fix the commit message
drivers/misc/mei/bus.c | 63 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 19 deletions(-)
drivers/misc/mei/bus.c +44 -19
@@ -384,39 +384,64 @@ out: }EXPORT_SYMBOL_GPL (mei_cl_disable_device); -static int mei_cl_device_match (struct device *dev,struct device_driver *drv) +/** +* mei_cl_device_find - find matching entry in the driver id table +* +* @cldev: me client device +* @cldrv: me client driver +* +* Return: id on success; NULL if no id is matching +*/ +static const +struct mei_cl_device_id *mei_cl_device_find (struct mei_cl_device *cldev, +struct mei_cl_driver *cldrv) { -struct mei_cl_device *cldev =to_mei_cl_device (dev); -struct mei_cl_driver *cldrv =to_mei_cl_driver (drv);const struct mei_cl_device_id *id;const uuid_le *uuid; -const char *name; - -if (!cldev) -return 0 ; uuid =mei_me_cl_uuid (cldev->me_cl); - name = cldev->name; - -if (!cldrv || !cldrv->id_table) -return 0 ; id = cldrv->id_table; -while (uuid_le_cmp (NULL_UUID_LE , id->uuid)) { -if (!uuid_le_cmp (*uuid, id->uuid)) { -if (id->name[0 ]) { -if (!strncmp (name, id->name,sizeof (id->name))) -return 1 ; - }else { -return 1 ; - } + +if (!cldev->name[0 ]) +return id; + +if (!strncmp (cldev->name, id->name,sizeof (id->name))) +return id; } id++; } +return NULL ; +} + +/** +* mei_cl_device_match - device match function +* +* @dev: device +* @drv: driver +* +* Return: 1 if matching device was found 0 otherwise +*/ +static int mei_cl_device_match (struct device *dev,struct device_driver *drv) +{ +struct mei_cl_device *cldev =to_mei_cl_device (dev); +struct mei_cl_driver *cldrv =to_mei_cl_driver (drv); +const struct mei_cl_device_id *found_id; + +if (!cldev) +return 0 ; + +if (!cldrv || !cldrv->id_table) +return 0 ; + + found_id =mei_cl_device_find (cldev, cldrv); +if (found_id) +return 1 ; +return 0 ; }
Signature · 1 line
2.4.3
PATCH v2 8/15 mei: bus: revamp probe and remove functions
In reply to Tomas WinklerInstead of generating device id on the fly during probing we find the matching id entry on the device id table. Get bus the module reference counter so it cannot be unloaded after the driver has bounded to the client device
---
V2: Resend
drivers/misc/mei/bus.c | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-)
drivers/misc/mei/bus.c +30 -11
@@ -445,30 +445,49 @@ static int mei_cl_device_match(struct device *dev, struct device_driver *drv)return 0 ; } +/** +* mei_cl_device_probe - bus probe function +* +* @dev: device +* +* Return: 0 on success; < 0 otherwise +*/ static int mei_cl_device_probe (struct device *dev) { -struct mei_cl_device *cldev =to_mei_cl_device (dev); +struct mei_cl_device *cldev;struct mei_cl_driver *cldrv; -struct mei_cl_device_id id; +const struct mei_cl_device_id *id; + + cldev =to_mei_cl_device (dev); + cldrv =to_mei_cl_driver (dev->driver);if (!cldev)return 0 ; - cldrv =to_mei_cl_driver (dev->driver);if (!cldrv || !cldrv->probe)return -ENODEV ; -dev_dbg (dev,"Device probe\n" ); + id =mei_cl_device_find (cldev, cldrv); +if (!id) +return -ENODEV ; -strlcpy (id.name, cldev->name,sizeof (id.name)); +__module_get (THIS_MODULE ); -return cldrv->probe (cldev, &id); +return cldrv->probe (cldev, id); } +/** +* mei_cl_device_remove - remove device from the bus +* +* @dev: device +* +* Return: 0 on success; < 0 otherwise +*/ static int mei_cl_device_remove (struct device *dev) {struct mei_cl_device *cldev =to_mei_cl_device (dev);struct mei_cl_driver *cldrv; +int ret =0 ;if (!cldev || !dev->driver)return 0 ;
@@ -479,13 +498,13 @@ static int mei_cl_device_remove(struct device *dev) } cldrv =to_mei_cl_driver (dev->driver); -if (!cldrv->remove) { - dev->driver =NULL ; +if (cldrv->remove) + ret = cldrv->remove (cldev); -return 0 ; - } +module_put (THIS_MODULE ); + dev->driver =NULL ; +return ret; -return cldrv->remove (cldev); } static ssize_t name_show(struct device *dev, struct device_attribute *a,
Signature · 1 line
2.4.3
PATCH v2 9/15 mei: bus: add reference to bus device in struct mei_cl_client
In reply to Tomas WinklerAdd reference to the bus device (mei_device) for easier access. To ensures that referencing cldev->bus is valid during cldev life time we increase the bus ref counter on a client device creation and drop it on the device release.
---
V2: resend
drivers/misc/mei/bus.c | 17 +++++++++++++++++ include/linux/mei_cl_bus.h | 3 +++ 2 files changed, 20 insertions(+)
drivers/misc/mei/bus.c +17 -0
@@ -589,6 +589,20 @@ static struct bus_type mei_cl_bus_type = { .uevent = mei_cl_device_uevent, }; +static struct mei_device *mei_dev_bus_get (struct mei_device *bus) +{ +if (bus) +get_device (bus->dev); + +return bus; +} + +static void mei_dev_bus_put (struct mei_device *bus) +{ +if (bus) +put_device (bus->dev); +} +static void mei_cl_dev_release (struct device *dev) {struct mei_cl_device *cldev =to_mei_cl_device (dev);
@@ -597,6 +611,7 @@ static void mei_cl_dev_release(struct device *dev)return ;mei_me_cl_put (cldev->me_cl); +mei_dev_bus_put (cldev->bus);kfree (cldev); }
@@ -640,6 +655,7 @@ struct mei_cl_device *mei_cl_add_device(struct mei_device *bus, cldev->dev.parent = bus->dev; cldev->dev.bus = &mei_cl_bus_type; cldev->dev.type = &mei_cl_device_type; + cldev->bus =mei_dev_bus_get (bus);strlcpy (cldev->name, name,sizeof (cldev->name));
@@ -649,6 +665,7 @@ struct mei_cl_device *mei_cl_add_device(struct mei_device *bus,if (status) {dev_err (bus->dev,"Failed to register MEI device\n" );mei_me_cl_put (cldev->me_cl); +mei_dev_bus_put (bus);kfree (cldev);return NULL ; }
include/linux/mei_cl_bus.h +3 -0
@@ -6,6 +6,7 @@#include <linux/mod_devicetable.h> struct mei_cl_device ; +struct mei_device ;typedef void (*mei_cl_event_cb_t )(struct mei_cl_device *device,u32 events,void *context);
@@ -17,6 +18,7 @@ typedef void (*mei_cl_event_cb_t)(struct mei_cl_device *device,* Drivers for MEI devices will get an mei_cl_device pointer * when being probed and shall use it for doing ME bus I/O. * +* @bus: parent mei device * @dev: linux driver model device pointer * @me_cl: me client * @cl: mei client
@@ -29,6 +31,7 @@ typedef void (*mei_cl_event_cb_t)(struct mei_cl_device *device,* @priv_data: client private data */ struct mei_cl_device { +struct mei_device *bus;struct device dev;struct mei_me_client *me_cl;
Signature · 1 line
2.4.3
PATCH v2 10/15 mei: bus: add me client device list infrastructure
In reply to Tomas WinklerInstead of holding the list of host clients (me_cl)
we want to keep the list me client devices (mei_cl_device) This way we can create host to me client connection only when needed. Add list head to mei_cl_device and cl_bus_lock
Add bus_added flag to the me client (mei_me_client) to track if the appropriate mei_cl_device was already created and is_added flag to mei_cl_device to track if it was already added to the device list across the bus rescans
---
V2: Resend
drivers/misc/mei/bus.c | 1 + drivers/misc/mei/init.c | 1 + drivers/misc/mei/mei_dev.h | 6 ++++-- include/linux/mei_cl_bus.h | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-)
drivers/misc/mei/bus.c +1 -0
@@ -656,6 +656,7 @@ struct mei_cl_device *mei_cl_add_device(struct mei_device *bus, cldev->dev.bus = &mei_cl_bus_type; cldev->dev.type = &mei_cl_device_type; cldev->bus =mei_dev_bus_get (bus); +INIT_LIST_HEAD (&cldev->bus_list);strlcpy (cldev->name, name,sizeof (cldev->name));
drivers/misc/mei/init.c +1 -0
@@ -392,6 +392,7 @@ void mei_device_init(struct mei_device *dev,INIT_LIST_HEAD (&dev->me_clients);mutex_init (&dev->device_lock);init_rwsem (&dev->me_clients_rwsem); +mutex_init (&dev->cl_bus_lock);init_waitqueue_head (&dev->wait_hw_ready);init_waitqueue_head (&dev->wait_pg);init_waitqueue_head (&dev->wait_hbm_start);
drivers/misc/mei/mei_dev.h +4 -2
@@ -178,7 +178,7 @@ struct mei_fw_status {* @client_id: me client id * @mei_flow_ctrl_creds: flow control credits * @connect_count: number connections to this client -* @reserved: reserved +* @bus_added: added to bus */ struct mei_me_client {struct list_head list;
@@ -187,7 +187,7 @@ struct mei_me_client {u8 client_id;u8 mei_flow_ctrl_creds;u8 connect_count; -u8 reserved; +u8 bus_added; };
@@ -447,6 +447,7 @@ const char *mei_pg_state_str(enum mei_pg_state state);* @reset_work : work item for the device reset * * @device_list : mei client bus list +* @cl_bus_lock : client bus list lock * * @dbgfs_dir : debugfs mei root directory *
@@ -543,6 +544,7 @@ struct mei_device {/* List of bus devices */ struct list_head device_list; +struct mutex cl_bus_lock;#if IS_ENABLED (CONFIG_DEBUG_FS )struct dentry *dbgfs_dir;
include/linux/mei_cl_bus.h +4 -0
@@ -18,6 +18,7 @@ typedef void (*mei_cl_event_cb_t)(struct mei_cl_device *device,* Drivers for MEI devices will get an mei_cl_device pointer * when being probed and shall use it for doing ME bus I/O. * +* @bus_list: device on the bus list * @bus: parent mei device * @dev: linux driver model device pointer * @me_cl: me client
@@ -28,9 +29,11 @@ typedef void (*mei_cl_event_cb_t)(struct mei_cl_device *device,* events (e.g. Rx buffer pending) notifications. * @event_context: event callback run context * @events: Events bitmask sent to the driver. +* @is_added: device is already scanned * @priv_data: client private data */ struct mei_cl_device { +struct list_head bus_list;struct mei_device *bus;struct device dev;
@@ -42,6 +45,7 @@ struct mei_cl_device {mei_cl_event_cb_t event_cb;void *event_context;unsigned long events; + unsigned int is_added:1;void *priv_data; };
Signature · 1 line
2.4.3
PATCH v2 11/15 mei: bus: enable running fixup routines before device registration
In reply to Tomas WinklerSplit the device registration into allocation and device struct initialization, device setup, and the final device registration. This why it is possible to run fixups and quirks during the setup stage on an initialized device. Each fixup routine effects do_match flag. If the flag is set to false at the end the device won't be registered on the bus.
---
V2: fix the commit message
drivers/misc/mei/bus-fixup.c | 30 +++++++++++++++ drivers/misc/mei/bus.c | 91 ++++++++++++++++++++++++++++++++++++-------- drivers/misc/mei/mei_dev.h | 2 +- include/linux/mei_cl_bus.h | 4 ++ 4 files changed, 111 insertions(+), 16 deletions(-)
drivers/misc/mei/bus-fixup.c +30 -0
@@ -20,12 +20,15 @@#include <linux/moduleparam.h> #include <linux/device.h> #include <linux/slab.h> +#include <linux/uuid.h> #include <linux/mei_cl_bus.h> #include "mei_dev.h" #include "client.h" +#define MEI_UUID_ANY NULL_UUID_LE +struct mei_nfc_cmd {u8 command;u8 status;
@@ -411,4 +414,31 @@ void mei_nfc_host_exit(struct mei_device *bus)mutex_unlock (&bus->device_lock); } +#define MEI_FIXUP (_uuid, _hook) { _uuid, _hook } + +static struct mei_fixup { + +const uuid_le uuid; +void (*hook)(struct mei_cl_device *cldev); +} mei_fixups[] = {}; + +/** +* mei_cl_dev_fixup - run fixup handlers +* +* @cldev: me client device +*/ +void mei_cl_dev_fixup (struct mei_cl_device *cldev) +{ +struct mei_fixup *f; +const uuid_le *uuid =mei_me_cl_uuid (cldev->me_cl); +int i; + +for (i =0 ; i <ARRAY_SIZE (mei_fixups); i++) { + + f = &mei_fixups[i]; +if (uuid_le_cmp (f->uuid,MEI_UUID_ANY ) ==0 || +uuid_le_cmp (f->uuid, *uuid) ==0 ) + f->hook (cldev); + } +}
drivers/misc/mei/bus.c +76 -15
116 lines not on this page · raw message
drivers/misc/mei/mei_dev.h +1 -1
@@ -335,7 +335,7 @@ struct mei_cl_device *mei_cl_add_device(struct mei_device *bus,struct mei_cl *cl, char *name);void mei_cl_remove_device (struct mei_cl_device *cldev); - +void mei_cl_dev_fixup (struct mei_cl_device *dev);ssize_t __mei_cl_send (struct mei_cl *cl,u8 *buf,size_t length,bool blocking);ssize_t __mei_cl_recv (struct mei_cl *cl,u8 *buf,size_t length);
include/linux/mei_cl_bus.h +4 -0
@@ -29,6 +29,8 @@ typedef void (*mei_cl_event_cb_t)(struct mei_cl_device *device,* events (e.g. Rx buffer pending) notifications. * @event_context: event callback run context * @events: Events bitmask sent to the driver. +* +* @do_match: wheather device can be matched with a driver * @is_added: device is already scanned * @priv_data: client private data */
@@ -45,6 +47,8 @@ struct mei_cl_device {mei_cl_event_cb_t event_cb;void *event_context;unsigned long events; + + unsigned int do_match:1; unsigned int is_added:1;void *priv_data;
Signature · 1 line
2.4.3
PATCH v2 12/15 mei: bus: blacklist the nfc info client
In reply to Tomas WinklerBlacklist nfc info client which is only used for retrieval of the NFC radio version
--- drivers/misc/mei/bus-fixup.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
drivers/misc/mei/bus-fixup.c +19 -4
@@ -27,8 +27,23 @@#include "mei_dev.h" #include "client.h" +#define MEI_UUID_NFC_INFO UUID_LE(0xd2de1625, 0x382d, 0x417d, \ + 0x48, 0xa4, 0xef, 0xab, 0xba, 0x8a, 0x12, 0x06) +#define MEI_UUID_ANY NULL_UUID_LE +/** +* blacklist - blacklist a client from the bus +* +* @cldev: me clients device +*/ +static void blacklist (struct mei_cl_device *cldev) +{ +dev_dbg (&cldev->dev,"running hook %s on %pUl\n" , + __func__,mei_me_cl_uuid (cldev->me_cl)); + cldev->do_match =0 ; +} +struct mei_nfc_cmd {u8 command;u8 status;
@@ -120,9 +135,7 @@ const uuid_le mei_nfc_guid = UUID_LE(0x0bb17a78, 0x2a8e, 0x4c50,0x94 ,0xd4 ,0x50 ,0x26 , 0x67, 0x23, 0x77, 0x5c); -static const uuid_le mei_nfc_info_guid =UUID_LE (0xd2de1625 ,0x382d ,0x417d , -0x48 ,0xa4 ,0xef ,0xab , -0xba ,0x8a ,0x12 ,0x06 ); +static const uuid_le mei_nfc_info_guid =MEI_UUID_NFC_INFO ;/* Vendors */ #define MEI_NFC_VENDOR_INSIDE 0x00
@@ -420,7 +433,9 @@ static struct mei_fixup {const uuid_le uuid;void (*hook)(struct mei_cl_device *cldev); -} mei_fixups[] = {}; +} mei_fixups[] = { + MEI_FIXUP(MEI_UUID_NFC_INFO, blacklist), +};/** * mei_cl_dev_fixup - run fixup handlers
Signature · 1 line
2.4.3
PATCH v2 13/15 mei: bus: blacklist clients by number of connections
In reply to Tomas WinklerCurrently we support only clients with single connection and fixed address clients so all other clients are blacklisted
--- drivers/misc/mei/bus-fixup.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/misc/mei/bus-fixup.c +19 -0
@@ -33,6 +33,24 @@#define MEI_UUID_ANY NULL_UUID_LE/** +* number_of_connections - determine whether an client be on the bus +* according number of connections +* We support only clients: +* 1. with single connection +* 2. and fixed clients (max_number_of_connections == 0) +* +* @cldev: me clients device +*/ +static void number_of_connections (struct mei_cl_device *cldev) +{ +dev_dbg (&cldev->dev,"running hook %s on %pUl\n" , + __func__,mei_me_cl_uuid (cldev->me_cl)); + +if (cldev->me_cl->props.max_number_of_connections >1 ) + cldev->do_match =0 ; +} + +/** * blacklist - blacklist a client from the bus * * @cldev: me clients device
@@ -434,6 +452,7 @@ static struct mei_fixup {const uuid_le uuid;void (*hook)(struct mei_cl_device *cldev); } mei_fixups[] = { +MEI_FIXUP (MEI_UUID_ANY , number_of_connections), MEI_FIXUP(MEI_UUID_NFC_INFO, blacklist), };
Signature · 1 line
2.4.3
PATCH v2 14/15 mei: bus: simplify how we build nfc bus name
In reply to Tomas WinklerRemove the dependency on struct ndev from the nfc device name creation function so it is possible to use it in a fixup routine
---
V2: Fix the commit message
drivers/misc/mei/bus-fixup.c | 115 ++++++++++++++++++++----------------------- drivers/misc/mei/bus.c | 2 +- drivers/misc/mei/mei_dev.h | 2 +- 3 files changed, 55 insertions(+), 64 deletions(-)
drivers/misc/mei/bus-fixup.c +53 -62
@@ -145,7 +145,7 @@ struct mei_nfc_dev {u8 fw_ivn;u8 vendor_id;u8 radio_type; -char *bus_name; +const char *bus_name; };/* UUIDs for NFC F/W clients */
@@ -184,69 +184,30 @@ static void mei_nfc_free(struct mei_nfc_dev *ndev)kfree (ndev); } -static int mei_nfc_build_bus_name (struct mei_nfc_dev *ndev) -{ -struct mei_device *bus; - -if (!ndev->cl) -return -ENODEV ; - - bus = ndev->cl->dev; - -switch (ndev->vendor_id) { -case MEI_NFC_VENDOR_INSIDE : -switch (ndev->radio_type) { -case MEI_NFC_VENDOR_INSIDE_UREAD : - ndev->bus_name ="microread" ; -return 0 ; - -default : -dev_err (bus->dev,"Unknown radio type 0x%x\n" , - ndev->radio_type); - -return -EINVAL ; - } - -case MEI_NFC_VENDOR_NXP : -switch (ndev->radio_type) { -case MEI_NFC_VENDOR_NXP_PN544 : - ndev->bus_name ="pn544" ; -return 0 ; -default : -dev_err (bus->dev,"Unknown radio type 0x%x\n" , - ndev->radio_type); - -return -EINVAL ; - } - -default : -dev_err (bus->dev,"Unknown vendor ID 0x%x\n" , - ndev->vendor_id); - -return -EINVAL ; - } - -return 0 ; -} - -static int mei_nfc_if_version (struct mei_nfc_dev *ndev) +/** +* mei_nfc_if_version - get NFC interface version +* +* @cl: host client (nfc info) +* @ver: NFC interface version to be filled in +* +* Return: 0 on success; < 0 otherwise +*/ +static int mei_nfc_if_version (struct mei_cl *cl, +struct mei_nfc_if_version *ver) {struct mei_device *bus; -struct mei_cl *cl; - -struct mei_nfc_cmd cmd; +struct mei_nfc_cmd cmd = { + .command =MEI_NFC_CMD_MAINTENANCE , + .data_size =1 , + .sub_command =MEI_NFC_SUBCMD_IF_VERSION , + };struct mei_nfc_reply *reply =NULL ; -struct mei_nfc_if_version *version;size_t if_version_length;int bytes_recv, ret; - cl = ndev->cl_info; bus = cl->dev; -memset (&cmd,0 ,sizeof (struct mei_nfc_cmd )); - cmd.command =MEI_NFC_CMD_MAINTENANCE ; - cmd.data_size =1 ; - cmd.sub_command =MEI_NFC_SUBCMD_IF_VERSION ; +WARN_ON (mutex_is_locked (&bus->device_lock)); ret =__mei_cl_send (cl, (u8 *)&cmd,sizeof (struct mei_nfc_cmd ),1 );if (ret <0 ) {
@@ -262,6 +223,7 @@ static int mei_nfc_if_version(struct mei_nfc_dev *ndev)if (!reply)return -ENOMEM ; + ret =0 ; bytes_recv =__mei_cl_recv (cl, (u8 *)reply, if_version_length);if (bytes_recv <0 || bytes_recv <sizeof (struct mei_nfc_reply )) {dev_err (bus->dev,"Could not read IF version\n" );
@@ -269,17 +231,39 @@ static int mei_nfc_if_version(struct mei_nfc_dev *ndev) goto err; } - version = (struct mei_nfc_if_version *)reply->data; +memcpy (ver, reply->data,sizeof (struct mei_nfc_if_version )); - ndev->fw_ivn = version->fw_ivn; - ndev->vendor_id = version->vendor_id; - ndev->radio_type = version->radio_type; +dev_info (bus->dev,"NFC MEI VERSION: IVN 0x%x Vendor ID 0x%x Type 0x%x\n" , + ver->fw_ivn, ver->vendor_id, ver->radio_type); err:kfree (reply);return ret; } +/** +* mei_nfc_radio_name - derive nfc radio name from the interface version +* +* @ver: NFC radio version +* +* Return: radio name string +*/ +static const char *mei_nfc_radio_name (struct mei_nfc_if_version *ver) +{ + +if (ver->vendor_id ==MEI_NFC_VENDOR_INSIDE ) { +if (ver->radio_type ==MEI_NFC_VENDOR_INSIDE_UREAD ) +return "microread" ; + } + +if (ver->vendor_id ==MEI_NFC_VENDOR_NXP ) { +if (ver->radio_type ==MEI_NFC_VENDOR_NXP_PN544 ) +return "pn544" ; + } + +return NULL ; +} +static void mei_nfc_init (struct work_struct *work) {struct mei_device *bus;
@@ -287,6 +271,7 @@ static void mei_nfc_init(struct work_struct *work)struct mei_nfc_dev *ndev;struct mei_cl *cl_info;struct mei_me_client *me_cl_info; +struct mei_nfc_if_version version; ndev = container_of(work, struct mei_nfc_dev, init_work);
@@ -313,12 +298,16 @@ static void mei_nfc_init(struct work_struct *work)mei_me_cl_put (me_cl_info);mutex_unlock (&bus->device_lock); -if (mei_nfc_if_version (ndev) <0 ) { +if (mei_nfc_if_version (cl_info, &version) <0 ) {dev_err (bus->dev,"Could not get the NFC interface version" ); goto err; } + ndev->fw_ivn = version.fw_ivn; + ndev->vendor_id = version.vendor_id; + ndev->radio_type = version.radio_type; +dev_info (bus->dev,"NFC MEI VERSION: IVN 0x%x Vendor ID 0x%x Type 0x%x\n" , ndev->fw_ivn, ndev->vendor_id, ndev->radio_type);
@@ -333,7 +322,9 @@ static void mei_nfc_init(struct work_struct *work)mutex_unlock (&bus->device_lock); -if (mei_nfc_build_bus_name (ndev) <0 ) { + ndev->bus_name =mei_nfc_radio_name (&version); + +if (!ndev->bus_name) {dev_err (bus->dev,"Could not build the bus ID name\n" );return ; }
drivers/misc/mei/bus.c +1 -1
@@ -709,7 +709,7 @@ static int mei_cl_bus_dev_add(struct mei_cl_device *cldev)struct mei_cl_device *mei_cl_add_device (struct mei_device *bus,struct mei_me_client *me_cl,struct mei_cl *cl, -char *name) +const char *name) {struct mei_cl_device *cldev;int status;
drivers/misc/mei/mei_dev.h +1 -1
@@ -333,7 +333,7 @@ struct mei_hw_ops {struct mei_cl_device *mei_cl_add_device (struct mei_device *bus,struct mei_me_client *me_cl,struct mei_cl *cl, -char *name); +const char *name);void mei_cl_remove_device (struct mei_cl_device *cldev);void mei_cl_dev_fixup (struct mei_cl_device *dev); ssize_t __mei_cl_send(struct mei_cl *cl, u8 *buf, size_t length,
Signature · 1 line
2.4.3
PATCH v2 15/15 mei: bus: link client devices instead of host clients
In reply to Tomas WinklerMEI bus was designed around nfc and was hard to extend. Instead of the hard coded way of adding the devices on the mei bus we scan the whole me client list and create a device for each eligible me client (mei_cl_bus_rescan); currently we support only clients with single connection and fixed address clients. NFC radio name detection is run as a fixup routine
The patch replaces handling the device list based on struct me_cl to device list based on me_cl_devices. The creating a connection is pushed from the device creation time to device enablement.
---
V2: Resend
drivers/misc/mei/bus-fixup.c | 287 ++++++++++--------------------------------- drivers/misc/mei/bus.c | 225 +++++++++++++++++++++------------ drivers/misc/mei/client.c | 9 +- drivers/misc/mei/init.c | 2 - drivers/misc/mei/mei_dev.h | 11 +- 5 files changed, 209 insertions(+), 325 deletions(-)
drivers/misc/mei/bus-fixup.c +62 -225
@@ -30,6 +30,11 @@#define MEI_UUID_NFC_INFO UUID_LE(0xd2de1625, 0x382d, 0x417d, \ 0x48, 0xa4, 0xef, 0xab, 0xba, 0x8a, 0x12, 0x06) +static const uuid_le mei_nfc_info_guid =MEI_UUID_NFC_INFO ; + +#define MEI_UUID_NFC_HCI UUID_LE(0x0bb17a78, 0x2a8e, 0x4c50, \ + 0x94, 0xd4, 0x50, 0x26, 0x67, 0x23, 0x77, 0x5c) +#define MEI_UUID_ANY NULL_UUID_LE/**
@@ -93,68 +98,10 @@ struct mei_nfc_if_version {u8 radio_type; } __packed; -struct mei_nfc_connect { -u8 fw_ivn; -u8 vendor_id; -} __packed; - -struct mei_nfc_connect_resp { -u8 fw_ivn; -u8 vendor_id; -u16 me_major; -u16 me_minor; -u16 me_hotfix; -u16 me_build; -} __packed; - -struct mei_nfc_hci_hdr { -u8 cmd; -u8 status; -u16 req_id; -u32 reserved; -u16 data_size; -} __packed;#define MEI_NFC_CMD_MAINTENANCE 0x00 -#define MEI_NFC_CMD_HCI_SEND 0x01 -#define MEI_NFC_CMD_HCI_RECV 0x02 - -#define MEI_NFC_SUBCMD_CONNECT 0x00#define MEI_NFC_SUBCMD_IF_VERSION 0x01 -#define MEI_NFC_HEADER_SIZE 10 - -/** -* struct mei_nfc_dev - NFC mei device -* -* @me_cl: NFC me client -* @cl: NFC host client -* @cl_info: NFC info host client -* @init_work: perform connection to the info client -* @fw_ivn: NFC Interface Version Number -* @vendor_id: NFC manufacturer ID -* @radio_type: NFC radio type -* @bus_name: bus name -* -*/ -struct mei_nfc_dev { -struct mei_me_client *me_cl; -struct mei_cl *cl; -struct mei_cl *cl_info; -struct work_struct init_work; -u8 fw_ivn; -u8 vendor_id; -u8 radio_type; -const char *bus_name; -}; - -/* UUIDs for NFC F/W clients */ -const uuid_le mei_nfc_guid =UUID_LE (0x0bb17a78 ,0x2a8e ,0x4c50 , -0x94 ,0xd4 ,0x50 ,0x26 , -0x67 ,0x23 ,0x77 ,0x5c ); - -static const uuid_le mei_nfc_info_guid =MEI_UUID_NFC_INFO ; -/* Vendors */ #define MEI_NFC_VENDOR_INSIDE 0x00#define MEI_NFC_VENDOR_NXP 0x01
@@ -163,27 +110,6 @@ static const uuid_le mei_nfc_info_guid = MEI_UUID_NFC_INFO;#define MEI_NFC_VENDOR_INSIDE_UREAD 0x00#define MEI_NFC_VENDOR_NXP_PN544 0x01 -static void mei_nfc_free (struct mei_nfc_dev *ndev) -{ -if (!ndev) -return ; - -if (ndev->cl) { -list_del (&ndev->cl->device_link); -mei_cl_unlink (ndev->cl); -kfree (ndev->cl); - } - -if (ndev->cl_info) { -list_del (&ndev->cl_info->device_link); -mei_cl_unlink (ndev->cl_info); -kfree (ndev->cl_info); - } - -mei_me_cl_put (ndev->me_cl); -kfree (ndev); -} -/** * mei_nfc_if_version - get NFC interface version *
@@ -264,176 +190,86 @@ static const char *mei_nfc_radio_name(struct mei_nfc_if_version *ver)return NULL ; } -static void mei_nfc_init (struct work_struct *work) +/** +* mei_nfc - The nfc fixup function. The function retrieves nfc radio +* name and set is as device attribute so we can load +* the proper device driver for it +* +* @cldev: me client device (nfc) +*/ +static void mei_nfc (struct mei_cl_device *cldev) {struct mei_device *bus; -struct mei_cl_device *cldev; -struct mei_nfc_dev *ndev; -struct mei_cl *cl_info; -struct mei_me_client *me_cl_info; -struct mei_nfc_if_version version; +struct mei_cl *cl; +struct mei_me_client *me_cl =NULL ; +struct mei_nfc_if_version ver; +const char *radio_name =NULL ; +int ret; - ndev = container_of(work, struct mei_nfc_dev, init_work); + bus = cldev->bus; - cl_info = ndev->cl_info; - bus = cl_info->dev; +dev_dbg (bus->dev,"running hook %s: %pUl match=%d\n" , + __func__,mei_me_cl_uuid (cldev->me_cl), cldev->do_match);mutex_lock (&bus->device_lock); - -/* check for valid client id */ - me_cl_info =mei_me_cl_by_uuid (bus, &mei_nfc_info_guid); -if (!me_cl_info) { -mutex_unlock (&bus->device_lock); -dev_info (bus->dev,"nfc: failed to find the info client\n" ); - goto err; - } - -if (mei_cl_connect (cl_info, me_cl_info,NULL ) <0 ) { -mei_me_cl_put (me_cl_info); -mutex_unlock (&bus->device_lock); -dev_err (bus->dev,"Could not connect to the NFC INFO ME client" ); - - goto err; +/* we need to connect to INFO GUID */ + cl =mei_cl_alloc_linked (bus,MEI_HOST_CLIENT_ID_ANY ); +if (IS_ERR (cl)) { + ret =PTR_ERR (cl); + cl =NULL ; +dev_err (bus->dev,"nfc hook alloc failed %d\n" , ret); + goto out; } -mei_me_cl_put (me_cl_info); -mutex_unlock (&bus->device_lock); -if (mei_nfc_if_version (cl_info, &version) <0 ) { -dev_err (bus->dev,"Could not get the NFC interface version" ); - - goto err; + me_cl =mei_me_cl_by_uuid (bus, &mei_nfc_info_guid); +if (!me_cl) { + ret = -ENOTTY ; +dev_err (bus->dev,"Cannot find nfc info %d\n" , ret); + goto out; } - ndev->fw_ivn = version.fw_ivn; - ndev->vendor_id = version.vendor_id; - ndev->radio_type = version.radio_type; - -dev_info (bus->dev,"NFC MEI VERSION: IVN 0x%x Vendor ID 0x%x Type 0x%x\n" , - ndev->fw_ivn, ndev->vendor_id, ndev->radio_type); - -mutex_lock (&bus->device_lock); - -if (mei_cl_disconnect (cl_info) <0 ) { -mutex_unlock (&bus->device_lock); -dev_err (bus->dev,"Could not disconnect the NFC INFO ME client" ); - - goto err; + ret =mei_cl_connect (cl, me_cl,NULL ); +if (ret <0 ) { +dev_err (&cldev->dev,"Can't connect to the NFC INFO ME ret = %d\n" , + ret); + goto out; }mutex_unlock (&bus->device_lock); - ndev->bus_name =mei_nfc_radio_name (&version); + ret =mei_nfc_if_version (cl, &ver); +if (ret) + goto disconnect; -if (!ndev->bus_name) { -dev_err (bus->dev,"Could not build the bus ID name\n" ); -return ; - } - - cldev =mei_cl_add_device (bus, ndev->me_cl, ndev->cl, - ndev->bus_name); -if (!cldev) { -dev_err (bus->dev,"Could not add the NFC device to the MEI bus\n" ); + radio_name =mei_nfc_radio_name (&ver); - goto err; +if (!radio_name) { + ret = -ENOENT ; +dev_err (&cldev->dev,"Can't get the NFC interface version ret = %d\n" , + ret); + goto disconnect; } - cldev->priv_data = ndev; - +dev_dbg (bus->dev,"nfc radio %s\n" , radio_name); +strlcpy (cldev->name, radio_name,sizeof (cldev->name)); -return ; - -err: +disconnect:mutex_lock (&bus->device_lock); -mei_nfc_free (ndev); -mutex_unlock (&bus->device_lock); - -} - - -int mei_nfc_host_init (struct mei_device *bus,struct mei_me_client *me_cl) -{ -struct mei_nfc_dev *ndev; -struct mei_cl *cl_info, *cl; -int ret; - - -/* in case of internal reset bail out -* as the device is already setup -*/ - cl =mei_cl_bus_find_cl_by_uuid (bus, mei_nfc_guid); -if (cl) -return 0 ; - - ndev =kzalloc (sizeof (struct mei_nfc_dev ),GFP_KERNEL ); -if (!ndev) { - ret = -ENOMEM ; - goto err; - } - - ndev->me_cl =mei_me_cl_get (me_cl); -if (!ndev->me_cl) { - ret = -ENODEV ; - goto err; - } +if (mei_cl_disconnect (cl) <0 ) +dev_err (bus->dev,"Can't disconnect the NFC INFO ME\n" ); - cl_info =mei_cl_alloc_linked (bus,MEI_HOST_CLIENT_ID_ANY ); -if (IS_ERR (cl_info)) { - ret =PTR_ERR (cl_info); - goto err; - } - -list_add_tail (&cl_info->device_link, &bus->device_list); - - ndev->cl_info = cl_info; - - cl =mei_cl_alloc_linked (bus,MEI_HOST_CLIENT_ID_ANY ); -if (IS_ERR (cl)) { - ret =PTR_ERR (cl); - goto err; - } - -list_add_tail (&cl->device_link, &bus->device_list); - - ndev->cl = cl; - -INIT_WORK (&ndev->init_work, mei_nfc_init); -schedule_work (&ndev->init_work); - -return 0 ; +mei_cl_flush_queues (cl,NULL ); -err: -mei_nfc_free (ndev); - -return ret; -} - -void mei_nfc_host_exit (struct mei_device *bus) -{ -struct mei_nfc_dev *ndev; -struct mei_cl *cl; -struct mei_cl_device *cldev; - - cl =mei_cl_bus_find_cl_by_uuid (bus, mei_nfc_guid); -if (!cl) -return ; - - cldev = cl->cldev; -if (!cldev) -return ; - - ndev = (struct mei_nfc_dev *)cldev->priv_data; -if (ndev) -cancel_work_sync (&ndev->init_work); +out: +mei_cl_unlink (cl); +mutex_unlock (&bus->device_lock); +mei_me_cl_put (me_cl); +kfree (cl); - cldev->priv_data =NULL ; +if (ret) + cldev->do_match =0 ; -mutex_lock (&bus->device_lock); -/* Need to remove the device here -* since mei_nfc_free will unlink the clients -*/ -mei_cl_remove_device (cldev); -mei_nfc_free (ndev); -mutex_unlock (&bus->device_lock); +dev_dbg (bus->dev,"end of fixup match = %d\n" , cldev->do_match); }#define MEI_FIXUP (_uuid, _hook) { _uuid, _hook }
@@ -445,6 +281,7 @@ static struct mei_fixup { } mei_fixups[] = {MEI_FIXUP (MEI_UUID_ANY , number_of_connections),MEI_FIXUP (MEI_UUID_NFC_INFO , blacklist), + MEI_FIXUP(MEI_UUID_NFC_HCI, mei_nfc), };/**
drivers/misc/mei/bus.c +144 -81
296 lines not on this page · raw message
drivers/misc/mei/client.c +2 -7
@@ -558,7 +558,6 @@ void mei_cl_init(struct mei_cl *cl, struct mei_device *dev)INIT_LIST_HEAD (&cl->rd_completed);INIT_LIST_HEAD (&cl->rd_pending);INIT_LIST_HEAD (&cl->link); -INIT_LIST_HEAD (&cl->device_link); cl->writing_state =MEI_IDLE ; cl->state =MEI_FILE_INITIALIZING ; cl->dev = dev;
@@ -690,16 +689,12 @@ void mei_host_client_init(struct work_struct *work)mei_wd_host_init (dev, me_cl);mei_me_cl_put (me_cl); - me_cl =mei_me_cl_by_uuid (dev, &mei_nfc_guid); -if (me_cl) -mei_nfc_host_init (dev, me_cl); -mei_me_cl_put (me_cl); - - dev->dev_state =MEI_DEV_ENABLED ; dev->reset_count =0 ;mutex_unlock (&dev->device_lock); +mei_cl_bus_rescan (dev); +pm_runtime_mark_last_busy (dev->dev);dev_dbg (dev->dev,"rpm: autosuspend\n" );pm_runtime_autosuspend (dev->dev);
drivers/misc/mei/init.c +0 -2
@@ -331,8 +331,6 @@ void mei_stop(struct mei_device *dev)mei_cancel_work (dev); -mei_nfc_host_exit (dev); -mei_cl_bus_remove_devices (dev);mutex_lock (&dev->device_lock);
drivers/misc/mei/mei_dev.h +1 -10
@@ -241,7 +241,6 @@ struct mei_cl_cb {* @rd_completed: completed read * * @cldev: device on the mei client bus -* @device_link: link to bus clients */ struct mei_cl {struct list_head link;
@@ -260,9 +259,7 @@ struct mei_cl {struct list_head rd_pending;struct list_head rd_completed; -/* MEI CL bus data */ struct mei_cl_device *cldev; -struct list_head device_link; };/** struct mei_hw_ops
@@ -329,12 +326,7 @@ struct mei_hw_ops { };/* MEI bus API*/ - -struct mei_cl_device *mei_cl_add_device (struct mei_device *bus, -struct mei_me_client *me_cl, -struct mei_cl *cl, -const char *name); -void mei_cl_remove_device (struct mei_cl_device *cldev); +void mei_cl_bus_rescan (struct mei_device *bus);void mei_cl_dev_fixup (struct mei_cl_device *dev);ssize_t __mei_cl_send (struct mei_cl *cl,u8 *buf,size_t length,bool blocking);
@@ -343,7 +335,6 @@ void mei_cl_bus_rx_event(struct mei_cl *cl);void mei_cl_bus_remove_devices (struct mei_device *bus);int mei_cl_bus_init (void );void mei_cl_bus_exit (void ); -struct mei_cl *mei_cl_bus_find_cl_by_uuid (struct mei_device *bus,uuid_le uuid);/** * enum mei_pg_event - power gating transition events
Signature · 1 line
2.4.3