From 86ba0c96fd0d8d77a3e820dc370a3c9022c1ce2c Mon Sep 17 00:00:00 2001 From: Frodo Looijaard Date: Sun, 6 Jun 1999 14:06:04 +0000 Subject: [PATCH] (Frodo) Several minor things * Made i2c-voodoo3.c compile with 2.0 kernels It should also run without problem, but obviously I could not test it Changes are in the memory mapping of PCI address space * Removed several warning from i2c-voodoo3.c It compiles now without any warnings, even with WARN=1 * Removed several warnings from matorb.c It compiles now without any warnings, even with WARN=1 In the proces, I fixed one serious bug (assignment instead of comparison) * Removed a warning from w83781d.c It compiles now without any warnings, even with WARN=1 Hint: Once in a while, try to compile with WARN=1 and remove warnings. It helps to find serious, hidden problems. Really! git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@472 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + kernel/busses/i2c-voodoo3.c | 51 ++++++++++++++++++++----------------- kernel/chips/matorb.c | 7 ++--- kernel/chips/w83781d.c | 2 +- 4 files changed, 34 insertions(+), 27 deletions(-) diff --git a/CHANGES b/CHANGES index 6d08d274..2dc23949 100644 --- a/CHANGES +++ b/CHANGES @@ -14,6 +14,7 @@ ask CVS about it: cvs diff -r V2-0-0 -r V2-0-1 -u 2.3.3 (19990603) + All: Now compiles against kernel 2.3.x (x >= 1) Module i2c-voodoo3: Timing issue fixes Module bt869: Seems to be functional and relatively well tested Many modules were modified to be more compatible with the new diff --git a/kernel/busses/i2c-voodoo3.c b/kernel/busses/i2c-voodoo3.c index 42b12a72..86a931be 100644 --- a/kernel/busses/i2c-voodoo3.c +++ b/kernel/busses/i2c-voodoo3.c @@ -139,7 +139,7 @@ void Voodoo3_I2CStop(void) out(); } -int Voodoo3_I2CAck() +int Voodoo3_I2CAck(void) { int ack; @@ -153,7 +153,7 @@ int ack; } -int Voodoo3_I2CReadByte() +int Voodoo3_I2CReadByte(void) { int i,temp; unsigned char data=0; @@ -216,66 +216,66 @@ int Voodoo3_BusCheck(void) { int Voodoo3_I2CRead_byte(int addr) { - int dat=0; + int this_dat=0; Voodoo3_I2CStart(); if (Voodoo3_I2CSendByte(addr)) { #ifdef DEBUG printk("i2c-voodoo3: No Ack on addr WriteByte to addr 0x%X\n",addr); #endif - dat=-1; + this_dat=-1; goto ENDREAD1; } - dat=Voodoo3_I2CReadByte(); + this_dat=Voodoo3_I2CReadByte(); ENDREAD1: Voodoo3_I2CStop(); #ifdef DEBUG - printk("i2c-voodoo3: Byte read at addr:0x%X result:0x%X\n",addr,dat); + printk("i2c-voodoo3: Byte read at addr:0x%X result:0x%X\n",addr,this_dat); #endif - return dat; + return this_dat; } int Voodoo3_I2CRead_byte_data(int addr,int command) { - int dat=0; + int this_dat=0; Voodoo3_I2CStart(); if (Voodoo3_I2CSendByte(addr)) { #ifdef DEBUG printk("i2c-voodoo3: No Ack on addr WriteByte to addr 0x%X\n",addr); #endif - dat=-1; + this_dat=-1; goto ENDREAD2; } if (Voodoo3_I2CSendByte(command)) { #ifdef DEBUG printk("i2c-voodoo3: No Ack on addr WriteByte to addr 0x%X\n",addr); #endif - dat=-1; + this_dat=-1; goto ENDREAD2; } - dat=Voodoo3_I2CReadByte(); + this_dat=Voodoo3_I2CReadByte(); ENDREAD2: Voodoo3_I2CStop(); #ifdef DEBUG - printk("i2c-voodoo3: Byte read at addr:0x%X (command:0x%X) result:0x%X\n",addr,command,dat); + printk("i2c-voodoo3: Byte read at addr:0x%X (command:0x%X) result:0x%X\n",addr,command,this_dat); #endif - return dat; + return this_dat; } int Voodoo3_I2CRead_word(int addr,int command) { - int dat=0; + int this_dat=0; Voodoo3_I2CStart(); if (Voodoo3_I2CSendByte(addr)) { #ifdef DEBUG printk("i2c-voodoo3: No Ack on addr WriteByte to addr 0x%X\n",addr); #endif - dat=-1; + this_dat=-1; goto ENDREAD3; } - dat=Voodoo3_I2CReadByte(); - dat|=(Voodoo3_I2CReadByte()<<8); + this_dat=Voodoo3_I2CReadByte(); + this_dat|=(Voodoo3_I2CReadByte()<<8); ENDREAD3: Voodoo3_I2CStop(); #ifdef DEBUG - printk("i2c-voodoo3: Word read at addr:0x%X (command:0x%X) result:0x%X\n",addr,command,dat); + printk("i2c-voodoo3: Word read at addr:0x%X (command:0x%X) result:0x%X\n",addr,command,this_dat); #endif - return dat; + return this_dat; } int Voodoo3_I2CWrite_byte(int addr,int command) @@ -361,7 +361,7 @@ int result=0; result=-1; } ENDWRITE3: Voodoo3_I2CStop(); #ifdef DEBUG - printk("i2c-voodoo3: Word write at addr:0x%X command:0x%X data:0x%X\n",addr,command,data); + printk("i2c-voodoo3: Word write at addr:0x%X command:0x%X data:0x%lX\n",addr,command,data); #endif return result; } @@ -371,14 +371,19 @@ void config_v3(struct pci_dev *dev, int num) unsigned int cadr; /* map Voodoo3 memory */ - cadr=dev->base_address[0]; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,54)) + cadr = dev->base_address[0]; +#else + pcibios_read_config_dword(dev->bus->number, dev->devfn, + PCI_BASE_ADDRESS_0,&cadr); +#endif cadr&=PCI_BASE_ADDRESS_MEM_MASK; mem=ioremap(cadr, 0x1000); /* Enable TV out mode, Voodoo3_I2C bus, etc. */ *((unsigned int *)(mem+0x70))=0x8160; *((unsigned int *)(mem+0x78))=0xcf980020; - printk("i2c-voodoo3: Using Banshee/Voodoo3 at 0x%X\n",mem); + printk("i2c-voodoo3: Using Banshee/Voodoo3 at 0x%p\n",mem); } @@ -422,7 +427,7 @@ static int voodoo3_setup(void) s32 voodoo3_access(u8 addr, char read_write, u8 command, int size, union smbus_data * data) { -int temp; +int temp=0; if (Voodoo3_BusCheck()) return -1; diff --git a/kernel/chips/matorb.c b/kernel/chips/matorb.c index 0184d17d..98709b3d 100644 --- a/kernel/chips/matorb.c +++ b/kernel/chips/matorb.c @@ -29,6 +29,7 @@ #include "i2c.h" #include "i2c-isa.h" #include "version.h" +#include "compat.h" /* Addresses to scan */ static unsigned short normal_i2c[] = {0x2E,SENSORS_I2C_END}; @@ -198,7 +199,6 @@ ERROR3: if (new_client == matorb_list[i]) matorb_list[i] = NULL; ERROR2: -ERROR1: kfree(new_client); ERROR0: return err; @@ -252,6 +252,7 @@ void matorb_dec_use (struct i2c_client *client) #endif } +#if 0 /* All registers are word-sized, except for the configuration register. MATORB uses a high-byte first convention, which is exactly opposite to the usual practice. */ @@ -259,13 +260,14 @@ int matorb_read_value(struct i2c_client *client, u8 reg) { return -1; /* Doesn't support reads */ } +#endif /* All registers are word-sized, except for the configuration register. MATORB uses a high-byte first convention, which is exactly opposite to the usual practice. */ int matorb_write_value(struct i2c_client *client, u8 reg, u16 value) { - if (reg=0) { + if (reg==0) { return smbus_write_byte(client->adapter,client->addr,value); } else { return smbus_write_byte_data(client->adapter,client->addr,reg,value); @@ -302,7 +304,6 @@ void matorb_update_client(struct i2c_client *client) void matorb_disp(struct i2c_client *client, int operation, int ctl_name, int *nrels_mag, long *results) { - struct matorb_data *data = client->data; if (operation == SENSORS_PROC_REAL_INFO) *nrels_mag = 0; else if (operation == SENSORS_PROC_REAL_READ) { diff --git a/kernel/chips/w83781d.c b/kernel/chips/w83781d.c index 78f5fc40..d532eda9 100644 --- a/kernel/chips/w83781d.c +++ b/kernel/chips/w83781d.c @@ -1366,7 +1366,7 @@ void w83781d_fan_div(struct i2c_client *client, int operation, int ctl_name, int *nrels_mag, long *results) { struct w83781d_data *data = client->data; - int old,old2,old3; + int old,old2,old3=0; if (operation == SENSORS_PROC_REAL_INFO) *nrels_mag = 0;