Changeset 1658

Show
Ignore:
Timestamp:
12/01/02 22:30:13 (10 years ago)
Author:
mds
Message:

compile fixes for i2c-amd8111.c, and add support in mkpatch.

Patch from

Vojtech Pavlik <vojtech@…>

Location:
lm-sensors/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/doc/busses/i2c-amd8111

    r1656 r1658  
    4646supported by this driver, and the SMBus 1.0 adapter is supported 
    4747by the i2c-amd756 driver. 
    48  
    49 The 8111 used with the AMD Hammer. While the module should work either with 
    50 CONFIG_X86 or CONFIG_X86_64, it will only be compiled with CONFIG_X86_64 
    51 (as it was the easiest way to prevent compilation in 2.2 kernels). 
    52 If you would like to compile it for CONFIG_X86, modify kernel/busses/Module.mk. 
  • lm-sensors/trunk/kernel/busses/Module.mk

    r1656 r1658  
    4141KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-amd756.o 
    4242endif 
    43 # Should also work for CONFIG_X86 but this is the easiest way to prevent compilation in 2.2 kernels... 
    44 ifeq ($(shell if grep -q '^CONFIG_X86_64=' $(LINUX)/.config; then echo 1; fi),1) 
    4543ifneq ($(shell if grep -q '^CONFIG_I2C_AMD8111=y' $(LINUX)/.config; then echo 1; fi),1) 
    4644KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-amd8111.o 
    47 endif 
    4845endif 
    4946ifneq ($(shell if grep -q '^CONFIG_I2C_HYDRA=y' $(LINUX)/.config; then echo 1; fi),1) 
  • lm-sensors/trunk/kernel/busses/i2c-amd8111.c

    r1656 r1658  
    2626#endif 
    2727 
     28#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) 
     29#define min_t(t, x, y)  (((x)<(y))?(x):(y)) 
     30#define __devinit 
     31#define __devexit 
     32#define __devinitdata 
     33struct pci_device_id { 
     34        unsigned int vendor, device; 
     35        unsigned int subvendor, subdevice; 
     36        unsigned int class, class_mask; 
     37        unsigned long driver_data; 
     38}; 
     39struct pci_driver { 
     40        struct list_head node; 
     41        char *name; 
     42        const struct pci_device_id *id_table; 
     43        int (*probe)(struct pci_dev *dev, const struct pci_device_id *id); 
     44        void (*remove)(struct pci_dev *dev); 
     45}; 
     46#define PCI_ANY_ID      0xffff 
     47#define IORESOURCE_IO 0x00000100 
     48#endif 
     49 
     50#ifdef MODULE_LICENSE 
    2851MODULE_LICENSE("GPL"); 
     52#endif 
    2953MODULE_AUTHOR ("Vojtech Pavlik <vojtech@suse.cz>"); 
    3054MODULE_DESCRIPTION("AMD8111 SMBus 2.0 driver"); 
     
    360384                return -1; 
    361385 
    362         if (!(smbus = kmalloc(sizeof(struct amd_smbus), GFP_KERNEL))) 
     386        if (!(smbus = (void*)kmalloc(sizeof(struct amd_smbus), GFP_KERNEL))) 
    363387                return -1; 
    364388        memset(smbus, 0, sizeof(struct amd_smbus)); 
     
    369393        smbus->size = pci_resource_len(dev, 0); 
    370394 
     395#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,14) 
    371396        if (!request_region(smbus->base, smbus->size, "amd8111 SMBus 2.0")) { 
    372397                kfree(smbus); 
    373398                return -1; 
    374399        } 
     400#else 
     401        if (check_region(smbus->base, smbus->size) < 0) { 
     402                kfree(smbus); 
     403                return -1; 
     404        } 
     405        request_region(smbus->base, smbus->size, "amd8111 SMBus 2.0"); 
     406#endif 
    375407 
    376408        sprintf(smbus->adapter.name, "SMBus2 AMD8111 adapter at %04x", smbus->base); 
     
    390422        pci_write_config_dword(smbus->dev, AMD_PCI_MISC, 0); 
    391423 
     424#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) 
     425        printk(KERN_INFO "i2c-amd8111.c: AMD8111 SMBus 2.0 adapter at %#x\n", smbus->base); 
     426#else 
    392427        printk(KERN_INFO "i2c-amd8111.c: AMD8111 SMBus 2.0 adapter at pci%s\n", dev->slot_name); 
     428#endif 
    393429        return 0; 
    394430} 
     
    396432static void __devexit amd8111_remove(struct pci_dev *dev) 
    397433{ 
    398         struct amd_smbus *smbus = pci_get_drvdata(dev); 
     434        struct amd_smbus *smbus = (void*) pci_get_drvdata(dev); 
    399435        if (i2c_del_adapter(&smbus->adapter)) { 
    400436                printk(KERN_WARNING "i2c-amd8111.c: Failed to unregister adapter.\n"); 
     
    408444{{ 0x1022, 0x746a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 
    409445 { 0 }}; 
     446 
     447#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) 
     448 
     449static struct pci_dev *amd8111_devs[8] = { NULL, /* ... */ }; 
     450static int amd8111_devcnt = 0; 
     451 
     452int i2c_amd_8111_init(void) 
     453{ 
     454        struct pci_dev *pci; 
     455        struct pci_device_id *id; 
     456        int found = 0; 
     457 
     458        for (id = amd8111_id_table; id->vendor; id++) { 
     459                pci = NULL; 
     460                while ((pci = pci_find_device(id->vendor, id->device, pci))) 
     461                        if (amd8111_devcnt < 8 && !amd8111_probe(pci, id)) 
     462                                amd8111_devs[amd8111_devcnt++] = pci; 
     463        } 
     464 
     465        return found ? 0 : -ENODEV; 
     466} 
     467 
     468#ifdef MODULE 
     469int init_module(void) 
     470{ 
     471        return i2c_amd8111_init(); 
     472} 
     473 
     474int cleanup_module(void) 
     475{ 
     476        int i; 
     477        for (i = 0; i < amd8111_devcnt; i++) 
     478                amd8111_remove(amd8111_devs[i]); 
     479} 
     480#endif  
     481 
     482#else 
    410483 
    411484static struct pci_driver amd8111_driver = { 
     
    428501module_init(amd8111_init); 
    429502module_exit(amd8111_exit); 
     503 
     504#endif 
  • lm-sensors/trunk/mkpatch/mkpatch.pl

    r1631 r1658  
    8080           m@Acer Labs ALI 1535@ or 
    8181           m@Acer Labs ALI 1533 and 1543C@ or 
    82            m@AMD 756/766@ or 
     82           m@AMD 756/766/768/8111@ or 
     83           m@AMD 8111 SMBus 2.0@ or 
    8384           m@Apple Hydra Mac I/O@ or 
    8485           m@Intel I801@ or 
     
    143144  is running. 
    144145 
    145 AMD 756/766/768 
     146AMD 756/766/768/8111 
    146147CONFIG_I2C_AMD756 
    147148  If you say yes to this option, support will be included for the AMD 
    148   756/766/768 mainboard I2C interfaces. This can also be  
     149  756/766/768/8111 mainboard I2C interfaces. This can also be  
     150  built as a module which can be inserted and removed while the kernel 
     151  is running. 
     152 
     153AMD 8111 SMBus 2.0 
     154CONFIG_I2C_AMD8111 
     155  If you say yes to this option, support will be included for the AMD 
     156  8111 mainboard SMBus 2.0 interface. This can also be  
    149157  built as a module which can be inserted and removed while the kernel 
    150158  is running. 
     
    801809    dep_tristate '  Acer Labs ALI 1533 and 1543C' CONFIG_I2C_ALI15X3 $CONFIG_I2C 
    802810    dep_tristate '  Apple Hydra Mac I/O' CONFIG_I2C_HYDRA $CONFIG_I2C_ALGOBIT 
    803     dep_tristate '  AMD 756/766/768' CONFIG_I2C_AMD756 $CONFIG_I2C 
     811    dep_tristate '  AMD 756/766/768/8111' CONFIG_I2C_AMD756 $CONFIG_I2C 
     812    dep_tristate '  AMD 8111 SMBus 2.0' CONFIG_I2C_AMD8111 $CONFIG_I2C 
    804813    dep_tristate '  DEC Tsunami I2C interface' CONFIG_I2C_TSUNAMI $CONFIG_I2C_ALGOBIT $CONFIG_ALPHA 
    805814    dep_tristate '  Intel 82801AA, AB, BA, DB' CONFIG_I2C_I801 $CONFIG_I2C 
     
    11731182obj-$(CONFIG_I2C_ALI15X3)               += i2c-ali15x3.o 
    11741183obj-$(CONFIG_I2C_AMD756)                += i2c-amd756.o 
     1184obj-$(CONFIG_I2C_AMD8111)               += i2c-amd8111.o 
    11751185obj-$(CONFIG_I2C_HYDRA)                 += i2c-hydra.o 
    11761186obj-$(CONFIG_I2C_I801)                  += i2c-i801.o 
     
    12141224endif 
    12151225 
     1226ifeq ($(CONFIG_I2C_AMD8111),y) 
     1227  L_OBJS += i2c-amd8111.o 
     1228else  
     1229  ifeq ($(CONFIG_I2C_AMD8111),m) 
     1230    M_OBJS += i2c-amd8111.o 
     1231  endif 
     1232endif 
     1233 
    12161234ifeq ($(CONFIG_I2C_HYDRA),y) 
    12171235  L_OBJS += i2c-hydra.o 
     
    13641382        extern int i2c_amd756_init(void); 
    13651383#endif 
     1384#ifdef CONFIG_I2C_AMD8111 
     1385        extern int i2c_amd8111_init(void); 
     1386#endif 
    13661387#ifdef CONFIG_I2C_HYDRA 
    13671388        extern int i2c_hydra_init(void); 
     
    14141435#ifdef CONFIG_I2C_AMD756 
    14151436        i2c_amd756_init(); 
     1437#endif 
     1438#ifdef CONFIG_I2C_AMD8111 
     1439        i2c_amd8111_init(); 
    14161440#endif 
    14171441#ifdef CONFIG_I2C_HYDRA