]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvar...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 14 Jan 2012 20:25:40 +0000 (12:25 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 14 Jan 2012 20:25:40 +0000 (12:25 -0800)
* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  MAINTAINERS: List i2c-omap and i2c-davinci drivers
  MAINTAINERS: i2c: Add third maintainer
  i2c/gpio-i2cmux: Convert to use module_platform_driver()
  i2c/busses: Use module_platform_driver()
  i2c-dev: Use memdup_user
  i2c: Convert to DEFINE_PCI_DEVICE_TABLE
  i2c-ali1535: enable SPARC support
  i2c: Fix error value returned by several bus drivers

41 files changed:
MAINTAINERS
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-at91.c
drivers/i2c/busses/i2c-au1550.c
drivers/i2c/busses/i2c-cpm.c
drivers/i2c/busses/i2c-designware-pcidrv.c
drivers/i2c/busses/i2c-eg20t.c
drivers/i2c/busses/i2c-highlander.c
drivers/i2c/busses/i2c-hydra.c
drivers/i2c/busses/i2c-i801.c
drivers/i2c/busses/i2c-ibm_iic.c
drivers/i2c/busses/i2c-intel-mid.c
drivers/i2c/busses/i2c-iop3xx.c
drivers/i2c/busses/i2c-isch.c
drivers/i2c/busses/i2c-ixp2000.c
drivers/i2c/busses/i2c-mpc.c
drivers/i2c/busses/i2c-mv64xxx.c
drivers/i2c/busses/i2c-nforce2.c
drivers/i2c/busses/i2c-ocores.c
drivers/i2c/busses/i2c-octeon.c
drivers/i2c/busses/i2c-pasemi.c
drivers/i2c/busses/i2c-pca-platform.c
drivers/i2c/busses/i2c-piix4.c
drivers/i2c/busses/i2c-pmcmsp.c
drivers/i2c/busses/i2c-powermac.c
drivers/i2c/busses/i2c-pxa-pci.c
drivers/i2c/busses/i2c-sh7760.c
drivers/i2c/busses/i2c-simtec.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
drivers/i2c/busses/i2c-viapro.c
drivers/i2c/busses/i2c-xiic.c
drivers/i2c/busses/scx200_acb.c
drivers/i2c/i2c-dev.c
drivers/i2c/muxes/gpio-i2cmux.c

index 1094edf0da173d2e77a34b7515cfa9b81d939f0a..7559c1ca56ba7afc11104e430c20417d905654f9 100644 (file)
@@ -3193,6 +3193,7 @@ F:        drivers/i2c/busses/i2c-stub.c
 I2C SUBSYSTEM
 M:     "Jean Delvare (PC drivers, core)" <khali@linux-fr.org>
 M:     "Ben Dooks (embedded platforms)" <ben-linux@fluff.org>
+M:     "Wolfram Sang (embedded platforms)" <w.sang@pengutronix.de>
 L:     linux-i2c@vger.kernel.org
 W:     http://i2c.wiki.kernel.org/
 T:     quilt kernel.org/pub/linux/kernel/people/jdelvare/linux-2.6/jdelvare-i2c/
@@ -4683,6 +4684,8 @@ Q:        http://patchwork.kernel.org/project/linux-omap/list/
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git
 S:     Maintained
 F:     arch/arm/*omap*/
+F:     drivers/i2c/busses/i2c-omap.c
+F:     include/linux/i2c-omap.h
 
 OMAP CLOCK FRAMEWORK SUPPORT
 M:     Paul Walmsley <paul@pwsan.com>
@@ -5956,6 +5959,7 @@ L:        davinci-linux-open-source@linux.davincidsp.com (subscribers-only)
 Q:     http://patchwork.kernel.org/project/linux-davinci/list/
 S:     Supported
 F:     arch/arm/mach-davinci
+F:     drivers/i2c/busses/i2c-davinci.c
 
 SIS 190 ETHERNET DRIVER
 M:     Francois Romieu <romieu@fr.zoreil.com>
index b6807db7b36f98f03ff00d15f6677906c4ddc8aa..e66d248fc126b8ffe4f9d85e45f82a76c5ee9bf7 100644 (file)
 #define        ALI1535_SMBIO_EN        0x04    /* SMB I/O Space enable         */
 
 static struct pci_driver ali1535_driver;
-static unsigned short ali1535_smba;
+static unsigned long ali1535_smba;
+static unsigned short ali1535_offset;
 
 /* Detect whether a ALI1535 can be found, and initialize it, where necessary.
    Note the differences between kernels with the old PCI BIOS interface and
@@ -140,7 +141,7 @@ static unsigned short ali1535_smba;
    defined to make the transition easier. */
 static int __devinit ali1535_setup(struct pci_dev *dev)
 {
-       int retval = -ENODEV;
+       int retval;
        unsigned char temp;
 
        /* Check the following things:
@@ -149,15 +150,28 @@ static int __devinit ali1535_setup(struct pci_dev *dev)
                - We can use the addresses
        */
 
+       retval = pci_enable_device(dev);
+       if (retval) {
+               dev_err(&dev->dev, "ALI1535_smb can't enable device\n");
+               goto exit;
+       }
+
        /* Determine the address of the SMBus area */
-       pci_read_config_word(dev, SMBBA, &ali1535_smba);
-       ali1535_smba &= (0xffff & ~(ALI1535_SMB_IOSIZE - 1));
-       if (ali1535_smba == 0) {
+       pci_read_config_word(dev, SMBBA, &ali1535_offset);
+       dev_dbg(&dev->dev, "ALI1535_smb is at offset 0x%04x\n", ali1535_offset);
+       ali1535_offset &= (0xffff & ~(ALI1535_SMB_IOSIZE - 1));
+       if (ali1535_offset == 0) {
                dev_warn(&dev->dev,
                        "ALI1535_smb region uninitialized - upgrade BIOS?\n");
+               retval = -ENODEV;
                goto exit;
        }
 
+       if (pci_resource_flags(dev, 0) & IORESOURCE_IO)
+               ali1535_smba = pci_resource_start(dev, 0) + ali1535_offset;
+       else
+               ali1535_smba = ali1535_offset;
+
        retval = acpi_check_region(ali1535_smba, ALI1535_SMB_IOSIZE,
                                   ali1535_driver.name);
        if (retval)
@@ -165,8 +179,9 @@ static int __devinit ali1535_setup(struct pci_dev *dev)
 
        if (!request_region(ali1535_smba, ALI1535_SMB_IOSIZE,
                            ali1535_driver.name)) {
-               dev_err(&dev->dev, "ALI1535_smb region 0x%x already in use!\n",
+               dev_err(&dev->dev, "ALI1535_smb region 0x%lx already in use!\n",
                        ali1535_smba);
+               retval = -EBUSY;
                goto exit;
        }
 
@@ -174,6 +189,7 @@ static int __devinit ali1535_setup(struct pci_dev *dev)
        pci_read_config_byte(dev, SMBCFG, &temp);
        if ((temp & ALI1535_SMBIO_EN) == 0) {
                dev_err(&dev->dev, "SMB device not enabled - upgrade BIOS?\n");
+               retval = -ENODEV;
                goto exit_free;
        }
 
@@ -181,6 +197,7 @@ static int __devinit ali1535_setup(struct pci_dev *dev)
        pci_read_config_byte(dev, SMBHSTCFG, &temp);
        if ((temp & 1) == 0) {
                dev_err(&dev->dev, "SMBus controller not enabled - upgrade BIOS?\n");
+               retval = -ENODEV;
                goto exit_free;
        }
 
@@ -196,14 +213,13 @@ static int __devinit ali1535_setup(struct pci_dev *dev)
        */
        pci_read_config_byte(dev, SMBREV, &temp);
        dev_dbg(&dev->dev, "SMBREV = 0x%X\n", temp);
-       dev_dbg(&dev->dev, "ALI1535_smba = 0x%X\n", ali1535_smba);
+       dev_dbg(&dev->dev, "ALI1535_smba = 0x%lx\n", ali1535_smba);
 
-       retval = 0;
-exit:
-       return retval;
+       return 0;
 
 exit_free:
        release_region(ali1535_smba, ALI1535_SMB_IOSIZE);
+exit:
        return retval;
 }
 
@@ -498,7 +514,7 @@ static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_
        ali1535_adapter.dev.parent = &dev->dev;
 
        snprintf(ali1535_adapter.name, sizeof(ali1535_adapter.name),
-               "SMBus ALI1535 adapter at %04x", ali1535_smba);
+               "SMBus ALI1535 adapter at %04x", ali1535_offset);
        return i2c_add_adapter(&ali1535_adapter);
 }
 
index a409cfcf06291fdf568c6c2aed21e666da7b23bb..47ae0091e027dbab7b11e83b7924e7a2fc016027 100644 (file)
@@ -417,7 +417,7 @@ static void __devexit ali1563_remove(struct pci_dev * dev)
        ali1563_shutdown(dev);
 }
 
