Changeset 1698
- Timestamp:
- 01/17/03 02:19:52 (6 years ago)
- Files:
-
- lm-sensors/trunk/kernel/busses/dmi_scan.c (modified) (1 diff)
- lm-sensors/trunk/kernel/busses/i2c-ali1535.c (modified) (6 diffs)
- lm-sensors/trunk/kernel/busses/i2c-ali15x3.c (modified) (5 diffs)
- lm-sensors/trunk/kernel/busses/i2c-amd756.c (modified) (7 diffs)
- lm-sensors/trunk/kernel/busses/i2c-amd8111.c (modified) (5 diffs)
- lm-sensors/trunk/kernel/busses/i2c-hydra.c (modified) (2 diffs)
- lm-sensors/trunk/kernel/busses/i2c-i801.c (modified) (5 diffs)
- lm-sensors/trunk/kernel/busses/i2c-i810.c (modified) (6 diffs)
- lm-sensors/trunk/kernel/busses/i2c-ipmb.c (modified) (7 diffs)
- lm-sensors/trunk/kernel/busses/i2c-ipmi.c (modified) (7 diffs)
- lm-sensors/trunk/kernel/busses/i2c-isa.c (modified) (2 diffs)
- lm-sensors/trunk/kernel/busses/i2c-keywest.c (modified) (9 diffs)
- lm-sensors/trunk/kernel/busses/i2c-piix4.c (modified) (4 diffs)
- lm-sensors/trunk/kernel/busses/i2c-savage4.c (modified) (4 diffs)
- lm-sensors/trunk/kernel/busses/i2c-sis5595.c (modified) (4 diffs)
- lm-sensors/trunk/kernel/busses/i2c-sis630.c (modified) (5 diffs)
- lm-sensors/trunk/kernel/busses/i2c-sis645.c (modified) (7 diffs)
- lm-sensors/trunk/kernel/busses/i2c-tsunami.c (modified) (6 diffs)
- lm-sensors/trunk/kernel/busses/i2c-via.c (modified) (6 diffs)
- lm-sensors/trunk/kernel/busses/i2c-viapro.c (modified) (4 diffs)
- lm-sensors/trunk/kernel/busses/i2c-voodoo3.c (modified) (6 diffs)
- lm-sensors/trunk/kernel/chips/adm1021.c (modified) (13 diffs)
- lm-sensors/trunk/kernel/chips/adm1024.c (modified) (13 diffs)
- lm-sensors/trunk/kernel/chips/adm1025.c (modified) (12 diffs)
- lm-sensors/trunk/kernel/chips/adm9240.c (modified) (13 diffs)
- lm-sensors/trunk/kernel/chips/bmcsensors.c (modified) (7 diffs)
- lm-sensors/trunk/kernel/chips/bt869.c (modified) (13 diffs)
- lm-sensors/trunk/kernel/chips/ddcmon.c (modified) (9 diffs)
- lm-sensors/trunk/kernel/chips/ds1307.c (modified) (1 diff)
- lm-sensors/trunk/kernel/chips/ds1621.c (modified) (12 diffs)
- lm-sensors/trunk/kernel/chips/eeprom.c (modified) (10 diffs)
- lm-sensors/trunk/kernel/chips/fscpos.c (modified) (12 diffs)
- lm-sensors/trunk/kernel/chips/fscscy.c (modified) (13 diffs)
- lm-sensors/trunk/kernel/chips/gl518sm.c (modified) (22 diffs)
- lm-sensors/trunk/kernel/chips/gl520sm.c (modified) (15 diffs)
- lm-sensors/trunk/kernel/chips/icspll.c (modified) (10 diffs)
- lm-sensors/trunk/kernel/chips/it87.c (modified) (15 diffs)
- lm-sensors/trunk/kernel/chips/lm75.c (modified) (13 diffs)
- lm-sensors/trunk/kernel/chips/lm78.c (modified) (14 diffs)
- lm-sensors/trunk/kernel/chips/lm80.c (modified) (14 diffs)
- lm-sensors/trunk/kernel/chips/lm87.c (modified) (13 diffs)
- lm-sensors/trunk/kernel/chips/lm92.c (modified) (1 diff)
- lm-sensors/trunk/kernel/chips/ltc1710.c (modified) (10 diffs)
- lm-sensors/trunk/kernel/chips/matorb.c (modified) (12 diffs)
- lm-sensors/trunk/kernel/chips/maxilife.c (modified) (15 diffs)
- lm-sensors/trunk/kernel/chips/mtp008.c (modified) (14 diffs)
- lm-sensors/trunk/kernel/chips/pcf8574.c (modified) (11 diffs)
- lm-sensors/trunk/kernel/chips/pcf8591.c (modified) (10 diffs)
- lm-sensors/trunk/kernel/chips/sis5595.c (modified) (16 diffs)
- lm-sensors/trunk/kernel/chips/smartbatt.c (modified) (11 diffs)
- lm-sensors/trunk/kernel/chips/smbus-arp.c (modified) (10 diffs)
- lm-sensors/trunk/kernel/chips/smsc47m1.c (modified) (14 diffs)
- lm-sensors/trunk/kernel/chips/thmc50.c (modified) (11 diffs)
- lm-sensors/trunk/kernel/chips/via686a.c (modified) (19 diffs)
- lm-sensors/trunk/kernel/chips/vt1211.c (modified) (13 diffs)
- lm-sensors/trunk/kernel/chips/vt8231.c (modified) (14 diffs)
- lm-sensors/trunk/kernel/chips/w83627hf.c (modified) (18 diffs)
- lm-sensors/trunk/kernel/chips/w83781d.c (modified) (16 diffs)
- lm-sensors/trunk/kernel/sensors.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
lm-sensors/trunk/kernel/busses/dmi_scan.c
r1661 r1698 230 230 } 231 231 232 #ifdef MODULE233 232 MODULE_DESCRIPTION("SM BIOS DMI Scanner"); 234 #ifdef MODULE_LICENSE235 233 MODULE_LICENSE("GPL"); 236 #endif237 234 EXPORT_SYMBOL(dmi_ident); 238 235 EXPORT_SYMBOL(dmi_scan_mach); 239 int init_module(void)240 {241 return 0;242 }243 244 int cleanup_module(void)245 {246 return 0;247 }248 249 #endiflm-sensors/trunk/kernel/busses/i2c-ali1535.c
r1572 r1698 67 67 #include <linux/init.h> 68 68 69 #ifdef MODULE_LICENSE70 69 MODULE_LICENSE("GPL"); 71 #endif72 70 73 71 #ifndef DECLARE_MUTEX … … 145 143 #define ALI1535_SMBIO_EN 0x04 /* SMB I/O Space enable */ 146 144 147 #ifdef MODULE148 static149 #else150 extern151 #endif152 int __init i2c_ali1535_init(void);153 static int __init ali1535_cleanup(void);154 static int ali1535_setup(void);155 static s32 ali1535_access(struct i2c_adapter *adap, u16 addr,156 unsigned short flags, char read_write,157 u8 command, int size,158 union i2c_smbus_data *data);159 145 static void ali1535_do_pause(unsigned int amount); 160 146 static int ali1535_transaction(void); 161 static void ali1535_inc(struct i2c_adapter *adapter); 162 static void ali1535_dec(struct i2c_adapter *adapter); 163 static u32 ali1535_func(struct i2c_adapter *adapter); 164 165 #ifdef MODULE 166 extern int init_module(void); 167 extern int cleanup_module(void); 168 #endif /* MODULE */ 169 170 static struct i2c_algorithm smbus_algorithm = { 171 /* name */ "Non-i2c SMBus adapter", 172 /* id */ I2C_ALGO_SMBUS, 173 /* master_xfer */ NULL, 174 /* smbus_access */ ali1535_access, 175 /* slave_send */ NULL, 176 /* slave_rcv */ NULL, 177 /* algo_control */ NULL, 178 /* functionality */ ali1535_func, 179 }; 180 181 static struct i2c_adapter ali1535_adapter = { 182 "unset", 183 I2C_ALGO_SMBUS | I2C_HW_SMBUS_ALI1535, 184 &smbus_algorithm, 185 NULL, 186 ali1535_inc, 187 ali1535_dec, 188 NULL, 189 NULL, 190 }; 191 192 static int __initdata ali1535_initialized; 147 193 148 static unsigned short ali1535_smba = 0; 194 149 DECLARE_MUTEX(i2c_ali1535_sem); … … 592 547 } 593 548 594 void ali1535_inc(struct i2c_adapter *adapter)595 {596 MOD_INC_USE_COUNT;597 }598 599 void ali1535_dec(struct i2c_adapter *adapter)600 {601 602 MOD_DEC_USE_COUNT;603 }604 549 605 550 u32 ali1535_func(struct i2c_adapter *adapter) … … 610 555 } 611 556 612 int __init i2c_ali1535_init(void) 613 { 614 int res; 615 printk("i2c-ali1535.o version %s (%s)\n", LM_VERSION, LM_DATE); 616 #ifdef DEBUG 617 /* PE- It might be good to make this a permanent part of the code! */ 618 if (ali1535_initialized) { 619 printk 620 ("i2c-ali1535.o: Oops, ali1535_init called a second time!\n"); 621 return -EBUSY; 622 } 623 #endif 624 ali1535_initialized = 0; 625 if ((res = ali1535_setup())) { 557 static struct i2c_algorithm smbus_algorithm = { 558 .name = "Non-i2c SMBus adapter", 559 .id = I2C_ALGO_SMBUS, 560 .smbus_xfer = ali1535_access, 561 .functionality = ali1535_func, 562 }; 563 564 static struct i2c_adapter ali1535_adapter = { 565 .owner = THIS_MODULE, 566 .name = "unset", 567 .id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_ALI1535, 568 .algo = &smbus_algorithm, 569 }; 570 571 572 static struct pci_device_id ali1535_ids[] __devinitdata = { 573 { 0, } 574 }; 575 576 static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id) 577 { 578 if (ali1535_setup()) { 626 579 printk 627 580 ("i2c-ali1535.o: ALI1535 not detected, module not inserted.\n"); 628 ali1535_cleanup(); 629 return res; 630 } 631 ali1535_initialized++; 581 return -ENODEV; 582 } 583 632 584 sprintf(ali1535_adapter.name, "SMBus ALI1535 adapter at %04x", 633 585 ali1535_smba); 634 if ((res = i2c_add_adapter(&ali1535_adapter))) { 635 printk 636 ("i2c-ali1535.o: Adapter registration failed, module not inserted.\n"); 637 ali1535_cleanup(); 638 return res; 639 } 640 ali1535_initialized++; 641 printk 642 ("i2c-ali1535.o: ALI1535 SMBus Controller detected and initialized\n"); 643 return 0; 644 } 645 646 int __init ali1535_cleanup(void) 647 { 648 int res; 649 if (ali1535_initialized >= 2) { 650 if ((res = i2c_del_adapter(&ali1535_adapter))) { 651 printk 652 ("i2c-ali1535.o: i2c_del_adapter failed, module not removed\n"); 653 return res; 654 } else 655 ali1535_initialized--; 656 } 657 if (ali1535_initialized >= 1) { 658 release_region(ali1535_smba, ALI1535_SMB_IOSIZE); 659 ali1535_initialized--; 660 } 661 return 0; 586 i2c_add_adapter(&ali1535_adapter); 587 } 588 589 static void __devexit ali1535_remove(struct pci_dev *dev) 590 { 591 i2c_del_adapter(&ali1535_adapter); 592 } 593 594 595 static struct pci_driver ali1535_driver = { 596 .name = "ali1535 smbus", 597 .id_table = ali1535_ids, 598 .probe = ali1535_probe, 599 .remove = __devexit_p(ali1535_remove), 600 }; 601 602 static int __init i2c_ali1535_init(void) 603 { 604 printk("i2c-ali1535.o version %s (%s)\n", LM_VERSION, LM_DATE); 605 return pci_module_init(&ali1535_driver); 606 } 607 608 609 static void __exit i2c_ali1535_exit(void) 610 { 611 pci_unregister_driver(&ali1535_driver); 612 release_region(ali1535_smba, ALI1535_SMB_IOSIZE); 662 613 } 663 614 … … 666 617 EXPORT_SYMBOL(ali1535_access); 667 618 EXPORT_SYMBOL(i2c_ali1535_sem); 668 #else669 EXPORT_NO_SYMBOLS;670 619 #endif 671 672 #ifdef MODULE673 620 674 621 MODULE_AUTHOR … … 677 624 MODULE_DESCRIPTION("ALI1535 SMBus driver"); 678 625 679 int init_module(void) 680 { 681 return i2c_ali1535_init(); 682 } 683 684 int cleanup_module(void) 685 { 686 return ali1535_cleanup(); 687 } 688 689 #endif /* MODULE */ 690 626 module_init(i2c_ali1535_init); 627 module_exit(i2c_ali1535_exit); 628 lm-sensors/trunk/kernel/busses/i2c-ali15x3.c
r1388 r1698 73 73 #include <linux/init.h> 74 74 75 #ifdef MODULE_LICENSE76 75 MODULE_LICENSE("GPL"); 77 #endif78 76 79 77 /* ALI15X3 SMBus address offsets */ … … 136 134 "Initialize the base address of the i2c controller"); 137 135 138 #ifdef MODULE 139 static 140 #else 141 extern 142 #endif 143 int __init i2c_ali15x3_init(void); 144 static int __init ali15x3_cleanup(void); 145 static int ali15x3_setup(void); 146 static s32 ali15x3_access(struct i2c_adapter *adap, u16 addr, 147 unsigned short flags, char read_write, 148 u8 command, int size, 149 union i2c_smbus_data *data); 136 150 137 static void ali15x3_do_pause(unsigned int amount); 151 138 static int ali15x3_transaction(void); 152 static void ali15x3_inc(struct i2c_adapter *adapter); 153 static void ali15x3_dec(struct i2c_adapter *adapter); 154 static u32 ali15x3_func(struct i2c_adapter *adapter); 155 156 #ifdef MODULE 157 extern int init_module(void); 158 extern int cleanup_module(void); 159 #endif /* MODULE */ 160 161 static struct i2c_algorithm smbus_algorithm = { 162 /* name */ "Non-I2C SMBus adapter", 163 /* id */ I2C_ALGO_SMBUS, 164 /* master_xfer */ NULL, 165 /* smbus_access */ ali15x3_access, 166 /* slave_send */ NULL, 167 /* slave_rcv */ NULL, 168 /* algo_control */ NULL, 169 /* functionality */ ali15x3_func, 170 }; 171 172 static struct i2c_adapter ali15x3_adapter = { 173 "unset", 174 I2C_ALGO_SMBUS | I2C_HW_SMBUS_ALI15X3, 175 &smbus_algorithm, 176 NULL, 177 ali15x3_inc, 178 ali15x3_dec, 179 NULL, 180 NULL, 181 }; 182 183 static int __initdata ali15x3_initialized; 139 184 140 static unsigned short ali15x3_smba = 0; 185 141 static int locked=0; … … 559 515 } 560 516 561 void ali15x3_inc(struct i2c_adapter *adapter)562 {563 MOD_INC_USE_COUNT;564 }565 566 void ali15x3_dec(struct i2c_adapter *adapter)567 {568 569 MOD_DEC_USE_COUNT;570 }571 517 572 518 u32 ali15x3_func(struct i2c_adapter *adapter) … … 577 523 } 578 524 579 int __init i2c_ali15x3_init(void) 580 { 581 int res; 582 printk("i2c-ali15x3.o version %s (%s)\n", LM_VERSION, LM_DATE); 583 #ifdef DEBUG 584 /* PE- It might be good to make this a permanent part of the code! */ 585 if (ali15x3_initialized) { 586 printk 587 ("i2c-ali15x3.o: Oops, ali15x3_init called a second time!\n"); 588 return -EBUSY; 589 } 590 #endif 591 ali15x3_initialized = 0; 592 if ((res = ali15x3_setup())) { 525 static struct i2c_algorithm smbus_algorithm = { 526 .name = "Non-I2C SMBus adapter", 527 .id = I2C_ALGO_SMBUS, 528 .smbus_xfer = ali15x3_access, 529 .functionality = ali15x3_func, 530 }; 531 532 static struct i2c_adapter ali15x3_adapter = { 533 .owner = THIS_MODULE, 534 .name = "unset", 535 .id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_ALI15X3, 536 .algo = &smbus_algorithm, 537 }; 538 539 540 541 static struct pci_device_id ali15x3_ids[] __devinitdata = { 542 { 0, } 543 }; 544 545 static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_id *id) 546 { 547 if (ali15x3_setup()) { 593 548 printk 594 549 ("i2c-ali15x3.o: ALI15X3 not detected, module not inserted.\n"); 595 ali15x3_cleanup(); 596 return res;597 } 598 ali15x3_initialized++; 550 551 return -ENODEV; 552 } 553 599 554 sprintf(ali15x3_adapter.name, "SMBus ALI15X3 adapter at %04x", 600 555 ali15x3_smba); 601 if ((res = i2c_add_adapter(&ali15x3_adapter))) { 602 printk 603 ("i2c-ali15x3.o: Adapter registration failed, module not inserted.\n"); 604 ali15x3_cleanup(); 605 return res; 606 } 607 ali15x3_initialized++; 608 printk 609 ("i2c-ali15x3.o: ALI15X3 SMBus Controller detected and initialized\n"); 610 return 0; 611 } 612 613 int __init ali15x3_cleanup(void) 614 { 615 int res; 616 if (ali15x3_initialized >= 2) { 617 if ((res = i2c_del_adapter(&ali15x3_adapter))) { 618 printk 619 ("i2c-ali15x3.o: i2c_del_adapter failed, module not removed\n"); 620 return res; 621 } else 622 ali15x3_initialized--; 623 } 624 if (ali15x3_initialized >= 1) { 625 release_region(ali15x3_smba, ALI15X3_SMB_IOSIZE); 626 ali15x3_initialized--; 627 } 628 return 0; 629 } 630 631 EXPORT_NO_SYMBOLS; 632 633 #ifdef MODULE 556 i2c_add_adapter(&ali15x3_adapter); 557 } 558 559 static void __devexit ali15x3_remove(struct pci_dev *dev) 560 { 561 i2c_del_adapter(&ali15x3_adapter); 562 } 563 564 static struct pci_driver ali15x3_driver = { 565 .name = "ali15x3 smbus", 566 .id_table = ali15x3_ids, 567 .probe = ali15x3_probe, 568 .remove = __devexit_p(ali15x3_remove), 569 }; 570 571 static int __init i2c_ali15x3_init(void) 572 { 573 printk("i2c-ali15x3.o version %s (%s)\n", LM_VERSION, LM_DATE); 574 return pci_module_init(&ali15x3_driver); 575 } 576 577 578 static void __exit i2c_ali15x3_exit(void) 579 { 580 pci_unregister_driver(&ali15x3_driver); 581 release_region(ali15x3_smba, ALI15X3_SMB_IOSIZE); 582 } 583 584 634 585 635 586 MODULE_AUTHOR … … 637 588 MODULE_DESCRIPTION("ALI15X3 SMBus driver"); 638 589 639 int init_module(void) 640 { 641 return i2c_ali15x3_init(); 642 } 643 644 int cleanup_module(void) 645 { 646 return ali15x3_cleanup(); 647 } 648 649 #endif /* MODULE */ 590 module_init(i2c_ali15x3_init); 591 module_exit(i2c_ali15x3_exit); lm-sensors/trunk/kernel/busses/i2c-amd756.c
r1694 r1698 204 204 205 205 /* Return -1 on error. */ 206 206 207 static s32 amd756_access(struct i2c_adapter * adap, u16 addr, 207 208 unsigned short flags, char read_write, … … 298 299 } 299 300 300 void amd756_inc(struct i2c_adapter *adapter)301 {302 MOD_INC_USE_COUNT;303 }304 305 void amd756_dec(struct i2c_adapter *adapter)306 {307 308 MOD_DEC_USE_COUNT;309 }310 311 301 static u32 amd756_func(struct i2c_adapter *adapter) 312 302 { … … 324 314 325 315 static struct i2c_adapter amd756_adapter = { 316 .owner = THIS_MODULE, 326 317 .name = "unset", 327 318 .id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_AMD756, 328 319 .algo = &smbus_algorithm, 329 .inc_use = amd756_inc,330 .dec_use = amd756_dec,331 320 }; 332 321 … … 406 395 } 407 396 397 408 398 static void __devexit amd756_remove(struct pci_dev *dev) 409 399 { 410 400 i2c_del_adapter(&amd756_adapter); 411 release_region(amd756_ioport, SMB_IOSIZE);412 401 } 413 402 … … 419 408 }; 420 409 421 static int __init amd756_init(void)410 static int __init i2c_amd756_init(void) 422 411 { 423 412 printk(KERN_INFO "i2c-amd756.o version %s (%s)\n", LM_VERSION, LM_DATE); … … 425 414 } 426 415 427 static void __exit amd756_exit(void) 416 417 static void __exit i2c_amd756_exit(void) 428 418 { 429 419 pci_unregister_driver(&amd756_driver); 420 release_region(amd756_ioport, SMB_IOSIZE); 430 421 } 431 422 … … 434 425 MODULE_LICENSE("GPL"); 435 426 436 module_init( amd756_init)437 module_exit( amd756_exit)427 module_init(i2c_amd756_init) 428 module_exit(i2c_amd756_exit) lm-sensors/trunk/kernel/busses/i2c-amd8111.c
r1693 r1698 321 321 } 322 322 323 void amd8111_inc(struct i2c_adapter *adapter)324 {325 MOD_INC_USE_COUNT;326 }327 328 void amd8111_dec(struct i2c_adapter *adapter)329 {330 MOD_DEC_USE_COUNT;331 }332 323 333 324 u32 amd8111_func(struct i2c_adapter *adapter) … … 346 337 }; 347 338 339 340 static struct pci_device_id amd8111_ids[] __devinitdata = { 341 { 0x1022, 0x746a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 342 { 0, } 343 }; 344 348 345 static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_id *id) 349 346 { 350 347 struct amd_smbus *smbus; 348 int error; 351 349 352 350 if (~pci_resource_flags(dev, 0) & IORESOURCE_IO) … … 367 365 } 368 366 367 smbus->adapter.owner = THIS_MODULE; 369 368 sprintf(smbus->adapter.name, "SMBus2 AMD8111 adapter at %04x", smbus->base); 370 369 smbus->adapter.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_AMD8111; 371 370 smbus->adapter.algo = &smbus_algorithm; 372 371 smbus->adapter.algo_data = smbus; 373 smbus->adapter.inc_use = amd8111_inc; 374 smbus->adapter.dec_use = amd8111_dec; 375 376 if (i2c_add_adapter(&smbus->adapter)) { 372 373 error = i2c_add_adapter(&smbus->adapter); 374 if (error) { 377 375 printk(KERN_WARNING "i2c-amd8111.c: Failed to register adapter.\n"); 378 376 release_region(smbus->base, smbus->size); … … 387 385 } 388 386 387 389 388 static void __devexit amd8111_remove(struct pci_dev *dev) 390 389 { 391 390 struct amd_smbus *smbus = (void*) pci_get_drvdata(dev); 392 if (i2c_del_adapter(&smbus->adapter)) { 393 printk(KERN_WARNING "i2c-amd8111.c: Failed to unregister adapter.\n"); 394 return; 395 } 391 i2c_del_adapter(&smbus->adapter); 396 392 release_region(smbus->base, smbus->size); 397 393 kfree(smbus); 398 394 } 399 395 400 static struct pci_device_id amd8111_id_table[] __devinitdata =401 {{ 0x1022, 0x746a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },402 { 0 }};403 404 405 396 static struct pci_driver amd8111_driver = { 406 .name = "amd8111 smbus 2.0",407 .id_table = amd8111_id_table,408 .probe = amd8111_probe,409 .remove = __devexit_p(amd8111_remove),397 .name = "amd8111 smbus 2.0", 398 .id_table = amd8111_ids, 399 .probe = amd8111_probe, 400 .remove = __devexit_p(amd8111_remove), 410 401 }; 411 402 412 int __initamd8111_init(void)403 static int __init i2c_amd8111_init(void) 413 404 { 414 405 printk(KERN_INFO "i2c-amd8111.o version %s (%s)\n", LM_VERSION, LM_DATE); … … 416 407 } 417 408 418 void __exit amd8111_exit(void) 409 410 static void __exit i2c_amd8111_exit(void) 419 411 { 420 412 pci_unregister_driver(&amd8111_driver); 421 413 } 422 414 423 module_init( amd8111_init);424 module_exit( amd8111_exit);415 module_init(i2c_amd8111_init); 416 module_exit(i2c_amd8111_exit); lm-sensors/trunk/kernel/busses/i2c-hydra.c
r1427 r1698 36 36 #include <linux/init.h> 37 37 38 #ifdef MODULE_LICENSE39 38 MODULE_LICENSE("GPL"); 40 #endif41 39 42 /* PCI device */43 #define VENDOR PCI_VENDOR_ID_APPLE44 #define DEVICE PCI_DEVICE_ID_APPLE_HYDRA45 40 46 41 #define HYDRA_CACHE_PD 0x00000030 … … 105 100 } 106 101 107 static void bit_hydra_inc(struct i2c_adapter *adap)108 {109 MOD_INC_USE_COUNT;110 }111 112 static void bit_hydra_dec(struct i2c_adapter *adap)113 {114 MOD_DEC_USE_COUNT;115 }116 117 102 /* ------------------------------------------------------------------------ */ 118 103 119 104 static struct i2c_algo_bit_data bit_hydra_data = { 120 NULL, 121 bit_hydra_setsda, 122 bit_hydra_setscl, 123 bit_hydra_getsda, 124 bit_hydra_getscl, 125 5, 5, 100, /*waits, timeout */ 105 .setsda = bit_hydra_setsda, 106 .setscl = bit_hydra_setscl, 107 .getsda = bit_hydra_getsda, 108 .getscl = bit_hydra_getscl, 109 .udelay = 5, 110 .mdelay = 5, 111 .timeout = HZ 126 112 }; 127 113 128 114 static struct i2c_adapter bit_hydra_ops = { 129 "Hydra i2c", 130 I2C_HW_B_HYDRA, 131 NULL, 132 &bit_hydra_data, 133 bit_hydra_inc, 134 bit_hydra_dec, 135 NULL, 136 NULL, 115 .owner = THIS_MODULE, 116 .name = "Hydra i2c", 117 .id = I2C_HW_B_HYDRA, 118 .algo_data = &bit_hydra_data, 137 119 }; 138 120 139 121 140 static int find_hydra(void) 122 /* PCI device */ 123 #define VENDOR PCI_VENDOR_ID_APPLE 124 #define DEVICE PCI_DEVICE_ID_APPLE_HYDRA 125 126 static struct pci_device_id hydra_ids[] __devinitdata = { 127 { 0, } 128 }; 129 130 static int __devinit hydra_probe(struct pci_dev *dev, const struct pci_device_id *id) 141 131 { 142 struct pci_dev *dev;143 132 unsigned int base_addr; 144 133 145 if (!pci_present())146 return -ENODEV;147 148 dev = pci_find_device(VENDOR, DEVICE, NULL);149 if (!dev) {150 printk("Hydra not found\n");151 return -ENODEV;152 }153 154 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13)155 134 base_addr = dev->resource[0].start; 156 #else157 base_addr = dev->base_address[0];158 #endif159 135 hydra_base = (unsigned long) ioremap(base_addr, 0x100); 160 136 161 return 0; 137 pdregw(0); /* clear SCLK_OE and SDAT_OE */ 138 return i2c_bit_add_bus(&bit_hydra_ops); 162 139 } 163 140 164 #ifdef MODULE 165 static 166 #else 167 extern 168 #endif 169 int __init i2c_hydra_init(void) 141 static void __devexit hydra_remove(struct pci_dev *dev) 170 142 { 171 if (find_hydra() < 0) { 172 printk("Error while reading PCI configuration\n"); 173 return -ENODEV; 174 } 175 176 pdregw(0); /* clear SCLK_OE and SDAT_OE */ 177 178 if (i2c_bit_add_bus(&bit_hydra_ops) == 0) { 179 printk("Hydra i2c: Module succesfully loaded\n"); 180 return 0; 181 } else { 182 iounmap((void *) hydra_base); 183 printk 184 ("Hydra i2c: Algo-bit error, couldn't register bus\n"); 185 return -ENODEV; 186 } 143 pdregw(0); /* clear SCLK_OE and SDAT_OE */ 144 i2c_bit_del_bus(&bit_hydra_ops); 187 145 } 188 146 189 EXPORT_NO_SYMBOLS;190 147 191 #ifdef MODULE 148 static struct pci_driver hydra_driver = { 149 .name = "hydra smbus", 150 .id_table = hydra_ids, 151 .probe = hydra_probe, 152 .remove = __devexit_p(hydra_remove), 153 }; 154 155 static int __init i2c_hydra_init(void) 156 { 157 return pci_module_init(&hydra_driver); 158 } 159 160 161 static void __exit i2c_hydra_exit(void) 162 { 163 pci_unregister_driver(&hydra_driver); 164 iounmap((void *) hydra_base); 165 } 166 167 168 192 169 MODULE_AUTHOR("Geert Uytterhoeven <geert@linux-m68k.org>"); 193 170 MODULE_DESCRIPTION("i2c for Apple Hydra Mac I/O"); 194 171 195 int init_module(void) 196 { 197 return i2c_hydra_init(); 198 } 172 module_init(i2c_hydra_init); 173 module_exit(i2c_hydra_exit); 199 174 200 void cleanup_module(void)201 {202 i2c_bit_del_bus(&bit_hydra_ops);203 if (hydra_base) {204 pdregw(0); /* clear SCLK_OE and SDAT_OE */205 iounmap((void *) hydra_base);206 }207 }208 #endiflm-sensors/trunk/kernel/busses/i2c-i801.c
r1490 r1698 52 52 #include "version.h" 53 53 54 #ifdef MODULE_LICENSE55 54 MODULE_LICENSE("GPL"); 56 #endif57 55 58 56 #ifdef I2C_FUNC_SMBUS_BLOCK_DATA_PEC … … 128 126 "EXTREMELY DANGEROUS!"); 129 127 130 #ifdef MODULE 131 static 132 #else 133 extern 134 #endif 135 int __init i2c_i801_init(void); 136 static int __init i801_cleanup(void); 137 static int i801_setup(void); 138 static s32 i801_access(struct i2c_adapter *adap, u16 addr, 139 unsigned short flags, char read_write, 140 u8 command, int size, union i2c_smbus_data *data); 128 129 130 131 141 132 static void i801_do_pause(unsigned int amount); 142 133 static int i801_transaction(void); 143 134 static int i801_block_transaction(union i2c_smbus_data *data, 144 135 char read_write, int command); 145 static void i801_inc(struct i2c_adapter *adapter); 146 static void i801_dec(struct i2c_adapter *adapter); 147 static u32 i801_func(struct i2c_adapter *adapter); 148 149 #ifdef MODULE 150 extern int init_module(void); 151 extern int cleanup_module(void); 152 #endif /* MODULE */ 153 154 static struct i2c_algorithm smbus_algorithm = { 155 /* name */ "Non-I2C SMBus adapter", 156 /* id */ I2C_ALGO_SMBUS, 157 /* master_xfer */ NULL, 158 /* smbus_xfer */ i801_access, 159 /* slave_send */ NULL, 160 /* slave_rcv */ NULL, 161 /* algo_control */ NULL, 162 /* functionality */ i801_func, 163 }; 164 165 static struct i2c_adapter i801_adapter = { 166 "unset", 167 I2C_ALGO_SMBUS | I2C_HW_SMBUS_I801, 168 &smbus_algorithm, 169 NULL, 170 i801_inc, 171 i801_dec, 172 NULL, 173 NULL, 174 }; 175 176 static int __initdata i801_initialized; 136 137 138 139 177 140 static unsigned short i801_smba = 0; 178 141 static struct pci_dev *I801_dev = NULL; … … 671 634 } 672 635 673 void i801_inc(struct i2c_adapter *adapter)674 {675 MOD_INC_USE_COUNT;676 }677 678 void i801_dec(struct i2c_adapter *adapter)679 {680 MOD_DEC_USE_COUNT;681 }682 636 683 637 u32 i801_func(struct i2c_adapter *adapter) … … 694 648 } 695 649 696 int __init i2c_i801_init(void) 697 { 698 int res; 699 printk(KERN_INFO "i2c-i801.o version %s (%s)\n", LM_VERSION, LM_DATE); 700 #ifdef DEBUG 701 /* PE- It might be good to make this a permanent part of the code! */ 702 if (i801_initialized) { 703 printk 704 (KERN_DEBUG "i2c-i801.o: Oops, i801_init called a second time!\n"); 705 return -EBUSY; 706 } 707 #endif 708 i801_initialized = 0; 709 if ((res = i801_setup())) { 650 static struct i2c_algorithm smbus_algorithm = { 651 .name = "Non-I2C SMBus adapter", 652 .id = I2C_ALGO_SMBUS, 653 .smbus_xfer = i801_access, 654 .functionality = i801_func, 655 }; 656 657 static struct i2c_adapter i801_adapter = { 658 .owner = THIS_MODULE, 659 .name = "unset", 660 .id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_I801, 661 .algo = &smbus_algorithm, 662 }; 663 664 665 666 static struct pci_device_id i801_ids[] __devinitdata = { 667 { 0, } 668 }; 669 670 static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id *id) 671 { 672 673 if (i801_setup()) { 710 674 printk 711 675 (KERN_WARNING "i2c-i801.o: I801 not detected, module not inserted.\n"); 712 i801_cleanup(); 713 return res; 714 } 715 i801_initialized++; 676 return -ENODEV; 677 } 678 716 679 sprintf(i801_adapter.name, "SMBus I801 adapter at %04x", 717 680 i801_smba); 718 if ((res = i2c_add_adapter(&i801_adapter))) { 719 printk 720 (KERN_ERR "i2c-i801.o: Adapter registration failed, module not inserted.\n"); 721 i801_cleanup(); 722 return res; 723 } 724 i801_initialized++; 725 printk(KERN_INFO "i2c-i801.o: I801 bus detected and initialized\n"); 726 return 0; 727 } 728 729 int __init i801_cleanup(void) 730 { 731 int res; 732 if (i801_initialized >= 2) { 733 if ((res = i2c_del_adapter(&i801_adapter))) { 734 printk 735 (KERN_ERR "i2c-i801.o: i2c_del_adapter failed, module not removed\n"); 736 return res; 737 } else 738 i801_initialized--; 739 } 740 if (i801_initialized >= 1) { 741 release_region(i801_smba, (isich4 ? 16 : 8)); 742 i801_initialized--; 743 } 744 return 0; 745 } 746 747 EXPORT_NO_SYMBOLS; 748 749 #ifdef MODULE 681 i2c_add_ada
