Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Stuart Yoder and committed by
Greg Kroah-Hartman
0afef456 57538afb

+32 -13
-13
drivers/staging/fsl-mc/include/mc.h
··· 51 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 54 * enum fsl_mc_pool_type - Types of allocatable MC bus resources 68 55 * 69 56 * Entries in these enum are used as indices in the array of resource
+16
include/linux/mod_devicetable.h
··· 657 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 676 #endif /* LINUX_MOD_DEVICETABLE_H */
+4
scripts/mod/devicetable-offsets.c
··· 202 202 DEVID_FIELD(hda_device_id, rev_id); 203 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 209 return 0; 206 210 }
+12
scripts/mod/file2alias.c
··· 1289 1289 } 1290 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 1304 /* Does namelen bytes of name exactly match the symbol? */ 1293 1305 static bool sym_is(const char *name, unsigned namelen, const char *symbol) 1294 1306 {