-static const struct pci_device_id ali1563_id_table[] __devinitconst = {
+static DEFINE_PCI_DEVICE_TABLE(ali1563_id_table) = {
        { PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1563) },
        {},
 };
index 83e8a60cdc86ba8cc87d4d0463d0d3cf859c35e7..087ea9caa74d3ac34b4ced643c0b8303aba6474e 100644 (file)
@@ -477,7 +477,7 @@ static struct i2c_adapter ali15x3_adapter = {
        .algo           = &smbus_algorithm,
 };
 
-static const struct pci_device_id ali15x3_ids[] = {
+static DEFINE_PCI_DEVICE_TABLE(ali15x3_ids) = {
        { PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101) },
        { 0, }
 };
index 03bcd07c4697721b35810bf0b379465baffd23f2..eb778bf15c18539f579a6d435d4d0410fe1e4bce 100644 (file)
@@ -308,7 +308,7 @@ static const char* chipname[] = {
        "nVidia nForce", "AMD8111",
 };
 
-static const struct pci_device_id amd756_ids[] = {
+static DEFINE_PCI_DEVICE_TABLE(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),
index 6b6a6b1d70252539f6be0c0da874281d624d817e..e5ac53b99b0473703b8408bdde663ddd207f2b70 100644 (file)
@@ -415,7 +415,7 @@ static const struct i2c_algorithm smbus_algorithm = {
 };
 
 
-static const struct pci_device_id amd8111_ids[] = {
+static DEFINE_PCI_DEVICE_TABLE(amd8111_ids) = {
        { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_SMBUS2) },
        { 0, }
 };
index 305c07504f7ebe055f2bfd5468e75a8e0ba31790..1679deef9c890131a951ee5cb8d50217ecb9bcf5 100644 (file)
@@ -295,9 +295,6 @@ static int at91_i2c_resume(struct platform_device *pdev)
 #define at91_i2c_resume                NULL
 #endif
 
-/* work with "modprobe at91_i2c" from hotplugging or coldplugging */
-MODULE_ALIAS("platform:at91_i2c");
-
 static struct platform_driver at91_i2c_driver = {
        .probe          = at91_i2c_probe,
        .remove         = __devexit_p(at91_i2c_remove),
@@ -309,19 +306,9 @@ static struct platform_driver at91_i2c_driver = {
        },
 };
 
-static int __init at91_i2c_init(void)
-{
-       return platform_driver_register(&at91_i2c_driver);
-}
-
-static void __exit at91_i2c_exit(void)
-{
-       platform_driver_unregister(&at91_i2c_driver);
-}
-
-module_init(at91_i2c_init);
-module_exit(at91_i2c_exit);
+module_platform_driver(at91_i2c_driver);
 
 MODULE_AUTHOR("Rick Bronson");
 MODULE_DESCRIPTION("I2C (TWI) driver for Atmel AT91");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:at91_i2c");
index f314d7f433d321f4abd236cca1723443db778aa7..582d616db34615611c4783525cbfc46bccf37351 100644 (file)
@@ -426,20 +426,9 @@ static struct platform_driver au1xpsc_smbus_driver = {
        .remove         = __devexit_p(i2c_au1550_remove),
 };
 
-static int __init i2c_au1550_init(void)
-{
-       return platform_driver_register(&au1xpsc_smbus_driver);
-}
-
-static void __exit i2c_au1550_exit(void)
-{
-       platform_driver_unregister(&au1xpsc_smbus_driver);
-}
+module_platform_driver(au1xpsc_smbus_driver);
 
 MODULE_AUTHOR("Dan Malek, Embedded Edge, LLC.");
 MODULE_DESCRIPTION("SMBus adapter Alchemy pb1550");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:au1xpsc_smbus");
-
-module_init (i2c_au1550_init);
-module_exit (i2c_au1550_exit);
index b1d9cd28d8da9d92906a6cd5dc6b20c50ac3b48e..c1e1096ba06936a08cb60950123d67fdf59b3e96 100644 (file)
@@ -724,18 +724,7 @@ static struct platform_driver cpm_i2c_driver = {
        },
 };
 
