[PATCH 2/3] drivers/staging: visorbus, add module autoload functionality

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch adds module autoload functionality to the visorbus bus drivers
(currently only visornic is in tree).  This patch adds visorbus alias
creation entries to modpost, and moves the appropriate structure define
into include/linux/mod_devicetable.h.

Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx>
---
 drivers/staging/unisys/include/visorbus.h       |    8 --------
 drivers/staging/unisys/visorbus/visorbus_main.c |    1 +
 include/linux/mod_devicetable.h                 |   11 +++++++++++
 scripts/mod/devicetable-offsets.c               |    4 ++++
 scripts/mod/file2alias.c                        |   11 +++++++++++
 5 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h
index e4a21e4..758ca94 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -53,14 +53,6 @@ struct visorchipset_state {
 	/* Remaining bits in this 32-bit word are unused. */
 };
 
-/** This struct describes a specific Supervisor channel, by providing its
- *  GUID, name, and sizes.
- */
-struct visor_channeltype_descriptor {
-	const uuid_le guid;
-	const char *name;
-};
-
 /** Information provided by each visor driver when it registers with the
  *  visorbus driver.
  */
diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
index 6db4719..df411ee 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -16,6 +16,7 @@
  */
 
 #include <linux/uuid.h>
+#include <linux/mod_devicetable.h>
 
 #include "visorbus.h"
 #include "visorbus_private.h"
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index becda6f..b849f19 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -646,4 +646,15 @@ struct ulpi_device_id {
 	kernel_ulong_t driver_data;
 };
 
+/**
+ * struct visor_channeltype_descriptor - VISORBUS Channel Type Descriptor
+ * @guid: UUID for the channel
+ * @name: name of the channel
+ *
+ * describes a specific Supervisor channel, by providing its * GUID and name.
+ */
+struct visor_channeltype_descriptor {
+	uuid_le guid;
+	char *name;
+};
 #endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c
index e70fcd1..4b8797b 100644
--- a/scripts/mod/devicetable-offsets.c
+++ b/scripts/mod/devicetable-offsets.c
@@ -196,5 +196,9 @@ int main(void)
 	DEVID_FIELD(ulpi_device_id, vendor);
 	DEVID_FIELD(ulpi_device_id, product);
 
+	DEVID(visor_channeltype_descriptor);
+	DEVID_FIELD(visor_channeltype_descriptor, guid);
+	DEVID_FIELD(visor_channeltype_descriptor, name);
+
 	return 0;
 }
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 8a46c60..f3d011f 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -1253,6 +1253,17 @@ static int do_ulpi_entry(const char *filename, void *symval,
 }
 ADD_TO_DEVTABLE("ulpi", ulpi_device_id, do_ulpi_entry);
 
+static int do_visorbus_entry(const char *filename, void *symval, char *alias)
+{
+	DEF_FIELD_ADDR(symval, visor_channeltype_descriptor, guid);
+
+	sprintf(alias, "visorbus:");
+	add_uuid(alias, *guid);
+
+	return 1;
+}
+ADD_TO_DEVTABLE("visorbus", visor_channeltype_descriptor, do_visorbus_entry);
+
 /* Does namelen bytes of name exactly match the symbol? */
 static bool sym_is(const char *name, unsigned namelen, const char *symbol)
 {
-- 
1.7.9.3

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux