Changeset 3758
- Timestamp:
- 01/14/03 00:22:50 (10 years ago)
- Location:
- i2c/trunk/kernel
- Files:
-
- 20 modified
-
Module.mk (modified) (2 diffs)
-
i2c-adap-ibm_ocp.c (modified) (1 diff)
-
i2c-algo-8xx.c (modified) (3 diffs)
-
i2c-algo-bit.c (modified) (5 diffs)
-
i2c-algo-biths.c (modified) (3 diffs)
-
i2c-algo-ibm_ocp.c (modified) (3 diffs)
-
i2c-algo-pcf.c (modified) (4 diffs)
-
i2c-core.c (modified) (14 diffs)
-
i2c-dev.c (modified) (5 diffs)
-
i2c-dev.h (modified) (2 diffs)
-
i2c-elektor.c (modified) (6 diffs)
-
i2c-elv.c (modified) (4 diffs)
-
i2c-frodo.c (modified) (2 diffs)
-
i2c-pcf-epp.c (modified) (2 diffs)
-
i2c-philips-par.c (modified) (3 diffs)
-
i2c-pport.c (modified) (3 diffs)
-
i2c-proc.c (modified) (7 diffs)
-
i2c-rpx.c (modified) (3 diffs)
-
i2c-velleman.c (modified) (4 diffs)
-
i2c.h (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
i2c/trunk/kernel/Module.mk
r3743 r3758 61 61 ifneq ($(shell if grep -q '^CONFIG_I2C_ELEKTOR=y' $(LINUX)/.config; then echo 1; fi),1) 62 62 KERNELTARGETS += $(MODULE_DIR)/i2c-elektor.o 63 KERNELINCLUDES += $(MODULE_DIR)/i2c- elektor.h $(MODULE_DIR)/i2c-pcf8584.h63 KERNELINCLUDES += $(MODULE_DIR)/i2c-pcf8584.h 64 64 endif 65 65 ifneq ($(shell if grep -q '^CONFIG_I2C_PROC=y' $(LINUX)/.config; then echo 1; fi),1) … … 78 78 # 79 79 #ifneq ($(shell if grep -q '^CONFIG_I2C_ALGO8XX=y' $(LINUX)/.config; then echo 1; fi),1) 80 #KERNELTARGETS += $(MODULE_DIR)/i2c-algo-8xx.o81 #KERNELINCLUDES += $(MODULE_DIR)/i2c-algo-8xx.h80 KERNELTARGETS += $(MODULE_DIR)/i2c-algo-8xx.o 81 KERNELINCLUDES += $(MODULE_DIR)/i2c-algo-8xx.h 82 82 #endif 83 83 #ifneq ($(shell if grep -q '^CONFIG_I2C_RPXLITE=y' $(LINUX)/.config; then echo 1; fi),1) 84 #KERNELTARGETS += $(MODULE_DIR)/i2c-rpx.o84 KERNELTARGETS += $(MODULE_DIR)/i2c-rpx.o 85 85 #endif 86 86 -
i2c/trunk/kernel/i2c-adap-ibm_ocp.c
r3753 r3758 276 276 277 277 278 //279 // Description: If this compiled as a module, then increment the count280 //281 static void iic_ibmocp_inc_use(struct i2c_adapter *adap)282 {283 #ifdef MODULE284 MOD_INC_USE_COUNT;285 #endif286 }287 288 289 //290 // Description: If this is a module, then decrement the count291 //292 static void iic_ibmocp_dec_use(struct i2c_adapter *adap)293 {294 #ifdef MODULE295 MOD_DEC_USE_COUNT;296 #endif297 }298 278 299 279 // -
i2c/trunk/kernel/i2c-algo-8xx.c
r3753 r3758 609 609 adap->algo = &cpm_algo; 610 610 611 #ifdef MODULE612 MOD_INC_USE_COUNT;613 #endif614 615 611 i2c_add_adapter(adap); 616 612 cpm_iic_init(cpm_adap); … … 643 639 printk("i2c-algo-8xx.o: adapter unregistered: %s\n",adap->name); 644 640 645 #ifdef MODULE646 MOD_DEC_USE_COUNT;647 #endif648 641 return 0; 649 642 } … … 652 645 EXPORT_SYMBOL(i2c_8xx_del_bus); 653 646 654 int __init i2c_algo_8xx_init (void)655 {656 printk("i2c-algo-8xx.o: i2c mpc8xx algorithm module version %s (%s)\n", I2C_VERSION, I2C_DATE);657 return 0;658 }659 660 661 #ifdef MODULE662 647 MODULE_AUTHOR("Brad Parker <brad@heeltoe.com>"); 663 648 MODULE_DESCRIPTION("I2C-Bus MPC8XX algorithm"); 664 649 MODULE_LICENSE("GPL"); 665 666 int init_module(void)667 {668 return i2c_algo_8xx_init();669 }670 671 void cleanup_module(void)672 {673 }674 #endif -
i2c/trunk/kernel/i2c-algo-bit.c
r3757 r3758 543 543 544 544 static struct i2c_algorithm i2c_bit_algo = { 545 "Bit-shift algorithm", 546 I2C_ALGO_BIT, 547 bit_xfer, 548 NULL, 549 NULL, /* slave_xmit */ 550 NULL, /* slave_recv */ 551 algo_control, /* ioctl */ 552 bit_func, /* functionality */ 545 .name = "Bit-shift algorithm", 546 .id = I2C_ALGO_BIT, 547 .master_xfer = bit_xfer, 548 .algo_control = algo_control, 549 .functionality = bit_func, 553 550 }; 554 551 … … 595 592 } 596 593 597 #ifdef MODULE598 MOD_INC_USE_COUNT;599 #endif600 594 i2c_add_adapter(i2c_adap); 601 602 595 return 0; 603 596 } … … 613 606 DEB2(printk(KERN_DEBUG "i2c-algo-bit.o: adapter unregistered: %s\n",i2c_adap->name)); 614 607 615 #ifdef MODULE616 MOD_DEC_USE_COUNT;617 #endif618 608 return 0; 619 609 } 620 621 int __init i2c_algo_bit_init (void)622 {623 printk(KERN_INFO "i2c-algo-bit.o: i2c bit algorithm module version %s (%s)\n", I2C_VERSION, I2C_DATE);624 return 0;625 }626 627 610 628 611 … … 630 613 EXPORT_SYMBOL(i2c_bit_del_bus); 631 614 632 #ifdef MODULE633 615 MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>"); 634 616 MODULE_DESCRIPTION("I2C-Bus bit-banging algorithm"); … … 643 625 MODULE_PARM_DESC(i2c_debug, 644 626 "debug level - 0 off; 1 normal; 2,3 more verbose; 9 bit-protocol"); 645 646 int init_module(void)647 {648 return i2c_algo_bit_init();649 }650 651 void cleanup_module(void)652 {653 }654 #endif -
i2c/trunk/kernel/i2c-algo-biths.c
r3757 r3758 586 586 587 587 static struct i2c_algorithm i2c_algo_biths = { 588 "Bit-shift algorithm", 589 I2C_ALGO_BIT, 590 bit_xfer, 591 NULL, 592 NULL, /* slave_xmit */ 593 NULL, /* slave_recv */ 594 algo_control, /* ioctl */ 595 bit_func, /* functionality */ 588 .name = "Bit-shift algorithm", 589 .id = I2C_ALGO_BIT, 590 .master_xfer = bit_xfer, 591 .algo_control = algo_control, 592 .functionality = bit_func, 596 593 }; 597 594 … … 744 741 DEB1(printk(KERN_DEBUG "i2c-algo-biths.o: hw routines for %s registered.\n", 745 742 i2c_adap->name)); 746 747 /* register new adapter to i2c module... */748 749 i2c_adap->id |= i2c_algo_biths.id;750 i2c_adap->algo = &i2c_algo_biths;751 752 i2c_adap->timeout = HZ; /* default values, should */753 i2c_adap->retries = 3; /* be replaced by defines */754 755 #ifdef MODULE756 MOD_INC_USE_COUNT;757 #endif758 i2c_add_adapter(i2c_adap);759 760 return 0;761 }762 763 764 int i2c_biths_del_bus(struct i2c_adapter *i2c_adap)765 {766 int res;767 768 if ((res = i2c_del_adapter(i2c_adap)) < 0)769 return res;770 771 DEB1(printk(KERN_DEBUG "i2c-algo-biths.o: adapter unregistered: %s\n",i2c_adap->name));772 773 #ifdef MODULE774 MOD_DEC_USE_COUNT;775 #endif776 return 0;777 }778 779 int __init i2c_algo_biths_init (void)780 {781 printk(KERN_INFO "i2c-algo-biths.o: i2c high-speed bit algorithm module version %s (%s)\n", I2C_VERSION, I2C_DATE);782 743 #ifdef rdtscl 783 744 DEB1(printk(KERN_DEBUG "i2c-algo-biths.o: ... will use rdtscl() for bus clock\n")); 784 745 #else 785 DEB1(printk(KERN_DEBUG "i2c-algo-biths.o: ... will use udelay() for bus clock\n") ;746 DEB1(printk(KERN_DEBUG "i2c-algo-biths.o: ... will use udelay() for bus clock\n")); 786 747 #endif 748 749 /* register new adapter to i2c module... */ 750 751 i2c_adap->id |= i2c_algo_biths.id; 752 i2c_adap->algo = &i2c_algo_biths; 753 754 i2c_adap->timeout = HZ; /* default values, should */ 755 i2c_adap->retries = 3; /* be replaced by defines */ 756 757 i2c_add_adapter(i2c_adap); 758 787 759 return 0; 788 760 } 789 761 790 762 763 int i2c_biths_del_bus(struct i2c_adapter *i2c_adap) 764 { 765 int res; 766 767 if ((res = i2c_del_adapter(i2c_adap)) < 0) 768 return res; 769 770 DEB1(printk(KERN_DEBUG "i2c-algo-biths.o: adapter unregistered: %s\n",i2c_adap->name)); 771 772 return 0; 773 } 791 774 792 775 EXPORT_SYMBOL(i2c_biths_add_bus); 793 776 EXPORT_SYMBOL(i2c_biths_del_bus); 794 777 795 #ifdef MODULE796 778 MODULE_AUTHOR("Kyösti Mälkki <kmalkki@cc.hut.fi>"); 797 779 MODULE_DESCRIPTION("I2C-Bus bit-banging algorithm"); … … 804 786 MODULE_PARM_DESC(i2c_debug, 805 787 "debug level - 1 use; 2 fatal, 3 +proto; 4 all, 5 +proto"); 806 807 int init_module(void)808 {809 return i2c_algo_biths_init();810 }811 812 void cleanup_module(void)813 {814 }815 #endif -
i2c/trunk/kernel/i2c-algo-ibm_ocp.c
r3753 r3758 891 891 adap->retries = 3; /* be replaced by defines */ 892 892 893 #ifdef MODULE894 MOD_INC_USE_COUNT;895 #endif896 897 893 iic_init(iic_adap); 898 894 i2c_add_adapter(adap); … … 918 914 DEB2(printk(KERN_DEBUG "i2c-algo-iic.o: adapter unregistered: %s\n",adap->name)); 919 915 920 #ifdef MODULE921 MOD_DEC_USE_COUNT;922 #endif923 916 return 0; 924 }925 926 927 //928 // Done929 //930 int __init i2c_algo_iic_init (void)931 {932 printk(KERN_INFO "IBM On-chip iic (i2c) algorithm module 2002.27.03\n");933 return 0;934 }935 936 937 void i2c_algo_iic_exit(void)938 {939 return;940 917 } 941 918 … … 960 937 "debug level - 0 off; 1 normal; 2,3 more verbose; 9 iic-protocol"); 961 938 962 963 module_init(i2c_algo_iic_init);964 module_exit(i2c_algo_iic_exit); -
i2c/trunk/kernel/i2c-algo-pcf.c
r3753 r3758 38 38 #include <linux/errno.h> 39 39 #include <linux/sched.h> 40 40 41 #include "i2c.h" 41 42 #include "i2c-algo-pcf.h" … … 475 476 } 476 477 477 #ifdef MODULE478 MOD_INC_USE_COUNT;479 #endif480 481 478 i2c_add_adapter(adap); 482 479 … … 510 507 int i2c_pcf_del_bus(struct i2c_adapter *adap) 511 508 { 512 int res; 513 if ((res = i2c_del_adapter(adap)) < 0) 514 return res; 515 DEB2(printk(KERN_DEBUG "i2c-algo-pcf.o: adapter unregistered: %s\n",adap->name)); 516 517 #ifdef MODULE 518 MOD_DEC_USE_COUNT; 519 #endif 520 return 0; 521 } 522 523 int __init i2c_algo_pcf_init (void) 524 { 525 printk(KERN_INFO "i2c-algo-pcf.o: i2c pcf8584 algorithm module version %s (%s)\n", I2C_VERSION, I2C_DATE); 526 return 0; 527 } 528 509 return i2c_del_adapter(adap); 510 } 529 511 530 512 EXPORT_SYMBOL(i2c_pcf_add_bus); 531 513 EXPORT_SYMBOL(i2c_pcf_del_bus); 532 514 533 #ifdef MODULE534 515 MODULE_AUTHOR("Hans Berglund <hb@spacetec.no>"); 535 516 MODULE_DESCRIPTION("I2C-Bus PCF8584 algorithm"); … … 542 523 MODULE_PARM_DESC(i2c_debug, 543 524 "debug level - 0 off; 1 normal; 2,3 more verbose; 9 pcf-protocol"); 544 545 546 int init_module(void)547 {548 return i2c_algo_pcf_init();549 }550 551 void cleanup_module(void)552 {553 }554 #endif -
i2c/trunk/kernel/i2c-core.c
r3753 r3758 37 37 #include <linux/init.h> 38 38 39 40 39 #include <asm/uaccess.h> 41 40 … … 58 57 59 58 /**** lock for writing to global variables: the adapter & driver list */ 60 struct semaphore adap_lock;61 struct semaphore driver_lock;59 DECLARE_MUTEX(adap_lock); 60 DECLARE_MUTEX(driver_lock); 62 61 63 62 /**** adapter list */ … … 78 77 79 78 #ifdef CONFIG_PROC_FS 80 81 static int i2cproc_init(void);82 static int i2cproc_cleanup(void);83 84 85 79 static ssize_t i2cproc_bus_read(struct file * file, char * buf,size_t count, 86 80 loff_t *ppos); … … 93 87 .read = i2cproc_bus_read, 94 88 }; 95 96 97 static int i2cproc_initialized = 0;98 99 #else /* undef CONFIG_PROC_FS */100 101 #define i2cproc_init() 0102 #define i2cproc_cleanup() 0103 104 89 #endif /* CONFIG_PROC_FS */ 105 90 … … 139 124 140 125 #ifdef CONFIG_PROC_FS 141 142 if (i2cproc_initialized) { 126 { 143 127 char name[8]; 144 128 struct proc_dir_entry *proc_entry; … … 158 142 adap->inode = proc_entry->low_ino; 159 143 } 160 161 144 #endif /* def CONFIG_PROC_FS */ 162 145 … … 237 220 } 238 221 #ifdef CONFIG_PROC_FS 239 if (i2cproc_initialized){222 { 240 223 char name[8]; 241 224 sprintf(name,"i2c-%d", i); 242 remove_proc_entry(name, proc_bus);225 remove_proc_entry(name, proc_bus); 243 226 } 244 227 #endif /* def CONFIG_PROC_FS */ … … 462 445 } 463 446 464 void i2c_inc_use_client(struct i2c_client *client) 465 { 466 467 if (client->driver->inc_use != NULL) 468 client->driver->inc_use(client); 469 470 if (client->adapter->inc_use != NULL) 471 client->adapter->inc_use(client->adapter); 472 } 473 474 void i2c_dec_use_client(struct i2c_client *client) 475 { 476 477 if (client->driver->dec_use != NULL) 478 client->driver->dec_use(client); 479 480 if (client->adapter->dec_use != NULL) 481 client->adapter->dec_use(client->adapter); 447 static int i2c_inc_use_client(struct i2c_client *client) 448 { 449 450 if (!try_module_get(client->driver->owner)) 451 return -ENODEV; 452 if (!try_module_get(client->adapter->owner)) { 453 module_put(client->driver->owner); 454 return -ENODEV; 455 } 456 457 return 0; 458 } 459 460 static void i2c_dec_use_client(struct i2c_client *client) 461 { 462 module_put(client->driver->owner); 463 module_put(client->adapter->owner); 482 464 } 483 465 … … 551 533 int i2c_use_client(struct i2c_client *client) 552 534 { 553 if(client->flags & I2C_CLIENT_ALLOW_USE) { 554 if (client->flags & I2C_CLIENT_ALLOW_MULTIPLE_USE) 535 if (!i2c_inc_use_client(client)) 536 return -ENODEV; 537 538 if (client->flags & I2C_CLIENT_ALLOW_USE) { 539 if (client->flags & I2C_CLIENT_ALLOW_MULTIPLE_USE) 555 540 client->usage_count++; 556 else { 557 if(client->usage_count > 0) 558 return -EBUSY; 559 else 560 client->usage_count++; 561 } 562 } 563 564 i2c_inc_use_client(client); 541 else if (client->usage_count > 0) 542 goto busy; 543 else 544 client->usage_count++; 545 } 565 546 566 547 return 0; 548 busy: 549 i2c_dec_use_client(client); 550 return -EBUSY; 567 551 } 568 552 … … 590 574 591 575 #ifdef CONFIG_PROC_FS 592 593 576 594 577 /* This function generates the output for /proc/bus/i2c */ … … 683 666 } 684 667 685 int i2cproc_init(void)668 static int i2cproc_init(void) 686 669 { 687 670 688 671 struct proc_dir_entry *proc_bus_i2c; 689 672 690 i2cproc_initialized = 0;691 692 if (! proc_bus) {693 printk(KERN_ERR "i2c-core.o: /proc/bus/ does not exist");694 i2cproc_cleanup();695 return -ENOENT;696 }697 673 proc_bus_i2c = create_proc_entry("i2c",0,proc_bus); 698 674 if (!proc_bus_i2c) { 699 675 printk(KERN_ERR "i2c-core.o: Could not create /proc/bus/i2c"); 700 i2cproc_cleanup();701 676 return -ENOENT; 702 677 } 678 703 679 proc_bus_i2c->read_proc = &read_bus_i2c; 704 680 proc_bus_i2c->owner = THIS_MODULE; 705 i2cproc_initialized += 2;706 681 return 0; 707 682 } 708 683 709 int i2cproc_cleanup(void) 710 { 711 712 if (i2cproc_initialized >= 1) { 713 remove_proc_entry("i2c",proc_bus); 714 i2cproc_initialized -= 2; 715 } 716 return 0; 717 } 718 719 684 static void __exit i2cproc_cleanup(void) 685 { 686 687 remove_proc_entry("i2c",proc_bus); 688 } 689 690 module_init(i2cproc_init); 691 module_exit(i2cproc_cleanup); 720 692 #endif /* def CONFIG_PROC_FS */ 721 693 … … 1464 1436 } 1465 1437 1466 #ifndef MODULE1467 #ifdef CONFIG_I2C_CHARDEV1468 extern int i2c_dev_init(void);1469 #endif1470 #ifdef CONFIG_I2C_ALGOBIT1471 extern int i2c_algo_bit_init(void);1472 #endif1473 #ifdef CONFIG_I2C_PHILIPSPAR1474 extern int i2c_bitlp_init(void);1475 #endif1476 #ifdef CONFIG_I2C_ELV1477 extern int i2c_bitelv_init(void);1478 #endif1479 #ifdef CONFIG_I2C_VELLEMAN1480 extern int i2c_bitvelle_init(void);1481 #endif1482 #ifdef CONFIG_I2C_PPORT1483 extern int i2c_bitpport_init(void);1484 #endif1485 #ifdef CONFIG_I2C_FRODO1486 extern int i2c_frodo_init(void);1487 #endif1488 #ifdef CONFIG_I2C_BITVIA1489 extern int i2c_bitvia_init(void);1490 #endif1491 1492 #ifdef CONFIG_I2C_ALGOPCF1493 extern int i2c_algo_pcf_init(void);1494 #endif1495 #ifdef CONFIG_I2C_ELEKTOR1496 extern int i2c_pcfisa_init(void);1497 #endif1498 #ifdef CONFIG_I2C_PCFEPP1499 extern int i2c_pcfepp_init(void);1500 #endif1501 1502 #ifdef CONFIG_I2C_ALGO8XX1503 extern int i2c_algo_8xx_init(void);1504 #endif1505 #ifdef CONFIG_I2C_RPXLITE1506 extern int i2c_rpx_init(void);1507 #endif1508 #ifdef CONFIG_I2C_IBM_OCP_ALGO1509 extern int i2c_algo_iic_init(void);1510 #endif1511 #ifdef CONFIG_I2C_IBM_OCP_ADAP1512 extern int iic_ibmocp_init(void);1513 #endif1514 #ifdef CONFIG_I2C_PROC1515 extern int sensors_init(void);1516 #endif1517 1518 /* This is needed for automatic patch generation: sensors code starts here */1519 /* This is needed for automatic patch generation: sensors code ends here */1520 1521 int __init i2c_init_all(void)1522 {1523 /* --------------------- global ----- */1524 i2c_init();1525 1526 #ifdef CONFIG_I2C_CHARDEV1527 i2c_dev_init();1528 #endif1529 /* --------------------- bit -------- */1530 #ifdef CONFIG_I2C_ALGOBIT1531 i2c_algo_bit_init();1532 #endif1533 #ifdef CONFIG_I2C_PHILIPSPAR1534 i2c_bitlp_init();1535 #endif1536 #ifdef CONFIG_I2C_ELV1537 i2c_bitelv_init();1538 #endif1539 #ifdef CONFIG_I2C_VELLEMAN1540 i2c_bitvelle_init();1541 #endif1542 #ifdef CONFIG_I2C_PPORT1543 i2c_bitpport_init();1544 #endif1545 #ifdef CONFIG_I2C_FRODO1546 i2c_frodo_init();1547 #endif1548 #ifdef CONFIG_I2C_BITVIA1549 i2c_bitvia_init();1550 #endif1551 1552 /* --------------------- pcf -------- */1553 #ifdef CONFIG_I2C_ALGOPCF1554 i2c_algo_pcf_init();1555 #endif1556 #ifdef CONFIG_I2C_ELEKTOR1557 i2c_pcfisa_init();1558 #endif1559 #ifdef CONFIG_I2C_PCFEPP1560 i2c_pcfepp_init();1561 #endif1562 1563 /* --------------------- 8xx -------- */1564 #ifdef CONFIG_I2C_ALGO8XX1565 i2c_algo_8xx_init();1566 #endif1567 #ifdef CONFIG_I2C_RPXLITE1568 i2c_rpx_init();1569 #endif1570 #ifdef CONFIG_I2C_IBM_OCP_ALGO1571 i2c_algo_iic_init();1572 #endif1573 #ifdef CONFIG_I2C_IBM_OCP_ADAP1574 iic_ibmocp_init();1575 #endif1576 1577 /* -------------- proc interface ---- */1578 #ifdef CONFIG_I2C_PROC1579 sensors_init();1580 #endif1581 /* This is needed for automatic patch generation: sensors code starts here */1582 /* This is needed for automatic patch generation: sensors code ends here */1583 1584 return 0;1585 }1586 1587 #endif1588 1589 1590 1591 1438 EXPORT_SYMBOL(i2c_add_adapter); 1592 1439 EXPORT_SYMBOL(i2c_del_adapter); … … 1595 1442 EXPORT_SYMBOL(i2c_attach_client); 1596 1443 EXPORT_SYMBOL(i2c_detach_client); 1597 EXPORT_SYMBOL(i2c_inc_use_client);1598 EXPORT_SYMBOL(i2c_dec_use_client);1599 1444 EXPORT_SYMBOL(i2c_get_client); 1600 1445 EXPORT_SYMBOL(i2c_use_client); … … 1629 1474 MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>"); 1630 1475 MODULE_DESCRIPTION("I2C-Bus main module"); 1476 MODULE_LICENSE("GPL"); 1477 1631 1478 MODULE_PARM(i2c_debug, "i"); 1632 1479 MODULE_PARM_DESC(i2c_debug,"debug level"); 1633 MODULE_LICENSE("GPL");1634 1635 module_init(i2c_init);1636 module_exit(i2c_exit); -
i2c/trunk/kernel/i2c-dev.c
r3757 r3758 365 365 file->private_data = client; 366 366 367 if (i2cdev_adaps[minor]->inc_use) 368 i2cdev_adaps[minor]->inc_use(i2cdev_adaps[minor]); 367 if (!try_module_get(i2cdev_adaps[minor]->owner)) { 368 kfree(client); 369 return -ENODEV; 370 } 369 371 370 372 #ifdef DEBUG … … 382 384 printk(KERN_DEBUG "i2c-dev.o: Closed: i2c-%d\n", minor); 383 385 #endif 384 lock_kernel(); 385 if (i2cdev_adaps[minor]->dec_use) 386 i2cdev_adaps[minor]->dec_use(i2cdev_adaps[minor]); 387 unlock_kernel(); 386 module_put(i2cdev_adaps[minor]->owner); 388 387 return 0; 389 388 } … … 434 433 } 435 434 436 static void i2cdev_cleanup(void)437 {438 int res;439 440 if ((res = i2c_del_driver(&i2cdev_driver))) {441 printk(KERN_ERR "i2c-dev.o: Driver deregistration failed, "442 "module not removed.\n");443 }444 445 devfs_remove("i2c");446 unregister_chrdev(I2C_MAJOR,"i2c");447 }448 449 435 int __init i2c_dev_init(void) 450 436 { … … 468 454 } 469 455 470 EXPORT_NO_SYMBOLS; 456 static void __exit i2c_dev_exit(void) 457 { 458 i2c_del_driver(&i2cdev_driver); 459 devfs_remove("i2c"); 460 unregister_chrdev(I2C_MAJOR,"i2c"); 461 } 471 462 472 463 MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl> and Simon G. Vogl <simon@tk.uni-linz.ac.at>"); … … 475 466 476 467 module_init(i2c_dev_init); 477 module_exit(i2c dev_cleanup);468 module_exit(i2c_dev_exit); -
i2c/trunk/kernel/i2c-dev.h
r3661 r3758 22 22 /* $Id$ */ 23 23 24 #ifndef I2C_DEV_H 25 #define I2C_DEV_H 26 24 #ifndef _LINUX_I2C_DEV_H 25 #define _LINUX_I2C_DEV_H 27 26 28 27 #include <linux/types.h> … … 216 215 #endif /* ndef __KERNEL__ */ 217 216 218 #endif 217 #endif /* _LINUX_I2C_DEV_H */ -
i2c/trunk/kernel/i2c-elektor.c
r3754 r3758 36 36 #include <linux/pci.h> 37 37 #include <linux/wait.h> 38 38 39 #include "i2c.h" 39 40 #include "i2c-algo-pcf.h" 40 #include "i2c-elektor.h"41 41 42 42 #include <asm/io.h> … … 143 143 { 144 144 if (!mmapped) { 145 if (check_region(base, 2) < 0 ) { 146 printk(KERN_ERR "i2c-elektor.o: requested I/O region (0x%X:2) is in use.\n", base); 145 if (!request_region(base, 2, "i2c (isa bus adapter)")) { 146 printk(KERN_ERR 147 "i2c-elektor.o: requested I/O region (0x%X:2) " 148 "is in use.\n", base); 147 149 return -ENODEV; 148 } else {149 request_region(base, 2, "i2c (isa bus adapter)");150 150 } 151 151 } … … 158 158 } 159 159 return 0; 160 }161 162 163 static void __exit pcf_isa_exit(void)164 {165 if (irq > 0) {166 disable_irq(irq);167 free_irq(irq, 0);168 }169 if (!mmapped) {170 release_region(base , 2);171 }172 }173 174 175 static int pcf_isa_reg(struct i2c_client *client)176 {177 return 0;178 }179 180 181 static int pcf_isa_unreg(struct i2c_client *client)182 {183 return 0;184 }185 186 static void pcf_isa_inc_use(struct i2c_adapter *adap)187 {188 #ifdef MODULE189 MOD_INC_USE_COUNT;190 #endif191 }192 193 static void pcf_isa_dec_use(struct i2c_adapter *adap)194 {195 #ifdef MODULE196 MOD_DEC_USE_COUNT;197 #endif198 160 } 199 161 … … 211 173 .udelay = 10, 212 174 .mdelay = 10, 213 .timeout = 100,175 .timeout = HZ, 214 176 }; 215 177 216 178 static struct i2c_adapter pcf_isa_ops = { 179 .owner = THIS_MODULE, 217 180 .name = "PCF8584 ISA adapter", 218 181 .id = I2C_HW_P_ELEK, 219 182 .algo_data = &pcf_isa_data, 220 .inc_use = pcf_isa_inc_use,221 .dec_use = pcf_isa_dec_use,222 .client_register = pcf_isa_reg,223 .client_unregister = pcf_isa_unreg,224 183 }; 225 184 226 int __init i2c_pcfisa_init(void)185 static int __init i2c_pcfisa_init(void) 227 186 { 228 187 #ifdef __alpha__ … … 282 241 283 242 init_waitqueue_head(&pcf_wait); 284 if (pcf_isa_init() == 0) { 285 if (i2c_pcf_add_bus(&pcf_isa_ops) < 0) { 286 pcf_isa_exit(); 287 return -ENODEV; 288 } 289 } else { 243 if (pcf_isa_init()) 290 244 return -ENODEV; 291 } 245 if (i2c_pcf_add_bus(&pcf_isa_ops) < 0) 246 goto fail; 292 247 293 248 printk(KERN_ERR "i2c-elektor.o: found device at %#x.\n", base); 294 249 295 250 return 0; 296 } 297 298 299 EXPORT_NO_SYMBOLS; 300 301 #ifdef MODULE 251 252 fail: 253 if (irq > 0) { 254 disable_irq(irq); 255 free_irq(irq, 0); 256 } 257 258 if (!mmapped) 259 release_region(base , 2); 260 return -ENODEV; 261 } 262 263 264 static void i2c_pcfisa_exit(void) 265 { 266 i2c_pcf_del_bus(&pcf_isa_ops); 267 268 if (irq > 0) { 269 disable_irq(irq); 270 free_irq(irq, 0); 271 } 272 273 if (!mmapped) 274 release_region(base , 2); 275 } 276 302 277 MODULE_AUTHOR("Hans Berglund <hb@spacetec.no>"); 303 278 MODULE_DESCRIPTION("I2C-Bus adapter routines for PCF8584 ISA bus adapter"); … … 311 286 MODULE_PARM(i2c_debug, "i"); 312 287 313 int init_module(void) 314 { 315 return i2c_pcfisa_init(); 316 } 317 318 void cleanup_module(void) 319 { 320 i2c_pcf_del_bus(&pcf_isa_ops); 321 pcf_isa_exit(); 322 } 323 324 #endif 288 module_init(i2c_pcfisa_init); 289 module_exit(i2c_pcfisa_exit); -
i2c/trunk/kernel/i2c-elv.c
r3753 r3758 89 89 static int bit_elv_init(void) 90 90 { 91 if (check_region(base,(base == 0x3bc)? 3 : 8) < 0 ) { 92 return -ENODEV; 93 } else { 94 /* test for ELV adap. */ 95 if (inb(base+1) & 0x80) { /* BUSY should be high */ 96 DEBINIT(printk(KERN_DEBUG "i2c-elv.o: Busy was low.\n")); 97 return -ENODEV; 98 } else { 99 outb(0x0c,base+2); /* SLCT auf low */ 100 udelay(400); 101 if ( !(inb(base+1) && 0x10) ) { 102 outb(0x04,base+2); 103 DEBINIT(printk(KERN_DEBUG "i2c-elv.o: Select was high.\n")); 104 return -ENODEV; 105 } 106 } 107 request_region(base,(base == 0x3bc)? 3 : 8, 108 "i2c (ELV adapter)"); 109 PortData = 0; 110 bit_elv_setsda((void*)base,1); 111 bit_elv_setscl((void*)base,1); 91 if (!request_region(base, (base == 0x3bc) ? 3 : 8, 92 "i2c (ELV adapter)")) 93 return -ENODEV; 94 95 if (inb(base+1) & 0x80) { /* BUSY should be high */ 96 DEBINIT(printk(KERN_DEBUG "i2c-elv.o: Busy was low.\n")); 97 goto fail; 98 } 99 100 outb(0x0c,base+2); /* SLCT auf low */ 101 udelay(400); 102 if (!(inb(base+1) && 0x10)) { 103 outb(0x04,base+2); 104 DEBINIT(printk(KERN_DEBUG "i2c-elv.o: Select was high.\n")); 105 goto fail; 112 106 } 107 108 PortData = 0; 109 bit_elv_setsda((void*)base,1); 110 bit_elv_setscl((void*)base,1); 113 111 return 0; 114 }115 112 116 static void __exit bit_elv_exit(void) 117 { 118 release_region( base , (base == 0x3bc)? 3 : 8 ); 119 } 120 121 static int bit_elv_reg(struct i2c_client *client) 122 { 123 return 0; 124 } 125 126 static int bit_elv_unreg(struct i2c_client *client) 127 { 128 return 0; 129 } 130 131 static void bit_elv_inc_use(struct i2c_adapter *adap) 132 { 133 #ifdef MODULE 134 MOD_INC_USE_COUNT; 135 #endif 136 } 137 138 static void bit_elv_dec_use(struct i2c_adapter *adap) 139 { 140 #ifdef MODULE 141 MOD_DEC_USE_COUNT; 142 #endif 113 fail: 114 release_region(base , (base == 0x3bc) ? 3 : 8); 115 return -ENODEV; 143 116 } 144 117 … … 157 130 158 131 static struct i2c_adapter bit_elv_ops = { 159 "ELV Parallel port adaptor", 160 I2C_HW_B_ELV, 161 NULL, 162 &bit_elv_data, 163 bit_elv_inc_use, 164 bit_elv_dec_use, 165 bit_elv_reg, 166 bit_elv_unreg, 132 .owner = THIS_MODULE, 133 .name = "ELV Parallel port adaptor", 134 .id = I2C_HW_B_ELV, 135 .algo_data = &bit_elv_data, 167 136 }; 168 137 169 int __init i2c_bitelv_init(void)138 static int __init i2c_bitelv_init(void) 170 139 { 171 140 printk(KERN_INFO "i2c-elv.o: i2c ELV parallel port adapter module version %s (%s)\n", I2C_VERSION, I2C_DATE); … … 193 162 } 194 163 164 static void __exit i2c_bitelv_exit(void) 165 { 166 i2c_bit_del_bus(&bit_elv_ops); 167 release_region(base , (base == 0x3bc) ? 3 : 8); 168 } 195 169 196 170 EXPORT_NO_SYMBOLS; 197 171 198 #ifdef MODULE199 172 MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>"); 200 173 MODULE_DESCRIPTION("I2C-Bus adapter routines for ELV parallel port adapter"); … … 203 176 MODULE_PARM(base, "i"); 204 177 205 int init_module(void) 206 { 207 return i2c_bitelv_init(); 208 } 209 210 void cleanup_module(void) 211 { 212 i2c_bit_del_bus(&bit_elv_ops); 213 bit_elv_exit(); 214 } 215 216 #endif 178 module_init(i2c_bitelv_init); 179 module_exit(i2c_bitelv_exit); -
i2c/trunk/kernel/i2c-frodo.c
r3757 r3758 62 62 }; 63 63 64 static int frodo_client_register (struct i2c_client *client)65 {66 return (0);67 }68 69 static int frodo_client_unregister (struct i2c_client *client)70 {71 return (0);72 }73 74 static void frodo_inc_use (struct i2c_adapter *adapter)75 {76 MOD_INC_USE_COUNT;77 }78 79 static void frodo_dec_use (struct i2c_adapter *adapter)80 {81 MOD_DEC_USE_COUNT;82 }83 84 64 static struct i2c_adapter frodo_ops = { 65 .owner = THIS_MODULE, 85 66 .name = "Frodo adapter driver", 86 67 .id = I2C_HW_B_FRODO, 87 68 .algo_data = &bit_frodo_data, 88 .inc_use = frodo_inc_use,89 .dec_use = frodo_dec_use,90 .client_register = frodo_client_register,91 .client_unregister = frodo_client_unregister92 69 }; 93 70 94 71 static int __init i2c_frodo_init (void) 95 72 { 96 return (i2c_bit_add_bus (&frodo_ops));73 return i2c_bit_add_bus(&frodo_ops); 97 74 } 98 99 EXPORT_NO_SYMBOLS;100 75 101 76 static void __exit i2c_frodo_exit (void) 102 77 { 103 i2c_bit_del_bus (&frodo_ops);78 i2c_bit_del_bus(&frodo_ops); 104 79 } 105 80 … … 108 83 MODULE_LICENSE ("GPL"); 109 84 110 EXPORT_NO_SYMBOLS;111 112 85 module_init (i2c_frodo_init); 113 86 module_exit (i2c_frodo_exit); -
i2c/trunk/kernel/i2c-pcf-epp.c
r3754 r3758 197 197 } 198 198 199 static void pcf_epp_inc_use(struct i2c_adapter *adap)200 {201 #ifdef MODULE202 MOD_INC_USE_COUNT;203 #endif204 }205 206 static void pcf_epp_dec_use(struct i2c_adapter *adap)207 {208 #ifdef MODULE209 MOD_DEC_USE_COUNT;210 #endif211 }212 199 213 200 … … 223 210 pcf_epp_getclock, 224 211 pcf_epp_waitforpin, 225 80, 80, 100, /* waits, timeout */212 80, 80, HZ, /* waits, timeout */ 226 213 }; 227 214 -
i2c/trunk/kernel/i2c-philips-par.c
r3753 r3758 128 128 return (parport_read_status((struct parport *) data) & 129 129 PARPORT_STATUS_BUSY) ? 0 : 1; 130 }131 132 static int bit_lp_reg(struct i2c_client *client)133 {134 return 0;135 }136 137 static int bit_lp_unreg(struct i2c_client *client)138 {139 return 0;140 }141 142 static void bit_lp_inc_use(struct i2c_adapter *adap)143 {144 MOD_INC_USE_COUNT;145 }146 147 static void bit_lp_dec_use(struct i2c_adapter *adap)148 {149 MOD_DEC_USE_COUNT;150 130 } 151 131 … … 174 154 175 155 static struct i2c_adapter bit_lp_ops = { 176 "Philips Parallel port adapter", 177 I2C_HW_B_LP, 178 NULL, 179 NULL, 180 bit_lp_inc_use, 181 bit_lp_dec_use, 182 bit_lp_reg, 183 184 bit_lp_unreg, 156 .owner = THIS_MODULE, 157 .name = "Philips Parallel port adapter", 158 .id = I2C_HW_B_LP, 185 159 }; 186 160 … … 284 258 MODULE_PARM(type, "i"); 285 259 286 #ifdef MODULE 287 int init_module(void) 288 { 289 return i2c_bitlp_init(); 290 } 291 292 void cleanup_module(void) 293 { 294 i2c_bitlp_exit(); 295 } 296 #endif 260 module_init(i2c_bitlp_init); 261 module_exit(i2c_bitlp_exit); -
i2c/trunk/kernel/i2c-pport.c
r3753 r3758 142 142 } 143 143 144 static int bit_pport_reg(struct i2c_client *client)145 {146 return 0;147 }148 149 static int bit_pport_unreg(struct i2c_client *client)150 {151 release_region((base+2),1);152 return 0;153 }154 155 static void bit_pport_inc_use(struct i2c_adapter *adap)156 {157 #ifdef MODULE158 MOD_INC_USE_COUNT;159 #endif160 }161 162 static void bit_pport_dec_use(struct i2c_adapter *adap)163 {164 #ifdef MODULE165 MOD_DEC_USE_COUNT;166 #endif167 }168 144 169 145 /* ------------------------------------------------------------------------ … … 182 158 183 159 static struct i2c_adapter bit_pport_ops = { 184 "Primitive Parallel port adaptor", 185 I2C_HW_B_PPORT, 186 NULL, 187 &bit_pport_data, 188 bit_pport_inc_use, 189 bit_pport_dec_use, 190 bit_pport_reg, 191 bit_pport_unreg, 160 .owner = THIS_MODULE, 161 .name = "Primitive Parallel port adaptor", 162 .id = I2C_HW_B_PPORT, 163 .algo_data = &bit_pport_data, 192 164 }; 193 165 … … 228 200 229 201 MODULE_AUTHOR("Daniel Smolik <marvin@sitour.cz>"); 230 MODULE_DESCRIPTION("I2C-Bus adapter routines for Primitive parallel port adapter") 231 ; 202 MODULE_DESCRIPTION("I2C-Bus adapter routines for Primitive parallel port adapter"); 232 203 MODULE_PARM(base, "i"); 233 204 -
i2c/trunk/kernel/i2c-proc.c
r3757 r3758 24 24 */ 25 25 26 #include <linux/version.h>27 26 #include <linux/module.h> 28 27 #include <linux/kernel.h> … … 32 31 #include <linux/proc_fs.h> 33 32 #include <linux/ioport.h> 34 #include <asm/uaccess.h>35 33 #include "i2c.h" 36 34 #include "i2c-proc.h" 37 35 #include <linux/init.h> 38 39 #ifndef THIS_MODULE 40 #define THIS_MODULE NULL 41 #endif 36 #include <asm/uaccess.h> 42 37 43 38 static int i2c_create_name(char **name, const char *prefix, … … 88 83 89 84 static struct ctl_table_header *i2c_proc_header; 90 static int i2c_initialized;91 85 92 86 /* This returns a nice name for a new directory; for example lm78-isa-0310 … … 610 604 611 605 for (addr = 0x00; addr <= (is_isa ? 0xffff : 0x7f); addr++) { 606 /* XXX: WTF is going on here??? */ 612 607 if ((is_isa && check_region(addr, 1)) || 613 608 (!is_isa && i2c_check_addr(adapter, addr))) … … 810 805 } 811 806 812 int __init sensors_init(void)807 static int __init i2c_proc_init(void) 813 808 { 814 809 printk(KERN_INFO "i2c-proc.o version %s (%s)\n", I2C_VERSION, I2C_DATE); 815 i2c_initialized = 0;816 810 if (! 817 811 (i2c_proc_header = … … 821 815 } 822 816 i2c_proc_header->ctl_table->child->de->owner = THIS_MODULE; 823 i2c_initialized++;824 817 return 0; 825 818 } 826 819 827 static void __exit i2c_cleanup(void) 828 { 829 if (i2c_initialized >= 1) { 830 unregister_sysctl_table(i2c_proc_header); 831 i2c_initialized--; 832 } 820 static void __exit i2c_proc_exit(void) 821 { 822 unregister_sysctl_table(i2c_proc_header); 833 823 } 834 824 … … 843 833 MODULE_LICENSE("GPL"); 844 834 845 module_init( sensors_init);846 module_exit(i2c_ cleanup);835 module_init(i2c_proc_init); 836 module_exit(i2c_proc_exit); -
i2c/trunk/kernel/i2c-rpx.c
r3727 r3758 67 67 } 68 68 69 static int rpx_reg(struct i2c_client *client)70 {71 return 0;72 }73 74 static int rpx_unreg(struct i2c_client *client)75 {76 return 0;77 }78 79 static void rpx_inc_use(struct i2c_adapter *adap)80 {81 #ifdef MODULE82 MOD_INC_USE_COUNT;83 #endif84 }85 86 static void rpx_dec_use(struct i2c_adapter *adap)87 {88 #ifdef MODULE89 MOD_DEC_USE_COUNT;90 #endif91 }92 93 69 static struct i2c_algo_8xx_data rpx_data = { 94 70 .setisr = rpx_install_isr 95 71 }; 96 72 97 98 73 static struct i2c_adapter rpx_ops = { 99 "m8xx", 100 I2C_HW_MPC8XX_EPON, 101 NULL, 102 &rpx_data, 103 rpx_inc_use, 104 rpx_dec_use, 105 rpx_reg, 106 rpx_unreg, 74 .owner = THIS_MODULE, 75 .name = "m8xx", 76 .id = I2C_HW_MPC8XX_EPON, 77 .algo_data = &rpx_data, 107 78 }; 108 79 … … 127 98 } 128 99 129 #ifdef MODULE130 100 MODULE_AUTHOR("Dan Malek <dmalek@jlc.net>"); 131 101 MODULE_DESCRIPTION("I2C-Bus adapter routines for MPC8xx boards"); … … 133 103 module_init(i2c_rpx_init); 134 104 module_exit(i2c_rpx_exit); 135 #endif136 -
i2c/trunk/kernel/i2c-velleman.c
r3753 r3758 91 91 static int bit_velle_init(void) 92 92 { 93 if (check_region(base,(base == 0x3bc)? 3 : 8) < 0 ) { 94 DEBE(printk(KERN_DEBUG "i2c-velleman.o: Port %#x already in use.\n", 95 base)); 93 if (!request_region(base, (base == 0x3bc) ? 3 : 8, 94 "i2c (Vellemann adapter)")) 96 95 return -ENODEV; 97 } else { 98 request_region(base, (base == 0x3bc)? 3 : 8, 99 "i2c (Vellemann adapter)"); 100 bit_velle_setsda((void*)base,1); 101 bit_velle_setscl((void*)base,1); 102 } 96 97 bit_velle_setsda((void*)base,1); 98 bit_velle_setscl((void*)base,1); 103 99 return 0; 104 }105 106 static void __exit bit_velle_exit(void)107 {108 release_region( base , (base == 0x3bc)? 3 : 8 );109 }110 111 112 static int bit_velle_reg(struct i2c_client *client)113 {114 return 0;115 }116 117 static int bit_velle_unreg(struct i2c_client *client)118 {119 return 0;120 }121 122 static void bit_velle_inc_use(struct i2c_adapter *adap)123 {124 #ifdef MODULE125 MOD_INC_USE_COUNT;126 #endif127 }128 129 static void bit_velle_dec_use(struct i2c_adapter *adap)130 {131 #ifdef MODULE132 MOD_DEC_USE_COUNT;133 #endif134 100 } 135 101 … … 149 115 150 116 static struct i2c_adapter bit_velle_ops = { 151 "Velleman K8000", 152 I2C_HW_B_VELLE, 153 NULL, 154 &bit_velle_data, 155 bit_velle_inc_use, 156 bit_velle_dec_use, 157 bit_velle_reg, 158 bit_velle_unreg, 117 .owner = THIS_MODULE, 118 .name = "Velleman K8000", 119 .id = I2C_HW_B_VELLE, 120 .algo_data = &bit_velle_data, 159 121 }; 160 122 161 int __initi2c_bitvelle_init(void)123 static int __init i2c_bitvelle_init(void) 162 124 { 163 125 printk(KERN_INFO "i2c-velleman.o: i2c Velleman K8000 adapter module version %s (%s)\n", I2C_VERSION, I2C_DATE); … … 185 147 } 186 148 187 EXPORT_NO_SYMBOLS; 149 static void __exit i2c_bitvelle_exit(void) 150 { 151 i2c_bit_del_bus(&bit_velle_ops); 152 release_region(base, (base == 0x3bc) ? 3 : 8); 153 } 188 154 189 #ifdef MODULE190 155 MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>"); 191 156 MODULE_DESCRIPTION("I2C-Bus adapter routines for Velleman K8000 adapter"); … … 194 159 MODULE_PARM(base, "i"); 195 160 196 int init_module(void) 197 { 198 return i2c_bitvelle_init(); 199 } 200 201 void cleanup_module(void) 202 { 203 i2c_bit_del_bus(&bit_velle_ops); 204 bit_velle_exit(); 205 } 206 207 #endif 161 module_init(i2c_bitvelle_init); 162 module_exit(i2c_bitvelle_exit); -
i2c/trunk/kernel/i2c.h
r3753 r3758 26 26 /* $Id$ */ 27 27 28 #ifndef I2C_H29 #define I2C_H28 #ifndef _LINUX_I2C_H 29 #define _LINUX_I2C_H 30 30 31 31 #define I2C_DATE "20021208" … … 41 41 #ifdef __KERNEL__ 42 42 43 /* --- Includes and compatibility declarations ------------------------ */ 44 45 #include <linux/version.h> 46 47 #include <asm/page.h> /* for 2.2.xx */ 43 #include <linux/config.h> 48 44 #include <asm/semaphore.h> 49 #include <linux/config.h> 45 50 46 51 47 /* --- General options ------------------------------------------------ */ … … 131 127 132 128 struct i2c_driver { 129 struct module *owner; 133 130 char name[32]; 134 131 int id; … … 154 151 */ 155 152 int (*command)(struct i2c_client *client,unsigned int cmd, void *arg); 156 157 /* These two are mainly used for bookkeeping & dynamic unloading of158 * kernel modules. inc_use tells the driver that a client is being159 * used by another module & that it should increase its ref. counter.160 * dec_use is the inverse operation.161 * NB: Make sure you have no circular dependencies, or else you get a162 * deadlock when trying to unload the modules.163 * You should use the i2c_{inc,dec}_use_client functions instead of164 * calling this function directly.165 */166 void (*inc_use)(struct i2c_client *client);167 void (*dec_use)(struct i2c_client *client);168 153 }; 169 154 … … 228 213 */ 229 214 struct i2c_adapter { 215 struct module *owner; 230 216 char name[32]; /* some useful name to identify the adapter */ 231 217 unsigned int id;/* == is algo->id | hwdep.struct->id, */ … … 233 219 struct i2c_algorithm *algo;/* the algorithm to access the bus */ 234 220 void *algo_data; 235 236 /* --- These may be NULL, but should increase the module use count */237 void (*inc_use)(struct i2c_adapter *);238 void (*dec_use)(struct i2c_adapter *);239 221 240 222 /* --- administration stuff. */ … … 311 293 extern int i2c_attach_client(struct i2c_client *); 312 294 extern int i2c_detach_client(struct i2c_client *); 313 314 /* Only call these if you grab a resource that makes unloading the315 client and the adapter it is on completely impossible. Like when a316 /proc directory is entered. */317 extern void i2c_inc_use_client(struct i2c_client *);318 extern void i2c_dec_use_client(struct i2c_client *);319 295 320 296 /* New function: This is to get an i2c_client-struct for controlling the … … 593 569 594 570 #endif /* def __KERNEL__ */ 595 #endif /* I2C_H */571 #endif /* _LINUX_I2C_H */