-static int __init cpm_i2c_init(void)
-{
-       return platform_driver_register(&cpm_i2c_driver);
-}
-
-static void __exit cpm_i2c_exit(void)
-{
-       platform_driver_unregister(&cpm_i2c_driver);
-}
-
-module_init(cpm_i2c_init);
-module_exit(cpm_i2c_exit);
+module_platform_driver(cpm_i2c_driver);
 
 MODULE_AUTHOR("Jochen Friedrich <jochen@scram.de>");
 MODULE_DESCRIPTION("I2C-Bus adapter routines for CPM boards");
index 9e89e7313d620437fcd892abb808a1181709f726..37f42113af31bc54da67d953938630c513955a4d 100644 (file)
@@ -349,7 +349,7 @@ static void __devexit i2c_dw_pci_remove(struct pci_dev *pdev)
 /* work with hotplug and coldplug */
 MODULE_ALIAS("i2c_designware-pci");
 
-DEFINE_PCI_DEVICE_TABLE(i2_designware_pci_ids) = {
+static DEFINE_PCI_DEVICE_TABLE(i2_designware_pci_ids) = {
        /* Moorestown */
        { PCI_VDEVICE(INTEL, 0x0802), moorestown_0 },
        { PCI_VDEVICE(INTEL, 0x0803), moorestown_1 },
index 18936ac9d51cd14af2221546fd062c3494ea18ec..3ef3557b6e32d5d03b1b048bdae39988d0524a4e 100644 (file)
@@ -185,7 +185,7 @@ static DEFINE_MUTEX(pch_mutex);
 #define PCI_DEVICE_ID_ML7213_I2C       0x802D
 #define PCI_DEVICE_ID_ML7223_I2C       0x8010
 
-static struct pci_device_id __devinitdata pch_pcidev_id[] = {
+static DEFINE_PCI_DEVICE_TABLE(pch_pcidev_id) = {
        { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PCH_I2C),   1, },
        { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7213_I2C), 2, },
        { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7223_I2C), 1, },
index 63bb1cc2a042125fe87e2bf9243a4bc40ffc5ab8..2294dea6b14584d1d757614da2a8870a2a7fc0da 100644 (file)
@@ -468,18 +468,7 @@ static struct platform_driver highlander_i2c_driver = {
        .remove         = __devexit_p(highlander_i2c_remove),
 };
 
-static int __init highlander_i2c_init(void)
-{
-       return platform_driver_register(&highlander_i2c_driver);
-}
-
-static void __exit highlander_i2c_exit(void)
-{
-       platform_driver_unregister(&highlander_i2c_driver);
-}
-
-module_init(highlander_i2c_init);
-module_exit(highlander_i2c_exit);
+module_platform_driver(highlander_i2c_driver);
 
 MODULE_AUTHOR("Paul Mundt");
 MODULE_DESCRIPTION("Renesas Highlander FPGA I2C/SMBus adapter");
index 9ff1695d845862ec77a4cf8ab1e5db7486ddc459..c527de17db4f25d8c539cefd2f3d2661b4e12fbf 100644 (file)
@@ -105,7 +105,7 @@ static struct i2c_adapter hydra_adap = {
        .algo_data      = &hydra_bit_data,
 };
 
-static const struct pci_device_id hydra_ids[] = {
+static DEFINE_PCI_DEVICE_TABLE(hydra_ids) = {
        { PCI_DEVICE(PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_HYDRA) },
        { 0, }
 };
index ab26840d0c7087073dbbba598953ebfca699b7b9..5d2e2816831f21dcd73912e8d33a9407f6df0b62 100644 (file)
@@ -609,7 +609,7 @@ static const struct i2c_algorithm smbus_algorithm = {
        .functionality  = i801_func,
 };
 
-static const struct pci_device_id i801_ids[] = {
+static DEFINE_PCI_DEVICE_TABLE(i801_ids) = {
        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_3) },
        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_3) },
        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_2) },
