diff options
| author | Andreas Schwab <schwab@linux-m68k.org> | 2013-01-20 11:58:47 -0500 |
|---|---|---|
| committer | Michal Marek <mmarek@suse.cz> | 2013-01-24 16:48:04 -0500 |
| commit | 6543becf26fff612cdadeed7250ccc8d49f67f27 (patch) | |
| tree | bcba277bb0c03a81aae46965f3ddc76e582b51f1 /include/linux | |
| parent | a49f0d1ea3ec94fc7cf33a7c36a16343b74bd565 (diff) | |
mod/file2alias: make modalias generation safe for cross compiling
Use the target compiler to compute the offsets for the fields of the
device_id structures, so that it won't be broken by different alignments
between the host and target ABIs.
This also fixes missing endian corrections for some modaliases.
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/mod_devicetable.h | 58 |
1 files changed, 9 insertions, 49 deletions
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index fed3def62818..779cf7c4a3d1 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
| @@ -33,8 +33,7 @@ struct ieee1394_device_id { | |||
| 33 | __u32 model_id; | 33 | __u32 model_id; |
| 34 | __u32 specifier_id; | 34 | __u32 specifier_id; |
| 35 | __u32 version; | 35 | __u32 version; |
| 36 | kernel_ulong_t driver_data | 36 | kernel_ulong_t driver_data; |
| 37 | __attribute__((aligned(sizeof(kernel_ulong_t)))); | ||
| 38 | }; | 37 | }; |
| 39 | 38 | ||
| 40 | 39 | ||
| @@ -148,8 +147,7 @@ struct hid_device_id { | |||
| 148 | __u16 group; | 147 | __u16 group; |
| 149 | __u32 vendor; | 148 | __u32 vendor; |
| 150 | __u32 product; | 149 | __u32 product; |
| 151 | kernel_ulong_t driver_data | 150 | kernel_ulong_t driver_data; |
| 152 | __attribute__((aligned(sizeof(kernel_ulong_t)))); | ||
| 153 | }; | 151 | }; |
| 154 | 152 | ||
| 155 | /* s390 CCW devices */ | 153 | /* s390 CCW devices */ |
| @@ -173,8 +171,6 @@ struct ccw_device_id { | |||
| 173 | struct ap_device_id { | 171 | struct ap_device_id { |
| 174 | __u16 match_flags; /* which fields to match against */ | 172 | __u16 match_flags; /* which fields to match against */ |
| 175 | __u8 dev_type; /* device type */ | 173 | __u8 dev_type; /* device type */ |
| 176 | __u8 pad1; | ||
| 177 | __u32 pad2; | ||
| 178 | kernel_ulong_t driver_info; | 174 | kernel_ulong_t driver_info; |
| 179 | }; | 175 | }; |
| 180 | 176 | ||
| @@ -184,13 +180,10 @@ struct ap_device_id { | |||
| 184 | struct css_device_id { | 180 | struct css_device_id { |
| 185 | __u8 match_flags; | 181 | __u8 match_flags; |
| 186 | __u8 type; /* subchannel type */ | 182 | __u8 type; /* subchannel type */ |
| 187 | __u16 pad2; | ||
| 188 | __u32 pad3; | ||
| 189 | kernel_ulong_t driver_data; | 183 | kernel_ulong_t driver_data; |
| 190 | }; | 184 | }; |
| 191 | 185 | ||
| 192 | #define ACPI_ID_LEN 16 /* only 9 bytes needed here, 16 bytes are used */ | 186 | #define ACPI_ID_LEN 9 |
| 193 | /* to workaround crosscompile issues */ | ||
| 194 | 187 | ||
| 195 | struct acpi_device_id { | 188 | struct acpi_device_id { |
| 196 | __u8 id[ACPI_ID_LEN]; | 189 | __u8 id[ACPI_ID_LEN]; |
| @@ -231,11 +224,7 @@ struct of_device_id | |||
| 231 | char name[32]; | 224 | char name[32]; |
| 232 | char type[32]; | 225 | char type[32]; |
| 233 | char compatible[128]; | 226 | char compatible[128]; |
| 234 | #ifdef __KERNEL__ | ||
| 235 | const void *data; | 227 | const void *data; |
| 236 | #else | ||
| 237 | kernel_ulong_t data; | ||
| 238 | #endif | ||
| 239 | }; | 228 | }; |
| 240 | 229 | ||
| 241 | /* VIO */ | 230 | /* VIO */ |
| @@ -260,24 +249,14 @@ struct pcmcia_device_id { | |||
| 260 | /* for pseudo multi-function devices */ | 249 | /* for pseudo multi-function devices */ |
| 261 | __u8 device_no; | 250 | __u8 device_no; |
| 262 | 251 | ||
| 263 | __u32 prod_id_hash[4] | 252 | __u32 prod_id_hash[4]; |
| 264 | __attribute__((aligned(sizeof(__u32)))); | ||
| 265 | 253 | ||
| 266 | /* not matched against in kernelspace*/ | 254 | /* not matched against in kernelspace*/ |
| 267 | #ifdef __KERNEL__ | ||
| 268 | const char * prod_id[4]; | 255 | const char * prod_id[4]; |
| 269 | #else | ||
| 270 | kernel_ulong_t prod_id[4] | ||
| 271 | __attribute__((aligned(sizeof(kernel_ulong_t)))); | ||
| 272 | #endif | ||
| 273 | 256 | ||
| 274 | /* not matched against */ | 257 | /* not matched against */ |
| 275 | kernel_ulong_t driver_info; | 258 | kernel_ulong_t driver_info; |
| 276 | #ifdef __KERNEL__ | ||
| 277 | char * cisfile; | 259 | char * cisfile; |
| 278 | #else | ||
| 279 | kernel_ulong_t cisfile; | ||
| 280 | #endif | ||
| 281 | }; | 260 | }; |
| 282 | 261 | ||
| 283 | #define PCMCIA_DEV_ID_MATCH_MANF_ID 0x0001 | 262 | #define PCMCIA_DEV_ID_MATCH_MANF_ID 0x0001 |
| @@ -373,8 +352,7 @@ struct sdio_device_id { | |||
| 373 | __u8 class; /* Standard interface or SDIO_ANY_ID */ | 352 | __u8 class; /* Standard interface or SDIO_ANY_ID */ |
| 374 | __u16 vendor; /* Vendor or SDIO_ANY_ID */ | 353 | __u16 vendor; /* Vendor or SDIO_ANY_ID */ |
| 375 | __u16 device; /* Device ID or SDIO_ANY_ID */ | 354 | __u16 device; /* Device ID or SDIO_ANY_ID */ |
| 376 | kernel_ulong_t driver_data /* Data private to the driver */ | 355 | kernel_ulong_t driver_data; /* Data private to the driver */ |
| 377 | __attribute__((aligned(sizeof(kernel_ulong_t)))); | ||
| 378 | }; | 356 | }; |
| 379 | 357 | ||
| 380 | /* SSB core, see drivers/ssb/ */ | 358 | /* SSB core, see drivers/ssb/ */ |
| @@ -420,8 +398,7 @@ struct virtio_device_id { | |||
| 420 | */ | 398 | */ |
| 421 | struct hv_vmbus_device_id { | 399 | struct hv_vmbus_device_id { |
| 422 | __u8 guid[16]; | 400 | __u8 guid[16]; |
| 423 | kernel_ulong_t driver_data /* Data private to the driver */ | 401 | kernel_ulong_t driver_data; /* Data private to the driver */ |
| 424 | __attribute__((aligned(sizeof(kernel_ulong_t)))); | ||
| 425 | }; | 402 | }; |
| 426 | 403 | ||
| 427 | /* rpmsg */ | 404 | /* rpmsg */ |
| @@ -440,8 +417,7 @@ struct rpmsg_device_id { | |||
| 440 | 417 | ||
| 441 | struct i2c_device_id { | 418 | struct i2c_device_id { |
| 442 | char name[I2C_NAME_SIZE]; | 419 | char name[I2C_NAME_SIZE]; |
| 443 | kernel_ulong_t driver_data /* Data private to the driver */ | 420 | kernel_ulong_t driver_data; /* Data private to the driver */ |
| 444 | __attribute__((aligned(sizeof(kernel_ulong_t)))); | ||
| 445 | }; | 421 | }; |
| 446 | 422 | ||
| 447 | /* spi */ | 423 | /* spi */ |
| @@ -451,8 +427,7 @@ struct i2c_device_id { | |||
| 451 | 427 | ||
| 452 | struct spi_device_id { | 428 | struct spi_device_id { |
| 453 | char name[SPI_NAME_SIZE]; | 429 | char name[SPI_NAME_SIZE]; |
| 454 | kernel_ulong_t driver_data /* Data private to the driver */ | 430 | kernel_ulong_t driver_data; /* Data private to the driver */ |
| 455 | __attribute__((aligned(sizeof(kernel_ulong_t)))); | ||
| 456 | }; | 431 | }; |
| 457 | 432 | ||
| 458 | /* dmi */ | 433 | /* dmi */ |
| @@ -484,15 +459,6 @@ struct dmi_strmatch { | |||
| 484 | char substr[79]; | 459 | char substr[79]; |
| 485 | }; | 460 | }; |
| 486 | 461 | ||
| 487 | #ifndef __KERNEL__ | ||
| 488 | struct dmi_system_id { | ||
| 489 | kernel_ulong_t callback; | ||
| 490 | kernel_ulong_t ident; | ||
| 491 | struct dmi_strmatch matches[4]; | ||
| 492 | kernel_ulong_t driver_data | ||
| 493 | __attribute__((aligned(sizeof(kernel_ulong_t)))); | ||
| 494 | }; | ||
| 495 | #else | ||
| 496 | struct dmi_system_id { | 462 | struct dmi_system_id { |
| 497 | int (*callback)(const struct dmi_system_id *); | 463 | int (*callback)(const struct dmi_system_id *); |
| 498 | const char *ident; | 464 | const char *ident; |
| @@ -506,7 +472,6 @@ struct dmi_system_id { | |||
| 506 | * error: storage size of '__mod_dmi_device_table' isn't known | 472 | * error: storage size of '__mod_dmi_device_table' isn't known |
| 507 | */ | 473 | */ |
| 508 | #define dmi_device_id dmi_system_id | 474 | #define dmi_device_id dmi_system_id |
| 509 | #endif | ||
| 510 | 475 | ||
| 511 | #define DMI_MATCH(a, b) { a, b } | 476 | #define DMI_MATCH(a, b) { a, b } |
| 512 | 477 | ||
| @@ -515,8 +480,7 @@ struct dmi_system_id { | |||
| 515 | 480 | ||
| 516 | struct platform_device_id { | 481 | struct platform_device_id { |
| 517 | char name[PLATFORM_NAME_SIZE]; | 482 | char name[PLATFORM_NAME_SIZE]; |
| 518 | kernel_ulong_t driver_data | 483 | kernel_ulong_t driver_data; |
| 519 | __attribute__((aligned(sizeof(kernel_ulong_t)))); | ||
| 520 | }; | 484 | }; |
| 521 | 485 | ||
| 522 | #define MDIO_MODULE_PREFIX "mdio:" | 486 | #define MDIO_MODULE_PREFIX "mdio:" |
| @@ -572,11 +536,7 @@ struct isapnp_device_id { | |||
| 572 | struct amba_id { | 536 | struct amba_id { |
| 573 | unsigned int id; | 537 | unsigned int id; |
| 574 | unsigned int mask; | 538 | unsigned int mask; |
| 575 | #ifndef __KERNEL__ | ||
| 576 | kernel_ulong_t data; | ||
| 577 | #else | ||
| 578 | void *data; | 539 | void *data; |
| 579 | #endif | ||
| 580 | }; | 540 | }; |
| 581 | 541 | ||
| 582 | /* | 542 | /* |
