95 lines
2.7 KiB
C
95 lines
2.7 KiB
C
#ifndef LINUX_3_2_COMPAT_H
|
|
#define LINUX_3_2_COMPAT_H
|
|
|
|
#include <linux/version.h>
|
|
|
|
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0))
|
|
|
|
#include <linux/skbuff.h>
|
|
#include <linux/dma-mapping.h>
|
|
|
|
/* backports b4625dab */
|
|
#define SDIO_CCCR_REV_3_00 3 /* CCCR/FBR Version 3.00 */
|
|
#define SDIO_SDIO_REV_3_00 4 /* SDIO Spec Version 3.00 */
|
|
|
|
#define PMSG_IS_AUTO(msg) (((msg).event & PM_EVENT_AUTO) != 0)
|
|
|
|
/* mask skb_frag_page as RHEL6 backports this */
|
|
#define skb_frag_page(a) compat_skb_frag_page(a)
|
|
|
|
/**
|
|
* skb_frag_page - retrieve the page refered to by a paged fragment
|
|
* @frag: the paged fragment
|
|
*
|
|
* Returns the &struct page associated with @frag.
|
|
*/
|
|
static inline struct page *skb_frag_page(const skb_frag_t *frag)
|
|
{
|
|
return frag->page;
|
|
}
|
|
|
|
/* mask skb_frag_dma_map as RHEL6 backports this */
|
|
#define skb_frag_dma_map(a,b,c,d,e) compat_skb_frag_dma_map(a,b,c,d,e)
|
|
|
|
/**
|
|
* skb_frag_dma_map - maps a paged fragment via the DMA API
|
|
* @device: the device to map the fragment to
|
|
* @frag: the paged fragment to map
|
|
* @offset: the offset within the fragment (starting at the
|
|
* fragment's own offset)
|
|
* @size: the number of bytes to map
|
|
* @direction: the direction of the mapping (%PCI_DMA_*)
|
|
*
|
|
* Maps the page associated with @frag to @device.
|
|
*/
|
|
static inline dma_addr_t skb_frag_dma_map(struct device *dev,
|
|
const skb_frag_t *frag,
|
|
size_t offset, size_t size,
|
|
enum dma_data_direction dir)
|
|
{
|
|
return dma_map_page(dev, skb_frag_page(frag),
|
|
frag->page_offset + offset, size, dir);
|
|
}
|
|
|
|
#define ETH_P_TDLS 0x890D /* TDLS */
|
|
|
|
/* mask skb_frag_size as RHEL6 backports this */
|
|
#define skb_frag_size(a) compat_skb_frag_size(a)
|
|
|
|
static inline unsigned int skb_frag_size(const skb_frag_t *frag)
|
|
{
|
|
return frag->size;
|
|
}
|
|
|
|
static inline char *hex_byte_pack(char *buf, u8 byte)
|
|
{
|
|
*buf++ = hex_asc_hi(byte);
|
|
*buf++ = hex_asc_lo(byte);
|
|
return buf;
|
|
}
|
|
|
|
/* module_platform_driver() - Helper macro for drivers that don't do
|
|
* anything special in module init/exit. This eliminates a lot of
|
|
* boilerplate. Each module may only use this macro once, and
|
|
* calling it replaces module_init() and module_exit()
|
|
*/
|
|
#define module_platform_driver(__platform_driver) \
|
|
module_driver(__platform_driver, platform_driver_register, \
|
|
platform_driver_unregister)
|
|
|
|
static inline void *dma_zalloc_coherent(struct device *dev, size_t size,
|
|
dma_addr_t *dma_handle, gfp_t flag)
|
|
{
|
|
void *ret = dma_alloc_coherent(dev, size, dma_handle, flag);
|
|
if (ret)
|
|
memset(ret, 0, size);
|
|
return ret;
|
|
}
|
|
|
|
extern int __netdev_printk(const char *level, const struct net_device *dev,
|
|
struct va_format *vaf);
|
|
|
|
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)) */
|
|
|
|
#endif /* LINUX_3_2_COMPAT_H */
|