[PATCH] (6/13) i2c: Reuse name strings in i2c bus drivers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Clean up name string usage in 12 i2c bus drivers:
* Use the i2c_adapter name for requesting the I/O region rather than
  redefining a new string.
* Do not initialize the i2c_adapter name to "unset".
This should save a few data bytes here and there.

Signed-off-by: Jean Delvare <khali at linux-fr.org>

 drivers/i2c/busses/i2c-ali1535.c |    6 +++---
 drivers/i2c/busses/i2c-ali1563.c |    6 ++++--
 drivers/i2c/busses/i2c-ali15x3.c |    5 +++--
 drivers/i2c/busses/i2c-amd756.c  |    5 ++---
 drivers/i2c/busses/i2c-amd8111.c |    4 +++-
 drivers/i2c/busses/i2c-i801.c    |    4 ++--
 drivers/i2c/busses/i2c-nforce2.c |    4 ++--
 drivers/i2c/busses/i2c-piix4.c   |    4 ++--
 drivers/i2c/busses/i2c-sis5595.c |    5 +++--
 drivers/i2c/busses/i2c-sis630.c  |    6 ++++--
 drivers/i2c/busses/i2c-sis96x.c  |    5 +++--
 drivers/i2c/busses/i2c-via.c     |    4 ++--
 12 files changed, 33 insertions(+), 25 deletions(-)

--- linux-2.6.14-rc2.orig/drivers/i2c/busses/i2c-ali1535.c	2005-09-25 09:03:35.000000000 +0200
+++ linux-2.6.14-rc2/drivers/i2c/busses/i2c-ali1535.c	2005-09-25 14:38:01.000000000 +0200
@@ -134,7 +134,7 @@
 					/*  -> Read  = 1		*/
 #define	ALI1535_SMBIO_EN	0x04	/* SMB I/O Space enable		*/
 
-
+static struct pci_driver ali1535_driver;
 static unsigned short ali1535_smba;
 static DECLARE_MUTEX(i2c_ali1535_sem);
 
@@ -162,7 +162,8 @@
 		goto exit;
 	}
 
