Skip to content

Commit 4111ecd

Browse files
nmarci1Jean Delvare
authored andcommitted
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>
1 parent 13dda80 commit 4111ecd

17 files changed

Lines changed: 17 additions & 17 deletions

‎drivers/i2c/busses/i2c-ali1535.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ static struct i2c_adapter ali1535_adapter = {
480480
.algo = &smbus_algorithm,
481481
};
482482

483-
static struct pci_device_id ali1535_ids[] = {
483+
static const struct pci_device_id ali1535_ids[] = {
484484
{ PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101) },
485485
{ },
486486
};

‎drivers/i2c/busses/i2c-ali1563.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ static void __devexit ali1563_remove(struct pci_dev * dev)
417417
ali1563_shutdown(dev);
418418
}
419419

420-
static struct pci_device_id __devinitdata ali1563_id_table[] = {
420+
static const struct pci_device_id ali1563_id_table[] __devinitconst = {
421421
{ PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1563) },
422422
{},
423423
};

‎drivers/i2c/busses/i2c-ali15x3.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ static struct i2c_adapter ali15x3_adapter = {
477477
.algo = &smbus_algorithm,
478478
};
479479

480-
static struct pci_device_id ali15x3_ids[] = {
480+
static const struct pci_device_id ali15x3_ids[] = {
481481
{ PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101) },
482482
{ 0, }
483483
};

‎drivers/i2c/busses/i2c-amd756.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ static const char* chipname[] = {
308308
"nVidia nForce", "AMD8111",
309309
};
310310

311-
static struct pci_device_id amd756_ids[] = {
311+
static const struct pci_device_id amd756_ids[] = {
312312
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_740B),
313313
.driver_data = AMD756 },
314314
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_7413),

‎drivers/i2c/busses/i2c-amd8111.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ static const struct i2c_algorithm smbus_algorithm = {
351351
};
352352

353353

354-
static struct pci_device_id amd8111_ids[] = {
354+
static const struct pci_device_id amd8111_ids[] = {
355355
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_SMBUS2) },
356356
{ 0, }
357357
};

‎drivers/i2c/busses/i2c-hydra.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static struct i2c_adapter hydra_adap = {
105105
.algo_data = &hydra_bit_data,
106106
};
107107

108-
static struct pci_device_id hydra_ids[] = {
108+
static const struct pci_device_id hydra_ids[] = {
109109
{ PCI_DEVICE(PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_HYDRA) },
110110
{ 0, }
111111
};

‎drivers/i2c/busses/i2c-i801.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ static struct i2c_adapter i801_adapter = {
561561
.algo = &smbus_algorithm,
562562
};
563563

564-
static struct pci_device_id i801_ids[] = {
564+
static const struct pci_device_id i801_ids[] = {
565565
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_3) },
566566
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_3) },
567567
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_2) },

‎drivers/i2c/busses/i2c-isch.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ static struct i2c_adapter sch_adapter = {
256256
.algo = &smbus_algorithm,
257257
};
258258

259-
static struct pci_device_id sch_ids[] = {
259+
static const struct pci_device_id sch_ids[] = {
260260
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SCH_LPC) },
261261
{ 0, }
262262
};

‎drivers/i2c/busses/i2c-nforce2.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ static struct i2c_algorithm smbus_algorithm = {
308308
};
309309

310310

311-
static struct pci_device_id nforce2_ids[] = {
311+
static const struct pci_device_id nforce2_ids[] = {
312312
{ PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS) },
313313
{ PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_SMBUS) },
314314
{ PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS) },

‎drivers/i2c/busses/i2c-pasemi.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ static void __devexit pasemi_smb_remove(struct pci_dev *dev)
400400
kfree(smbus);
401401
}
402402

403-
static struct pci_device_id pasemi_smb_ids[] = {
403+
static const struct pci_device_id pasemi_smb_ids[] = {
404404
{ PCI_DEVICE(0x1959, 0xa003) },
405405
{ 0, }
406406
};

0 commit comments

Comments
 (0)