Changeset 1662
- Timestamp:
- 12/04/02 03:52:36 (11 years ago)
- Files:
-
- 1 modified
-
lm-sensors/trunk/kernel/busses/i2c-amd8111.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/kernel/busses/i2c-amd8111.c
r1660 r1662 27 27 28 28 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) 29 #include <linux/kcomp.h> 30 #define MAX_PCI_DEVS 8 31 static struct pci_dev *amd8111_devs[MAX_PCI_DEVS] = { NULL, /* ... */ }; 32 static void *amd8111_drvdata[MAX_PCI_DEVS]; 33 static int amd8111_devcnt = 0; 34 29 35 #define min_t(t, x, y) (((x)<(y))?(x):(y)) 30 36 #define __devinit … … 46 52 }; 47 53 #define PCI_ANY_ID 0xffff 48 #define IORESOURCE_IO 0x00000100 54 55 static 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 64 static 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 49 72 #endif 50 73 … … 378 401 return -1; 379 402 380 if (!(smbus = (void*)kmalloc(sizeof(struct amd_smbus), GFP_KERNEL)))403 if (!(smbus = kmalloc(sizeof(struct amd_smbus), GFP_KERNEL))) 381 404 return -1; 382 405 memset(smbus, 0, sizeof(struct amd_smbus)); … … 426 449 static void __devexit amd8111_remove(struct pci_dev *dev) 427 450 { 428 struct amd_smbus *smbus = (void*)pci_get_drvdata(dev);451 struct amd_smbus *smbus = pci_get_drvdata(dev); 429 452 if (i2c_del_adapter(&smbus->adapter)) { 430 453 printk(KERN_WARNING "i2c-amd8111.c: Failed to unregister adapter.\n"); … … 441 464 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) 442 465 443 static struct pci_dev *amd8111_devs[8] = { NULL, /* ... */ }; 444 static int amd8111_devcnt = 0; 445 446 int i2c_amd_8111_init(void) 466 int i2c_amd8111_init(void) 447 467 { 448 468 struct pci_dev *pci; … … 460 480 } 461 481 462 #ifdef MODULE 463 int init_module(void) 482 int __init amd8111_init(void) 464 483 { 465 484 return i2c_amd8111_init(); 466 485 } 467 486 468 int cleanup_module(void)487 void __exit amd8111_exit(void) 469 488 { 470 489 int i; … … 472 491 amd8111_remove(amd8111_devs[i]); 473 492 } 474 #endif475 493 476 494 #else … … 493 511 } 494 512 513 514 MODULE_DEVICE_TABLE(pci, amd8111_id_table); 515 516 #endif 517 495 518 module_init(amd8111_init); 496 519 module_exit(amd8111_exit); 497 520 498 #endif
