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

i2c: Make PCI device ids constant

The id_table field of the struct pci_driver is constant in <linux/pci.h>
so it is worth to make initialization data also constant.

The semantic match that finds this kind of pattern is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r@
disable decl_init,const_decl_init;
identifier I1, I2, x;
@@
struct I1 {
...
const struct I2 *x;
...
};
@s@
identifier r.I1, y;
identifier r.x, E;
@@
struct I1 y = {
.x = E,
};
@c@
identifier r.I2;
identifier s.E;
@@
const struct I2 E[] = ... ;
@depends on !c@
identifier r.I2;
identifier s.E;
@@
+ const
struct I2 E[] = ...;
// </smpl>

Signed-off-by: Márton Németh <nm127@freemail.hu>
Cc: Julia Lawall <julia@diku.dk>
Signed-off-by: Jean Delvare <khali@linux-fr.org>

authored by

Márton Németh and committed by
Jean Delvare
4111ecd2 13dda80e

+17 -17
+1 -1
drivers/i2c/busses/i2c-ali1535.c
··· 480 480 .algo = &smbus_algorithm, 481 481 }; 482 482 483 - static struct pci_device_id ali1535_ids[] = { 483 + static const struct pci_device_id ali1535_ids[] = { 484 484 { PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101) }, 485 485 { }, 486 486 };
+1 -1
drivers/i2c/busses/i2c-ali1563.c
··· 417 417 ali1563_shutdown(dev); 418 418 } 419 419 420 - static struct pci_device_id __devinitdata ali1563_id_table[] = { 420 + static const struct pci_device_id ali1563_id_table[] __devinitconst = { 421 421 { PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1563) }, 422 422 {}, 423 423 };
+1 -1
drivers/i2c/busses/i2c-ali15x3.c
··· 477 477 .algo = &smbus_algorithm, 478 478 }; 479 479 480 - static struct pci_device_id ali15x3_ids[] = { 480 + static const struct pci_device_id ali15x3_ids[] = { 481 481 { PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101) }, 482 482 { 0, } 483 483 };
+1 -1
drivers/i2c/busses/i2c-amd756.c
··· 308 308 "nVidia nForce", "AMD8111", 309 309 }; 310 310 311 - static struct pci_device_id amd756_ids[] = { 311 + static const struct pci_device_id amd756_ids[] = { 312 312 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_740B), 313 313 .driver_data = AMD756 }, 314 314 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_7413),
+1 -1
drivers/i2c/busses/i2c-amd8111.c
··· 351 351 }; 352 352 353 353 354 - static struct pci_device_id amd8111_ids[] = { 354 + static const struct pci_device_id amd8111_ids[] = { 355 355 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_SMBUS2) }, 356 356 { 0, } 357 357 };
+1 -1
drivers/i2c/busses/i2c-hydra.c
··· 105 105 .algo_data = &hydra_bit_data, 106 106 }; 107 107 108 - static struct pci_device_id hydra_ids[] = { 108 + static const struct pci_device_id hydra_ids[] = { 109 109 { PCI_DEVICE(PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_HYDRA) }, 110 110 { 0, } 111 111 };
+1 -1
drivers/i2c/busses/i2c-i801.c
··· 561 561 .algo = &smbus_algorithm, 562 562 }; 563 563 564 - static struct pci_device_id i801_ids[] = { 564 + static const struct pci_device_id i801_ids[] = { 565 565 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_3) }, 566 566 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_3) }, 567 567 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_2) },
+1 -1
drivers/i2c/busses/i2c-isch.c
··· 256 256 .algo = &smbus_algorithm, 257 257 }; 258 258 259 - static struct pci_device_id sch_ids[] = { 259 + static const struct pci_device_id sch_ids[] = { 260 260 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SCH_LPC) }, 261 261 { 0, } 262 262 };
+1 -1
drivers/i2c/busses/i2c-nforce2.c
··· 308 308 }; 309 309 310 310 311 - static struct pci_device_id nforce2_ids[] = { 311 + static const struct pci_device_id nforce2_ids[] = { 312 312 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS) }, 313 313 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_SMBUS) }, 314 314 { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS) },
+1 -1
drivers/i2c/busses/i2c-pasemi.c
··· 400 400 kfree(smbus); 401 401 } 402 402 403 - static struct pci_device_id pasemi_smb_ids[] = { 403 + static const struct pci_device_id pasemi_smb_ids[] = { 404 404 { PCI_DEVICE(0x1959, 0xa003) }, 405 405 { 0, } 406 406 };
+1 -1
drivers/i2c/busses/i2c-piix4.c
··· 472 472 .algo = &smbus_algorithm, 473 473 }; 474 474 475 - static struct pci_device_id piix4_ids[] = { 475 + static const struct pci_device_id piix4_ids[] = { 476 476 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3) }, 477 477 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443MX_3) }, 478 478 { PCI_DEVICE(PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_3) },
+1 -1
drivers/i2c/busses/i2c-sis5595.c
··· 369 369 .algo = &smbus_algorithm, 370 370 }; 371 371 372 - static struct pci_device_id sis5595_ids[] __devinitdata = { 372 + static const struct pci_device_id sis5595_ids[] __devinitconst = { 373 373 { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503) }, 374 374 { 0, } 375 375 };
+1 -1
drivers/i2c/busses/i2c-sis630.c
··· 468 468 .algo = &smbus_algorithm, 469 469 }; 470 470 471 - static struct pci_device_id sis630_ids[] __devinitdata = { 471 + static const struct pci_device_id sis630_ids[] __devinitconst = { 472 472 { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503) }, 473 473 { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_LPC) }, 474 474 { 0, }
+1 -1
drivers/i2c/busses/i2c-sis96x.c
··· 245 245 .algo = &smbus_algorithm, 246 246 }; 247 247 248 - static struct pci_device_id sis96x_ids[] = { 248 + static const struct pci_device_id sis96x_ids[] = { 249 249 { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_SMBUS) }, 250 250 { 0, } 251 251 };
+1 -1
drivers/i2c/busses/i2c-tiny-usb.c
··· 137 137 * Future Technology Devices International Ltd., later a pair was 138 138 * bought from EZPrototypes 139 139 */ 140 - static struct usb_device_id i2c_tiny_usb_table [] = { 140 + static const struct usb_device_id i2c_tiny_usb_table[] = { 141 141 { USB_DEVICE(0x0403, 0xc631) }, /* FTDI */ 142 142 { USB_DEVICE(0x1c40, 0x0534) }, /* EZPrototypes */ 143 143 { } /* Terminating entry */
+1 -1
drivers/i2c/busses/i2c-via.c
··· 89 89 }; 90 90 91 91 92 - static struct pci_device_id vt586b_ids[] __devinitdata = { 92 + static const struct pci_device_id vt586b_ids[] __devinitconst = { 93 93 { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3) }, 94 94 { 0, } 95 95 };
+1 -1
drivers/i2c/busses/i2c-viapro.c
··· 444 444 return error; 445 445 } 446 446 447 - static struct pci_device_id vt596_ids[] = { 447 + static const struct pci_device_id vt596_ids[] = { 448 448 { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C596_3), 449 449 .driver_data = SMBBA1 }, 450 450 { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C596B_3),