Show
Ignore:
Timestamp:
06/03/03 04:05:18 (10 years ago)
Author:
mds
Message:

get i2c-viapro working again by backporting from

kernel 2.5.69 and adding new sensors_compat.h for the
drv_dbg(), etc. calls

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/kernel/busses/i2c-viapro.c

    r1708 r1754  
    4242#include <linux/init.h> 
    4343#include <asm/io.h> 
    44 #include "version.h" 
    45  
    46 #define SMBBA1      0x90 
    47 #define SMBBA2      0x80 
    48 #define SMBBA3      0xD0 
    49  
    50 struct sd { 
    51         const unsigned short dev; 
    52         const unsigned char base; 
    53         const unsigned char hstcfg; 
    54         const char *name; 
    55 }; 
    56  
    57 static struct sd supported[] = { 
    58         {PCI_DEVICE_ID_VIA_82C596_3, SMBBA1, 0xD2, "VT82C596A/B"}, 
    59         {PCI_DEVICE_ID_VIA_82C596B_3, SMBBA1, 0xD2, "VT82C596B"}, 
    60         {PCI_DEVICE_ID_VIA_82C686_4, SMBBA1, 0xD2, "VT82C686A/B"}, 
    61         {PCI_DEVICE_ID_VIA_8233_0, SMBBA3, 0xD2, "VT8233"}, 
    62         {0x3147, SMBBA3, 0xD2, "VT8233A"}, 
    63         {0x3177, SMBBA3, 0xD2, "VT8233A/8235"}, 
    64         {0x8235, SMBBA1, 0xD2, "VT8231"}, 
    65         {0, 0, 0, NULL} 
    66 }; 
    67  
    68 static struct sd *num = supported; 
     44#include "sensors_compat.h" 
     45 
     46#define SMBBA1           0x90 
     47#define SMBBA2           0x80 
     48#define SMBBA3           0xD0 
    6949 
    7050/* SMBus address offsets */ 
    71 #define SMBHSTSTS (0 + vt596_smba) 
    72 #define SMBHSLVSTS (1 + vt596_smba) 
    73 #define SMBHSTCNT (2 + vt596_smba) 
    74 #define SMBHSTCMD (3 + vt596_smba) 
    75 #define SMBHSTADD (4 + vt596_smba) 
    76 #define SMBHSTDAT0 (5 + vt596_smba) 
    77 #define SMBHSTDAT1 (6 + vt596_smba) 
    78 #define SMBBLKDAT (7 + vt596_smba) 
    79 #define SMBSLVCNT (8 + vt596_smba) 
    80 #define SMBSHDWCMD (9 + vt596_smba) 
    81 #define SMBSLVEVT (0xA + vt596_smba) 
    82 #define SMBSLVDAT (0xC + vt596_smba) 
     51static unsigned short vt596_smba; 
     52#define SMBHSTSTS       (vt596_smba + 0) 
     53#define SMBHSLVSTS      (vt596_smba + 1) 
     54#define SMBHSTCNT       (vt596_smba + 2) 
     55#define SMBHSTCMD       (vt596_smba + 3) 
     56#define SMBHSTADD       (vt596_smba + 4) 
     57#define SMBHSTDAT0      (vt596_smba + 5) 
     58#define SMBHSTDAT1      (vt596_smba + 6) 
     59#define SMBBLKDAT       (vt596_smba + 7) 
     60#define SMBSLVCNT       (vt596_smba + 8) 
     61#define SMBSHDWCMD      (vt596_smba + 9) 
     62#define SMBSLVEVT       (vt596_smba + 0xA) 
     63#define SMBSLVDAT       (vt596_smba + 0xC) 
    8364 
    8465/* PCI Address Constants */ 
     
    8768   We try to select the better one*/ 
    8869 
    89 static unsigned short smb_cf_hstcfg; 
     70static unsigned short smb_cf_hstcfg = 0xD2; 
    9071 
    9172#define SMBHSTCFG   (smb_cf_hstcfg) 
    92 #define SMBSLVC     (SMBHSTCFG+1) 
    93 #define SMBSHDW1    (SMBHSTCFG+2) 
    94 #define SMBSHDW2    (SMBHSTCFG+3) 
    95 #define SMBREV      (SMBHSTCFG+4) 
     73#define SMBSLVC     (smb_cf_hstcfg + 1) 
     74#define SMBSHDW1    (smb_cf_hstcfg + 2) 
     75#define SMBSHDW2    (smb_cf_hstcfg + 3) 
     76#define SMBREV      (smb_cf_hstcfg + 4) 
    9677 
    9778/* Other settings */ 
    98 #define MAX_TIMEOUT 500 
    99 #define  ENABLE_INT9 0 
     79#define MAX_TIMEOUT     500 
     80#define ENABLE_INT9     0 
    10081 
    10182/* VT82C596 constants */ 
     
    10687#define VT596_BLOCK_DATA 0x14 
    10788 
    108 /* insmod parameters */ 
    10989 
    11090/* If force is set to anything different from 0, we forcibly enable the 
    11191   VT596. DANGEROUS! */ 
    112 static int force = 0; 
     92static int force; 
    11393MODULE_PARM(force, "i"); 
    11494MODULE_PARM_DESC(force, "Forcibly enable the SMBus. DANGEROUS!"); 
     
    11696/* If force_addr is set to anything different from 0, we forcibly enable 
    11797   the VT596 at the given address. VERY DANGEROUS! */ 
    118 static int force_addr = 0; 
     98static int force_addr; 
    11999MODULE_PARM(force_addr, "i"); 
    120100MODULE_PARM_DESC(force_addr, 
     
    123103 
    124104 
    125  
    126  
    127  
    128 static void vt596_do_pause(unsigned int amount); 
    129 static int vt596_transaction(void); 
    130  
    131  
    132  
    133 static unsigned short vt596_smba = 0; 
    134  
    135  
    136 /* Detect whether a compatible device can be found, and initialize it. */ 
    137 int vt596_setup(void) 
    138 { 
    139         unsigned char temp; 
    140  
    141         struct pci_dev *VT596_dev = NULL; 
    142  
    143         /* First check whether we can access PCI at all */ 
    144         if (pci_present() == 0) 
    145                 return(-ENODEV); 
    146  
    147         /* Look for a supported device/function */ 
    148         do { 
    149                 if((VT596_dev = pci_find_device(PCI_VENDOR_ID_VIA, num->dev, 
    150                                                 VT596_dev))) 
    151                         break; 
    152         } while ((++num)->dev); 
    153  
    154         if (VT596_dev == NULL) 
    155                 return(-ENODEV); 
    156         printk("i2c-viapro.o: Found Via %s device\n", num->name); 
    157  
    158 /* Determine the address of the SMBus areas */ 
    159         smb_cf_hstcfg = num->hstcfg; 
    160         if (force_addr) { 
    161                 vt596_smba = force_addr & 0xfff0; 
    162                 force = 0; 
    163         } else { 
    164                 if ((pci_read_config_word(VT596_dev, num->base, &vt596_smba)) 
    165                     || !(vt596_smba & 0x1)) { 
    166                         /* try 2nd address and config reg. for 596 */ 
    167                         if((num->dev == PCI_DEVICE_ID_VIA_82C596_3) && 
    168                            (!pci_read_config_word(VT596_dev, SMBBA2, &vt596_smba)) && 
    169                            (vt596_smba & 0x1)) { 
    170                                 smb_cf_hstcfg = 0x84; 
    171                         } else { 
    172                                 /* no matches at all */ 
    173                                 printk("i2c-viapro.o: Cannot configure SMBus " 
    174                                        "I/O Base address\n"); 
    175                                 return(-ENODEV); 
    176                         } 
    177                 } 
    178                 vt596_smba &= 0xfff0; 
    179                 if(vt596_smba == 0) { 
    180                         printk(KERN_ERR "i2c-viapro.o: SMBus base address" 
    181                            "uninitialized - upgrade BIOS or use force_addr=0xaddr\n"); 
    182                         return -ENODEV; 
    183                 } 
    184         } 
    185  
    186         if (check_region(vt596_smba, 8)) { 
    187                 printk("i2c-viapro.o: SMBus region 0x%x already in use!\n", 
    188                         vt596_smba); 
    189                 return(-ENODEV); 
    190         } 
    191  
    192         pci_read_config_byte(VT596_dev, SMBHSTCFG, &temp); 
    193 /* If force_addr is set, we program the new address here. Just to make 
    194    sure, we disable the VT596 first. */ 
    195         if (force_addr) { 
    196                 pci_write_config_byte(VT596_dev, SMBHSTCFG, temp & 0xfe); 
    197                 pci_write_config_word(VT596_dev, num->base, vt596_smba); 
    198                 pci_write_config_byte(VT596_dev, SMBHSTCFG, temp | 0x01); 
    199                 printk 
    200                     ("i2c-viapro.o: WARNING: SMBus interface set to new " 
    201                      "address 0x%04x!\n", vt596_smba); 
    202         } else if ((temp & 1) == 0) { 
    203                 if (force) { 
    204 /* NOTE: This assumes I/O space and other allocations WERE 
    205    done by the Bios!  Don't complain if your hardware does weird  
    206    things after enabling this. :') Check for Bios updates before 
    207    resorting to this.  */ 
    208                         pci_write_config_byte(VT596_dev, SMBHSTCFG, 
    209                                               temp | 1); 
    210                         printk 
    211                             ("i2c-viapro.o: enabling SMBus device\n"); 
    212                 } else { 
    213                         printk 
    214                             ("SMBUS: Error: Host SMBus controller not enabled! - " 
    215                              "upgrade BIOS or use force=1\n"); 
    216                         return(-ENODEV); 
    217                 } 
    218         } 
    219  
    220         /* Everything is happy, let's grab the memory and set things up. */ 
    221         request_region(vt596_smba, 8, "viapro-smbus"); 
    222  
    223 #ifdef DEBUG 
    224         if ((temp & 0x0E) == 8) 
    225                 printk("i2c-viapro.o: using Interrupt 9 for SMBus.\n"); 
    226         else if ((temp & 0x0E) == 0) 
    227                 printk("i2c-viapro.o: using Interrupt SMI# for SMBus.\n"); 
    228         else 
    229                 printk 
    230                     ("i2c-viapro.o: Illegal Interrupt configuration (or code out " 
    231                      "of date)!\n"); 
    232  
    233         pci_read_config_byte(VT596_dev, SMBREV, &temp); 
    234         printk("i2c-viapro.o: SMBREV = 0x%X\n", temp); 
    235         printk("i2c-viapro.o: VT596_smba = 0x%X\n", vt596_smba); 
    236 #endif                          /* DEBUG */ 
    237  
    238         return(0); 
    239 } 
    240  
     105static struct i2c_adapter vt596_adapter; 
    241106 
    242107/* Internally used pause function */ 
    243 void vt596_do_pause(unsigned int amount) 
     108static void vt596_do_pause(unsigned int amount) 
    244109{ 
    245110        current->state = TASK_INTERRUPTIBLE; 
     
    248113 
    249114/* Another internally used function */ 
    250 int vt596_transaction(void) 
     115static int vt596_transaction(void) 
    251116{ 
    252117        int temp; 
     
    254119        int timeout = 0; 
    255120 
    256 #ifdef DEBUG 
    257         printk 
    258             ("i2c-viapro.o: Transaction (pre): CNT=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, " 
    259              "DAT1=%02x\n", inb_p(SMBHSTCNT), inb_p(SMBHSTCMD), 
    260              inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1)); 
    261 #endif 
     121        dev_dbg(&vt596_adapter, "Transaction (pre): CNT=%02x, CMD=%02x, " 
     122                "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT),  
     123                inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0),  
     124                inb_p(SMBHSTDAT1)); 
    262125 
    263126        /* Make sure the SMBus host is ready to start transmitting */ 
    264127        if ((temp = inb_p(SMBHSTSTS)) != 0x00) { 
    265 #ifdef DEBUG 
    266                 printk("i2c-viapro.o: SMBus busy (0x%02x). Resetting... \n", 
    267                        temp); 
    268 #endif 
     128                dev_dbg(&vt596_adapter, "SMBus busy (0x%02x). " 
     129                                "Resetting...\n", temp); 
     130                 
    269131                outb_p(temp, SMBHSTSTS); 
    270132                if ((temp = inb_p(SMBHSTSTS)) != 0x00) { 
    271 #ifdef DEBUG 
    272                         printk("i2c-viapro.o: Failed! (0x%02x)\n", temp); 
    273 #endif 
     133                        dev_dbg(&vt596_adapter, "Failed! (0x%02x)\n", temp); 
     134                         
    274135                        return -1; 
    275136                } else { 
    276 #ifdef DEBUG 
    277                         printk("i2c-viapro.o: Successfull!\n"); 
    278 #endif 
     137                        dev_dbg(&vt596_adapter, "Successfull!\n"); 
    279138                } 
    280139        } 
     
    292151        /* If the SMBus is still busy, we give up */ 
    293152        if (timeout >= MAX_TIMEOUT) { 
    294 #ifdef DEBUG 
    295                 printk("i2c-viapro.o: SMBus Timeout!\n"); 
    296153                result = -1; 
    297 #endif 
     154                dev_dbg(&vt596_adapter, "SMBus Timeout!\n"); 
    298155        } 
    299156 
    300157        if (temp & 0x10) { 
    301158                result = -1; 
    302 #ifdef DEBUG 
    303                 printk("i2c-viapro.o: Error: Failed bus transaction\n"); 
    304 #endif 
     159                dev_dbg(&vt596_adapter, "Error: Failed bus transaction\n"); 
    305160        } 
    306161 
    307162        if (temp & 0x08) { 
    308163                result = -1; 
    309                 printk 
    310                     ("i2c-viapro.o: Bus collision! SMBus may be locked until next hard\n" 
    311                      "reset. (sorry!)\n"); 
     164                dev_info(&vt596_adapter, "Bus collision! SMBus may be " 
     165                        "locked until next hard\nreset. (sorry!)\n"); 
    312166                /* Clock stops and slave is stuck in mid-transmission */ 
    313167        } 
     
    315169        if (temp & 0x04) { 
    316170                result = -1; 
    317 #ifdef DEBUG 
    318                 printk("i2c-viapro.o: Error: no response!\n"); 
    319 #endif 
     171                dev_dbg(&vt596_adapter, "Error: no response!\n"); 
    320172        } 
    321173 
     
    324176 
    325177        if ((temp = inb_p(SMBHSTSTS)) != 0x00) { 
    326 #ifdef DEBUG 
    327                 printk 
    328                     ("i2c-viapro.o: Failed reset at end of transaction (%02x)\n", 
    329                      temp); 
    330 #endif 
    331         } 
    332 #ifdef DEBUG 
    333         printk 
    334             ("i2c-viapro.o: Transaction (post): CNT=%02x, CMD=%02x, ADD=%02x, " 
    335              "DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT), inb_p(SMBHSTCMD), 
    336              inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1)); 
    337 #endif 
     178                dev_dbg(&vt596_adapter, "Failed reset at end of " 
     179                        "transaction (%02x)\n", temp); 
     180        } 
     181        dev_dbg(&vt596_adapter, "Transaction (post): CNT=%02x, CMD=%02x, " 
     182                "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT), 
     183                inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0),  
     184                inb_p(SMBHSTDAT1)); 
     185         
    338186        return result; 
    339187} 
    340188 
    341189/* Return -1 on error. */ 
    342 s32 vt596_access(struct i2c_adapter * adap, u16 addr, unsigned short flags, 
    343                  char read_write, 
    344                  u8 command, int size, union i2c_smbus_data * data) 
     190static s32 vt596_access(struct i2c_adapter *adap, u16 addr, 
     191                unsigned short flags,  char read_write, u8 command, 
     192                int size,  union i2c_smbus_data *data) 
    345193{ 
    346194        int i, len; 
     
    348196        switch (size) { 
    349197        case I2C_SMBUS_PROC_CALL: 
    350                 printk 
    351                     ("i2c-viapro.o: I2C_SMBUS_PROC_CALL not supported!\n"); 
     198                dev_info(&vt596_adapter, 
     199                         "I2C_SMBUS_PROC_CALL not supported!\n"); 
    352200                return -1; 
    353201        case I2C_SMBUS_QUICK: 
     
    402250        outb_p((size & 0x1C) + (ENABLE_INT9 & 1), SMBHSTCNT); 
    403251 
    404         if (vt596_transaction())        /* Error in transaction */ 
     252        if (vt596_transaction()) /* Error in transaction */ 
    405253                return -1; 
    406254 
     
    408256                return 0; 
    409257 
    410  
    411258        switch (size) { 
    412         case VT596_BYTE:        /* Where is the result put? I assume here it is in 
    413                                    SMBHSTDAT0 but it might just as well be in the 
    414                                    SMBHSTCMD. No clue in the docs */ 
    415  
     259        case VT596_BYTE: 
     260                /* Where is the result put? I assume here it is in 
     261                 * SMBHSTDAT0 but it might just as well be in the 
     262                 * SMBHSTCMD. No clue in the docs  
     263                 */ 
    416264                data->byte = inb_p(SMBHSTDAT0); 
    417265                break; 
     
    432280} 
    433281 
    434  
    435 u32 vt596_func(struct i2c_adapter *adapter) 
     282static u32 vt596_func(struct i2c_adapter *adapter) 
    436283{ 
    437284        return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | 
     
    439286            I2C_FUNC_SMBUS_BLOCK_DATA; 
    440287} 
    441  
    442288 
    443289static struct i2c_algorithm smbus_algorithm = { 
     
    450296static struct i2c_adapter vt596_adapter = { 
    451297        .owner          = THIS_MODULE, 
    452         .name           = "unset", 
    453298        .id             = I2C_ALGO_SMBUS | I2C_HW_SMBUS_VIA2, 
    454299        .algo           = &smbus_algorithm, 
     300        .name   = "unset", 
    455301}; 
    456302 
    457  
     303static int __devinit vt596_probe(struct pci_dev *pdev, 
     304                                 const struct pci_device_id *id) 
     305{ 
     306        unsigned char temp; 
     307        int error = -ENODEV; 
     308         
     309        /* Determine the address of the SMBus areas */ 
     310        if (force_addr) { 
     311                vt596_smba = force_addr & 0xfff0; 
     312                force = 0; 
     313                goto found; 
     314        } 
     315 
     316        if ((pci_read_config_word(pdev, id->driver_data, &vt596_smba)) || 
     317            !(vt596_smba & 0x1)) { 
     318                /* try 2nd address and config reg. for 596 */ 
     319                if (id->device == PCI_DEVICE_ID_VIA_82C596_3 && 
     320                    !pci_read_config_word(pdev, SMBBA2, &vt596_smba) && 
     321                    (vt596_smba & 0x1)) { 
     322                        smb_cf_hstcfg = 0x84; 
     323                } else { 
     324                        /* no matches at all */ 
     325                        dev_err(pdev, "Cannot configure " 
     326                                "SMBus I/O Base address\n"); 
     327                        return -ENODEV; 
     328                } 
     329        } 
     330 
     331        vt596_smba &= 0xfff0; 
     332        if (vt596_smba == 0) { 
     333                dev_err(pdev, "SMBus base address " 
     334                        "uninitialized - upgrade BIOS or use " 
     335                        "force_addr=0xaddr\n"); 
     336                return -ENODEV; 
     337        } 
     338 
     339 found: 
     340        if (!request_region(vt596_smba, 8, "viapro-smbus")) { 
     341                dev_err(pdev, "SMBus region 0x%x already in use!\n", 
     342                        vt596_smba); 
     343                return -ENODEV; 
     344        } 
     345 
     346        pci_read_config_byte(pdev, SMBHSTCFG, &temp); 
     347        /* If force_addr is set, we program the new address here. Just to make 
     348           sure, we disable the VT596 first. */ 
     349        if (force_addr) { 
     350                pci_write_config_byte(pdev, SMBHSTCFG, temp & 0xfe); 
     351                pci_write_config_word(pdev, id->driver_data, vt596_smba); 
     352                pci_write_config_byte(pdev, SMBHSTCFG, temp | 0x01); 
     353                dev_warn(pdev, "WARNING: SMBus interface set to new " 
     354                     "address 0x%04x!\n", vt596_smba); 
     355        } else if ((temp & 1) == 0) { 
     356                if (force) { 
     357                        /* NOTE: This assumes I/O space and other allocations  
     358                         * WERE done by the Bios!  Don't complain if your  
     359                         * hardware does weird things after enabling this.  
     360                         * :') Check for Bios updates before resorting to  
     361                         * this. 
     362                         */ 
     363                        pci_write_config_byte(pdev, SMBHSTCFG, temp | 1); 
     364                        dev_info(pdev, "Enabling SMBus device\n"); 
     365                } else { 
     366                        dev_err(pdev, "SMBUS: Error: Host SMBus " 
     367                                "controller not enabled! - upgrade BIOS or " 
     368                                "use force=1\n"); 
     369                        goto release_region; 
     370                } 
     371        } 
     372 
     373        if ((temp & 0x0E) == 8) 
     374                dev_dbg(pdev, "using Interrupt 9 for SMBus.\n"); 
     375        else if ((temp & 0x0E) == 0) 
     376                dev_dbg(pdev, "using Interrupt SMI# for SMBus.\n"); 
     377        else 
     378                dev_dbg(pdev, "Illegal Interrupt configuration " 
     379                        "(or code out of date)!\n"); 
     380 
     381        pci_read_config_byte(pdev, SMBREV, &temp); 
     382        dev_dbg(pdev, "SMBREV = 0x%X\n", temp); 
     383        dev_dbg(pdev, "VT596_smba = 0x%X\n", vt596_smba); 
     384 
     385        snprintf(vt596_adapter.name, 32, 
     386                        "SMBus Via Pro adapter at %04x", vt596_smba); 
     387         
     388        return i2c_add_adapter(&vt596_adapter); 
     389 
     390 release_region: 
     391        release_region(vt596_smba, 8); 
     392        return error; 
     393} 
     394 
     395static void __devexit vt596_remove(struct pci_dev *pdev) 
     396{ 
     397        i2c_del_adapter(&vt596_adapter); 
     398        release_region(vt596_smba, 8); 
     399} 
     400 
     401#ifndef PCI_DEVICE_ID_VIA_8235 
     402#define PCI_DEVICE_ID_VIA_8235  0x3177 
     403#endif 
    458404static struct pci_device_id vt596_ids[] __devinitdata = { 
     405        { 
     406                .vendor         = PCI_VENDOR_ID_VIA, 
     407                .device         = PCI_DEVICE_ID_VIA_82C596_3, 
     408                .subvendor      = PCI_ANY_ID, 
     409                .subdevice      = PCI_ANY_ID, 
     410                .driver_data    = SMBBA1, 
     411        }, 
     412        { 
     413                .vendor         = PCI_VENDOR_ID_VIA, 
     414                .device         = PCI_DEVICE_ID_VIA_82C596B_3, 
     415                .subvendor      = PCI_ANY_ID, 
     416                .subdevice      = PCI_ANY_ID, 
     417                .driver_data    = SMBBA1, 
     418        }, 
     419        { 
     420                .vendor         = PCI_VENDOR_ID_VIA, 
     421                .device         = PCI_DEVICE_ID_VIA_82C686_4, 
     422                .subvendor      = PCI_ANY_ID, 
     423                .subdevice      = PCI_ANY_ID, 
     424                .driver_data    = SMBBA1, 
     425        }, 
     426        { 
     427                .vendor         = PCI_VENDOR_ID_VIA, 
     428                .device         = PCI_DEVICE_ID_VIA_8233_0, 
     429                .subvendor      = PCI_ANY_ID, 
     430                .subdevice      = PCI_ANY_ID, 
     431                .driver_data    = SMBBA3 
     432        }, 
     433        { 
     434                .vendor         = PCI_VENDOR_ID_VIA, 
     435                .device         = PCI_DEVICE_ID_VIA_8233A, 
     436                .subvendor      = PCI_ANY_ID, 
     437                .subdevice      = PCI_ANY_ID, 
     438                .driver_data    = SMBBA3, 
     439        }, 
     440        { 
     441                .vendor         = PCI_VENDOR_ID_VIA, 
     442                .device         = PCI_DEVICE_ID_VIA_8235, 
     443                .subvendor      = PCI_ANY_ID, 
     444                .subdevice      = PCI_ANY_ID, 
     445                .driver_data    = SMBBA3 
     446        }, 
     447        { 
     448                .vendor         = PCI_VENDOR_ID_VIA, 
     449                .device         = PCI_DEVICE_ID_VIA_8231_4, 
     450                .subvendor      = PCI_ANY_ID, 
     451                .subdevice      = PCI_ANY_ID, 
     452                .driver_data    = SMBBA1, 
     453        }, 
    459454        { 0, } 
    460455}; 
    461  
    462 static int __devinit vt596_probe(struct pci_dev *dev, const struct pci_device_id *id) 
    463 { 
    464  
    465         if (vt596_setup()) { 
    466                 printk 
    467                     ("i2c-viapro.o: Can't detect vt82c596 or compatible device, module not inserted.\n"); 
    468  
    469                 return -ENODEV; 
    470         } 
    471  
    472         sprintf(vt596_adapter.name, "SMBus Via Pro adapter at %04x", 
    473                 vt596_smba); 
    474         i2c_add_adapter(&vt596_adapter); 
    475 } 
    476  
    477 static void __devexit vt596_remove(struct pci_dev *dev) 
    478 { 
    479         i2c_del_adapter(&vt596_adapter); 
    480 } 
    481456 
    482457static struct pci_driver vt596_driver = { 
     
    489464static int __init i2c_vt596_init(void) 
    490465{ 
    491         printk("i2c-viapro.o version %s (%s)\n", LM_VERSION, LM_DATE); 
    492466        return pci_module_init(&vt596_driver); 
    493467} 
     
    497471{ 
    498472        pci_unregister_driver(&vt596_driver); 
    499         release_region(vt596_smba, 8); 
    500 } 
    501  
    502  
    503  
    504 MODULE_AUTHOR 
    505     ("Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>"); 
     473} 
     474 
     475MODULE_AUTHOR( 
     476    "Frodo Looijaard <frodol@dds.nl> and " 
     477    "Philip Edelbrock <phil@netroedge.com>"); 
    506478MODULE_DESCRIPTION("vt82c596 SMBus driver"); 
    507  
    508479MODULE_LICENSE("GPL"); 
    509480