Commit f88609a0e447fb73851c0f640ed47257838ff99f
Exists in
master
and in
38 other branches
Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
* '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
Showing 41 changed files Side-by-side Diff
- 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
MAINTAINERS
... | ... | @@ -3193,6 +3193,7 @@ |
3193 | 3193 | I2C SUBSYSTEM |
3194 | 3194 | M: "Jean Delvare (PC drivers, core)" <khali@linux-fr.org> |
3195 | 3195 | M: "Ben Dooks (embedded platforms)" <ben-linux@fluff.org> |
3196 | +M: "Wolfram Sang (embedded platforms)" <w.sang@pengutronix.de> | |
3196 | 3197 | L: linux-i2c@vger.kernel.org |
3197 | 3198 | W: http://i2c.wiki.kernel.org/ |
3198 | 3199 | T: quilt kernel.org/pub/linux/kernel/people/jdelvare/linux-2.6/jdelvare-i2c/ |
... | ... | @@ -4683,6 +4684,8 @@ |
4683 | 4684 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git |
4684 | 4685 | S: Maintained |
4685 | 4686 | F: arch/arm/*omap*/ |
4687 | +F: drivers/i2c/busses/i2c-omap.c | |
4688 | +F: include/linux/i2c-omap.h | |
4686 | 4689 | |
4687 | 4690 | OMAP CLOCK FRAMEWORK SUPPORT |
4688 | 4691 | M: Paul Walmsley <paul@pwsan.com> |
... | ... | @@ -5956,6 +5959,7 @@ |
5956 | 5959 | Q: http://patchwork.kernel.org/project/linux-davinci/list/ |
5957 | 5960 | S: Supported |
5958 | 5961 | F: arch/arm/mach-davinci |
5962 | +F: drivers/i2c/busses/i2c-davinci.c | |
5959 | 5963 | |
5960 | 5964 | SIS 190 ETHERNET DRIVER |
5961 | 5965 | M: Francois Romieu <romieu@fr.zoreil.com> |
drivers/i2c/busses/i2c-ali1535.c
... | ... | @@ -132,7 +132,8 @@ |
132 | 132 | #define ALI1535_SMBIO_EN 0x04 /* SMB I/O Space enable */ |
133 | 133 | |
134 | 134 | static struct pci_driver ali1535_driver; |
135 | -static unsigned short ali1535_smba; | |
135 | +static unsigned long ali1535_smba; | |
136 | +static unsigned short ali1535_offset; | |
136 | 137 | |
137 | 138 | /* Detect whether a ALI1535 can be found, and initialize it, where necessary. |
138 | 139 | Note the differences between kernels with the old PCI BIOS interface and |
... | ... | @@ -140,7 +141,7 @@ |
140 | 141 | defined to make the transition easier. */ |
141 | 142 | static int __devinit ali1535_setup(struct pci_dev *dev) |
142 | 143 | { |
143 | - int retval = -ENODEV; | |
144 | + int retval; | |
144 | 145 | unsigned char temp; |
145 | 146 | |
146 | 147 | /* Check the following things: |
147 | 148 | |
148 | 149 | |
149 | 150 | |
... | ... | @@ -149,15 +150,28 @@ |
149 | 150 | - We can use the addresses |
150 | 151 | */ |
151 | 152 | |
153 | + retval = pci_enable_device(dev); | |
154 | + if (retval) { | |
155 | + dev_err(&dev->dev, "ALI1535_smb can't enable device\n"); | |
156 | + goto exit; | |
157 | + } | |
158 | + | |
152 | 159 | /* Determine the address of the SMBus area */ |
153 | - pci_read_config_word(dev, SMBBA, &ali1535_smba); | |
154 | - ali1535_smba &= (0xffff & ~(ALI1535_SMB_IOSIZE - 1)); | |
155 | - if (ali1535_smba == 0) { | |
160 | + pci_read_config_word(dev, SMBBA, &ali1535_offset); | |
161 | + dev_dbg(&dev->dev, "ALI1535_smb is at offset 0x%04x\n", ali1535_offset); | |
162 | + ali1535_offset &= (0xffff & ~(ALI1535_SMB_IOSIZE - 1)); | |
163 | + if (ali1535_offset == 0) { | |
156 | 164 | dev_warn(&dev->dev, |
157 | 165 | "ALI1535_smb region uninitialized - upgrade BIOS?\n"); |
166 | + retval = -ENODEV; | |
158 | 167 | goto exit; |
159 | 168 | } |
160 | 169 | |
170 | + if (pci_resource_flags(dev, 0) & IORESOURCE_IO) | |
171 | + ali1535_smba = pci_resource_start(dev, 0) + ali1535_offset; | |
172 | + else | |
173 | + ali1535_smba = ali1535_offset; | |
174 | + | |
161 | 175 | retval = acpi_check_region(ali1535_smba, ALI1535_SMB_IOSIZE, |
162 | 176 | ali1535_driver.name); |
163 | 177 | if (retval) |
164 | 178 | |
... | ... | @@ -165,8 +179,9 @@ |
165 | 179 | |
166 | 180 | if (!request_region(ali1535_smba, ALI1535_SMB_IOSIZE, |
167 | 181 | ali1535_driver.name)) { |
168 | - dev_err(&dev->dev, "ALI1535_smb region 0x%x already in use!\n", | |
182 | + dev_err(&dev->dev, "ALI1535_smb region 0x%lx already in use!\n", | |
169 | 183 | ali1535_smba); |
184 | + retval = -EBUSY; | |
170 | 185 | goto exit; |
171 | 186 | } |
172 | 187 | |
... | ... | @@ -174,6 +189,7 @@ |
174 | 189 | pci_read_config_byte(dev, SMBCFG, &temp); |
175 | 190 | if ((temp & ALI1535_SMBIO_EN) == 0) { |
176 | 191 | dev_err(&dev->dev, "SMB device not enabled - upgrade BIOS?\n"); |
192 | + retval = -ENODEV; | |
177 | 193 | goto exit_free; |
178 | 194 | } |
179 | 195 | |
... | ... | @@ -181,6 +197,7 @@ |
181 | 197 | pci_read_config_byte(dev, SMBHSTCFG, &temp); |
182 | 198 | if ((temp & 1) == 0) { |
183 | 199 | dev_err(&dev->dev, "SMBus controller not enabled - upgrade BIOS?\n"); |
200 | + retval = -ENODEV; | |
184 | 201 | goto exit_free; |
185 | 202 | } |
186 | 203 | |
187 | 204 | |
188 | 205 | |
... | ... | @@ -196,14 +213,13 @@ |
196 | 213 | */ |
197 | 214 | pci_read_config_byte(dev, SMBREV, &temp); |
198 | 215 | dev_dbg(&dev->dev, "SMBREV = 0x%X\n", temp); |
199 | - dev_dbg(&dev->dev, "ALI1535_smba = 0x%X\n", ali1535_smba); | |
216 | + dev_dbg(&dev->dev, "ALI1535_smba = 0x%lx\n", ali1535_smba); | |
200 | 217 | |
201 | - retval = 0; | |
202 | -exit: | |
203 | - return retval; | |
218 | + return 0; | |
204 | 219 | |
205 | 220 | exit_free: |
206 | 221 | release_region(ali1535_smba, ALI1535_SMB_IOSIZE); |
222 | +exit: | |
207 | 223 | return retval; |
208 | 224 | } |
209 | 225 | |
... | ... | @@ -498,7 +514,7 @@ |
498 | 514 | ali1535_adapter.dev.parent = &dev->dev; |
499 | 515 | |
500 | 516 | snprintf(ali1535_adapter.name, sizeof(ali1535_adapter.name), |
501 | - "SMBus ALI1535 adapter at %04x", ali1535_smba); | |
517 | + "SMBus ALI1535 adapter at %04x", ali1535_offset); | |
502 | 518 | return i2c_add_adapter(&ali1535_adapter); |
503 | 519 | } |
504 | 520 |
drivers/i2c/busses/i2c-ali1563.c
... | ... | @@ -417,7 +417,7 @@ |
417 | 417 | ali1563_shutdown(dev); |
418 | 418 | } |
419 | 419 | |
420 | -static const struct pci_device_id ali1563_id_table[] __devinitconst = { | |
420 | +static DEFINE_PCI_DEVICE_TABLE(ali1563_id_table) = { | |
421 | 421 | { PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1563) }, |
422 | 422 | {}, |
423 | 423 | }; |
drivers/i2c/busses/i2c-ali15x3.c
drivers/i2c/busses/i2c-amd756.c
... | ... | @@ -308,7 +308,7 @@ |
308 | 308 | "nVidia nForce", "AMD8111", |
309 | 309 | }; |
310 | 310 | |
311 | -static const struct pci_device_id amd756_ids[] = { | |
311 | +static DEFINE_PCI_DEVICE_TABLE(amd756_ids) = { | |
312 | 312 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_740B), |
313 | 313 | .driver_data = AMD756 }, |
314 | 314 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_7413), |
drivers/i2c/busses/i2c-amd8111.c
drivers/i2c/busses/i2c-at91.c
... | ... | @@ -295,9 +295,6 @@ |
295 | 295 | #define at91_i2c_resume NULL |
296 | 296 | #endif |
297 | 297 | |
298 | -/* work with "modprobe at91_i2c" from hotplugging or coldplugging */ | |
299 | -MODULE_ALIAS("platform:at91_i2c"); | |
300 | - | |
301 | 298 | static struct platform_driver at91_i2c_driver = { |
302 | 299 | .probe = at91_i2c_probe, |
303 | 300 | .remove = __devexit_p(at91_i2c_remove), |
304 | 301 | |
305 | 302 | |
... | ... | @@ -309,20 +306,10 @@ |
309 | 306 | }, |
310 | 307 | }; |
311 | 308 | |
312 | -static int __init at91_i2c_init(void) | |
313 | -{ | |
314 | - return platform_driver_register(&at91_i2c_driver); | |
315 | -} | |
309 | +module_platform_driver(at91_i2c_driver); | |
316 | 310 | |
317 | -static void __exit at91_i2c_exit(void) | |
318 | -{ | |
319 | - platform_driver_unregister(&at91_i2c_driver); | |
320 | -} | |
321 | - | |
322 | -module_init(at91_i2c_init); | |
323 | -module_exit(at91_i2c_exit); | |
324 | - | |
325 | 311 | MODULE_AUTHOR("Rick Bronson"); |
326 | 312 | MODULE_DESCRIPTION("I2C (TWI) driver for Atmel AT91"); |
327 | 313 | MODULE_LICENSE("GPL"); |
314 | +MODULE_ALIAS("platform:at91_i2c"); |
drivers/i2c/busses/i2c-au1550.c
... | ... | @@ -426,21 +426,10 @@ |
426 | 426 | .remove = __devexit_p(i2c_au1550_remove), |
427 | 427 | }; |
428 | 428 | |
429 | -static int __init i2c_au1550_init(void) | |
430 | -{ | |
431 | - return platform_driver_register(&au1xpsc_smbus_driver); | |
432 | -} | |
429 | +module_platform_driver(au1xpsc_smbus_driver); | |
433 | 430 | |
434 | -static void __exit i2c_au1550_exit(void) | |
435 | -{ | |
436 | - platform_driver_unregister(&au1xpsc_smbus_driver); | |
437 | -} | |
438 | - | |
439 | 431 | MODULE_AUTHOR("Dan Malek, Embedded Edge, LLC."); |
440 | 432 | MODULE_DESCRIPTION("SMBus adapter Alchemy pb1550"); |
441 | 433 | MODULE_LICENSE("GPL"); |
442 | 434 | MODULE_ALIAS("platform:au1xpsc_smbus"); |
443 | - | |
444 | -module_init (i2c_au1550_init); | |
445 | -module_exit (i2c_au1550_exit); |
drivers/i2c/busses/i2c-cpm.c
... | ... | @@ -724,18 +724,7 @@ |
724 | 724 | }, |
725 | 725 | }; |
726 | 726 | |
727 | -static int __init cpm_i2c_init(void) | |
728 | -{ | |
729 | - return platform_driver_register(&cpm_i2c_driver); | |
730 | -} | |
731 | - | |
732 | -static void __exit cpm_i2c_exit(void) | |
733 | -{ | |
734 | - platform_driver_unregister(&cpm_i2c_driver); | |
735 | -} | |
736 | - | |
737 | -module_init(cpm_i2c_init); | |
738 | -module_exit(cpm_i2c_exit); | |
727 | +module_platform_driver(cpm_i2c_driver); | |
739 | 728 | |
740 | 729 | MODULE_AUTHOR("Jochen Friedrich <jochen@scram.de>"); |
741 | 730 | MODULE_DESCRIPTION("I2C-Bus adapter routines for CPM boards"); |
drivers/i2c/busses/i2c-designware-pcidrv.c
... | ... | @@ -349,7 +349,7 @@ |
349 | 349 | /* work with hotplug and coldplug */ |
350 | 350 | MODULE_ALIAS("i2c_designware-pci"); |
351 | 351 | |
352 | -DEFINE_PCI_DEVICE_TABLE(i2_designware_pci_ids) = { | |
352 | +static DEFINE_PCI_DEVICE_TABLE(i2_designware_pci_ids) = { | |
353 | 353 | /* Moorestown */ |
354 | 354 | { PCI_VDEVICE(INTEL, 0x0802), moorestown_0 }, |
355 | 355 | { PCI_VDEVICE(INTEL, 0x0803), moorestown_1 }, |
drivers/i2c/busses/i2c-eg20t.c
... | ... | @@ -185,7 +185,7 @@ |
185 | 185 | #define PCI_DEVICE_ID_ML7213_I2C 0x802D |
186 | 186 | #define PCI_DEVICE_ID_ML7223_I2C 0x8010 |
187 | 187 | |
188 | -static struct pci_device_id __devinitdata pch_pcidev_id[] = { | |
188 | +static DEFINE_PCI_DEVICE_TABLE(pch_pcidev_id) = { | |
189 | 189 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PCH_I2C), 1, }, |
190 | 190 | { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7213_I2C), 2, }, |
191 | 191 | { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7223_I2C), 1, }, |
drivers/i2c/busses/i2c-highlander.c
... | ... | @@ -468,18 +468,7 @@ |
468 | 468 | .remove = __devexit_p(highlander_i2c_remove), |
469 | 469 | }; |
470 | 470 | |
471 | -static int __init highlander_i2c_init(void) | |
472 | -{ | |
473 | - return platform_driver_register(&highlander_i2c_driver); | |
474 | -} | |
475 | - | |
476 | -static void __exit highlander_i2c_exit(void) | |
477 | -{ | |
478 | - platform_driver_unregister(&highlander_i2c_driver); | |
479 | -} | |
480 | - | |
481 | -module_init(highlander_i2c_init); | |
482 | -module_exit(highlander_i2c_exit); | |
471 | +module_platform_driver(highlander_i2c_driver); | |
483 | 472 | |
484 | 473 | MODULE_AUTHOR("Paul Mundt"); |
485 | 474 | MODULE_DESCRIPTION("Renesas Highlander FPGA I2C/SMBus adapter"); |
drivers/i2c/busses/i2c-hydra.c
drivers/i2c/busses/i2c-i801.c
... | ... | @@ -609,7 +609,7 @@ |
609 | 609 | .functionality = i801_func, |
610 | 610 | }; |
611 | 611 | |
612 | -static const struct pci_device_id i801_ids[] = { | |
612 | +static DEFINE_PCI_DEVICE_TABLE(i801_ids) = { | |
613 | 613 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_3) }, |
614 | 614 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_3) }, |
615 | 615 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_2) }, |
drivers/i2c/busses/i2c-ibm_iic.c
... | ... | @@ -815,16 +815,5 @@ |
815 | 815 | .remove = __devexit_p(iic_remove), |
816 | 816 | }; |
817 | 817 | |
818 | -static int __init iic_init(void) | |
819 | -{ | |
820 | - return platform_driver_register(&ibm_iic_driver); | |
821 | -} | |
822 | - | |
823 | -static void __exit iic_exit(void) | |
824 | -{ | |
825 | - platform_driver_unregister(&ibm_iic_driver); | |
826 | -} | |
827 | - | |
828 | -module_init(iic_init); | |
829 | -module_exit(iic_exit); | |
818 | +module_platform_driver(ibm_iic_driver); |
drivers/i2c/busses/i2c-intel-mid.c
... | ... | @@ -1093,7 +1093,7 @@ |
1093 | 1093 | pci_release_region(dev, 0); |
1094 | 1094 | } |
1095 | 1095 | |
1096 | -static struct pci_device_id intel_mid_i2c_ids[] = { | |
1096 | +static DEFINE_PCI_DEVICE_TABLE(intel_mid_i2c_ids) = { | |
1097 | 1097 | /* Moorestown */ |
1098 | 1098 | { PCI_VDEVICE(INTEL, 0x0802), 0 }, |
1099 | 1099 | { PCI_VDEVICE(INTEL, 0x0803), 1 }, |
drivers/i2c/busses/i2c-iop3xx.c
... | ... | @@ -523,21 +523,7 @@ |
523 | 523 | }, |
524 | 524 | }; |
525 | 525 | |
526 | -static int __init | |
527 | -i2c_iop3xx_init (void) | |
528 | -{ | |
529 | - return platform_driver_register(&iop3xx_i2c_driver); | |
530 | -} | |
531 | - | |
532 | -static void __exit | |
533 | -i2c_iop3xx_exit (void) | |
534 | -{ | |
535 | - platform_driver_unregister(&iop3xx_i2c_driver); | |
536 | - return; | |
537 | -} | |
538 | - | |
539 | -module_init (i2c_iop3xx_init); | |
540 | -module_exit (i2c_iop3xx_exit); | |
526 | +module_platform_driver(iop3xx_i2c_driver); | |
541 | 527 | |
542 | 528 | MODULE_AUTHOR("D-TACQ Solutions Ltd <www.d-tacq.com>"); |
543 | 529 | MODULE_DESCRIPTION("IOP3xx iic algorithm and driver"); |
drivers/i2c/busses/i2c-isch.c
... | ... | @@ -306,21 +306,10 @@ |
306 | 306 | .remove = __devexit_p(smbus_sch_remove), |
307 | 307 | }; |
308 | 308 | |
309 | -static int __init i2c_sch_init(void) | |
310 | -{ | |
311 | - return platform_driver_register(&smbus_sch_driver); | |
312 | -} | |
309 | +module_platform_driver(smbus_sch_driver); | |
313 | 310 | |
314 | -static void __exit i2c_sch_exit(void) | |
315 | -{ | |
316 | - platform_driver_unregister(&smbus_sch_driver); | |
317 | -} | |
318 | - | |
319 | 311 | MODULE_AUTHOR("Jacob Pan <jacob.jun.pan@intel.com>"); |
320 | 312 | MODULE_DESCRIPTION("Intel SCH SMBus driver"); |
321 | 313 | MODULE_LICENSE("GPL"); |
322 | - | |
323 | -module_init(i2c_sch_init); | |
324 | -module_exit(i2c_sch_exit); | |
325 | 314 | MODULE_ALIAS("platform:isch_smbus"); |
drivers/i2c/busses/i2c-ixp2000.c
... | ... | @@ -148,18 +148,7 @@ |
148 | 148 | }, |
149 | 149 | }; |
150 | 150 | |
151 | -static int __init ixp2000_i2c_init(void) | |
152 | -{ | |
153 | - return platform_driver_register(&ixp2000_i2c_driver); | |
154 | -} | |
155 | - | |
156 | -static void __exit ixp2000_i2c_exit(void) | |
157 | -{ | |
158 | - platform_driver_unregister(&ixp2000_i2c_driver); | |
159 | -} | |
160 | - | |
161 | -module_init(ixp2000_i2c_init); | |
162 | -module_exit(ixp2000_i2c_exit); | |
151 | +module_platform_driver(ixp2000_i2c_driver); | |
163 | 152 | |
164 | 153 | MODULE_AUTHOR ("Deepak Saxena <dsaxena@plexity.net>"); |
165 | 154 | MODULE_DESCRIPTION("IXP2000 GPIO-based I2C bus driver"); |
drivers/i2c/busses/i2c-mpc.c
... | ... | @@ -715,18 +715,7 @@ |
715 | 715 | }, |
716 | 716 | }; |
717 | 717 | |
718 | -static int __init fsl_i2c_init(void) | |
719 | -{ | |
720 | - return platform_driver_register(&mpc_i2c_driver); | |
721 | -} | |
722 | - | |
723 | -static void __exit fsl_i2c_exit(void) | |
724 | -{ | |
725 | - platform_driver_unregister(&mpc_i2c_driver); | |
726 | -} | |
727 | - | |
728 | -module_init(fsl_i2c_init); | |
729 | -module_exit(fsl_i2c_exit); | |
718 | +module_platform_driver(mpc_i2c_driver); | |
730 | 719 | |
731 | 720 | MODULE_AUTHOR("Adrian Cox <adrian@humboldt.co.uk>"); |
732 | 721 | MODULE_DESCRIPTION("I2C-Bus adapter for MPC107 bridge and " |
drivers/i2c/busses/i2c-mv64xxx.c
... | ... | @@ -611,20 +611,7 @@ |
611 | 611 | }, |
612 | 612 | }; |
613 | 613 | |
614 | -static int __init | |
615 | -mv64xxx_i2c_init(void) | |
616 | -{ | |
617 | - return platform_driver_register(&mv64xxx_i2c_driver); | |
618 | -} | |
619 | - | |
620 | -static void __exit | |
621 | -mv64xxx_i2c_exit(void) | |
622 | -{ | |
623 | - platform_driver_unregister(&mv64xxx_i2c_driver); | |
624 | -} | |
625 | - | |
626 | -module_init(mv64xxx_i2c_init); | |
627 | -module_exit(mv64xxx_i2c_exit); | |
614 | +module_platform_driver(mv64xxx_i2c_driver); | |
628 | 615 | |
629 | 616 | MODULE_AUTHOR("Mark A. Greer <mgreer@mvista.com>"); |
630 | 617 | MODULE_DESCRIPTION("Marvell mv64xxx host bridge i2c ctlr driver"); |
drivers/i2c/busses/i2c-nforce2.c
... | ... | @@ -309,7 +309,7 @@ |
309 | 309 | }; |
310 | 310 | |
311 | 311 | |
312 | -static const struct pci_device_id nforce2_ids[] = { | |
312 | +static DEFINE_PCI_DEVICE_TABLE(nforce2_ids) = { | |
313 | 313 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS) }, |
314 | 314 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_SMBUS) }, |
315 | 315 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS) }, |
... | ... | @@ -356,7 +356,7 @@ |
356 | 356 | error = acpi_check_region(smbus->base, smbus->size, |
357 | 357 | nforce2_driver.name); |
358 | 358 | if (error) |
359 | - return -1; | |
359 | + return error; | |
360 | 360 | |
361 | 361 | if (!request_region(smbus->base, smbus->size, nforce2_driver.name)) { |
362 | 362 | dev_err(&smbus->adapter.dev, "Error requesting region %02x .. %02X for %s\n", |
drivers/i2c/busses/i2c-ocores.c
... | ... | @@ -394,9 +394,6 @@ |
394 | 394 | }; |
395 | 395 | MODULE_DEVICE_TABLE(of, ocores_i2c_match); |
396 | 396 | |
397 | -/* work with hotplug and coldplug */ | |
398 | -MODULE_ALIAS("platform:ocores-i2c"); | |
399 | - | |
400 | 397 | static struct platform_driver ocores_i2c_driver = { |
401 | 398 | .probe = ocores_i2c_probe, |
402 | 399 | .remove = __devexit_p(ocores_i2c_remove), |
403 | 400 | |
404 | 401 | |
... | ... | @@ -409,20 +406,10 @@ |
409 | 406 | }, |
410 | 407 | }; |
411 | 408 | |
412 | -static int __init ocores_i2c_init(void) | |
413 | -{ | |
414 | - return platform_driver_register(&ocores_i2c_driver); | |
415 | -} | |
409 | +module_platform_driver(ocores_i2c_driver); | |
416 | 410 | |
417 | -static void __exit ocores_i2c_exit(void) | |
418 | -{ | |
419 | - platform_driver_unregister(&ocores_i2c_driver); | |
420 | -} | |
421 | - | |
422 | -module_init(ocores_i2c_init); | |
423 | -module_exit(ocores_i2c_exit); | |
424 | - | |
425 | 411 | MODULE_AUTHOR("Peter Korsgaard <jacmet@sunsite.dk>"); |
426 | 412 | MODULE_DESCRIPTION("OpenCores I2C bus driver"); |
427 | 413 | MODULE_LICENSE("GPL"); |
414 | +MODULE_ALIAS("platform:ocores-i2c"); |
drivers/i2c/busses/i2c-octeon.c
... | ... | @@ -629,25 +629,11 @@ |
629 | 629 | }, |
630 | 630 | }; |
631 | 631 | |
632 | -static int __init octeon_i2c_init(void) | |
633 | -{ | |
634 | - int rv; | |
632 | +module_platform_driver(octeon_i2c_driver); | |
635 | 633 | |
636 | - rv = platform_driver_register(&octeon_i2c_driver); | |
637 | - return rv; | |
638 | -} | |
639 | - | |
640 | -static void __exit octeon_i2c_exit(void) | |
641 | -{ | |
642 | - platform_driver_unregister(&octeon_i2c_driver); | |
643 | -} | |
644 | - | |
645 | 634 | MODULE_AUTHOR("Michael Lawnick <michael.lawnick.ext@nsn.com>"); |
646 | 635 | MODULE_DESCRIPTION("I2C-Bus adapter for Cavium OCTEON processors"); |
647 | 636 | MODULE_LICENSE("GPL"); |
648 | 637 | MODULE_VERSION(DRV_VERSION); |
649 | 638 | MODULE_ALIAS("platform:" DRV_NAME); |
650 | - | |
651 | -module_init(octeon_i2c_init); | |
652 | -module_exit(octeon_i2c_exit); |
drivers/i2c/busses/i2c-pasemi.c
drivers/i2c/busses/i2c-pca-platform.c
... | ... | @@ -286,20 +286,9 @@ |
286 | 286 | }, |
287 | 287 | }; |
288 | 288 | |
289 | -static int __init i2c_pca_pf_init(void) | |
290 | -{ | |
291 | - return platform_driver_register(&i2c_pca_pf_driver); | |
292 | -} | |
289 | +module_platform_driver(i2c_pca_pf_driver); | |
293 | 290 | |
294 | -static void __exit i2c_pca_pf_exit(void) | |
295 | -{ | |
296 | - platform_driver_unregister(&i2c_pca_pf_driver); | |
297 | -} | |
298 | - | |
299 | 291 | MODULE_AUTHOR("Wolfram Sang <w.sang@pengutronix.de>"); |
300 | 292 | MODULE_DESCRIPTION("I2C-PCA9564/PCA9665 platform driver"); |
301 | 293 | MODULE_LICENSE("GPL"); |
302 | - | |
303 | -module_init(i2c_pca_pf_init); | |
304 | -module_exit(i2c_pca_pf_exit); |
drivers/i2c/busses/i2c-piix4.c
... | ... | @@ -472,7 +472,7 @@ |
472 | 472 | .algo = &smbus_algorithm, |
473 | 473 | }; |
474 | 474 | |
475 | -static const struct pci_device_id piix4_ids[] = { | |
475 | +static DEFINE_PCI_DEVICE_TABLE(piix4_ids) = { | |
476 | 476 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3) }, |
477 | 477 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443MX_3) }, |
478 | 478 | { PCI_DEVICE(PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_3) }, |
drivers/i2c/busses/i2c-pmcmsp.c
... | ... | @@ -627,9 +627,6 @@ |
627 | 627 | .name = DRV_NAME, |
628 | 628 | }; |
629 | 629 | |
630 | -/* work with hotplug and coldplug */ | |
631 | -MODULE_ALIAS("platform:" DRV_NAME); | |
632 | - | |
633 | 630 | static struct platform_driver pmcmsptwi_driver = { |
634 | 631 | .probe = pmcmsptwi_probe, |
635 | 632 | .remove = __devexit_p(pmcmsptwi_remove), |
636 | 633 | |
637 | 634 | |
... | ... | @@ -639,19 +636,9 @@ |
639 | 636 | }, |
640 | 637 | }; |
641 | 638 | |
642 | -static int __init pmcmsptwi_init(void) | |
643 | -{ | |
644 | - return platform_driver_register(&pmcmsptwi_driver); | |
645 | -} | |
639 | +module_platform_driver(pmcmsptwi_driver); | |
646 | 640 | |
647 | -static void __exit pmcmsptwi_exit(void) | |
648 | -{ | |
649 | - platform_driver_unregister(&pmcmsptwi_driver); | |
650 | -} | |
651 | - | |
652 | 641 | MODULE_DESCRIPTION("PMC MSP TWI/SMBus/I2C driver"); |
653 | 642 | MODULE_LICENSE("GPL"); |
654 | - | |
655 | -module_init(pmcmsptwi_init); | |
656 | -module_exit(pmcmsptwi_exit); | |
643 | +MODULE_ALIAS("platform:" DRV_NAME); |
drivers/i2c/busses/i2c-powermac.c
... | ... | @@ -312,10 +312,6 @@ |
312 | 312 | return rc; |
313 | 313 | } |
314 | 314 | |
315 | - | |
316 | -/* work with hotplug and coldplug */ | |
317 | -MODULE_ALIAS("platform:i2c-powermac"); | |
318 | - | |
319 | 315 | static struct platform_driver i2c_powermac_driver = { |
320 | 316 | .probe = i2c_powermac_probe, |
321 | 317 | .remove = __devexit_p(i2c_powermac_remove), |
322 | 318 | |
... | ... | @@ -325,18 +321,7 @@ |
325 | 321 | }, |
326 | 322 | }; |
327 | 323 | |
328 | -static int __init i2c_powermac_init(void) | |
329 | -{ | |
330 | - platform_driver_register(&i2c_powermac_driver); | |
331 | - return 0; | |
332 | -} | |
324 | +module_platform_driver(i2c_powermac_driver); | |
333 | 325 | |
334 | - | |
335 | -static void __exit i2c_powermac_cleanup(void) | |
336 | -{ | |
337 | - platform_driver_unregister(&i2c_powermac_driver); | |
338 | -} | |
339 | - | |
340 | -module_init(i2c_powermac_init); | |
341 | -module_exit(i2c_powermac_cleanup); | |
326 | +MODULE_ALIAS("platform:i2c-powermac"); |
drivers/i2c/busses/i2c-pxa-pci.c
drivers/i2c/busses/i2c-sh7760.c
... | ... | @@ -560,18 +560,7 @@ |
560 | 560 | .remove = __devexit_p(sh7760_i2c_remove), |
561 | 561 | }; |
562 | 562 | |
563 | -static int __init sh7760_i2c_init(void) | |
564 | -{ | |
565 | - return platform_driver_register(&sh7760_i2c_drv); | |
566 | -} | |
567 | - | |
568 | -static void __exit sh7760_i2c_exit(void) | |
569 | -{ | |
570 | - platform_driver_unregister(&sh7760_i2c_drv); | |
571 | -} | |
572 | - | |
573 | -module_init(sh7760_i2c_init); | |
574 | -module_exit(sh7760_i2c_exit); | |
563 | +module_platform_driver(sh7760_i2c_drv); | |
575 | 564 | |
576 | 565 | MODULE_LICENSE("GPL"); |
577 | 566 | MODULE_DESCRIPTION("SH7760 I2C bus driver"); |
drivers/i2c/busses/i2c-simtec.c
... | ... | @@ -156,12 +156,8 @@ |
156 | 156 | return 0; |
157 | 157 | } |
158 | 158 | |
159 | - | |
160 | 159 | /* device driver */ |
161 | 160 | |
162 | -/* work with hotplug and coldplug */ | |
163 | -MODULE_ALIAS("platform:simtec-i2c"); | |
164 | - | |
165 | 161 | static struct platform_driver simtec_i2c_driver = { |
166 | 162 | .driver = { |
167 | 163 | .name = "simtec-i2c", |
168 | 164 | |
169 | 165 | |
... | ... | @@ -171,20 +167,10 @@ |
171 | 167 | .remove = simtec_i2c_remove, |
172 | 168 | }; |
173 | 169 | |
174 | -static int __init i2c_adap_simtec_init(void) | |
175 | -{ | |
176 | - return platform_driver_register(&simtec_i2c_driver); | |
177 | -} | |
170 | +module_platform_driver(simtec_i2c_driver); | |
178 | 171 | |
179 | -static void __exit i2c_adap_simtec_exit(void) | |
180 | -{ | |
181 | - platform_driver_unregister(&simtec_i2c_driver); | |
182 | -} | |
183 | - | |
184 | -module_init(i2c_adap_simtec_init); | |
185 | -module_exit(i2c_adap_simtec_exit); | |
186 | - | |
187 | 172 | MODULE_DESCRIPTION("Simtec Generic I2C Bus driver"); |
188 | 173 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); |
189 | 174 | MODULE_LICENSE("GPL"); |
175 | +MODULE_ALIAS("platform:simtec-i2c"); |
drivers/i2c/busses/i2c-sis5595.c
... | ... | @@ -147,7 +147,7 @@ |
147 | 147 | u16 a; |
148 | 148 | u8 val; |
149 | 149 | int *i; |
150 | - int retval = -ENODEV; | |
150 | + int retval; | |
151 | 151 | |
152 | 152 | /* Look for imposters */ |
153 | 153 | for (i = blacklist; *i != 0; i++) { |
... | ... | @@ -223,7 +223,7 @@ |
223 | 223 | |
224 | 224 | error: |
225 | 225 | release_region(sis5595_base + SMB_INDEX, 2); |
226 | - return retval; | |
226 | + return -ENODEV; | |
227 | 227 | } |
228 | 228 | |
229 | 229 | static int sis5595_transaction(struct i2c_adapter *adap) |
... | ... | @@ -369,7 +369,7 @@ |
369 | 369 | .algo = &smbus_algorithm, |
370 | 370 | }; |
371 | 371 | |
372 | -static const struct pci_device_id sis5595_ids[] __devinitconst = { | |
372 | +static DEFINE_PCI_DEVICE_TABLE(sis5595_ids) = { | |
373 | 373 | { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503) }, |
374 | 374 | { 0, } |
375 | 375 | }; |
drivers/i2c/busses/i2c-sis630.c
... | ... | @@ -393,7 +393,7 @@ |
393 | 393 | { |
394 | 394 | unsigned char b; |
395 | 395 | struct pci_dev *dummy = NULL; |
396 | - int retval = -ENODEV, i; | |
396 | + int retval, i; | |
397 | 397 | |
398 | 398 | /* check for supported SiS devices */ |
399 | 399 | for (i=0; supported[i] > 0 ; i++) { |
400 | 400 | |
401 | 401 | |
... | ... | @@ -418,18 +418,21 @@ |
418 | 418 | */ |
419 | 419 | if (pci_read_config_byte(sis630_dev, SIS630_BIOS_CTL_REG,&b)) { |
420 | 420 | dev_err(&sis630_dev->dev, "Error: Can't read bios ctl reg\n"); |
421 | + retval = -ENODEV; | |
421 | 422 | goto exit; |
422 | 423 | } |
423 | 424 | /* if ACPI already enabled , do nothing */ |
424 | 425 | if (!(b & 0x80) && |
425 | 426 | pci_write_config_byte(sis630_dev, SIS630_BIOS_CTL_REG, b | 0x80)) { |
426 | 427 | dev_err(&sis630_dev->dev, "Error: Can't enable ACPI\n"); |
428 | + retval = -ENODEV; | |
427 | 429 | goto exit; |
428 | 430 | } |
429 | 431 | |
430 | 432 | /* Determine the ACPI base address */ |
431 | 433 | if (pci_read_config_word(sis630_dev,SIS630_ACPI_BASE_REG,&acpi_base)) { |
432 | 434 | dev_err(&sis630_dev->dev, "Error: Can't determine ACPI base address\n"); |
435 | + retval = -ENODEV; | |
433 | 436 | goto exit; |
434 | 437 | } |
435 | 438 | |
... | ... | @@ -445,6 +448,7 @@ |
445 | 448 | sis630_driver.name)) { |
446 | 449 | dev_err(&sis630_dev->dev, "SMBus registers 0x%04x-0x%04x already " |
447 | 450 | "in use!\n", acpi_base + SMB_STS, acpi_base + SMB_SAA); |
451 | + retval = -EBUSY; | |
448 | 452 | goto exit; |
449 | 453 | } |
450 | 454 | |
... | ... | @@ -468,7 +472,7 @@ |
468 | 472 | .algo = &smbus_algorithm, |
469 | 473 | }; |
470 | 474 | |
471 | -static const struct pci_device_id sis630_ids[] __devinitconst = { | |
475 | +static DEFINE_PCI_DEVICE_TABLE(sis630_ids) = { | |
472 | 476 | { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503) }, |
473 | 477 | { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_LPC) }, |
474 | 478 | { 0, } |
drivers/i2c/busses/i2c-sis96x.c
drivers/i2c/busses/i2c-via.c
drivers/i2c/busses/i2c-viapro.c
... | ... | @@ -324,7 +324,7 @@ |
324 | 324 | const struct pci_device_id *id) |
325 | 325 | { |
326 | 326 | unsigned char temp; |
327 | - int error = -ENODEV; | |
327 | + int error; | |
328 | 328 | |
329 | 329 | /* Determine the address of the SMBus areas */ |
330 | 330 | if (force_addr) { |
... | ... | @@ -390,6 +390,7 @@ |
390 | 390 | dev_err(&pdev->dev, "SMBUS: Error: Host SMBus " |
391 | 391 | "controller not enabled! - upgrade BIOS or " |
392 | 392 | "use force=1\n"); |
393 | + error = -ENODEV; | |
393 | 394 | goto release_region; |
394 | 395 | } |
395 | 396 | } |
396 | 397 | |
... | ... | @@ -422,9 +423,11 @@ |
422 | 423 | "SMBus Via Pro adapter at %04x", vt596_smba); |
423 | 424 | |
424 | 425 | vt596_pdev = pci_dev_get(pdev); |
425 | - if (i2c_add_adapter(&vt596_adapter)) { | |
426 | + error = i2c_add_adapter(&vt596_adapter); | |
427 | + if (error) { | |
426 | 428 | pci_dev_put(vt596_pdev); |
427 | 429 | vt596_pdev = NULL; |
430 | + goto release_region; | |
428 | 431 | } |
429 | 432 | |
430 | 433 | /* Always return failure here. This is to allow other drivers to bind |
... | ... | @@ -438,7 +441,7 @@ |
438 | 441 | return error; |
439 | 442 | } |
440 | 443 | |
441 | -static const struct pci_device_id vt596_ids[] = { | |
444 | +static DEFINE_PCI_DEVICE_TABLE(vt596_ids) = { | |
442 | 445 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C596_3), |
443 | 446 | .driver_data = SMBBA1 }, |
444 | 447 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C596B_3), |
drivers/i2c/busses/i2c-xiic.c
... | ... | @@ -795,10 +795,6 @@ |
795 | 795 | return 0; |
796 | 796 | } |
797 | 797 | |
798 | - | |
799 | -/* work with hotplug and coldplug */ | |
800 | -MODULE_ALIAS("platform:"DRIVER_NAME); | |
801 | - | |
802 | 798 | static struct platform_driver xiic_i2c_driver = { |
803 | 799 | .probe = xiic_i2c_probe, |
804 | 800 | .remove = __devexit_p(xiic_i2c_remove), |
805 | 801 | |
806 | 802 | |
... | ... | @@ -808,20 +804,10 @@ |
808 | 804 | }, |
809 | 805 | }; |
810 | 806 | |
811 | -static int __init xiic_i2c_init(void) | |
812 | -{ | |
813 | - return platform_driver_register(&xiic_i2c_driver); | |
814 | -} | |
807 | +module_platform_driver(xiic_i2c_driver); | |
815 | 808 | |
816 | -static void __exit xiic_i2c_exit(void) | |
817 | -{ | |
818 | - platform_driver_unregister(&xiic_i2c_driver); | |
819 | -} | |
820 | - | |
821 | -module_init(xiic_i2c_init); | |
822 | -module_exit(xiic_i2c_exit); | |
823 | - | |
824 | 809 | MODULE_AUTHOR("info@mocean-labs.com"); |
825 | 810 | MODULE_DESCRIPTION("Xilinx I2C bus driver"); |
826 | 811 | MODULE_LICENSE("GPL v2"); |
812 | +MODULE_ALIAS("platform:"DRIVER_NAME); |
drivers/i2c/busses/scx200_acb.c
... | ... | @@ -559,7 +559,7 @@ |
559 | 559 | .remove = __devexit_p(scx200_remove), |
560 | 560 | }; |
561 | 561 | |
562 | -static const struct pci_device_id scx200_isa[] __initconst = { | |
562 | +static DEFINE_PCI_DEVICE_TABLE(scx200_isa) = { | |
563 | 563 | { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_BRIDGE) }, |
564 | 564 | { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SC1100_BRIDGE) }, |
565 | 565 | { 0, } |
drivers/i2c/i2c-dev.c
... | ... | @@ -251,15 +251,10 @@ |
251 | 251 | if (rdwr_arg.nmsgs > I2C_RDRW_IOCTL_MAX_MSGS) |
252 | 252 | return -EINVAL; |
253 | 253 | |
254 | - rdwr_pa = kmalloc(rdwr_arg.nmsgs * sizeof(struct i2c_msg), GFP_KERNEL); | |
255 | - if (!rdwr_pa) | |
256 | - return -ENOMEM; | |
257 | - | |
258 | - if (copy_from_user(rdwr_pa, rdwr_arg.msgs, | |
259 | - rdwr_arg.nmsgs * sizeof(struct i2c_msg))) { | |
260 | - kfree(rdwr_pa); | |
261 | - return -EFAULT; | |
262 | - } | |
254 | + rdwr_pa = memdup_user(rdwr_arg.msgs, | |
255 | + rdwr_arg.nmsgs * sizeof(struct i2c_msg)); | |
256 | + if (IS_ERR(rdwr_pa)) | |
257 | + return PTR_ERR(rdwr_pa); | |
263 | 258 | |
264 | 259 | data_ptrs = kmalloc(rdwr_arg.nmsgs * sizeof(u8 __user *), GFP_KERNEL); |
265 | 260 | if (data_ptrs == NULL) { |
drivers/i2c/muxes/gpio-i2cmux.c
... | ... | @@ -165,18 +165,7 @@ |
165 | 165 | }, |
166 | 166 | }; |
167 | 167 | |
168 | -static int __init gpiomux_init(void) | |
169 | -{ | |
170 | - return platform_driver_register(&gpiomux_driver); | |
171 | -} | |
172 | - | |
173 | -static void __exit gpiomux_exit(void) | |
174 | -{ | |
175 | - platform_driver_unregister(&gpiomux_driver); | |
176 | -} | |
177 | - | |
178 | -module_init(gpiomux_init); | |
179 | -module_exit(gpiomux_exit); | |
168 | +module_platform_driver(gpiomux_driver); | |
180 | 169 | |
181 | 170 | MODULE_DESCRIPTION("GPIO-based I2C multiplexer driver"); |
182 | 171 | MODULE_AUTHOR("Peter Korsgaard <peter.korsgaard@barco.com>"); |