-2005-05-28 Frank Hess,,, <fmhess@users.sourceforge.net>
+2005-06-04 Frank Hess <fmhess@users.sourceforge.net>
+
+ Patch from abbotti@mev.co.uk (Ian Abbott) to
+ make it possible to remove deprecated check_region()
+ calls from drivers.
+ * include/linux/ioport.h: Added compat__request_region()
+ * include/linux/pci.h: Replace use of check_region() with
+ modern version of request_region().
+
+2005-05-28 Frank Hess <fmhess@users.sourceforge.net>
* include/linux/delay.h: Added msleep_interruptible()
* include/linux/time.h:i Added msecs_to_jiffies() and jiffies_to_msecs()
#include_next <linux/ioport.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,11)
+
+/* 'struct resource' not defined. Define a dummy version. */
+struct resource {
+ int dummy;
+};
+
+/* Define a compatible version of request_region that returns a pointer
+ * to a non-NULL value on success. */
+static inline struct resource *compat__request_region(unsigned long from,
+ unsigned long extent, const char *name)
+{
+ if (check_region(from, extent) < 0) {
+ return (struct resource *)0;
+ }
+ request_region(from, extent, name);
+ return ((struct resource *)0 + 1); /* Should be non-NULL */
+}
+
+/* Replace existing request_region macro/function. */
+#undef request_region
+#define request_region(f,e,n) compat__request_region(f,e,n)
+
+#endif
+
#endif // _COMPAT_IOPORT_H
if(dev->base_address[i])
{
if(dev->base_address[i] & PCI_BASE_ADDRESS_SPACE_IO)
- retval = check_region(pci_resource_start(dev, i),
- fake_length);
- if( retval )
- break;
+ if(!request_region(pci_resource_start(dev, i),
+ fake_length, name))
+ {
+ retval = -EBUSY;
+ break;
+ }
}
}
- if(retval) return retval;
-
- for(i = 0; i < max_num_base_addr; i++)
+ if(retval)
{
- if(dev->base_address[i])
+ while(--i >= 0)
{
if(dev->base_address[i] & PCI_BASE_ADDRESS_SPACE_IO)
- request_region(pci_resource_start(dev, i),
- fake_length, name);
+ release_region(pci_resource_start(dev, i),
+ fake_length);
}
}
- return 0;
+ return retval;
}
static inline void pci_release_regions(struct pci_dev *dev)