Automatic MODULE_ALIAS() for DMI match tables.
Subsystems (4)
PATCH 1/1 Automatic MODULE_ALIAS() for DMI match tables.
This makes modpost handle MODULE_DEVICE_TABLE(dmi, xxxx).
I had to change the string pointers in the match table to char arrays, and picked a size of 79 bytes almost at random -- do we need to make it bigger than that? I was a bit concerned about the 'bloat' this introduces into the match tables, but they should all be __initdata so it shouldn't matter too much.
(Actually, modpost does go through the relocations and look at most of them; it wouldn't be impossible to make it handle string pointers -- but doesn't seem to be worth the effort, since they're __initdata).
include/linux/dmi.h +2 -39
@@ -2,29 +2,9 @@#define __DMI_H__#include <linux/list.h> +#include <linux/mod_devicetable.h> -enum dmi_field { -DMI_NONE , -DMI_BIOS_VENDOR , -DMI_BIOS_VERSION , -DMI_BIOS_DATE , -DMI_SYS_VENDOR , -DMI_PRODUCT_NAME , -DMI_PRODUCT_VERSION , -DMI_PRODUCT_SERIAL , -DMI_PRODUCT_UUID , -DMI_BOARD_VENDOR , -DMI_BOARD_NAME , -DMI_BOARD_VERSION , -DMI_BOARD_SERIAL , -DMI_BOARD_ASSET_TAG , -DMI_CHASSIS_VENDOR , -DMI_CHASSIS_TYPE , -DMI_CHASSIS_VERSION , -DMI_CHASSIS_SERIAL , -DMI_CHASSIS_ASSET_TAG , -DMI_STRING_MAX , -}; +/* enum dmi_field is in mod_devicetable.h */ enum dmi_device_type {DMI_DEV_TYPE_ANY =0 ,
@@ -48,23 +28,6 @@ struct dmi_header {u16 handle; }; -/* -* DMI callbacks for problem boards -*/ -struct dmi_strmatch { -u8 slot; -char *substr; -}; - -struct dmi_system_id { -int (*callback)(const struct dmi_system_id *); -const char *ident; -struct dmi_strmatch matches[4 ]; -void *driver_data; -}; - -#define DMI_MATCH (a, b) { a, b } -struct dmi_device {struct list_head list;int type;
include/linux/mod_devicetable.h +47 -0
52 lines not on this page · raw message
scripts/mod/file2alias.c +57 -0
69 lines not on this page · raw message
Signature · 2 lines
David Woodhouse Open Source Technology Centre [email protected] Intel Corporation
PATCH 1/1 Fix autoloading of MacBook Pro backlight driver.
Use new MODULE_DEVICE_TABLE(dmi, ...) facility. There's no need for every driver to screw it up for themselves, when the alias can be generated automatically.
drivers/video/backlight/mbp_nvidia_bl.c +1 -3
@@ -111,6 +111,4 @@ module_exit(mbp_exit);MODULE_AUTHOR ("Matthew Garrett <[email protected]>" );MODULE_DESCRIPTION ("Nvidia-based Macbook Pro Backlight Driver" );MODULE_LICENSE ("GPL" ); -MODULE_ALIAS ("svnAppleInc.:pnMacBookPro3,1" ); -MODULE_ALIAS ("svnAppleInc.:pnMacBookPro3,2" ); -MODULE_ALIAS ("svnAppleInc.:pnMacBookPro4,1" ); +MODULE_DEVICE_TABLE (dmi, mbp_device_table);
Signature · 2 lines
David Woodhouse Open Source Technology Centre [email protected] Intel Corporation
Re: [PATCH] Fix autoloading of MacBook Pro backlight driver.
Quoted 5 lines · David Woodhouse
Use new
MODULE_DEVICE_TABLE(dmi, ...)facility. There's no need for every driver to screw it up for themselves, when the alias can be generated automatically.Signed-off-by David Woodhouse <[email protected]>
Signature · 1 line
Matthew Garrett | [email protected]