Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4111ecd2 authored by Márton Németh's avatar Márton Németh Committed by Jean Delvare
Browse files

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: default avatarMárton Németh <nm127@freemail.hu>
Cc: Julia Lawall <julia@diku.dk>
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
parent 13dda80e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -480,7 +480,7 @@ static struct i2c_adapter ali1535_adapter = {
	.algo		= &smbus_algorithm,
};

static struct pci_device_id ali1535_ids[] = {
static const struct pci_device_id ali1535_ids[] = {
	{ PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101) },
	{ },
};
+1 −1
Original line number Diff line number Diff line
@@ -417,7 +417,7 @@ static void __devexit ali1563_remove(struct pci_dev * dev)
	ali1563_shutdown(dev);
}

static struct pci_device_id __devinitdata ali1563_id_table[] = {
static const struct pci_device_id ali1563_id_table[] __devinitconst = {
	{ PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1563) },
	{},
};
+1 −1
Original line number Diff line number Diff line
@@ -477,7 +477,7 @@ static struct i2c_adapter ali15x3_adapter = {
	.algo		= &smbus_algorithm,
};

static struct pci_device_id ali15x3_ids[] = {
static const struct pci_device_id ali15x3_ids[] = {
	{ PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101) },
	{ 0, }
};
+1 −1
Original line number Diff line number Diff line
@@ -308,7 +308,7 @@ static const char* chipname[] = {
	"nVidia nForce", "AMD8111",
};

static struct pci_device_id amd756_ids[] = {
static const struct pci_device_id amd756_ids[] = {
	{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_740B),
	  .driver_data = AMD756 },
	{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_7413),
+1 −1
Original line number Diff line number Diff line
@@ -351,7 +351,7 @@ static const struct i2c_algorithm smbus_algorithm = {
};


static struct pci_device_id amd8111_ids[] = {
static const struct pci_device_id amd8111_ids[] = {
	{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_SMBUS2) },
	{ 0, }
};
Loading