From aa337ef1fbc9650f8b5b9087af1dac33f71eb01c Mon Sep 17 00:00:00 2001 From: Scott Smedley Date: Fri, 18 Dec 2009 10:54:26 -0800 Subject: Staging: add dt3155 driver This is a driver for the DT3155 Digitizer Signed-off-by: Scott Smedley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dt3155/pci-compat.h | 97 +++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 drivers/staging/dt3155/pci-compat.h (limited to 'drivers/staging/dt3155/pci-compat.h') diff --git a/drivers/staging/dt3155/pci-compat.h b/drivers/staging/dt3155/pci-compat.h new file mode 100644 index 00000000000..5f47d5a94d4 --- /dev/null +++ b/drivers/staging/dt3155/pci-compat.h @@ -0,0 +1,97 @@ + +/* This header only makes send when included in a 2.0 compile */ + +#ifndef _PCI_COMPAT_H_ +#define _PCI_COMPAT_H_ + +#ifdef __KERNEL__ + +#include /* pcibios_* */ +#include /* pcibios_* */ +#include /* kmalloc */ + +/* fake the new pci interface based on the old one: encapsulate bus/devfn */ +struct pci_fake_dev { + u8 bus; + u8 devfn; + int index; +}; +#define pci_dev pci_fake_dev /* the other pci_dev is unused by 2.0 drivers */ + +extern inline struct pci_dev *pci_find_device(unsigned int vendorid, + unsigned int devid, + struct pci_dev *from) +{ + struct pci_dev *pptr = kmalloc(sizeof(*pptr), GFP_KERNEL); + int index = 0; + int ret; + + if (!pptr) return NULL; + if (from) index = pptr->index + 1; + ret = pcibios_find_device(vendorid, devid, index, + &pptr->bus, &pptr->devfn); + if (ret) { kfree(pptr); return NULL; } + return pptr; +} + +extern inline struct pci_dev *pci_find_class(unsigned int class, + struct pci_dev *from) +{ + return NULL; /* FIXME */ +} + +extern inline void pci_release_device(struct pci_dev *dev) +{ + kfree(dev); +} + +/* struct pci_dev *pci_find_slot (unsigned int bus, unsigned int devfn); */ + +#define pci_present pcibios_present + +extern inline int +pci_read_config_byte(struct pci_dev *dev, u8 where, u8 *val) +{ + return pcibios_read_config_byte(dev->bus, dev->devfn, where, val); +} + +extern inline int +pci_read_config_word(struct pci_dev *dev, u8 where, u16 *val) +{ + return pcibios_read_config_word(dev->bus, dev->devfn, where, val); +} + +extern inline int +pci_read_config_dword(struct pci_dev *dev, u8 where, u32 *val) +{ + return pcibios_read_config_dword(dev->bus, dev->devfn, where, val); +} + +extern inline int +pci_write_config_byte(struct pci_dev *dev, u8 where, u8 val) +{ + return pcibios_write_config_byte(dev->bus, dev->devfn, where, val); +} + +extern inline int +pci_write_config_word(struct pci_dev *dev, u8 where, u16 val) +{ + return pcibios_write_config_word(dev->bus, dev->devfn, where, val); +} + +extern inline int +pci_write_config_dword(struct pci_dev *dev, u8 where, u32 val) +{ + return pcibios_write_config_dword(dev->bus, dev->devfn, where, val); +} + +extern inline void pci_set_master(struct pci_dev *dev) +{ + u16 cmd; + pcibios_read_config_word(dev->bus, dev->devfn, PCI_COMMAND, &cmd); + cmd |= PCI_COMMAND_MASTER; + pcibios_write_config_word(dev->bus, dev->devfn, PCI_COMMAND, cmd); +} + +#endif /* __KERNEL__ */ +#endif /* _PCI_COMPAT_H_ */ -- cgit v1.2.3