index 3c110fbc409bb2c2ecd0cc2d7c6f9048914256cf..dacc5457a1be5c0eb23e8938bb06a7399dde1d88 100644 (file)
@@ -815,15 +815,4 @@ static struct platform_driver ibm_iic_driver = {
        .remove = __devexit_p(iic_remove),
 };
 
-static int __init iic_init(void)
-{
-       return platform_driver_register(&ibm_iic_driver);
-}
-
-static void __exit iic_exit(void)
-{
-       platform_driver_unregister(&ibm_iic_driver);
-}
-
-module_init(iic_init);
-module_exit(iic_exit);
+module_platform_driver(ibm_iic_driver);
index e828ac85cfa7298c68e1c5d6396ce13bc051aa14..365bad5b890b7ed6001ab48de51a17505056a789 100644 (file)
@@ -1093,7 +1093,7 @@ static void __devexit intel_mid_i2c_remove(struct pci_dev *dev)
        pci_release_region(dev, 0);
 }
 
-static struct pci_device_id intel_mid_i2c_ids[] = {
+static DEFINE_PCI_DEVICE_TABLE(intel_mid_i2c_ids) = {
        /* Moorestown */
        { PCI_VDEVICE(INTEL, 0x0802), 0 },
        { PCI_VDEVICE(INTEL, 0x0803), 1 },
index f09c9319a2babdecdb743a016995c0dd6554ad5a..93f147a96b6222253f367d4c6eb161922447a85a 100644 (file)
@@ -523,21 +523,7 @@ static struct platform_driver iop3xx_i2c_driver = {
        },
 };
 
-static int __init 
-i2c_iop3xx_init (void)
-{
-       return platform_driver_register(&iop3xx_i2c_driver);
-}
-
-static void __exit 
-i2c_iop3xx_exit (void)
-{
-       platform_driver_unregister(&iop3xx_i2c_driver);
-       return;
-}
-
-module_init (i2c_iop3xx_init);
-module_exit (i2c_iop3xx_exit);
+module_platform_driver(iop3xx_i2c_driver);
 
 MODULE_AUTHOR("D-TACQ Solutions Ltd <www.d-tacq.com>");
 MODULE_DESCRIPTION("IOP3xx iic algorithm and driver");
index 0682f8f277b013847b5545f597f68114920f408d..6561d275b8cf20fd9ed056c1963d66fd4c318899 100644 (file)
@@ -306,20 +306,9 @@ static struct platform_driver smbus_sch_driver = {
        .remove         = __devexit_p(smbus_sch_remove),
 };
 
-static int __init i2c_sch_init(void)
-{
-       return platform_driver_register(&smbus_sch_driver);
-}
-
-static void __exit i2c_sch_exit(void)
-{
-       platform_driver_unregister(&smbus_sch_driver);
-}
+module_platform_driver(smbus_sch_driver);
 
 MODULE_AUTHOR("Jacob Pan <jacob.jun.pan@intel.com>");
 MODULE_DESCRIPTION("Intel SCH SMBus driver");
 MODULE_LICENSE("GPL");
-
-module_init(i2c_sch_init);
-module_exit(i2c_sch_exit);
 MODULE_ALIAS("platform:isch_smbus");
index c01e9519f6c15ee5df4e8cb32ae44ae234f57482..5d263f9014d647a325373ce76fe26c4e7ba75177 100644 (file)
@@ -148,18 +148,7 @@ static struct platform_driver ixp2000_i2c_driver = {
        },
 };
 
-static int __init ixp2000_i2c_init(void)
-{
-       return platform_driver_register(&ixp2000_i2c_driver);
-}
-
-static void __exit ixp2000_i2c_exit(void)
-{
-       platform_driver_unregister(&ixp2000_i2c_driver);
-}
-
-module_init(ixp2000_i2c_init);
-module_exit(ixp2000_i2c_exit);
+module_platform_driver(ixp2000_i2c_driver);
 
 MODULE_AUTHOR ("Deepak Saxena <dsaxena@plexity.net>");
 MODULE_DESCRIPTION("IXP2000 GPIO-based I2C bus driver");
index 107397a606b48957638a9569c2672ba363a5c57d..a8ebb84e23f9b179c80c2eb20c8266461b0265da 100644 (file)
@@ -715,18 +715,7 @@ static struct platform_driver mpc_i2c_driver = {
        },
 };
 
