diff options
-rw-r--r-- | drivers/staging/ipack/ipack.h | 26 | ||||
-rw-r--r-- | drivers/staging/ipack/ipack_ids.h | 27 | ||||
-rw-r--r-- | include/linux/mod_devicetable.h | 7 | ||||
-rw-r--r-- | scripts/mod/file2alias.c | 15 |
4 files changed, 75 insertions, 0 deletions
diff --git a/drivers/staging/ipack/ipack.h b/drivers/staging/ipack/ipack.h index e3609b16368b..703142d1859b 100644 --- a/drivers/staging/ipack/ipack.h +++ b/drivers/staging/ipack/ipack.h | |||
@@ -9,6 +9,7 @@ | |||
9 | * Software Foundation; version 2 of the License. | 9 | * Software Foundation; version 2 of the License. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/mod_devicetable.h> | ||
12 | #include <linux/device.h> | 13 | #include <linux/device.h> |
13 | 14 | ||
14 | #define IPACK_IDPROM_OFFSET_I 0x01 | 15 | #define IPACK_IDPROM_OFFSET_I 0x01 |
@@ -95,6 +96,7 @@ struct ipack_driver_ops { | |||
95 | */ | 96 | */ |
96 | struct ipack_driver { | 97 | struct ipack_driver { |
97 | struct device_driver driver; | 98 | struct device_driver driver; |
99 | const struct ipack_device_id *id_table; | ||
98 | struct ipack_driver_ops *ops; | 100 | struct ipack_driver_ops *ops; |
99 | }; | 101 | }; |
100 | 102 | ||
@@ -169,3 +171,27 @@ void ipack_driver_unregister(struct ipack_driver *edrv); | |||
169 | */ | 171 | */ |
170 | struct ipack_device *ipack_device_register(struct ipack_bus_device *bus, int slot, int irqv); | 172 | struct ipack_device *ipack_device_register(struct ipack_bus_device *bus, int slot, int irqv); |
171 | void ipack_device_unregister(struct ipack_device *dev); | 173 | void ipack_device_unregister(struct ipack_device *dev); |
174 | |||
175 | /** | ||
176 | * DEFINE_IPACK_DEVICE_TABLE - macro used to describe a IndustryPack table | ||
177 | * @_table: device table name | ||
178 | * | ||
179 | * This macro is used to create a struct ipack_device_id array (a device table) | ||
180 | * in a generic manner. | ||
181 | */ | ||
182 | #define DEFINE_IPACK_DEVICE_TABLE(_table) \ | ||
183 | const struct ipack_device_id _table[] __devinitconst | ||
184 | |||
185 | /** | ||
186 | * IPACK_DEVICE - macro used to describe a specific IndustryPack device | ||
187 | * @_format: the format version (currently either 1 or 2, 8 bit value) | ||
188 | * @vend: the 8 or 24 bit IndustryPack Vendor ID | ||
189 | * @dev: the 8 or 16 bit IndustryPack Device ID | ||
190 | * | ||
191 | * This macro is used to create a struct ipack_device_id that matches a specific | ||
192 | * device. | ||
193 | */ | ||
194 | #define IPACK_DEVICE(_format, vend, dev) \ | ||
195 | .format = (_format), \ | ||
196 | .vendor = (vend), \ | ||
197 | .device = (dev) | ||
diff --git a/drivers/staging/ipack/ipack_ids.h b/drivers/staging/ipack/ipack_ids.h new file mode 100644 index 000000000000..ba85ec53b2c3 --- /dev/null +++ b/drivers/staging/ipack/ipack_ids.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * IndustryPack Fromat, Vendor and Device IDs. | ||
3 | */ | ||
4 | |||
5 | /* ID section format versions */ | ||
6 | #define IPACK_ID_VERSION_INVALID 0x00 | ||
7 | #define IPACK_ID_VERSION_1 0x01 | ||
8 | #define IPACK_ID_VERSION_2 0x02 | ||
9 | |||
10 | /* Vendors and devices. Sort key: vendor first, device next. */ | ||
11 | #define IPACK1_VENDOR_ID_RESERVED1 0x00 | ||
12 | #define IPACK1_VENDOR_ID_RESERVED2 0xFF | ||
13 | #define IPACK1_VENDOR_ID_UNREGISTRED01 0x01 | ||
14 | #define IPACK1_VENDOR_ID_UNREGISTRED02 0x02 | ||
15 | #define IPACK1_VENDOR_ID_UNREGISTRED03 0x03 | ||
16 | #define IPACK1_VENDOR_ID_UNREGISTRED04 0x04 | ||
17 | #define IPACK1_VENDOR_ID_UNREGISTRED05 0x05 | ||
18 | #define IPACK1_VENDOR_ID_UNREGISTRED06 0x06 | ||
19 | #define IPACK1_VENDOR_ID_UNREGISTRED07 0x07 | ||
20 | #define IPACK1_VENDOR_ID_UNREGISTRED08 0x08 | ||
21 | #define IPACK1_VENDOR_ID_UNREGISTRED09 0x09 | ||
22 | #define IPACK1_VENDOR_ID_UNREGISTRED10 0x0A | ||
23 | #define IPACK1_VENDOR_ID_UNREGISTRED11 0x0B | ||
24 | #define IPACK1_VENDOR_ID_UNREGISTRED12 0x0C | ||
25 | #define IPACK1_VENDOR_ID_UNREGISTRED13 0x0D | ||
26 | #define IPACK1_VENDOR_ID_UNREGISTRED14 0x0E | ||
27 | #define IPACK1_VENDOR_ID_UNREGISTRED15 0x0F | ||
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 6955045199b0..999c4c25fbf7 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
@@ -600,4 +600,11 @@ struct x86_cpu_id { | |||
600 | #define X86_MODEL_ANY 0 | 600 | #define X86_MODEL_ANY 0 |
601 | #define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */ | 601 | #define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */ |
602 | 602 | ||
603 | #define IPACK_ANY_ID (~0) | ||
604 | struct ipack_device_id { | ||
605 | __u8 format; /* Format version or IPACK_ANY_ID */ | ||
606 | __u32 vendor; /* Vendor ID or IPACK_ANY_ID */ | ||
607 | __u32 device; /* Device ID or IPACK_ANY_ID */ | ||
608 | }; | ||
609 | |||
603 | #endif /* LINUX_MOD_DEVICETABLE_H */ | 610 | #endif /* LINUX_MOD_DEVICETABLE_H */ |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 7ed6864ef65b..3c22bda8fdf3 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -966,6 +966,21 @@ static int do_isapnp_entry(const char *filename, | |||
966 | } | 966 | } |
967 | ADD_TO_DEVTABLE("isapnp", struct isapnp_device_id, do_isapnp_entry); | 967 | ADD_TO_DEVTABLE("isapnp", struct isapnp_device_id, do_isapnp_entry); |
968 | 968 | ||
969 | /* Looks like: "ipack:fNvNdN". */ | ||
970 | static int do_ipack_entry(const char *filename, | ||
971 | struct ipack_device_id *id, char *alias) | ||
972 | { | ||
973 | id->vendor = TO_NATIVE(id->vendor); | ||
974 | id->device = TO_NATIVE(id->device); | ||
975 | strcpy(alias, "ipack:"); | ||
976 | ADD(alias, "f", id->format != IPACK_ANY_ID, id->format); | ||
977 | ADD(alias, "v", id->vendor != IPACK_ANY_ID, id->vendor); | ||
978 | ADD(alias, "d", id->device != IPACK_ANY_ID, id->device); | ||
979 | add_wildcard(alias); | ||
980 | return 1; | ||
981 | } | ||
982 | ADD_TO_DEVTABLE("ipack", struct ipack_device_id, do_ipack_entry); | ||
983 | |||
969 | /* | 984 | /* |
970 | * Append a match expression for a single masked hex digit. | 985 | * Append a match expression for a single masked hex digit. |
971 | * outp points to a pointer to the character at which to append. | 986 | * outp points to a pointer to the character at which to append. |