handle 2.2 kernels void request_region()

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1655 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Mark D. Studebaker committed 2002-11-28 19:57:23 +00:00
1 parent be8a79a8bf
commit 1b74956ae0
3 files changed
+29 -2

No files matched your search

+10 -2
View File
@@ -326,10 +326,18 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_
smbus->base = pci_resource_start(dev, 0);
smbus->size = pci_resource_len(dev, 0);
if (!request_region(smbus->base, smbus->size, "amd81111 SMBus 2.0")) {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,14)
if (!request_region(smbus->base, smbus->size, "amd8111 SMBus 2.0")) {
kfree(smbus);
return -1;
}
#else
if (check_region(smbus->base, smbus->size) < 0) {
kfree(smbus);
return -1;
}
request_region(smbus->base, smbus->size, "amd8111 SMBus 2.0");
#endif
sprintf(smbus->adapter.name, "SMBus2 AMD8111 adapter at %04x", smbus->base);
smbus->adapter.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_AMD8111;
@@ -355,7 +363,7 @@ static void __devexit amd8111_remove(struct pci_dev *dev)
{
struct amd_smbus *smbus = pci_get_drvdata(dev);
if (i2c_del_adapter(&smbus->adapter)) {
printk(KERN_WARNING "i2c-amd81111.c: Failed to unregister adapter.\n");
printk(KERN_WARNING "i2c-amd8111.c: Failed to unregister adapter.\n");
return;
}
release_region(smbus->base, smbus->size);
+9
View File
@@ -452,11 +452,20 @@ int sis630_setup(void) {
#endif
/* Everything is happy, let's grab the memory and set things up. */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,14)
if (!request_region(acpi_base + SMB_STS, SIS630_SMB_IOREGION, "sis630-smbus")){
printk(KERN_ERR "i2c-sis630.o: SMBus registers 0x%04x-0x%04x "
"already in use!\n",acpi_base + SMB_STS, acpi_base + SMB_SAA);
return -ENODEV;
}
#else
if (check_region(acpi_base + SMB_STS, SIS630_SMB_IOREGION) < 0){
printk(KERN_ERR "i2c-sis630.o: SMBus registers 0x%04x-0x%04x "
"already in use!\n",acpi_base + SMB_STS, acpi_base + SMB_SAA);
return -ENODEV;
}
request_region(acpi_base + SMB_STS, SIS630_SMB_IOREGION, "sis630-smbus");
#endif
return 0;
}
+10
View File
@@ -332,12 +332,22 @@ static int sis645_setup(void)
printk("i2c-sis645.o: SiS645 SMBus base address: 0x%04x\n", sis645_smbus_base);
/* Everything is happy, let's grab the memory and set things up. */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,14)
if (!request_region(sis645_smbus_base, SIS645_SMB_IOREGION, "sis645-smbus")) {
printk
("i2c-sis645.o: SMBus registers 0x%04x-0x%04x already in use!\n",
sis645_smbus_base, sis645_smbus_base + SIS645_SMB_IOREGION - 1);
return -EINVAL;
}
#else
if (check_region(sis645_smbus_base, SIS645_SMB_IOREGION) < 0) {
printk
("i2c-sis645.o: SMBus registers 0x%04x-0x%04x already in use!\n",
sis645_smbus_base, sis645_smbus_base + SIS645_SMB_IOREGION - 1);
return -EINVAL;
}
request_region(sis645_smbus_base, SIS645_SMB_IOREGION, "sis645-smbus");
#endif
return(0);
}