1 #ifndef LINUX_3_2_COMPAT_H
2 #define LINUX_3_2_COMPAT_H
4 #include <linux/version.h>
6 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0))
8 #include <linux/skbuff.h>
9 #include <linux/dma-mapping.h>
11 /* backports b4625dab */
12 #define SDIO_CCCR_REV_3_00 3 /* CCCR/FBR Version 3.00 */
13 #define SDIO_SDIO_REV_3_00 4 /* SDIO Spec Version 3.00 */
15 #define PMSG_IS_AUTO(msg) (((msg).event & PM_EVENT_AUTO) != 0)
18 * skb_frag_page - retrieve the page refered to by a paged fragment
19 * @frag: the paged fragment
21 * Returns the &struct page associated with @frag.
23 static inline struct page *skb_frag_page(const skb_frag_t *frag)
29 * skb_frag_dma_map - maps a paged fragment via the DMA API
30 * @device: the device to map the fragment to
31 * @frag: the paged fragment to map
32 * @offset: the offset within the fragment (starting at the
33 * fragment's own offset)
34 * @size: the number of bytes to map
35 * @direction: the direction of the mapping (%PCI_DMA_*)
37 * Maps the page associated with @frag to @device.
39 static inline dma_addr_t skb_frag_dma_map(struct device *dev,
40 const skb_frag_t *frag,
41 size_t offset, size_t size,
42 enum dma_data_direction dir)
44 return dma_map_page(dev, skb_frag_page(frag),
45 frag->page_offset + offset, size, dir);
48 #define ETH_P_TDLS 0x890D /* TDLS */
50 static inline unsigned int skb_frag_size(const skb_frag_t *frag)
55 static inline char *hex_byte_pack(char *buf, u8 byte)
57 *buf++ = hex_asc_hi(byte);
58 *buf++ = hex_asc_lo(byte);
62 /* module_platform_driver() - Helper macro for drivers that don't do
63 * anything special in module init/exit. This eliminates a lot of
64 * boilerplate. Each module may only use this macro once, and
65 * calling it replaces module_init() and module_exit()
67 #define module_platform_driver(__platform_driver) \
68 module_driver(__platform_driver, platform_driver_register, \
69 platform_driver_unregister)
71 static inline void *dma_zalloc_coherent(struct device *dev, size_t size,
72 dma_addr_t *dma_handle, gfp_t flag)
74 void *ret = dma_alloc_coherent(dev, size, dma_handle, flag);
80 extern int __netdev_printk(const char *level, const struct net_device *dev,
81 struct va_format *vaf);
83 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)) */
85 #endif /* LINUX_3_2_COMPAT_H */