OLD | NEW |
1 #ifndef LINUX_26_34_COMPAT_H | 1 #ifndef LINUX_26_34_COMPAT_H |
2 #define LINUX_26_34_COMPAT_H | 2 #define LINUX_26_34_COMPAT_H |
3 | 3 |
4 #include <linux/version.h> | 4 #include <linux/version.h> |
5 | 5 |
6 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)) | 6 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)) |
7 | 7 |
8 #include <linux/netdevice.h> | 8 #include <linux/netdevice.h> |
9 | 9 |
10 #define netdev_mc_count(dev) ((dev)->mc_count) | 10 #define netdev_mc_count(dev) ((dev)->mc_count) |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 if (0) \ | 135 if (0) \ |
136 netif_printk(KERN_DEBUG, dev, format, ##args); \ | 136 netif_printk(KERN_DEBUG, dev, format, ##args); \ |
137 0; \ | 137 0; \ |
138 }) | 138 }) |
139 #endif | 139 #endif |
140 /* source: include/linux/netdevice.h */ | 140 /* source: include/linux/netdevice.h */ |
141 | 141 |
142 | 142 |
143 static inline void device_lock(struct device *dev) | 143 static inline void device_lock(struct device *dev) |
144 { | 144 { |
| 145 #if defined(CONFIG_PREEMPT_RT) || defined(CONFIG_PREEMPT_DESKTOP) |
| 146 mutex_lock(&dev->mutex); |
| 147 #else |
145 down(&dev->sem); | 148 down(&dev->sem); |
| 149 #endif |
146 } | 150 } |
147 | 151 |
148 static inline int device_trylock(struct device *dev) | 152 static inline int device_trylock(struct device *dev) |
149 { | 153 { |
| 154 #if defined(CONFIG_PREEMPT_RT) || defined(CONFIG_PREEMPT_DESKTOP) |
| 155 return mutex_trylock(&dev->mutex); |
| 156 #else |
150 return down_trylock(&dev->sem); | 157 return down_trylock(&dev->sem); |
| 158 #endif |
151 } | 159 } |
152 | 160 |
153 static inline void device_unlock(struct device *dev) | 161 static inline void device_unlock(struct device *dev) |
154 { | 162 { |
| 163 #if defined(CONFIG_PREEMPT_RT) || defined(CONFIG_PREEMPT_DESKTOP) |
| 164 mutex_unlock(&dev->mutex); |
| 165 #else |
155 up(&dev->sem); | 166 up(&dev->sem); |
| 167 #endif |
156 } | 168 } |
157 | 169 |
158 #if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) | 170 #if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) |
159 #define PCMCIA_DEVICE_PROD_ID3(v3, vh3) { \ | 171 #define PCMCIA_DEVICE_PROD_ID3(v3, vh3) { \ |
160 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID3, \ | 172 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID3, \ |
161 .prod_id = { NULL, NULL, (v3), NULL }, \ | 173 .prod_id = { NULL, NULL, (v3), NULL }, \ |
162 .prod_id_hash = { 0, 0, (vh3), 0 }, } | 174 .prod_id_hash = { 0, 0, (vh3), 0 }, } |
163 #endif | 175 #endif |
164 | 176 |
165 #define rcu_dereference_check(p, c) rcu_dereference(p) | 177 #define rcu_dereference_check(p, c) rcu_dereference(p) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 { | 232 { |
221 if (!dma_supported(dev, mask)) | 233 if (!dma_supported(dev, mask)) |
222 return -EIO; | 234 return -EIO; |
223 dev->coherent_dma_mask = mask; | 235 dev->coherent_dma_mask = mask; |
224 return 0; | 236 return 0; |
225 } | 237 } |
226 | 238 |
227 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)) */ | 239 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)) */ |
228 | 240 |
229 #endif /* LINUX_26_34_COMPAT_H */ | 241 #endif /* LINUX_26_34_COMPAT_H */ |
OLD | NEW |