summaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei/bus-fixup.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2015-07-23 15:08:43 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-08-03 17:24:16 -0700
commit71ce789115f878a07e4a6c43d6006cea6aee1078 (patch)
treeaef1e29741969c8b7b3d0501e4c451fba1fe456a /drivers/misc/mei/bus-fixup.c
parent0ff0a8d853039aa60bba3ca3e04e4fb74584a736 (diff)
downloadlinux-71ce789115f878a07e4a6c43d6006cea6aee1078.tar.bz2
mei: bus: enable running fixup routines before device registration
Split 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. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/bus-fixup.c')
-rw-r--r--drivers/misc/mei/bus-fixup.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/misc/mei/bus-fixup.c b/drivers/misc/mei/bus-fixup.c
index 47aa1523d9e1..865e33bcd226 100644
--- a/drivers/misc/mei/bus-fixup.c
+++ b/drivers/misc/mei/bus-fixup.c
@@ -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;
@@ -412,4 +415,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);
+ }
+}