-	if (!request_region(ali1535_smba, ALI1535_SMB_IOSIZE, "ali1535-smb")) {
+	if (!request_region(ali1535_smba, ALI1535_SMB_IOSIZE,
+			    ali1535_driver.name)) {
 		dev_err(&dev->dev, "ALI1535_smb region 0x%x already in use!\n",
 			ali1535_smba);
 		goto exit;
@@ -480,7 +481,6 @@
 	.owner		= THIS_MODULE,
 	.class          = I2C_CLASS_HWMON,
 	.algo		= &smbus_algorithm,
-	.name		= "unset",
 };
 
 static struct pci_device_id ali1535_ids[] = {
--- linux-2.6.14-rc2.orig/drivers/i2c/busses/i2c-ali15x3.c	2005-09-25 14:32:07.000000000 +0200
+++ linux-2.6.14-rc2/drivers/i2c/busses/i2c-ali15x3.c	2005-09-25 14:38:01.000000000 +0200
@@ -130,6 +130,7 @@
 MODULE_PARM_DESC(force_addr,
 		 "Initialize the base address of the i2c controller");
 
+static struct pci_driver ali15x3_driver;
 static unsigned short ali15x3_smba;
 
 static int ali15x3_setup(struct pci_dev *ALI15X3_dev)
@@ -166,7 +167,8 @@
 	if(force_addr)
 		ali15x3_smba = force_addr & ~(ALI15X3_SMB_IOSIZE - 1);
 
-	if (!request_region(ali15x3_smba, ALI15X3_SMB_IOSIZE, "ali15x3-smb")) {
+	if (!request_region(ali15x3_smba, ALI15X3_SMB_IOSIZE,
+			    ali15x3_driver.name)) {
 		dev_err(&ALI15X3_dev->dev,
 			"ALI15X3_smb region 0x%x already in use!\n",
 			ali15x3_smba);
@@ -470,7 +472,6 @@
 	.owner		= THIS_MODULE,
 	.class          = I2C_CLASS_HWMON,
 	.algo		= &smbus_algorithm,
-	.name		= "unset",
 };
 
 static struct pci_device_id ali15x3_ids[] = {
--- linux-2.6.14-rc2.orig/drivers/i2c/busses/i2c-amd756.c	2005-09-25 14:32:07.000000000 +0200
+++ linux-2.6.14-rc2/drivers/i2c/busses/i2c-amd756.c	2005-09-25 14:41:52.000000000 +0200
@@ -85,7 +85,7 @@
 #define AMD756_PROCESS_CALL	0x04
 #define AMD756_BLOCK_DATA	0x05
 
-
+static struct pci_driver amd756_driver;
 static unsigned short amd756_ioport;
 
 /* 
@@ -303,7 +303,6 @@
 	.owner		= THIS_MODULE,
 	.class          = I2C_CLASS_HWMON,
 	.algo		= &smbus_algorithm,
-	.name		= "unset",
 };
 
 enum chiptype { AMD756, AMD766, AMD768, NFORCE, AMD8111 };
@@ -365,7 +364,7 @@
 		amd756_ioport += SMB_ADDR_OFFSET;
 	}
 
-	if (!request_region(amd756_ioport, SMB_IOSIZE, "amd756-smbus")) {
+	if (!request_region(amd756_ioport, SMB_IOSIZE, amd756_driver.name)) {
 		dev_err(&pdev->dev, "SMB region 0x%x already in use!\n",
 			amd756_ioport);
 		return -ENODEV;
--- linux-2.6.14-rc2.orig/drivers/i2c/busses/i2c-i801.c	2005-09-25 09:03:35.000000000 +0200
+++ linux-2.6.14-rc2/drivers/i2c/busses/i2c-i801.c	2005-09-25 14:38:01.000000000 +0200
@@ -110,6 +110,7 @@
 				  char read_write, int command);
 
 static unsigned short i801_smba;
+static struct pci_driver i801_driver;
 static struct pci_dev *I801_dev;
 static int isich4;
 
@@ -143,7 +144,7 @@
 		}
 	}
 
-	if (!request_region(i801_smba, (isich4 ? 16 : 8), "i801-smbus")) {
+	if (!request_region(i801_smba, (isich4 ? 16 : 8), i801_driver.name)) {
 		dev_err(&dev->dev, "I801_smb region 0x%x already in use!\n",
 			i801_smba);
 		error_return = -EBUSY;
@@ -543,7 +544,6 @@
 	.owner		= THIS_MODULE,
 	.class		= I2C_CLASS_HWMON,
 	.algo		= &smbus_algorithm,
-	.name		= "unset",
 };
 
 static struct pci_device_id i801_ids[] = {
--- linux-2.6.14-rc2.orig/drivers/i2c/busses/i2c-nforce2.c	2005-09-25 09:03:35.000000000 +0200
+++ linux-2.6.14-rc2/drivers/i2c/busses/i2c-nforce2.c	2005-09-25 14:38:01.000000000 +0200
@@ -97,6 +97,7 @@
 #define NVIDIA_SMB_PRTCL_I2C_BLOCK_DATA		0x4a
 #define NVIDIA_SMB_PRTCL_PEC			0x80
 
+static struct pci_driver nforce2_driver;
 
 static s32 nforce2_access(struct i2c_adapter *adap, u16 addr,
 		       unsigned short flags, char read_write,
@@ -113,7 +114,6 @@
 	.owner          = THIS_MODULE,
 	.class          = I2C_CLASS_HWMON,
 	.algo           = &smbus_algorithm,
-	.name   	= "unset",
 };
 
 /* Return -1 on error. See smbus.h for more information */
@@ -285,7 +285,7 @@
 	smbus->base = iobase & 0xfffc;
 	smbus->size = 8;
 
-	if (!request_region(smbus->base, smbus->size, "nForce2 SMBus")) {
+	if (!request_region(smbus->base, smbus->size, nforce2_driver.name)) {
 		dev_err(&smbus->adapter.dev, "Error requesting region %02x .. %02X for %s\n",
 			smbus->base, smbus->base+smbus->size-1, name);
 		return -1;
--- linux-2.6.14-rc2.orig/drivers/i2c/busses/i2c-piix4.c	2005-09-25 14:32:07.000000000 +0200
+++ linux-2.6.14-rc2/drivers/i2c/busses/i2c-piix4.c	2005-09-25 14:38:01.000000000 +0200
@@ -112,6 +112,7 @@
 static int piix4_transaction(void);
 
 static unsigned short piix4_smba;
+static struct pci_driver piix4_driver;
 static struct i2c_adapter piix4_adapter;
 
 static struct dmi_system_id __devinitdata piix4_dmi_table[] = {
@@ -157,7 +158,7 @@
 		}
 	}
 
-	if (!request_region(piix4_smba, SMBIOSIZE, "piix4-smbus")) {
+	if (!request_region(piix4_smba, SMBIOSIZE, piix4_driver.name)) {
 		dev_err(&PIIX4_dev->dev, "SMB region 0x%x already in use!\n",
 			piix4_smba);
 		return -ENODEV;
@@ -407,7 +408,6 @@
 	.owner		= THIS_MODULE,
 	.class		= I2C_CLASS_HWMON,
 	.algo		= &smbus_algorithm,
-	.name		= "unset",
 };
 
 static struct pci_device_id piix4_ids[] = {
--- linux-2.6.14-rc2.orig/drivers/i2c/busses/i2c-sis5595.c	2005-09-25 14:32:07.000000000 +0200
+++ linux-2.6.14-rc2/drivers/i2c/busses/i2c-sis5595.c	2005-09-25 14:38:01.000000000 +0200
@@ -127,6 +127,7 @@
 module_param(force_addr, ushort, 0);
 MODULE_PARM_DESC(force_addr, "Initialize the base address of the i2c controller");
 
+static struct pci_driver sis5595_driver;
 static unsigned short sis5595_base;
 
 static u8 sis5595_read(u8 reg)
@@ -172,7 +173,8 @@
 
 	/* NB: We grab just the two SMBus registers here, but this may still
 	 * interfere with ACPI :-(  */
-	if (!request_region(sis5595_base + SMB_INDEX, 2, "sis5595-smbus")) {
+	if (!request_region(sis5595_base + SMB_INDEX, 2,
+			    sis5595_driver.name)) {
 		dev_err(&SIS5595_dev->dev, "SMBus registers 0x%04x-0x%04x already in use!\n",
 			sis5595_base + SMB_INDEX, sis5595_base + SMB_INDEX + 1);
 		return -ENODEV;
@@ -364,7 +366,6 @@
 static struct i2c_adapter sis5595_adapter = {
 	.owner		= THIS_MODULE,
 	.class          = I2C_CLASS_HWMON,
-	.name		= "unset",
 	.algo		= &smbus_algorithm,
 };
 
--- linux-2.6.14-rc2.orig/drivers/i2c/busses/i2c-sis630.c	2005-09-25 14:32:07.000000000 +0200
+++ linux-2.6.14-rc2/drivers/i2c/busses/i2c-sis630.c	2005-09-25 14:38:01.000000000 +0200
@@ -92,6 +92,8 @@
 #define SIS630_PCALL		0x04
 #define SIS630_BLOCK_DATA	0x05
 
+static struct pci_driver sis630_driver;
+
 /* insmod parameters */
 static int high_clock;
 static int force;
@@ -432,7 +434,8 @@
 	dev_dbg(&sis630_dev->dev, "ACPI base at 0x%04x\n", acpi_base);
 
 	/* Everything is happy, let's grab the memory and set things up. */
-	if (!request_region(acpi_base + SMB_STS, SIS630_SMB_IOREGION, "sis630-smbus")) {
+	if (!request_region(acpi_base + SMB_STS, SIS630_SMB_IOREGION,
+			    sis630_driver.name)) {
 		dev_err(&sis630_dev->dev, "SMBus registers 0x%04x-0x%04x already "
 			"in use!\n", acpi_base + SMB_STS, acpi_base + SMB_SAA);
 		goto exit;
@@ -455,7 +458,6 @@
 static struct i2c_adapter sis630_adapter = {
 	.owner		= THIS_MODULE,
 	.class		= I2C_CLASS_HWMON,
-	.name		= "unset",
 	.algo		= &smbus_algorithm,
 };
 
--- linux-2.6.14-rc2.orig/drivers/i2c/busses/i2c-sis96x.c	2005-09-25 14:32:07.000000000 +0200
+++ linux-2.6.14-rc2/drivers/i2c/busses/i2c-sis96x.c	2005-09-25 14:38:01.000000000 +0200
@@ -82,6 +82,7 @@
 #define SIS96x_PROC_CALL  0x04
 #define SIS96x_BLOCK_DATA 0x05
 
+static struct pci_driver sis96x_driver;
 static struct i2c_adapter sis96x_adapter;
 static u16 sis96x_smbus_base;
 
@@ -257,7 +258,6 @@
 	.owner		= THIS_MODULE,
 	.class		= I2C_CLASS_HWMON,
 	.algo		= &smbus_algorithm,
-	.name		= "unset",
 };
 
 static struct pci_device_id sis96x_ids[] = {
@@ -294,7 +294,8 @@
 			sis96x_smbus_base);
 
 	/* Everything is happy, let's grab the memory and set things up. */
-	if (!request_region(sis96x_smbus_base, SMB_IOSIZE, "sis96x-smbus")) {
+	if (!request_region(sis96x_smbus_base, SMB_IOSIZE,
+			    sis96x_driver.name)) {
 		dev_err(&dev->dev, "SMBus registers 0x%04x-0x%04x "
 			"already in use!\n", sis96x_smbus_base,
 			sis96x_smbus_base + SMB_IOSIZE - 1);
--- linux-2.6.14-rc2.orig/drivers/i2c/busses/i2c-via.c	2005-09-25 14:32:07.000000000 +0200
+++ linux-2.6.14-rc2/drivers/i2c/busses/i2c-via.c	2005-09-25 14:41:41.000000000 +0200
@@ -43,8 +43,8 @@
 
 /* io-region reservation */
 #define IOSPACE		0x06
-#define IOTEXT		"via-i2c"
 
+static struct pci_driver vt586b_driver;
 static u16 pm_io_base;
 
 /*
@@ -130,7 +130,7 @@
 	pci_read_config_word(dev, base, &pm_io_base);
 	pm_io_base &= (0xff << 8);
 
-	if (!request_region(I2C_DIR, IOSPACE, IOTEXT)) {
+	if (!request_region(I2C_DIR, IOSPACE, vt586b_driver.name)) {
 		dev_err(&dev->dev, "IO 0x%x-0x%x already in use\n", I2C_DIR, I2C_DIR + IOSPACE);
 		return -ENODEV;
 	}
--- linux-2.6.14-rc2.orig/drivers/i2c/busses/i2c-ali1563.c	2005-09-25 09:03:35.000000000 +0200
+++ linux-2.6.14-rc2/drivers/i2c/busses/i2c-ali1563.c	2005-09-25 14:38:01.000000000 +0200
@@ -60,6 +60,7 @@
 
 #define HST_CNTL2_SIZEMASK	0x38
 
+static struct pci_driver ali1563_pci_driver;
 static unsigned short ali1563_smba;
 
 static int ali1563_transaction(struct i2c_adapter * a, int size)
@@ -350,7 +351,8 @@
 		dev_warn(&dev->dev,"ali1563_smba Uninitialized\n");
 		goto Err;
 	}
-	if (!request_region(ali1563_smba,ALI1563_SMB_IOSIZE,"i2c-ali1563")) {
+	if (!request_region(ali1563_smba, ALI1563_SMB_IOSIZE,
+			    ali1563_pci_driver.name)) {
 		dev_warn(&dev->dev,"Could not allocate I/O space");
 		goto Err;
 	}
@@ -406,7 +408,7 @@
 MODULE_DEVICE_TABLE (pci, ali1563_id_table);
 
 static struct pci_driver ali1563_pci_driver = {
- 	.name		= "ali1563_i2c",
+ 	.name		= "ali1563_smbus",
 	.id_table	= ali1563_id_table,
  	.probe		= ali1563_probe,
 	.remove		= __devexit_p(ali1563_remove),
--- linux-2.6.14-rc2.orig/drivers/i2c/busses/i2c-amd8111.c	2005-09-25 09:03:35.000000000 +0200
+++ linux-2.6.14-rc2/drivers/i2c/busses/i2c-amd8111.c	2005-09-25 14:38:01.000000000 +0200
@@ -30,6 +30,8 @@
 	int size;
 };
 
+static struct pci_driver amd8111_driver;
+
 /*
  * AMD PCI control registers definitions.
  */
@@ -352,7 +354,7 @@
 	smbus->base = pci_resource_start(dev, 0);
 	smbus->size = pci_resource_len(dev, 0);
 
-	if (!request_region(smbus->base, smbus->size, "amd8111 SMBus 2.0"))
+	if (!request_region(smbus->base, smbus->size, amd8111_driver.name))
 		goto out_kfree;
 
 	smbus->adapter.owner = THIS_MODULE;

-- 
Jean Delvare




[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux