Made i2c-hydra.o 2.0.x kernel compatible

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@442 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Frodo Looijaard committed 1999-05-02 21:00:24 +00:00
1 parent 6569c8364c
commit 5ffe4834e5
2 files changed
+31 -2

No files matched your search

+24 -2
View File
@@ -33,6 +33,12 @@
#include "i2c.h"
#include "algo-bit.h"
#include "compat.h"
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,54))
#include <linux/bios32.h>
#endif
/* PCI device */
#define VENDOR PCI_VENDOR_ID_APPLE
@@ -128,19 +134,35 @@ struct bit_adapter bit_hydra_ops = {
static int find_hydra(void)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,54))
struct pci_dev *dev;
#else
unsigned char bus, devfn;
int res;
#endif
unsigned int base_addr;
if (!pci_present())
return -ENODEV;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,54))
dev = pci_find_device(VENDOR, DEVICE, NULL);
if (!dev) {
#else
res = pcibios_find_device(VENDOR,DEVICE,0,&bus, &devfn);
if (res) {
#endif
printk("Hydra not found\n");
return -ENODEV;
}
hydra_base = (unsigned long)ioremap(dev->base_address[0], 0x100);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,54))
base_addr = dev->base_address[0];
#else
pcibios_read_config_dword(bus, devfn,PCI_BASE_ADDRESS_0,&base_addr);
#endif
hydra_base = (unsigned long)ioremap(base_addr, 0x100);
return 0;
}
+7
View File
@@ -81,5 +81,12 @@
pci_write_config_byte(device,com,res)
#endif
/* I hope this is always correct, even for the PPC, but I really think so.
And yes, the kernel version is exactly correct */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0))
#include <linux/mm.h>
#define ioremap vremap
#define iounmap vfree
#endif
#endif /* SENSORS_COMPAT_H */