]> err.no Git - linux-2.6/commitdiff
[PATCH] i2c: Reuse name strings in i2c bus drivers
authorJean Delvare <khali@linux-fr.org>
Sun, 25 Sep 2005 14:37:04 +0000 (16:37 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 28 Oct 2005 21:02:06 +0000 (14:02 -0700)
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@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
 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(-)

12 files changed:
drivers/i2c/busses/i2c-ali1535.c
drivers/i2c/busses/i2c-ali1563.c
drivers/i2c/busses/i2c-ali15x3.c
drivers/i2c/busses/i2c-amd756.c
drivers/i2c/busses/i2c-amd8111.c
drivers/i2c/busses/i2c-i801.c
drivers/i2c/busses/i2c-nforce2.c
drivers/i2c/busses/i2c-piix4.c
drivers/i2c/busses/i2c-sis5595.c
drivers/i2c/busses/i2c-sis630.c
drivers/i2c/busses/i2c-sis96x.c
drivers/i2c/busses/i2c-via.c

index f021acd2674e9cfe6377a3225520418363a51fc9..3eb47890db40b24e627e468487595a696115b252 100644 (file)
                                        /*  -> 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 @@ static int ali1535_setup(struct pci_dev *dev)
                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 @@ static struct i2c_adapter ali1535_adapter = {
        .owner          = THIS_MODULE,
        .class          = I2C_CLASS_HWMON,
        .algo           = &smbus_algorithm,
-       .name           = "unset",
 };
 
 static struct pci_device_id ali1535_ids[] = {
index 86947504aea1e041f64677052882a552bae14d7a..e6f63208fc4a631df15682ed6a32c3c5f68793bd 100644 (file)
@@ -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 @@ static int __devinit ali1563_setup(struct pci_dev * dev)
                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 @@ static struct pci_device_id __devinitdata ali1563_id_table[] = {
 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),
index e13d60c120b926283205b4a48be35d29d20e0977..7a5c0941dbc13f396aaabaf5881f48eb0650761c 100644 (file)
@@ -130,6 +130,7 @@ module_param(force_addr, ushort, 0);
 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 @@ static int ali15x3_setup(struct pci_dev *ALI15X3_dev)
        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 @@ static struct i2c_adapter ali15x3_adapter = {
        .owner          = THIS_MODULE,
        .class          = I2C_CLASS_HWMON,
        .algo           = &smbus_algorithm,
-       .name           = "unset",
 };
 
 static struct pci_device_id ali15x3_ids[] = {
index 3bbac2f8ce3877b54e1ae62a71cc412f4ec974f2..1750dedaf4b5620a553455778efd62d3bf9ca2fd 100644 (file)
@@ -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 @@ struct i2c_adapter amd756_smbus = {
        .owner          = THIS_MODULE,
        .class          = I2C_CLASS_HWMON,
        .algo           = &smbus_algorithm,
-       .name           = "unset",
 };
 
 enum chiptype { AMD756, AMD766, AMD768, NFORCE, AMD8111 };
@@ -365,7 +364,7 @@ static int __devinit amd756_probe(struct pci_dev *pdev,
                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;
index 45ea24ba14d5b2d537502a6d3e43a4065f96902a..49ff11e5134f08f6d7fe4a630830a8be70700f84 100644 (file)
@@ -30,6 +30,8 @@ struct amd_smbus {
        int size;
 };
 
+static struct pci_driver amd8111_driver;
+
 /*
  * AMD PCI control registers definitions.
  */
@@ -352,7 +354,7 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_
        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;
index 709beab76609eb43bdd4deb1b2a96db195d23aa0..588583530c9fce1d72817aa0db1e9bdaa3409cf0 100644 (file)
@@ -110,6 +110,7 @@ static int i801_block_transaction(union i2c_smbus_data *data,
                                  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 @@ static int i801_setup(struct pci_dev *dev)
                }
        }
 
-       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 @@ static struct i2c_adapter i801_adapter = {
        .owner          = THIS_MODULE,
        .class          = I2C_CLASS_HWMON,
        .algo           = &smbus_algorithm,
-       .name           = "unset",
 };
 
 static struct pci_device_id i801_ids[] = {
index fe9c0f42a2b7735e746a2a8ac5ddce404b7044f4..dd4b6d8e03efa74ca2792cc2666d0002e41599a0 100644 (file)
@@ -97,6 +97,7 @@ struct nforce2_smbus {
 #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 @@ static struct i2c_adapter nforce2_adapter = {
        .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 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int reg,
        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;
index 1b2d3ebd107574b8269c9f1f80a75cd54bfb3efa..692f473454813722d9a8cd676eb3d724265e2a72 100644 (file)
@@ -112,6 +112,7 @@ MODULE_PARM_DESC(fix_hstcfg,
 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 @@ static int __devinit piix4_setup(struct pci_dev *PIIX4_dev,
                }
        }
 
-       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 @@ static struct i2c_adapter piix4_adapter = {
        .owner          = THIS_MODULE,
        .class          = I2C_CLASS_HWMON,
        .algo           = &smbus_algorithm,
-       .name           = "unset",
 };
 
 static struct pci_device_id piix4_ids[] = {
index 3fd38f4673e3611a6d399c7273fb435bc85b5404..b57ab74d23ecaa42c14ff8d0a22a225766ba7c12 100644 (file)
@@ -127,6 +127,7 @@ static u16 force_addr;
 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 @@ static int sis5595_setup(struct pci_dev *SIS5595_dev)
 
        /* 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_algorithm smbus_algorithm = {
 static struct i2c_adapter sis5595_adapter = {
        .owner          = THIS_MODULE,
        .class          = I2C_CLASS_HWMON,
-       .name           = "unset",
        .algo           = &smbus_algorithm,
 };
 
index 44c4e68e9a988c6b6c3f79a280ea26cdcd93374f..acb75e2824140220fcea0b4e010fac3e0c69f0fb 100644 (file)
@@ -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 @@ static int sis630_setup(struct pci_dev *sis630_dev)
        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_algorithm smbus_algorithm = {
 static struct i2c_adapter sis630_adapter = {
        .owner          = THIS_MODULE,
        .class          = I2C_CLASS_HWMON,
-       .name           = "unset",
        .algo           = &smbus_algorithm,
 };
 
index 9ddd910c3b992ece293c2d140578d830e3f0c32d..3024907cdafe6d44bd0eaf1a54a8edc587987584 100644 (file)
@@ -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 @@ static struct i2c_adapter sis96x_adapter = {
        .owner          = THIS_MODULE,
        .class          = I2C_CLASS_HWMON,
        .algo           = &smbus_algorithm,
-       .name           = "unset",
 };
 
 static struct pci_device_id sis96x_ids[] = {
@@ -294,7 +294,8 @@ static int __devinit sis96x_probe(struct pci_dev *dev,
                        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);
index 0b3edd4e6c12f51174fc85251ca2d83cba6d61c0..484bbacfce6bf005fc435f7f1a653fdc7659495f 100644 (file)
@@ -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 @@ static int __devinit vt586b_probe(struct pci_dev *dev, const struct pci_device_i
        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;
        }