-static int __init fsl_i2c_init(void)
-{
-       return platform_driver_register(&mpc_i2c_driver);
-}
-
-static void __exit fsl_i2c_exit(void)
-{
-       platform_driver_unregister(&mpc_i2c_driver);
-}
-
-module_init(fsl_i2c_init);
-module_exit(fsl_i2c_exit);
+module_platform_driver(mpc_i2c_driver);
 
 MODULE_AUTHOR("Adrian Cox <adrian@humboldt.co.uk>");
 MODULE_DESCRIPTION("I2C-Bus adapter for MPC107 bridge and "
index a9941c65f226758d2992bb123fd0b5b2ead759dd..4f44a33017b061db314e051f9df882d4dee6a9e0 100644 (file)
@@ -611,20 +611,7 @@ static struct platform_driver mv64xxx_i2c_driver = {
        },
 };
 
-static int __init
-mv64xxx_i2c_init(void)
-{
-       return platform_driver_register(&mv64xxx_i2c_driver);
-}
-
-static void __exit
-mv64xxx_i2c_exit(void)
-{
-       platform_driver_unregister(&mv64xxx_i2c_driver);
-}
-
-module_init(mv64xxx_i2c_init);
-module_exit(mv64xxx_i2c_exit);
+module_platform_driver(mv64xxx_i2c_driver);
 
 MODULE_AUTHOR("Mark A. Greer <mgreer@mvista.com>");
 MODULE_DESCRIPTION("Marvell mv64xxx host bridge i2c ctlr driver");
index ff1e127dfea8e9b100c9fa1f6e2ebfd54c6992a6..43a96a123920c8d75773735b3070e7b4872ddd62 100644 (file)
@@ -309,7 +309,7 @@ static struct i2c_algorithm smbus_algorithm = {
 };
 
 
-static const struct pci_device_id nforce2_ids[] = {
+static DEFINE_PCI_DEVICE_TABLE(nforce2_ids) = {
        { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS) },
        { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_SMBUS) },
        { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS) },
@@ -356,7 +356,7 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar,
        error = acpi_check_region(smbus->base, smbus->size,
                                  nforce2_driver.name);
        if (error)
-               return -1;
+               return error;
 
        if (!request_region(smbus->base, smbus->size, nforce2_driver.name)) {
                dev_err(&smbus->adapter.dev, "Error requesting region %02x .. %02X for %s\n",
index 1b46a9d9f907336fb70526ca93881ce3b3934950..18068dee48f1aa11543413894485e4916bfc5811 100644 (file)
@@ -394,9 +394,6 @@ static struct of_device_id ocores_i2c_match[] = {
 };
 MODULE_DEVICE_TABLE(of, ocores_i2c_match);
 
-/* work with hotplug and coldplug */
-MODULE_ALIAS("platform:ocores-i2c");
-
 static struct platform_driver ocores_i2c_driver = {
        .probe   = ocores_i2c_probe,
        .remove  = __devexit_p(ocores_i2c_remove),
@@ -409,19 +406,9 @@ static struct platform_driver ocores_i2c_driver = {
        },
 };
 
-static int __init ocores_i2c_init(void)
-{
-       return platform_driver_register(&ocores_i2c_driver);
-}
-
-static void __exit ocores_i2c_exit(void)
-{
-       platform_driver_unregister(&ocores_i2c_driver);
-}
-
-module_init(ocores_i2c_init);
-module_exit(ocores_i2c_exit);
+module_platform_driver(ocores_i2c_driver);
 
 MODULE_AUTHOR("Peter Korsgaard <jacmet@sunsite.dk>");
 MODULE_DESCRIPTION("OpenCores I2C bus driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:ocores-i2c");
index 56dbe54e88118a3fb7b112da16e11ccd5bdbc9fb..ee139a598814ea46da91fc494d6d2ded770ddef4 100644 (file)
@@ -629,24 +629,10 @@ static struct platform_driver octeon_i2c_driver = {
        },
 };
 
-static int __init octeon_i2c_init(void)
-{
-       int rv;
-
-       rv = platform_driver_register(&octeon_i2c_driver);
-       return rv;
-}
-
-static void __exit octeon_i2c_exit(void)
-{
-       platform_driver_unregister(&octeon_i2c_driver);
-}
+module_platform_driver(octeon_i2c_driver);
 
 MODULE_AUTHOR("Michael Lawnick <michael.lawnick.ext@nsn.com>");
 MODULE_DESCRIPTION("I2C-Bus adapter for Cavium OCTEON processors");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
 MODULE_ALIAS("platform:" DRV_NAME);
-
-module_init(octeon_i2c_init);
-module_exit(octeon_i2c_exit);
index 837b8c1aa02a494ef92899c46ccaf67cb709f9c1..eaaea73209c5ca5d81a0aec5b389d0520cba850d 100644 (file)
@@ -401,7 +401,7 @@ static void __devexit pasemi_smb_remove(struct pci_dev *dev)
        kfree(smbus);
 }
 
-static const struct pci_device_id pasemi_smb_ids[] = {
+static DEFINE_PCI_DEVICE_TABLE(pasemi_smb_ids) = {
        { PCI_DEVICE(0x1959, 0xa003) },
        { 0, }
 };
index ace67995d7de85d6bd93920e0595f73b49bd9763..2adbf1a8fdea0019d8ca3acae29790ca18722552 100644 (file)
@@ -286,20 +286,8 @@ static struct platform_driver i2c_pca_pf_driver = {
        },
 };
 
