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 #define PMSG_IS_AUTO(msg) (((msg).event & PM_EVENT_AUTO) != 0)
14 * skb_frag_page - retrieve the page refered to by a paged fragment
15 * @frag: the paged fragment
17 * Returns the &struct page associated with @frag.
19 static inline struct page *skb_frag_page(const skb_frag_t *frag)
25 * skb_frag_dma_map - maps a paged fragment via the DMA API
26 * @device: the device to map the fragment to
27 * @frag: the paged fragment to map
28 * @offset: the offset within the fragment (starting at the
29 * fragment's own offset)
30 * @size: the number of bytes to map
31 * @direction: the direction of the mapping (%PCI_DMA_*)
33 * Maps the page associated with @frag to @device.
35 static inline dma_addr_t skb_frag_dma_map(struct device *dev,
36 const skb_frag_t *frag,
37 size_t offset, size_t size,
38 enum dma_data_direction dir)
40 return dma_map_page(dev, skb_frag_page(frag),
41 frag->page_offset + offset, size, dir);
44 #define ETH_P_TDLS 0x890D /* TDLS */
46 static inline unsigned int skb_frag_size(const skb_frag_t *frag)
51 static inline char *hex_byte_pack(char *buf, u8 byte)
53 *buf++ = hex_asc_hi(byte);
54 *buf++ = hex_asc_lo(byte);
58 /* module_platform_driver() - Helper macro for drivers that don't do
59 * anything special in module init/exit. This eliminates a lot of
60 * boilerplate. Each module may only use this macro once, and
61 * calling it replaces module_init() and module_exit()
63 #define module_platform_driver(__platform_driver) \
64 module_driver(__platform_driver, platform_driver_register, \
65 platform_driver_unregister)
67 static inline void *dma_zalloc_coherent(struct device *dev, size_t size,
68 dma_addr_t *dma_handle, gfp_t flag)
70 void *ret = dma_alloc_coherent(dev, size, dma_handle, flag);
76 extern int __netdev_printk(const char *level, const struct net_device *dev,
77 struct va_format *vaf);
79 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)) */
81 #endif /* LINUX_3_2_COMPAT_H */