1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18
19#include <linux/kernel.h>
20#include <linux/module.h>
21
22#include "ath.h"
23
24MODULE_AUTHOR("Atheros Communications");
25MODULE_DESCRIPTION("Shared library for Atheros wireless LAN cards.");
26MODULE_LICENSE("Dual BSD/GPL");
27
28struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
29 u32 len,
30 gfp_t gfp_mask)
31{
32 struct sk_buff *skb;
33 u32 off;
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 skb = __dev_alloc_skb(len + common->cachelsz - 1, gfp_mask);
49 if (skb != NULL) {
50 off = ((unsigned long) skb->data) % common->cachelsz;
51 if (off != 0)
52 skb_reserve(skb, common->cachelsz - off);
53 } else {
54 pr_err("skbuff alloc of size %u failed\n", len);
55 return NULL;
56 }
57
58 return skb;
59}
60EXPORT_SYMBOL(ath_rxbuf_alloc);
61
62void ath_printk(const char *level, const struct ath_common* common,
63 const char *fmt, ...)
64{
65 struct va_format vaf;
66 va_list args;
67
68 va_start(args, fmt);
69
70 vaf.fmt = fmt;
71 vaf.va = &args;
72
73 if (common && common->hw && common->hw->wiphy)
74 printk("%sath: %s: %pV",
75 level, wiphy_name(common->hw->wiphy), &vaf);
76 else
77 printk("%sath: %pV", level, &vaf);
78
79 va_end(args);
80}
81EXPORT_SYMBOL(ath_printk);
82