-static int __init i2c_pca_pf_init(void)
-{
-       return platform_driver_register(&i2c_pca_pf_driver);
-}
-
-static void __exit i2c_pca_pf_exit(void)
-{
-       platform_driver_unregister(&i2c_pca_pf_driver);
-}
+module_platform_driver(i2c_pca_pf_driver);
 
 MODULE_AUTHOR("Wolfram Sang <w.sang@pengutronix.de>");
 MODULE_DESCRIPTION("I2C-PCA9564/PCA9665 platform driver");
 MODULE_LICENSE("GPL");
-
-module_init(i2c_pca_pf_init);
-module_exit(i2c_pca_pf_exit);
-
index 6d14ac2e3c41b80982b1c5666cbca554d7c5facb..c14d48dd601a7d524ab97c8fff076867f21bae05 100644 (file)
@@ -472,7 +472,7 @@ static struct i2c_adapter piix4_adapter = {
        .algo           = &smbus_algorithm,
 };
 
-static const struct pci_device_id piix4_ids[] = {
+static DEFINE_PCI_DEVICE_TABLE(piix4_ids) = {
        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3) },
        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443MX_3) },
        { PCI_DEVICE(PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_3) },
index 127051b06921093f423b055f8b58cf364cc318e3..07b7447ecbc9102c7721e27727ab7d25223f35d8 100644 (file)
@@ -627,9 +627,6 @@ static struct i2c_adapter pmcmsptwi_adapter = {
        .name           = DRV_NAME,
 };
 
-/* work with hotplug and coldplug */
-MODULE_ALIAS("platform:" DRV_NAME);
-
 static struct platform_driver pmcmsptwi_driver = {
        .probe  = pmcmsptwi_probe,
        .remove = __devexit_p(pmcmsptwi_remove),
@@ -639,18 +636,8 @@ static struct platform_driver pmcmsptwi_driver = {
        },
 };
 
-static int __init pmcmsptwi_init(void)
-{
-       return platform_driver_register(&pmcmsptwi_driver);
-}
-
-static void __exit pmcmsptwi_exit(void)
-{
-       platform_driver_unregister(&pmcmsptwi_driver);
-}
+module_platform_driver(pmcmsptwi_driver);
 
 MODULE_DESCRIPTION("PMC MSP TWI/SMBus/I2C driver");
 MODULE_LICENSE("GPL");
-
-module_init(pmcmsptwi_init);
-module_exit(pmcmsptwi_exit);
+MODULE_ALIAS("platform:" DRV_NAME);
index b289ec99eeba087cd4be7e7da762a70a5de34889..7b397c6f607e46e4d52dd87f127d0208dde13839 100644 (file)
@@ -312,10 +312,6 @@ static int __devinit i2c_powermac_probe(struct platform_device *dev)
        return rc;
 }
 
-
-/* work with hotplug and coldplug */
-MODULE_ALIAS("platform:i2c-powermac");
-
 static struct platform_driver i2c_powermac_driver = {
        .probe = i2c_powermac_probe,
        .remove = __devexit_p(i2c_powermac_remove),
@@ -325,17 +321,6 @@ static struct platform_driver i2c_powermac_driver = {
        },
 };
 
-static int __init i2c_powermac_init(void)
-{
-       platform_driver_register(&i2c_powermac_driver);
-       return 0;
-}
+module_platform_driver(i2c_powermac_driver);
 
-
-static void __exit i2c_powermac_cleanup(void)
-{
-       platform_driver_unregister(&i2c_powermac_driver);
-}
-
-module_init(i2c_powermac_init);
-module_exit(i2c_powermac_cleanup);
+MODULE_ALIAS("platform:i2c-powermac");
index 632e088760a3fc006147f375bd97d15b453fe961..a05817980556542d77a9e4463060fb8e7fc6ab5d 100644 (file)
@@ -150,7 +150,7 @@ static void __devexit ce4100_i2c_remove(struct pci_dev *dev)
        kfree(sds);
 }
 
-static struct pci_device_id ce4100_i2c_devices[] __devinitdata = {
+static DEFINE_PCI_DEVICE_TABLE(ce4100_i2c_devices) = {
        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2e68)},
        { },
 };
index a67132b2e0922b893c3920621524a014aabaf4c9..c0c9dffbdb12faa38fded2cfdae970dc941c91c5 100644 (file)
@@ -560,18 +560,7 @@ static struct platform_driver sh7760_i2c_drv = {
        .remove         = __devexit_p(sh7760_i2c_remove),
 };
 
-static int __init sh7760_i2c_init(void)
-{
-       return platform_driver_register(&sh7760_i2c_drv);
-}
-
-static void __exit sh7760_i2c_exit(void)
-{
-       platform_driver_unregister(&sh7760_i2c_drv);
-}
-
-module_init(sh7760_i2c_init);
-module_exit(sh7760_i2c_exit);
+module_platform_driver(sh7760_i2c_drv);
 
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("SH7760 I2C bus driver");
index 2fc08fbf67a223d6e7bfb26a0cf0d50ff40f821d..4fc87e7c94c9472b1df8b44f25e10dd605593805 100644 (file)
@@ -156,12 +156,8 @@ static int simtec_i2c_remove(struct platform_device *dev)
        return 0;
 }
 
