diff options
author | Stuart Yoder <stuart.yoder@nxp.com> | 2016-06-22 17:40:45 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-06-26 20:14:03 -0400 |
commit | 0afef45654ae908536278ecb143ded5bbc713391 (patch) | |
tree | 8f1ce0a2ad4a69fdd08426c6cf861b4c6adbc8c7 | |
parent | 57538afb42e492eb6984f89663361bcfd80d9745 (diff) |
staging: fsl-mc: add support for device table matching
Move the definition of fsl_mc_device_id to its proper location in
mod_devicetable.h, and add fsl-mc bus support to devicetable-offsets.c
and file2alias.c to enable device table matching. With this patch udev
based module loading of fsl-mc drivers is supported.
Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/fsl-mc/include/mc.h | 13 | ||||
-rw-r--r-- | include/linux/mod_devicetable.h | 16 | ||||
-rw-r--r-- | scripts/mod/devicetable-offsets.c | 4 | ||||
-rw-r--r-- | scripts/mod/file2alias.c | 12 |
4 files changed, 32 insertions, 13 deletions
diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index bc0d45cb9b65..a9a9d23f78d5 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h | |||
@@ -51,19 +51,6 @@ struct fsl_mc_driver { | |||
51 | container_of(_drv, struct fsl_mc_driver, driver) | 51 | container_of(_drv, struct fsl_mc_driver, driver) |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * struct fsl_mc_device_id - MC object device Id entry for driver matching | ||
55 | * @vendor: vendor ID | ||
56 | * @obj_type: MC object type | ||
57 | * | ||
58 | * Type of entries in the "device Id" table for MC object devices supported by | ||
59 | * a MC object device driver. The last entry of the table has vendor set to 0x0 | ||
60 | */ | ||
61 | struct fsl_mc_device_id { | ||
62 | u16 vendor; | ||
63 | const char obj_type[16]; | ||
64 | }; | ||
65 | |||
66 | /** | ||
67 | * enum fsl_mc_pool_type - Types of allocatable MC bus resources | 54 | * enum fsl_mc_pool_type - Types of allocatable MC bus resources |
68 | * | 55 | * |
69 | * Entries in these enum are used as indices in the array of resource | 56 | * Entries in these enum are used as indices in the array of resource |
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 6e4c645e1c0d..ed84c07f6a51 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
@@ -657,4 +657,20 @@ struct ulpi_device_id { | |||
657 | kernel_ulong_t driver_data; | 657 | kernel_ulong_t driver_data; |
658 | }; | 658 | }; |
659 | 659 | ||
660 | /** | ||
661 | * struct fsl_mc_device_id - MC object device identifier | ||
662 | * @vendor: vendor ID | ||
663 | * @obj_type: MC object type | ||
664 | * @ver_major: MC object version major number | ||
665 | * @ver_minor: MC object version minor number | ||
666 | * | ||
667 | * Type of entries in the "device Id" table for MC object devices supported by | ||
668 | * a MC object device driver. The last entry of the table has vendor set to 0x0 | ||
669 | */ | ||
670 | struct fsl_mc_device_id { | ||
671 | __u16 vendor; | ||
672 | const char obj_type[16]; | ||
673 | }; | ||
674 | |||
675 | |||
660 | #endif /* LINUX_MOD_DEVICETABLE_H */ | 676 | #endif /* LINUX_MOD_DEVICETABLE_H */ |
diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c index 840b97328b39..e4d90e50f6fe 100644 --- a/scripts/mod/devicetable-offsets.c +++ b/scripts/mod/devicetable-offsets.c | |||
@@ -202,5 +202,9 @@ int main(void) | |||
202 | DEVID_FIELD(hda_device_id, rev_id); | 202 | DEVID_FIELD(hda_device_id, rev_id); |
203 | DEVID_FIELD(hda_device_id, api_version); | 203 | DEVID_FIELD(hda_device_id, api_version); |
204 | 204 | ||
205 | DEVID(fsl_mc_device_id); | ||
206 | DEVID_FIELD(fsl_mc_device_id, vendor); | ||
207 | DEVID_FIELD(fsl_mc_device_id, obj_type); | ||
208 | |||
205 | return 0; | 209 | return 0; |
206 | } | 210 | } |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index fec75786f75b..29d6699d5a06 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -1289,6 +1289,18 @@ static int do_hda_entry(const char *filename, void *symval, char *alias) | |||
1289 | } | 1289 | } |
1290 | ADD_TO_DEVTABLE("hdaudio", hda_device_id, do_hda_entry); | 1290 | ADD_TO_DEVTABLE("hdaudio", hda_device_id, do_hda_entry); |
1291 | 1291 | ||
1292 | /* Looks like: fsl-mc:vNdN */ | ||
1293 | static int do_fsl_mc_entry(const char *filename, void *symval, | ||
1294 | char *alias) | ||
1295 | { | ||
1296 | DEF_FIELD(symval, fsl_mc_device_id, vendor); | ||
1297 | DEF_FIELD_ADDR(symval, fsl_mc_device_id, obj_type); | ||
1298 | |||
1299 | sprintf(alias, "fsl-mc:v%08Xd%s", vendor, *obj_type); | ||
1300 | return 1; | ||
1301 | } | ||
1302 | ADD_TO_DEVTABLE("fslmc", fsl_mc_device_id, do_fsl_mc_entry); | ||
1303 | |||
1292 | /* Does namelen bytes of name exactly match the symbol? */ | 1304 | /* Does namelen bytes of name exactly match the symbol? */ |
1293 | static bool sym_is(const char *name, unsigned namelen, const char *symbol) | 1305 | static bool sym_is(const char *name, unsigned namelen, const char *symbol) |
1294 | { | 1306 | { |