add 2.4 compatibility for pcmcia_register_driver() and pcmcia_unregister_driver()
authorFrank Mori Hess <fmhess@speakeasy.net>
Mon, 31 May 2004 21:44:53 +0000 (21:44 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Mon, 31 May 2004 21:44:53 +0000 (21:44 +0000)
include/linux/device.h [new file with mode: 0644]
include/pcmcia/ds.h [new file with mode: 0644]

diff --git a/include/linux/device.h b/include/linux/device.h
new file mode 100644 (file)
index 0000000..3631fd5
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * linux/device.h compatibility header
+ */
+
+#ifndef __COMPAT_LINUX_DEVICE_H_
+#define __COMPAT_LINUX_DEVICE_H_
+
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+struct device_driver 
+{
+       char                    * name;
+};
+#else
+#include_next <linux/device.h>
+#endif
+
+#endif // __COMPAT_LINUX_DEVICE_H_
+
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
new file mode 100644 (file)
index 0000000..8de9f00
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * pcmcia/ds.h compatibility header
+ */
+
+#ifndef __COMPAT_PCMCIA_DS_H_
+#define __COMPAT_PCMCIA_DS_H_
+
+#include <linux/version.h>
+#include_next <pcmcia/ds.h>
+#include <linux/device.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+struct pcmcia_driver {
+       dev_link_t              *(*attach)(void);
+       void                    (*detach)(dev_link_t *);
+       struct module           *owner;
+       struct device_driver    drv;
+};
+
+/* driver registration */
+static inline int pcmcia_register_driver(struct pcmcia_driver *driver)
+{
+       return register_pccard_driver(driver->drv.name, driver->attach, driver->detach);
+}
+
+static void inline pcmcia_unregister_driver(struct pcmcia_driver *driver)
+{
+       unregister_pccard_driver(driver->drv.name);
+}
+
+
+#endif
+
+#endif // __COMPAT_PCMCIA_DS_H_
+