Changeset 1646
- Timestamp:
- 11/26/02 01:12:11 (10 years ago)
- Files:
-
- 1 modified
-
lm-sensors/trunk/kernel/chips/bmcsensors.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/kernel/chips/bmcsensors.c
r1635 r1646 75 75 76 76 static void bmcsensors_update_client(struct i2c_client *client); 77 static void bmcsensors_init_client(struct i2c_client *client);78 77 static int bmcsensors_find(int *address); 79 78 static void bmcsensors_reserve_sdr(void); … … 406 405 bmc_data.sysctl_id = i; 407 406 408 bmcsensors_init_client(&bmc_client);409 407 printk(KERN_INFO "bmcsensors.o: %d reservations cancelled\n", errorcount); 410 408 printk(KERN_INFO "bmcsensors.o: registered %d temp, %d volt, %d current, %d fan sensors\n", 411 409 temps, volts, currs, fans); 412 bmcsensors_update_client(&bmc_client); 410 /* 411 This completes the initialization. The first userspace read 412 of a /proc value will force the first 413 bmcsensors_update_client() which starts the 414 reading of the sensors themselves via IPMI messages. 415 */ 413 416 } 414 417 … … 591 594 if(sdrd_count == 0) { 592 595 printk(KERN_INFO "bmcsensors.o: No recognized sensors found.\n"); 593 rstate = STATE_DONE;594 596 /* unregister?? */ 595 597 } else { 596 598 bmcsensors_build_proc_table(); 597 rstate = STATE_READING;598 }599 } 600 rstate = STATE_DONE; 599 601 } else { 600 602 bmcsensors_get_sdr(0, nextrecord, 0); … … 611 613 case STATE_RESERVE: 612 614 resid = (((u16)msg->data[2]) << 8) || msg->data[1]; 613 #if 1614 printk(KERN_ INFO"bmcsensors.o: Got first resid 0x%.4x\n", resid);615 #ifdef DEBUG 616 printk(KERN_DEBUG "bmcsensors.o: Got first resid 0x%.4x\n", resid); 615 617 #endif 616 618 bmcsensors_get_sdr(0, 0, 0); … … 629 631 case STATE_UNCANCEL: 630 632 resid = (((u16)msg->data[2]) << 8) || msg->data[1]; 631 #if 1632 printk(KERN_ INFO"bmcsensors.o: Got new resid 0x%.4x\n", resid);633 #ifdef DEBUG 634 printk(KERN_DEBUG "bmcsensors.o: Got new resid 0x%.4x\n", resid); 633 635 #endif 634 636 rx_msg_data_offset = 0; … … 652 654 if(state == STATE_SDR && msg->msg.data[0] == 0xc5) { 653 655 /* )(*&@(*&#@$ reservation cancelled, get new resid */ 654 if(++errorcount > 1000) {656 if(++errorcount > 275) { 655 657 printk(KERN_ERR 656 658 "bmcsensors.o: Too many reservations cancelled, giving up\n"); 657 659 state = STATE_DONE; 658 660 } else { 659 #if 1660 printk(KERN_ ERR661 #ifdef DEBUG 662 printk(KERN_DEBUG 661 663 "bmcsensors.o: resid 0x%04x cancelled, getting new one\n", resid); 662 664 #endif … … 708 710 static void bmcsensors_get_sdr(u16 res_id, u16 record, u8 offset) 709 711 { 710 #if 1711 printk(KERN_ INFO"bmcsensors.o: Get SDR 0x%x 0x%x 0x%x\n",712 #ifdef DEBUG 713 printk(KERN_DEBUG "bmcsensors.o: Get SDR 0x%x 0x%x 0x%x\n", 712 714 res_id, record, offset); 713 715 #endif … … 819 821 } 820 822 821 static void bmcsensors_init_client(struct i2c_client *client) 822 { 823 /*******************************************/ 824 825 826 823 static void bmc_do_pause(unsigned int amount) 824 { 825 current->state = TASK_INTERRUPTIBLE; 826 schedule_timeout(amount); 827 827 } 828 828 … … 830 830 { 831 831 struct bmcsensors_data *data = client->data; 832 int i;832 int j = 0; 833 833 834 834 /* … … 836 836 */ 837 837 838 /* if within 3 seconds you get old data */ 838 839 if ((jiffies - data->last_updated > 3 * HZ) || 839 840 (jiffies < data->last_updated) || !data->valid) { … … 841 842 if(state != STATE_READING) { 842 843 state = STATE_READING; 844 #ifdef DEBUG 845 printk(KERN_DEBUG "bmcsensors.o: starting update\n", j); 846 #endif 843 847 bmcsensors_get_reading(client, 0); 844 848 } 849 /* wait 4 seconds max */ 850 while(state == STATE_READING && j++ < 100) 851 bmc_do_pause(HZ / 25); 852 #ifdef DEBUG 853 printk("bmcsensors.o: update complete; j = %d\n", j); 854 #endif 855 data->last_updated = jiffies; 856 data->valid = 1; 845 857 } 846 858 … … 910 922 int i; 911 923 struct bmcsensors_data *data = client->data; 912 int nr = ctl_name - BMC_SYSCTL_TEMP1 + 1;913 924 914 925 if((i = find_sdrd(ctl_name)) < 0) {