-
 /* device driver */
 
-/* work with hotplug and coldplug */
-MODULE_ALIAS("platform:simtec-i2c");
-
 static struct platform_driver simtec_i2c_driver = {
        .driver         = {
                .name           = "simtec-i2c",
@@ -171,19 +167,9 @@ static struct platform_driver simtec_i2c_driver = {
        .remove         = simtec_i2c_remove,
 };
 
-static int __init i2c_adap_simtec_init(void)
-{
-       return platform_driver_register(&simtec_i2c_driver);
-}
-
-static void __exit i2c_adap_simtec_exit(void)
-{
-       platform_driver_unregister(&simtec_i2c_driver);
-}
-
-module_init(i2c_adap_simtec_init);
-module_exit(i2c_adap_simtec_exit);
+module_platform_driver(simtec_i2c_driver);
 
 MODULE_DESCRIPTION("Simtec Generic I2C Bus driver");
 MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:simtec-i2c");
index 437586611d4a18819f110698d7618f7dde9471c3..87e5126d449ce4072eb263cb04b180e5c6d597f4 100644 (file)
@@ -147,7 +147,7 @@ static int __devinit sis5595_setup(struct pci_dev *SIS5595_dev)
        u16 a;
        u8 val;
        int *i;
-       int retval = -ENODEV;
+       int retval;
 
        /* Look for imposters */
        for (i = blacklist; *i != 0; i++) {
@@ -223,7 +223,7 @@ static int __devinit sis5595_setup(struct pci_dev *SIS5595_dev)
 
 error:
        release_region(sis5595_base + SMB_INDEX, 2);
-       return retval;
+       return -ENODEV;
 }
 
 static int sis5595_transaction(struct i2c_adapter *adap)
@@ -369,7 +369,7 @@ static struct i2c_adapter sis5595_adapter = {
        .algo           = &smbus_algorithm,
 };
 
-static const struct pci_device_id sis5595_ids[] __devinitconst = {
+static DEFINE_PCI_DEVICE_TABLE(sis5595_ids) = {
        { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503) }, 
        { 0, }
 };
index e6f539e26f65fb97918e132164d45b80ce4a0113..e3df028bcf3b08946823253a281d30aea0afe660 100644 (file)
@@ -393,7 +393,7 @@ static int __devinit sis630_setup(struct pci_dev *sis630_dev)
 {
        unsigned char b;
        struct pci_dev *dummy = NULL;
-       int retval = -ENODEV, i;
+       int retval, i;
 
        /* check for supported SiS devices */
        for (i=0; supported[i] > 0 ; i++) {
@@ -418,18 +418,21 @@ static int __devinit sis630_setup(struct pci_dev *sis630_dev)
        */
        if (pci_read_config_byte(sis630_dev, SIS630_BIOS_CTL_REG,&b)) {
                dev_err(&sis630_dev->dev, "Error: Can't read bios ctl reg\n");
+               retval = -ENODEV;
                goto exit;
        }
        /* if ACPI already enabled , do nothing */
        if (!(b & 0x80) &&
            pci_write_config_byte(sis630_dev, SIS630_BIOS_CTL_REG, b | 0x80)) {
                dev_err(&sis630_dev->dev, "Error: Can't enable ACPI\n");
+               retval = -ENODEV;
                goto exit;
        }
 
        /* Determine the ACPI base address */
        if (pci_read_config_word(sis630_dev,SIS630_ACPI_BASE_REG,&acpi_base)) {
                dev_err(&sis630_dev->dev, "Error: Can't determine ACPI base address\n");
+               retval = -ENODEV;
                goto exit;
        }
 
@@ -445,6 +448,7 @@ static int __devinit sis630_setup(struct pci_dev *sis630_dev)
                            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);
+               retval = -EBUSY;
                goto exit;
        }
 
@@ -468,7 +472,7 @@ static struct i2c_adapter sis630_adapter = {
        .algo           = &smbus_algorithm,
 };
 
-static const struct pci_device_id sis630_ids[] __devinitconst = {
+static DEFINE_PCI_DEVICE_TABLE(sis630_ids) = {
        { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503) },
        { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_LPC) },
        { 0, }
index 86837f0c4cb92efc4e1582dc2cfa2e89f68d936a..cc5d149413f7edb236ca48f57af155aaef5fefd9 100644 (file)
@@ -245,7 +245,7 @@ static struct i2c_adapter sis96x_adapter = {
        .algo           = &smbus_algorithm,
 };
 
-static const struct pci_device_id sis96x_ids[] = {
+static DEFINE_PCI_DEVICE_TABLE(sis96x_ids) = {
        { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_SMBUS) },
        { 0, }
 };
index 7799fe5bda885d3513a6e7b34f5686ae979d8456..713d31ade26b7ca8f77f2fa6be99757cb6af3299 100644 (file)
@@ -89,7 +89,7 @@ static struct i2c_adapter vt586b_adapter = {
 };
 
 
-static const struct pci_device_id vt586b_ids[] __devinitconst = {
+static DEFINE_PCI_DEVICE_TABLE(vt586b_ids) = {
        { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3) },
        { 0, }
 };
index 0b012f1f8ac5791ba9a4aa7926f75fbe97c57567..c3926c26d8cfa55f432dac0906bbd31c5701a675 100644 (file)
@@ -324,7 +324,7 @@ static int __devinit vt596_probe(struct pci_dev *pdev,
                                 const struct pci_device_id *id)
 {
        unsigned char temp;
-       int error = -ENODEV;
+       int error;
 
        /* Determine the address of the SMBus areas */
        if (force_addr) {
@@ -390,6 +390,7 @@ found:
                        dev_err(&pdev->dev, "SMBUS: Error: Host SMBus "
                                "controller not enabled! - upgrade BIOS or "
                                "use force=1\n");
+                       error = -ENODEV;
                        goto release_region;
                }
        }
@@ -422,9 +423,11 @@ found:
                 "SMBus Via Pro adapter at %04x", vt596_smba);
 
        vt596_pdev = pci_dev_get(pdev);
-       if (i2c_add_adapter(&vt596_adapter)) {
+       error = i2c_add_adapter(&vt596_adapter);
+       if (error) {
                pci_dev_put(vt596_pdev);
                vt596_pdev = NULL;
+               goto release_region;
        }
 
        /* Always return failure here.  This is to allow other drivers to bind
@@ -438,7 +441,7 @@ release_region:
        return error;
 }
 
-static const struct pci_device_id vt596_ids[] = {
+static DEFINE_PCI_DEVICE_TABLE(vt596_ids) = {
        { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C596_3),
          .driver_data = SMBBA1 },
        { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C596B_3),
index ac083a28ae08e97f815632836638a7637d8732c1..2bded7647ef25b1a98f2211d1723de10568e3e7f 100644 (file)
@@ -795,10 +795,6 @@ static int __devexit xiic_i2c_remove(struct platform_device* pdev)
        return 0;
 }
 
-
-/* work with hotplug and coldplug */
-MODULE_ALIAS("platform:"DRIVER_NAME);
-
 static struct platform_driver xiic_i2c_driver = {
        .probe   = xiic_i2c_probe,
        .remove  = __devexit_p(xiic_i2c_remove),
@@ -808,19 +804,9 @@ static struct platform_driver xiic_i2c_driver = {
        },
 };
 
-static int __init xiic_i2c_init(void)
-{
-       return platform_driver_register(&xiic_i2c_driver);
-}
-
-static void __exit xiic_i2c_exit(void)
-{
-       platform_driver_unregister(&xiic_i2c_driver);
-}
-
-module_init(xiic_i2c_init);
-module_exit(xiic_i2c_exit);
+module_platform_driver(xiic_i2c_driver);
 
 MODULE_AUTHOR("info@mocean-labs.com");
 MODULE_DESCRIPTION("Xilinx I2C bus driver");
 MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:"DRIVER_NAME);
index 91e349c884c5c9ec73fc42b6fecd4964afc7ff12..2eacb7784d565edfeac64533ef48937c068220da 100644 (file)
@@ -559,7 +559,7 @@ static struct platform_driver scx200_pci_driver = {
        .remove = __devexit_p(scx200_remove),
 };
 
-static const struct pci_device_id scx200_isa[] __initconst = {
+static DEFINE_PCI_DEVICE_TABLE(scx200_isa) = {
        { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_BRIDGE) },
        { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SC1100_BRIDGE) },
        { 0, }
index 57a45ce84b2d42f893cf45fb6e876bc1904bcfde..10e7f1e7658610b8e2b697cf6e355a999aa4f5b6 100644 (file)
@@ -251,15 +251,10 @@ static noinline int i2cdev_ioctl_rdrw(struct i2c_client *client,
        if (rdwr_arg.nmsgs > I2C_RDRW_IOCTL_MAX_MSGS)
                return -EINVAL;
 
-       rdwr_pa = kmalloc(rdwr_arg.nmsgs * sizeof(struct i2c_msg), GFP_KERNEL);
-       if (!rdwr_pa)
-               return -ENOMEM;
-
-       if (copy_from_user(rdwr_pa, rdwr_arg.msgs,
-                          rdwr_arg.nmsgs * sizeof(struct i2c_msg))) {
-               kfree(rdwr_pa);
-               return -EFAULT;
-       }
+       rdwr_pa = memdup_user(rdwr_arg.msgs,
+                             rdwr_arg.nmsgs * sizeof(struct i2c_msg));
+       if (IS_ERR(rdwr_pa))
+               return PTR_ERR(rdwr_pa);
 
        data_ptrs = kmalloc(rdwr_arg.nmsgs * sizeof(u8 __user *), GFP_KERNEL);
        if (data_ptrs == NULL) {
index 7b6ce624cd6e7e403b2cb7708b8581423298ef42..e5fa695eb0fa64673e1c26e82536b52a3a3388e8 100644 (file)
@@ -165,18 +165,7 @@ static struct platform_driver gpiomux_driver = {
        },
 };
 
-static int __init gpiomux_init(void)
-{
-       return platform_driver_register(&gpiomux_driver);
-}
-
-static void __exit gpiomux_exit(void)
-{
-       platform_driver_unregister(&gpiomux_driver);
-}
-
-module_init(gpiomux_init);
-module_exit(gpiomux_exit);
+module_platform_driver(gpiomux_driver);
 
 MODULE_DESCRIPTION("GPIO-based I2C multiplexer driver");
 MODULE_AUTHOR("Peter Korsgaard <peter.korsgaard@barco.com>");