1 #ifndef LINUX_26_36_COMPAT_H
2 #define LINUX_26_36_COMPAT_H
4 #include <linux/version.h>
6 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
9 #include <pcmcia/cistpl.h>
10 #include <pcmcia/ds.h>
11 #include <linux/pm_qos_params.h>
12 #include <linux/smp_lock.h>
14 #define kparam_block_sysfs_write(a)
15 #define kparam_unblock_sysfs_write(a)
22 #define device_rename(dev, new_name) device_rename(dev, (char *)new_name)
24 #ifdef CONFIG_COMPAT_USB_URB_THREAD_FIX
25 #define usb_scuttle_anchored_urbs(anchor) compat_usb_scuttle_anchored_urbs(anchor)
26 #define usb_get_from_anchor(anchor) compat_usb_get_from_anchor(anchor)
27 #define usb_unlink_anchored_urbs(anchor) compat_usb_unlink_anchored_urbs(anchor)
29 extern void compat_usb_unlink_anchored_urbs(struct usb_anchor *anchor);
30 extern struct urb *compat_usb_get_from_anchor(struct usb_anchor *anchor);
31 extern void compat_usb_scuttle_anchored_urbs(struct usb_anchor *anchor);
35 * pcmcia_read_config_byte() - read a byte from a card configuration register
37 * pcmcia_read_config_byte() reads a byte from a configuration register in
40 static inline int pcmcia_read_config_byte(struct pcmcia_device *p_dev, off_t where, u8 *val)
43 conf_reg_t reg = { 0, CS_READ, where, 0 };
44 ret = pcmcia_access_configuration_register(p_dev, ®);
50 * pcmcia_write_config_byte() - write a byte to a card configuration register
52 * pcmcia_write_config_byte() writes a byte to a configuration register in
55 static inline int pcmcia_write_config_byte(struct pcmcia_device *p_dev, off_t where, u8 val)
57 conf_reg_t reg = { 0, CS_WRITE, where, val };
58 return pcmcia_access_configuration_register(p_dev, ®);
61 struct pm_qos_request_list {
66 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
68 #define pm_qos_add_request(_req, _class, _value) do { \
69 (_req)->request = #_req; \
70 (_req)->qos = _class; \
71 pm_qos_add_requirement((_class), (_req)->request, (_value)); \
74 #define pm_qos_update_request(_req, _value) \
75 pm_qos_update_requirement((_req)->qos, (_req)->request, (_value))
77 #define pm_qos_remove_request(_req) \
78 pm_qos_remove_requirement((_req)->qos, (_req)->request)
82 #define pm_qos_add_request(_req, _class, _value) do { \
83 (_req)->request = pm_qos_add_request((_class), (_value)); \
86 #define pm_qos_update_request(_req, _value) \
87 pm_qos_update_request((_req)->request, (_value))
89 #define pm_qos_remove_request(_req) \
90 pm_qos_remove_request((_req)->request)
95 * Dummy printk for disabled debugging statements to use whilst maintaining
96 * gcc's format and side-effect checking.
98 static inline __attribute__ ((format (printf, 1, 2)))
99 int no_printk(const char *s, ...) { return 0; }
101 #ifndef alloc_workqueue
102 #define alloc_workqueue(name, flags, max_active) __create_workqueue(name, flags, max_active, 0)
105 #define EXTPROC 0200000
106 #define TIOCPKT_IOCTL 64
108 static inline void tty_lock(void) __acquires(kernel_lock)
110 #ifdef CONFIG_LOCK_KERNEL
111 /* kernel_locked is 1 for !CONFIG_LOCK_KERNEL */
112 WARN_ON(kernel_locked());
116 static inline void tty_unlock(void) __releases(kernel_lock)
120 #define tty_locked() (kernel_locked())
122 #define usleep_range(_min, _max) msleep((_max) / 1000)
123 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) */
125 #endif /* LINUX_26_36_COMPAT_H */