Changeset 952

Show
Ignore:
Timestamp:
12/16/00 16:42:02 (12 years ago)
Author:
mds
Message:

(mds) patch from Steffen Persvold <sp@…>. Change function names,

etc. from LM87... to lm87...; rename /proc entries to standard
in[0-5], etc.; also column 80 cleanup.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/kernel/chips/lm87.c

    r933 r952  
    11/* 
    2     LM87.c - Part of lm_sensors, Linux kernel modules for hardware 
     2    lm87.c - Part of lm_sensors, Linux kernel modules for hardware 
    33             monitoring 
    44    Copyright (c) 2000  Frodo Looijaard <frodol@dds.nl> 
     
    5454 
    5555/* Insmod parameters */ 
    56 SENSORS_INSMOD_1(LM87); 
     56SENSORS_INSMOD_1(lm87); 
    5757 
    5858/* The following is the calculation for the register offset 
     
    8585      /* These are all read-only */ 
    8686#define LM87_REG_2_5V_EXT_TEMP_2         0x20  /* front ambient for us */ 
    87 #define LM87_REG_VCCP1                   0x21  /* this will be CPU core voltage */ 
     87#define LM87_REG_VCCP1                   0x21  /* CPU core voltage */ 
    8888#define LM87_REG_3_3V                    0x22   
    8989#define LM87_REG_5V                      0x23 
     
    239239   dynamically allocated, at the same time when a new LM87 client is 
    240240   allocated. */ 
    241 struct LM87_data { 
     241struct lm87_data { 
    242242        int sysctl_id; 
    243243        enum chips type; 
     
    273273extern 
    274274#endif 
    275 int __init sensors_LM87_init(void); 
    276 static int __init LM87_cleanup(void); 
    277  
    278 static int LM87_attach_adapter(struct i2c_adapter *adapter); 
    279 static int LM87_detect(struct i2c_adapter *adapter, int address, 
     275int __init sensors_lm87_init(void); 
     276static int __init lm87_cleanup(void); 
     277 
     278static int lm87_attach_adapter(struct i2c_adapter *adapter); 
     279static int lm87_detect(struct i2c_adapter *adapter, int address, 
    280280                          unsigned short flags, int kind); 
    281 static int LM87_detach_client(struct i2c_client *client); 
    282 static int LM87_command(struct i2c_client *client, unsigned int cmd, 
     281static int lm87_detach_client(struct i2c_client *client); 
     282static int lm87_command(struct i2c_client *client, unsigned int cmd, 
    283283                           void *arg); 
    284 static void LM87_inc_use(struct i2c_client *client); 
    285 static void LM87_dec_use(struct i2c_client *client); 
    286  
    287 static int LM87_read_value(struct i2c_client *client, u8 register); 
    288 static int LM87_write_value(struct i2c_client *client, u8 register, 
     284static void lm87_inc_use(struct i2c_client *client); 
     285static void lm87_dec_use(struct i2c_client *client); 
     286 
     287static int lm87_read_value(struct i2c_client *client, u8 register); 
     288static int lm87_write_value(struct i2c_client *client, u8 register, 
    289289                               u8 value); 
    290 static void LM87_update_client(struct i2c_client *client); 
    291 static void LM87_init_client(struct i2c_client *client); 
    292  
    293  
    294 static void LM87_in(struct i2c_client *client, int operation, 
     290static void lm87_update_client(struct i2c_client *client); 
     291static void lm87_init_client(struct i2c_client *client); 
     292 
     293 
     294static void lm87_in(struct i2c_client *client, int operation, 
    295295                       int ctl_name, int *nrels_mag, long *results); 
    296 static void LM87_fan(struct i2c_client *client, int operation, 
     296static void lm87_fan(struct i2c_client *client, int operation, 
    297297                        int ctl_name, int *nrels_mag, long *results); 
    298 static void LM87_temp(struct i2c_client *client, int operation, 
     298static void lm87_temp(struct i2c_client *client, int operation, 
    299299                         int ctl_name, int *nrels_mag, long *results); 
    300 static void LM87_alarms(struct i2c_client *client, int operation, 
     300static void lm87_alarms(struct i2c_client *client, int operation, 
    301301                           int ctl_name, int *nrels_mag, long *results); 
    302 static void LM87_fan_div(struct i2c_client *client, int operation, 
     302static void lm87_fan_div(struct i2c_client *client, int operation, 
    303303                            int ctl_name, int *nrels_mag, long *results); 
    304 static void LM87_analog_out(struct i2c_client *client, int operation, 
     304static void lm87_analog_out(struct i2c_client *client, int operation, 
    305305                               int ctl_name, int *nrels_mag, 
    306306                               long *results); 
    307 static void LM87_vid(struct i2c_client *client, int operation, 
     307static void lm87_vid(struct i2c_client *client, int operation, 
    308308                        int ctl_name, int *nrels_mag, long *results); 
    309309 
     
    311311   allocation could also be used; the code needed for this would probably 
    312312   take more memory than the datastructure takes now. */ 
    313 static int LM87_id = 0; 
    314  
    315 static struct i2c_driver LM87_driver = { 
     313static int lm87_id = 0; 
     314 
     315static struct i2c_driver lm87_driver = { 
    316316        /* name */          "LM87 sensor driver", 
    317317        /* id */             I2C_DRIVERID_LM87, 
    318318        /* flags */          I2C_DF_NOTIFY, 
    319         /* attach_adapter */ &LM87_attach_adapter, 
    320         /* detach_client */  &LM87_detach_client, 
    321         /* command */        &LM87_command, 
    322         /* inc_use */        &LM87_inc_use, 
    323         /* dec_use */        &LM87_dec_use 
     319        /* attach_adapter */ &lm87_attach_adapter, 
     320        /* detach_client */  &lm87_detach_client, 
     321        /* command */        &lm87_command, 
     322        /* inc_use */        &lm87_inc_use, 
     323        /* dec_use */        &lm87_dec_use 
    324324}; 
    325325 
    326 /* Used by LM87_init/cleanup */ 
    327 static int __initdata LM87_initialized = 0; 
     326/* Used by lm87_init/cleanup */ 
     327static int __initdata lm87_initialized = 0; 
    328328 
    329329/* The /proc/sys entries */ 
     
    334334   when a new copy is allocated. */ 
    335335 
    336 static ctl_table LM87_dir_table_template[] = { 
    337         {LM87_SYSCTL_IN0, "2.5V", NULL, 0, 0644, NULL, &sensors_proc_real, 
    338           &sensors_sysctl_real, NULL, &LM87_in}, 
    339         {LM87_SYSCTL_IN1, "cpu_volt", NULL, 0, 0644, NULL, &sensors_proc_real, 
    340           &sensors_sysctl_real, NULL, &LM87_in}, 
    341         {LM87_SYSCTL_IN2, "3.3V", NULL, 0, 0644, NULL, &sensors_proc_real, 
    342           &sensors_sysctl_real, NULL, &LM87_in}, 
    343         {LM87_SYSCTL_IN3, "5V", NULL, 0, 0644, NULL, &sensors_proc_real, 
    344           &sensors_sysctl_real, NULL, &LM87_in}, 
    345         {LM87_SYSCTL_IN4, "12V", NULL, 0, 0644, NULL, &sensors_proc_real, 
    346           &sensors_sysctl_real, NULL, &LM87_in}, 
    347         {LM87_SYSCTL_IN5, "Vccp2", NULL, 0, 0644, NULL, &sensors_proc_real, 
    348           &sensors_sysctl_real, NULL, &LM87_in}, 
    349         {LM87_SYSCTL_FAN, "fan", NULL, 0, 0644, NULL, &sensors_proc_real, 
    350           &sensors_sysctl_real, NULL, &LM87_fan}, 
    351         {LM87_SYSCTL_FRNT_TEMP, "front_amb_temp", NULL, 0, 0644, NULL, &sensors_proc_real, 
    352           &sensors_sysctl_real, NULL, &LM87_temp}, 
    353         {LM87_SYSCTL_CPU_TEMP, "cpu_temp", NULL, 0, 0644, NULL, &sensors_proc_real, 
    354           &sensors_sysctl_real, NULL, &LM87_temp}, 
    355         {LM87_SYSCTL_INT_TEMP, "int_temp", NULL, 0, 0644, NULL, &sensors_proc_real, 
    356           &sensors_sysctl_real, NULL, &LM87_temp}, 
    357         {LM87_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &sensors_proc_real, 
    358           &sensors_sysctl_real, NULL, &LM87_fan_div}, 
     336static ctl_table lm87_dir_table_template[] = { 
     337        {LM87_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &sensors_proc_real, 
     338          &sensors_sysctl_real, NULL, &lm87_in}, 
     339        {LM87_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &sensors_proc_real, 
     340          &sensors_sysctl_real, NULL, &lm87_in}, 
     341        {LM87_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &sensors_proc_real, 
     342          &sensors_sysctl_real, NULL, &lm87_in}, 
     343        {LM87_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &sensors_proc_real, 
     344          &sensors_sysctl_real, NULL, &lm87_in}, 
     345        {LM87_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &sensors_proc_real, 
     346          &sensors_sysctl_real, NULL, &lm87_in}, 
     347        {LM87_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &sensors_proc_real, 
     348          &sensors_sysctl_real, NULL, &lm87_in}, 
     349        {LM87_SYSCTL_FAN, "fan1", NULL, 0, 0644, NULL, &sensors_proc_real, 
     350          &sensors_sysctl_real, NULL, &lm87_fan}, 
     351        {LM87_SYSCTL_FRNT_TEMP, "temp1", NULL, 
     352          0, 0644, NULL, &sensors_proc_real, 
     353          &sensors_sysctl_real, NULL, &lm87_temp}, 
     354        {LM87_SYSCTL_CPU_TEMP, "temp2", NULL, 0, 0644, NULL, &sensors_proc_real, 
     355          &sensors_sysctl_real, NULL, &lm87_temp}, 
     356        {LM87_SYSCTL_INT_TEMP, "temp3", NULL, 0, 0644, NULL, &sensors_proc_real, 
     357          &sensors_sysctl_real, NULL, &lm87_temp}, 
     358        {LM87_SYSCTL_FAN_DIV, "fan_div", NULL, 
     359          0, 0644, NULL, &sensors_proc_real, 
     360          &sensors_sysctl_real, NULL, &lm87_fan_div}, 
    359361        {LM87_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &sensors_proc_real, 
    360           &sensors_sysctl_real, NULL, &LM87_alarms}, 
    361         {LM87_SYSCTL_ANALOG_OUT, "analog_out", NULL, 0, 0644, NULL, &sensors_proc_real, 
    362           &sensors_sysctl_real, NULL, &LM87_analog_out}, 
     362          &sensors_sysctl_real, NULL, &lm87_alarms}, 
     363        {LM87_SYSCTL_ANALOG_OUT, "analog_out", NULL, 
     364          0, 0644, NULL, &sensors_proc_real, 
     365          &sensors_sysctl_real, NULL, &lm87_analog_out}, 
    363366        {LM87_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &sensors_proc_real, 
    364           &sensors_sysctl_real, NULL, &LM87_vid}, 
     367          &sensors_sysctl_real, NULL, &lm87_vid}, 
    365368        {0} 
    366369}; 
    367370 
    368 int LM87_attach_adapter(struct i2c_adapter *adapter) 
     371int lm87_attach_adapter(struct i2c_adapter *adapter) 
    369372{ 
    370373   int error; 
     
    379382   lm87_client_data.force            = addr_data.forces->force; 
    380383 
    381         error = i2c_probe(adapter, &lm87_client_data, LM87_detect); 
    382         sensors_detect(adapter, &addr_data, LM87_detect); 
     384        error = i2c_probe(adapter, &lm87_client_data, lm87_detect); 
     385        sensors_detect(adapter, &addr_data, lm87_detect); 
    383386 
    384387        return error; 
    385388} 
    386389 
    387 static int LM87_detect(struct i2c_adapter *adapter, int address, 
     390static int lm87_detect(struct i2c_adapter *adapter, int address, 
    388391                          unsigned short flags, int kind) 
    389392{ 
    390393        int i; 
    391394        struct i2c_client *new_client; 
    392         struct LM87_data *data; 
     395        struct lm87_data *data; 
    393396        int err = 0; 
    394397        const char *type_name = ""; 
     
    403406 
    404407        if (!(new_client = kmalloc(sizeof(struct i2c_client) + 
    405                                    sizeof(struct LM87_data), 
     408                                   sizeof(struct lm87_data), 
    406409                                   GFP_KERNEL))) { 
    407410                err = -ENOMEM; 
     
    409412        } 
    410413 
    411         data = (struct LM87_data *) (new_client + 1); 
     414        data = (struct lm87_data *) (new_client + 1); 
    412415        new_client->addr = address; 
    413416        new_client->data = data; 
    414417        new_client->adapter = adapter; 
    415         new_client->driver = &LM87_driver; 
     418        new_client->driver = &lm87_driver; 
    416419        new_client->flags = 0; 
    417420 
     
    419422 
    420423        if (kind < 0) { 
    421             if ((LM87_read_value(new_client, LM87_REG_CONFIG) & 0x80) != 0x00) 
     424            if ((lm87_read_value(new_client, LM87_REG_CONFIG) & 0x80) != 0x00) 
    422425               goto ERROR1; 
    423426        } 
    424427 
    425         /* Fill in the remaining client fields and put it into the global list */ 
    426         type_name = "LM87"; 
     428        /* Fill in the remaining client fields and put into the global list */ 
     429        type_name = "lm87"; 
    427430        client_name = "LM87 chip"; 
    428431        strcpy(new_client->name, client_name); 
    429432        data->type = kind; 
    430433 
    431         new_client->id = LM87_id++; 
     434        new_client->id = lm87_id++; 
    432435        data->valid = 0; 
    433436        init_MUTEX(&data->update_lock); 
     
    440443        if ((i = sensors_register_entry(new_client, 
    441444                                        type_name, 
    442                                         LM87_dir_table_template, 
     445                                        lm87_dir_table_template, 
    443446                                        THIS_MODULE)) < 0) { 
    444447                err = i; 
     
    448451 
    449452        /* Initialize the LM87 chip */ 
    450         LM87_init_client(new_client); 
     453        lm87_init_client(new_client); 
    451454        return 0; 
    452455 
     
    463466} 
    464467 
    465 int LM87_detach_client(struct i2c_client *client) 
     468int lm87_detach_client(struct i2c_client *client) 
    466469{ 
    467470        int err; 
    468471 
    469         sensors_deregister_entry(((struct LM87_data *) (client->data))-> 
     472        sensors_deregister_entry(((struct lm87_data *) (client->data))-> 
    470473                                 sysctl_id); 
    471474 
    472475        if ((err = i2c_detach_client(client))) { 
    473476                printk 
    474                     ("LM87.o: Client deregistration failed, client not detached.\n"); 
     477            ("lm87.o: Client deregistration failed, client not detached.\n"); 
    475478                return err; 
    476479        } 
     
    483486 
    484487/* No commands defined yet */ 
    485 int LM87_command(struct i2c_client *client, unsigned int cmd, void *arg) 
     488int lm87_command(struct i2c_client *client, unsigned int cmd, void *arg) 
    486489{ 
    487490        return 0; 
    488491} 
    489492 
    490 void LM87_inc_use(struct i2c_client *client) 
     493void lm87_inc_use(struct i2c_client *client) 
    491494{ 
    492495#ifdef MODULE 
     
    495498} 
    496499 
    497 void LM87_dec_use(struct i2c_client *client) 
     500void lm87_dec_use(struct i2c_client *client) 
    498501{ 
    499502#ifdef MODULE 
     
    502505} 
    503506 
    504 int LM87_read_value(struct i2c_client *client, u8 reg) 
     507int lm87_read_value(struct i2c_client *client, u8 reg) 
    505508{ 
    506509        return 0xFF & i2c_smbus_read_byte_data(client, reg); 
    507510} 
    508511 
    509 int LM87_write_value(struct i2c_client *client, u8 reg, u8 value) 
     512int lm87_write_value(struct i2c_client *client, u8 reg, u8 value) 
    510513{ 
    511514        return i2c_smbus_write_byte_data(client, reg, value); 
     
    513516 
    514517/* Called when we have found a new LM87. It should set limits, etc. */ 
    515 void LM87_init_client(struct i2c_client *client) 
     518void lm87_init_client(struct i2c_client *client) 
    516519{ 
    517520        /* Reset all except Watchdog values and last conversion values 
    518521           This sets fan-divs to 2, among others. This makes most other 
    519522           initializations unnecessary */ 
    520         LM87_write_value(client, LM87_REG_CONFIG, 0x80); 
     523        lm87_write_value(client, LM87_REG_CONFIG, 0x80); 
    521524 
    522525        /* Setup Channel Mode register for configuration of monitoring  
     
    524527         *      bit 2 - Configures 2.5V/D2 input     (1 = 2nd Therm.)  
    525528         */ 
    526         LM87_write_value(client, LM87_REG_CHANNEL_MODE, 0x05); 
    527  
    528  
    529         LM87_write_value(client, LM87_REG_IN_MIN(1), 
     529        lm87_write_value(client, LM87_REG_CHANNEL_MODE, 0x05); 
     530 
     531 
     532        lm87_write_value(client, LM87_REG_IN_MIN(1), 
    530533                            IN_TO_REG(LM87_INIT_IN_MIN_1, 1)); 
    531         LM87_write_value(client, LM87_REG_IN_MAX(1), 
     534        lm87_write_value(client, LM87_REG_IN_MAX(1), 
    532535                            IN_TO_REG(LM87_INIT_IN_MAX_1, 1)); 
    533         LM87_write_value(client, LM87_REG_IN_MIN(2), 
     536        lm87_write_value(client, LM87_REG_IN_MIN(2), 
    534537                            IN_TO_REG(LM87_INIT_IN_MIN_2, 2)); 
    535         LM87_write_value(client, LM87_REG_IN_MAX(2), 
     538        lm87_write_value(client, LM87_REG_IN_MAX(2), 
    536539                            IN_TO_REG(LM87_INIT_IN_MAX_2, 2)); 
    537         LM87_write_value(client, LM87_REG_IN_MIN(3), 
     540        lm87_write_value(client, LM87_REG_IN_MIN(3), 
    538541                            IN_TO_REG(LM87_INIT_IN_MIN_3, 3)); 
    539         LM87_write_value(client, LM87_REG_IN_MAX(3), 
     542        lm87_write_value(client, LM87_REG_IN_MAX(3), 
    540543                            IN_TO_REG(LM87_INIT_IN_MAX_3, 3)); 
    541         LM87_write_value(client, LM87_REG_IN_MIN(4), 
     544        lm87_write_value(client, LM87_REG_IN_MIN(4), 
    542545                            IN_TO_REG(LM87_INIT_IN_MIN_4, 4)); 
    543         LM87_write_value(client, LM87_REG_IN_MAX(4), 
     546        lm87_write_value(client, LM87_REG_IN_MAX(4), 
    544547                            IN_TO_REG(LM87_INIT_IN_MAX_4, 4)); 
    545         LM87_write_value(client, LM87_REG_IN_MIN(5), 
     548        lm87_write_value(client, LM87_REG_IN_MIN(5), 
    546549                            IN_TO_REG(LM87_INIT_IN_MIN_5, 5)); 
    547         LM87_write_value(client, LM87_REG_IN_MAX(5), 
     550        lm87_write_value(client, LM87_REG_IN_MAX(5), 
    548551                            IN_TO_REG(LM87_INIT_IN_MAX_5, 5)); 
    549552 
    550         LM87_write_value(client, LM87_REG_EXT_TEMP_1_HIGH, 
     553        lm87_write_value(client, LM87_REG_EXT_TEMP_1_HIGH, 
    551554                            TEMP_LIMIT_TO_REG(LM87_INIT_EXT_TEMP_MAX)); 
    552         LM87_write_value(client, LM87_REG_EXT_TEMP_1_LOW, 
     555        lm87_write_value(client, LM87_REG_EXT_TEMP_1_LOW, 
    553556                            TEMP_LIMIT_TO_REG(LM87_INIT_EXT_TEMP_MIN)); 
    554         LM87_write_value(client, LM87_REG_2_5V_EXT_TEMP_2_HIGH, 
     557        lm87_write_value(client, LM87_REG_2_5V_EXT_TEMP_2_HIGH, 
    555558                            TEMP_LIMIT_TO_REG(LM87_INIT_EXT_TEMP_MAX)); 
    556         LM87_write_value(client, LM87_REG_2_5V_EXT_TEMP_2_LOW, 
     559        lm87_write_value(client, LM87_REG_2_5V_EXT_TEMP_2_LOW, 
    557560                            TEMP_LIMIT_TO_REG(LM87_INIT_EXT_TEMP_MIN)); 
    558         LM87_write_value(client, LM87_REG_INT_TEMP_HIGH, 
     561        lm87_write_value(client, LM87_REG_INT_TEMP_HIGH, 
    559562                            TEMP_LIMIT_TO_REG(LM87_INIT_INT_TEMP_MAX)); 
    560         LM87_write_value(client, LM87_REG_INT_TEMP_LOW, 
     563        lm87_write_value(client, LM87_REG_INT_TEMP_LOW, 
    561564                            TEMP_LIMIT_TO_REG(LM87_INIT_INT_TEMP_MIN)); 
    562565 
    563         LM87_write_value(client, LM87_REG_FAN1_AIN1_LIMIT, 
     566        lm87_write_value(client, LM87_REG_FAN1_AIN1_LIMIT, 
    564567                            IN_TO_REG(LM87_INIT_IN_MAX_0, 0)); 
    565568 
    566         LM87_write_value(client, LM87_REG_FAN2_AIN2_LIMIT, 
     569        lm87_write_value(client, LM87_REG_FAN2_AIN2_LIMIT, 
    567570                            FAN_TO_REG(LM87_INIT_FAN_MIN, 2)); 
    568571 
    569572        /* Start monitoring */ 
    570         LM87_write_value(client, LM87_REG_CONFIG, 0x01); 
    571 } 
    572  
    573 void LM87_update_client(struct i2c_client *client) 
    574 { 
    575         struct LM87_data *data = client->data; 
     573        lm87_write_value(client, LM87_REG_CONFIG, 0x01); 
     574} 
     575 
     576void lm87_update_client(struct i2c_client *client) 
     577{ 
     578        struct lm87_data *data = client->data; 
    576579        u8 i; 
    577580 
     
    587590                for (i = 0; i <= 5; i++) {   
    588591                    /* Since we are using AIN 1 as our 2.5V monitoring, need to  
    589                      * accomodate with a hardcode register address and we only get 
     592                     * accomodate with a hardcode 
     593                     * register address and we only get 
    590594                     * to look at one threshold. 
    591595                     */ 
    592596                    if (i == 0) { 
    593597                        data->in[i] =  
    594                             LM87_read_value(client, LM87_REG_FAN1_AIN1); 
     598                            lm87_read_value(client, LM87_REG_FAN1_AIN1); 
    595599                        data->in_min[i] = 0; 
    596600                        data->in_max[i] =  
    597                             LM87_read_value(client, LM87_REG_FAN1_AIN1_LIMIT); 
     601                            lm87_read_value(client, LM87_REG_FAN1_AIN1_LIMIT); 
    598602                    } 
    599603                    else { 
    600604                        data->in[i] =  
    601                             LM87_read_value(client, LM87_REG_IN(i)); 
     605                            lm87_read_value(client, LM87_REG_IN(i)); 
    602606                        data->in_min[i] =  
    603                             LM87_read_value(client, 
     607                            lm87_read_value(client, 
    604608                                               LM87_REG_IN_MIN(i)); 
    605609                        data->in_max[i] =  
    606                             LM87_read_value(client, 
     610                            lm87_read_value(client, 
    607611                                               LM87_REG_IN_MAX(i)); 
    608612                    } 
     
    610614 
    611615                data->fan = 
    612                     LM87_read_value(client, LM87_REG_FAN2_AIN2); 
     616                    lm87_read_value(client, LM87_REG_FAN2_AIN2); 
    613617                data->fan_min = 
    614                     LM87_read_value(client, LM87_REG_FAN2_AIN2_LIMIT); 
     618                    lm87_read_value(client, LM87_REG_FAN2_AIN2_LIMIT); 
    615619 
    616620                data->front_amb_temp = 
    617                     LM87_read_value(client, LM87_REG_2_5V_EXT_TEMP_2); 
     621                    lm87_read_value(client, LM87_REG_2_5V_EXT_TEMP_2); 
    618622                data->cpu_temp = 
    619                     LM87_read_value(client, LM87_REG_EXT_TEMP_1); 
     623                    lm87_read_value(client, LM87_REG_EXT_TEMP_1); 
    620624                data->int_temp = 
    621                     LM87_read_value(client, LM87_REG_INT_TEMP); 
     625                    lm87_read_value(client, LM87_REG_INT_TEMP); 
    622626 
    623627                data->front_amb_temp_max = 
    624                     LM87_read_value(client, LM87_REG_2_5V_EXT_TEMP_2_HIGH); 
     628                    lm87_read_value(client, LM87_REG_2_5V_EXT_TEMP_2_HIGH); 
    625629                data->front_amb_temp_min = 
    626                     LM87_read_value(client, LM87_REG_2_5V_EXT_TEMP_2_LOW); 
     630                    lm87_read_value(client, LM87_REG_2_5V_EXT_TEMP_2_LOW); 
    627631 
    628632                data->cpu_temp_max = 
    629                     LM87_read_value(client, LM87_REG_EXT_TEMP_1_HIGH); 
     633                    lm87_read_value(client, LM87_REG_EXT_TEMP_1_HIGH); 
    630634                data->cpu_temp_min = 
    631                     LM87_read_value(client, LM87_REG_EXT_TEMP_1_LOW); 
     635                    lm87_read_value(client, LM87_REG_EXT_TEMP_1_LOW); 
    632636 
    633637                data->int_temp_max = 
    634                     LM87_read_value(client, LM87_REG_INT_TEMP_HIGH); 
     638                    lm87_read_value(client, LM87_REG_INT_TEMP_HIGH); 
    635639                data->int_temp_min = 
    636                     LM87_read_value(client, LM87_REG_INT_TEMP_LOW); 
    637  
    638                 i = LM87_read_value(client, LM87_REG_VID_FAN_DIV); 
     640                    lm87_read_value(client, LM87_REG_INT_TEMP_LOW); 
     641 
     642                i = lm87_read_value(client, LM87_REG_VID_FAN_DIV); 
    639643                data->fan_div = (i >> 4) & 0x03; 
    640644                data->vid = i & 0x0f; 
    641645                data->vid |= 
    642                     (LM87_read_value(client, LM87_REG_VID4) & 0x01) 
     646                    (lm87_read_value(client, LM87_REG_VID4) & 0x01) 
    643647                    << 4; 
    644648 
    645649                data->alarms = 
    646                     LM87_read_value(client, 
     650                    lm87_read_value(client, 
    647651                                       LM87_REG_INT1_STAT) + 
    648                     (LM87_read_value(client, LM87_REG_INT2_STAT) << 
     652                    (lm87_read_value(client, LM87_REG_INT2_STAT) << 
    649653                     8); 
    650654                data->analog_out = 
    651                     LM87_read_value(client, LM87_REG_ANALOG_OUT); 
     655                    lm87_read_value(client, LM87_REG_ANALOG_OUT); 
    652656                data->last_updated = jiffies; 
    653657                data->valid = 1; 
     
    671675   good practice, but as long as you put less than about 5 values in results, 
    672676   you can assume it is large enough. */ 
    673 void LM87_in(struct i2c_client *client, int operation, int ctl_name, 
     677void lm87_in(struct i2c_client *client, int operation, int ctl_name, 
    674678                int *nrels_mag, long *results) 
    675679{ 
     
    682686        int scales[6] = { 260, 200, 344, 520, 1250, 260 }; 
    683687 
    684         struct LM87_data *data = client->data; 
     688        struct lm87_data *data = client->data; 
    685689        int nr = ctl_name - LM87_SYSCTL_IN0; 
    686690 
     
    688692                *nrels_mag = 2; 
    689693        else if (operation == SENSORS_PROC_REAL_READ) { 
    690                 LM87_update_client(client); 
     694                lm87_update_client(client); 
    691695 
    692696                results[0] = 
     
    711715                        data->in_min[nr] = 
    712716                            IN_TO_REG((results[0] * 192) / scales[nr], nr); 
    713                         LM87_write_value(client, LM87_REG_IN_MIN(nr), 
     717                        lm87_write_value(client, LM87_REG_IN_MIN(nr), 
    714718                                            data->in_min[nr]); 
    715719                } 
     
    717721                        data->in_max[nr] = 
    718722                            IN_TO_REG((results[1] * 192) / scales[nr], nr); 
    719                         LM87_write_value(client, LM87_REG_IN_MAX(nr), 
     723                        lm87_write_value(client, LM87_REG_IN_MAX(nr), 
    720724                                            data->in_max[nr]); 
    721725                } 
     
    723727} 
    724728 
    725 void LM87_fan(struct i2c_client *client, int operation, int ctl_name, 
     729void lm87_fan(struct i2c_client *client, int operation, int ctl_name, 
    726730                 int *nrels_mag, long *results) 
    727731{ 
    728         struct LM87_data *data = client->data; 
     732        struct lm87_data *data = client->data; 
    729733        int nr = ctl_name - LM87_SYSCTL_FAN + 1; /* not sure +1 needed */ 
    730734 
     
    732736                *nrels_mag = 0; 
    733737        else if (operation == SENSORS_PROC_REAL_READ) { 
    734                 LM87_update_client(client); 
     738                lm87_update_client(client); 
    735739                results[0] = FAN_FROM_REG(data->fan_min, 
    736740                                          DIV_FROM_REG(data->fan_div)); 
     
    743747                                                   DIV_FROM_REG 
    744748                                                   (data->fan_div)); 
    745                         LM87_write_value(client, LM87_REG_FAN2_AIN2_LIMIT, 
     749                        lm87_write_value(client, LM87_REG_FAN2_AIN2_LIMIT, 
    746750                                            data->fan_min); 
    747751                } 
     
    750754 
    751755 
    752 void LM87_temp(struct i2c_client *client, int operation, int ctl_name, 
     756void lm87_temp(struct i2c_client *client, int operation, int ctl_name, 
    753757                  int *nrels_mag, long *results) 
    754758{ 
    755         struct LM87_data *data = client->data; 
     759        struct lm87_data *data = client->data; 
    756760 
    757761        if (operation == SENSORS_PROC_REAL_INFO) 
     
    759763        else if (operation == SENSORS_PROC_REAL_READ)  
    760764        { 
    761            LM87_update_client(client); 
     765           lm87_update_client(client); 
    762766 
    763767           /* find out which temp. is being requested */ 
     
    784788                if (*nrels_mag >= 1) { 
    785789                   if (ctl_name == LM87_SYSCTL_FRNT_TEMP) { 
    786                         data->front_amb_temp_max = TEMP_LIMIT_TO_REG(results[0]); 
    787                         LM87_write_value(client, LM87_REG_2_5V_EXT_TEMP_2_HIGH, 
     790                        data->front_amb_temp_max = 
     791                                             TEMP_LIMIT_TO_REG(results[0]); 
     792                        lm87_write_value(client, LM87_REG_2_5V_EXT_TEMP_2_HIGH, 
    788793                                            data->front_amb_temp_max); 
    789794                   } 
    790795                   if (ctl_name == LM87_SYSCTL_CPU_TEMP) { 
    791796                        data->cpu_temp_max = TEMP_LIMIT_TO_REG(results[0]); 
    792                         LM87_write_value(client, LM87_REG_EXT_TEMP_1_HIGH, 
     797                        lm87_write_value(client, LM87_REG_EXT_TEMP_1_HIGH, 
    793798                                            data->int_temp_max); 
    794799                   } 
    795800                   if (ctl_name == LM87_SYSCTL_INT_TEMP) { 
    796801                        data->int_temp_max = TEMP_LIMIT_TO_REG(results[0]); 
    797                         LM87_write_value(client, LM87_REG_INT_TEMP_HIGH, 
     802                        lm87_write_value(client, LM87_REG_INT_TEMP_HIGH, 
    798803                                            data->int_temp_max); 
    799804                   } 
     
    801806                if (*nrels_mag >= 2) { 
    802807                   if (ctl_name == LM87_SYSCTL_FRNT_TEMP) { 
    803                         data->front_amb_temp_min = TEMP_LIMIT_TO_REG(results[0]); 
    804                         LM87_write_value(client, LM87_REG_2_5V_EXT_TEMP_2_LOW, 
     808                        data->front_amb_temp_min = 
     809                                          TEMP_LIMIT_TO_REG(results[0]); 
     810                        lm87_write_value(client, LM87_REG_2_5V_EXT_TEMP_2_LOW, 
    805811                                            data->front_amb_temp_min); 
    806812                   } 
    807813                   if (ctl_name == LM87_SYSCTL_CPU_TEMP) { 
    808814                        data->cpu_temp_min = TEMP_LIMIT_TO_REG(results[0]); 
    809                         LM87_write_value(client, LM87_REG_EXT_TEMP_1_LOW, 
     815                        lm87_write_value(client, LM87_REG_EXT_TEMP_1_LOW, 
    810816                                            data->int_temp_min); 
    811817                   } 
    812818                   if (ctl_name == LM87_SYSCTL_INT_TEMP) { 
    813819                        data->int_temp_min = TEMP_LIMIT_TO_REG(results[1]); 
    814                         LM87_write_value(client, LM87_REG_INT_TEMP_LOW, 
     820                        lm87_write_value(client, LM87_REG_INT_TEMP_LOW, 
    815821                                            data->int_temp_min); 
    816822                   } 
     
    819825} 
    820826 
    821 void LM87_alarms(struct i2c_client *client, int operation, int ctl_name, 
     827void lm87_alarms(struct i2c_client *client, int operation, int ctl_name, 
    822828                    int *nrels_mag, long *results) 
    823829{ 
    824         struct LM87_data *data = client->data; 
     830        struct lm87_data *data = client->data; 
    825831        if (operation == SENSORS_PROC_REAL_INFO) 
    826832                *nrels_mag = 0; 
    827833        else if (operation == SENSORS_PROC_REAL_READ) { 
    828                 LM87_update_client(client); 
     834                lm87_update_client(client); 
    829835                results[0] = ALARMS_FROM_REG(data->alarms); 
    830836                *nrels_mag = 1; 
     
    832838} 
    833839 
    834 void LM87_fan_div(struct i2c_client *client, int operation, 
     840void lm87_fan_div(struct i2c_client *client, int operation, 
    835841                     int ctl_name, int *nrels_mag, long *results) 
    836842{ 
    837         struct LM87_data *data = client->data; 
     843        struct lm87_data *data = client->data; 
    838844        int old; 
    839845 
     
    841847                *nrels_mag = 0; 
    842848        else if (operation == SENSORS_PROC_REAL_READ) { 
    843                 LM87_update_client(client); 
     849                lm87_update_client(client); 
    844850                results[0] = DIV_FROM_REG(data->fan_div); 
    845851                *nrels_mag = 1; 
    846852        } else if (operation == SENSORS_PROC_REAL_WRITE) { 
    847                 old = LM87_read_value(client, LM87_REG_VID_FAN_DIV); 
     853                old = lm87_read_value(client, LM87_REG_VID_FAN_DIV); 
    848854                if (*nrels_mag >= 2) { 
    849855                        data->fan_div = DIV_TO_REG(results[1]); 
     
    853859                        data->fan_div = DIV_TO_REG(results[0]); 
    854860                        old = (old & 0xcf) | (data->fan_div << 4); 
    855                         LM87_write_value(client, LM87_REG_VID_FAN_DIV, old); 
     861                        lm87_write_value(client, LM87_REG_VID_FAN_DIV, old); 
    856862                } 
    857863        } 
    858864} 
    859865 
    860 void LM87_analog_out(struct i2c_client *client, int operation, 
     866void lm87_analog_out(struct i2c_client *client, int operation, 
    861867                        int ctl_name, int *nrels_mag, long *results) 
    862868{ 
    863         struct LM87_data *data = client->data; 
     869        struct lm87_data *data = client->data; 
    864870 
    865871        if (operation == SENSORS_PROC_REAL_INFO) 
    866872                *nrels_mag = 0; 
    867873        else if (operation == SENSORS_PROC_REAL_READ) { 
    868                 LM87_update_client(client); 
     874                lm87_update_client(client); 
    869875                results[0] = data->analog_out; 
    870876                *nrels_mag = 1; 
     
    872878                if (*nrels_mag >= 1) { 
    873879                        data->analog_out = results[0]; 
    874                         LM87_write_value(client, LM87_REG_ANALOG_OUT, 
     880                        lm87_write_value(client, LM87_REG_ANALOG_OUT, 
    875881                                            data->analog_out); 
    876882                } 
     
    878884} 
    879885 
    880 void LM87_vid(struct i2c_client *client, int operation, int ctl_name, 
     886void lm87_vid(struct i2c_client *client, int operation, int ctl_name, 
    881887                 int *nrels_mag, long *results) 
    882888{ 
    883         struct LM87_data *data = client->data; 
     889        struct lm87_data *data = client->data; 
    884890 
    885891 
     
    888894        else if (operation == SENSORS_PROC_REAL_READ) { 
    889895 
    890                 LM87_update_client(client); 
     896                lm87_update_client(client); 
    891897                if ((data->vid == 0x1f) || (data->vid == 0x0f)) { 
    892898                   results[0] = 0; 
    893899                } 
    894900                else if (data->vid > 0x0f) { 
    895                    results[0] = (1275 - (((data->vid - 0x10) * 1000) * 0.025))/10; 
     901                   results[0] = (1275 - 
     902                        (((data->vid - 0x10) * 1000) * 0.025))/10; 
    896903                } 
    897904                else { 
     
    903910} 
    904911 
    905 int __init sensors_LM87_init(void) 
     912int __init sensors_lm87_init(void) 
    906913{ 
    907914        int res; 
    908915 
    909         printk("LM87.o version %s (%s)\n", LM_VERSION, LM_DATE); 
    910         LM87_initialized = 0; 
    911  
    912         if ((res = i2c_add_driver(&LM87_driver))) { 
     916        printk("lm87.o version %s (%s)\n", LM_VERSION, LM_DATE); 
     917        lm87_initialized = 0; 
     918 
     919        if ((res = i2c_add_driver(&lm87_driver))) { 
    913920                printk 
    914                     ("LM87.o: Driver registration failed, module not inserted.\n"); 
    915                 LM87_cleanup(); 
     921                ("lm87.o: Driver registration failed, module not inserted.\n"); 
     922                lm87_cleanup(); 
    916923                return res; 
    917924        } 
    918         LM87_initialized++; 
     925        lm87_initialized++; 
    919926        return 0; 
    920927} 
    921928 
    922 int __init LM87_cleanup(void) 
     929int __init lm87_cleanup(void) 
    923930{ 
    924931        int res; 
    925932 
    926         if (LM87_initialized >= 1) { 
    927                 if ((res = i2c_del_driver(&LM87_driver))) { 
     933        if (lm87_initialized >= 1) { 
     934                if ((res = i2c_del_driver(&lm87_driver))) { 
    928935                        printk 
    929                             ("LM87.o: Driver deregistration failed, module not removed.\n"); 
     936               ("lm87.o: Driver deregistration failed, module not removed.\n"); 
    930937                        return res; 
    931938                } 
    932                 LM87_initialized--; 
     939                lm87_initialized--; 
    933940        } 
    934941        return 0; 
     
    943950      and Stephen Rousset <stephen.rousset@rocketlogix.com>"); 
    944951 
    945 MODULE_DESCRIPTION("LM87 driver"); 
     952MODULE_DESCRIPTION("lm87 driver"); 
    946953 
    947954int init_module(void) 
    948955{ 
    949         return sensors_LM87_init(); 
     956        return sensors_lm87_init(); 
    950957} 
    951958 
    952959int cleanup_module(void) 
    953960{ 
    954         return LM87_cleanup(); 
     961        return lm87_cleanup(); 
    955962} 
    956963