Changeset 1662

Show
Ignore:
Timestamp:
12/04/02 03:52:36 (11 years ago)
Author:
mds
Message:

more 2.2 fixes from Vojtech

Files:
1 modified

Legend:

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

    r1660 r1662  
    2727 
    2828#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) 
     29#include <linux/kcomp.h> 
     30#define MAX_PCI_DEVS    8 
     31static struct pci_dev *amd8111_devs[MAX_PCI_DEVS] = { NULL, /* ... */ }; 
     32static void *amd8111_drvdata[MAX_PCI_DEVS]; 
     33static int amd8111_devcnt = 0; 
     34 
    2935#define min_t(t, x, y)  (((x)<(y))?(x):(y)) 
    3036#define __devinit 
     
    4652}; 
    4753#define PCI_ANY_ID      0xffff 
    48 #define IORESOURCE_IO 0x00000100 
     54 
     55static void *pci_get_drvdata(struct pci_dev *dev) 
     56{ 
     57        int i; 
     58        for (i = 0; i < amd8111_devcnt; i++) 
     59                if (amd8111_devs[i] == dev) 
     60                        return amd8111_drvdata[i]; 
     61        return NULL; 
     62} 
     63 
     64static void pci_set_drvdata(struct pci_dev *dev, void *driver_data) 
     65{ 
     66        int i; 
     67        for (i = 0; i < amd8111_devcnt; i++) 
     68                if (amd8111_devs[i] == dev) 
     69                        amd8111_drvdata[i] = driver_data; 
     70} 
     71 
    4972#endif 
    5073 
     
    378401                return -1; 
    379402 
    380         if (!(smbus = (void*)kmalloc(sizeof(struct amd_smbus), GFP_KERNEL))) 
     403        if (!(smbus = kmalloc(sizeof(struct amd_smbus), GFP_KERNEL))) 
    381404                return -1; 
    382405        memset(smbus, 0, sizeof(struct amd_smbus)); 
     
    426449static void __devexit amd8111_remove(struct pci_dev *dev) 
    427450{ 
    428         struct amd_smbus *smbus = (void*) pci_get_drvdata(dev); 
     451        struct amd_smbus *smbus = pci_get_drvdata(dev); 
    429452        if (i2c_del_adapter(&smbus->adapter)) { 
    430453                printk(KERN_WARNING "i2c-amd8111.c: Failed to unregister adapter.\n"); 
     
    441464#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) 
    442465 
    443 static struct pci_dev *amd8111_devs[8] = { NULL, /* ... */ }; 
    444 static int amd8111_devcnt = 0; 
    445  
    446 int i2c_amd_8111_init(void) 
     466int i2c_amd8111_init(void) 
    447467{ 
    448468        struct pci_dev *pci; 
     
    460480} 
    461481 
    462 #ifdef MODULE 
    463 int init_module(void) 
     482int __init amd8111_init(void) 
    464483{ 
    465484        return i2c_amd8111_init(); 
    466485} 
    467486 
    468 int cleanup_module(void) 
     487void __exit amd8111_exit(void) 
    469488{ 
    470489        int i; 
     
    472491                amd8111_remove(amd8111_devs[i]); 
    473492} 
    474 #endif  
    475493 
    476494#else 
     
    493511} 
    494512 
     513 
     514MODULE_DEVICE_TABLE(pci, amd8111_id_table); 
     515 
     516#endif 
     517 
    495518module_init(amd8111_init); 
    496519module_exit(amd8111_exit); 
    497520 
    498 #endif