fix error output of brctl if bridging is not supported.
[openwrt.git] / package / mac80211 / patches / 500-ath9k_debugfs_chainmask.patch
1 --- a/drivers/net/wireless/ath/ath9k/debug.c
2 +++ b/drivers/net/wireless/ath/ath9k/debug.c
3 @@ -77,6 +77,90 @@ static const struct file_operations fops
4
5 #define DMA_BUF_LEN 1024
6
7 +static ssize_t read_file_tx_chainmask(struct file *file, char __user *user_buf,
8 + size_t count, loff_t *ppos)
9 +{
10 + struct ath_softc *sc = file->private_data;
11 + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
12 + char buf[32];
13 + unsigned int len;
14 +
15 + len = snprintf(buf, sizeof(buf), "0x%08x\n", common->tx_chainmask);
16 + return simple_read_from_buffer(user_buf, count, ppos, buf, len);
17 +}
18 +
19 +static ssize_t write_file_tx_chainmask(struct file *file, const char __user *user_buf,
20 + size_t count, loff_t *ppos)
21 +{
22 + struct ath_softc *sc = file->private_data;
23 + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
24 + unsigned long mask;
25 + char buf[32];
26 + ssize_t len;
27 +
28 + len = min(count, sizeof(buf) - 1);
29 + if (copy_from_user(buf, user_buf, len))
30 + return -EINVAL;
31 +
32 + buf[len] = '\0';
33 + if (strict_strtoul(buf, 0, &mask))
34 + return -EINVAL;
35 +
36 + common->tx_chainmask = mask;
37 + sc->sc_ah->caps.tx_chainmask = mask;
38 + return count;
39 +}
40 +
41 +static const struct file_operations fops_tx_chainmask = {
42 + .read = read_file_tx_chainmask,
43 + .write = write_file_tx_chainmask,
44 + .open = ath9k_debugfs_open,
45 + .owner = THIS_MODULE
46 +};
47 +
48 +
49 +static ssize_t read_file_rx_chainmask(struct file *file, char __user *user_buf,
50 + size_t count, loff_t *ppos)
51 +{
52 + struct ath_softc *sc = file->private_data;
53 + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
54 + char buf[32];
55 + unsigned int len;
56 +
57 + len = snprintf(buf, sizeof(buf), "0x%08x\n", common->rx_chainmask);
58 + return simple_read_from_buffer(user_buf, count, ppos, buf, len);
59 +}
60 +
61 +static ssize_t write_file_rx_chainmask(struct file *file, const char __user *user_buf,
62 + size_t count, loff_t *ppos)
63 +{
64 + struct ath_softc *sc = file->private_data;
65 + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
66 + unsigned long mask;
67 + char buf[32];
68 + ssize_t len;
69 +
70 + len = min(count, sizeof(buf) - 1);
71 + if (copy_from_user(buf, user_buf, len))
72 + return -EINVAL;
73 +
74 + buf[len] = '\0';
75 + if (strict_strtoul(buf, 0, &mask))
76 + return -EINVAL;
77 +
78 + common->rx_chainmask = mask;
79 + sc->sc_ah->caps.rx_chainmask = mask;
80 + return count;
81 +}
82 +
83 +static const struct file_operations fops_rx_chainmask = {
84 + .read = read_file_rx_chainmask,
85 + .write = write_file_rx_chainmask,
86 + .open = ath9k_debugfs_open,
87 + .owner = THIS_MODULE
88 +};
89 +
90 +
91 static ssize_t read_file_dma(struct file *file, char __user *user_buf,
92 size_t count, loff_t *ppos)
93 {
94 @@ -719,6 +803,16 @@ int ath9k_init_debug(struct ath_hw *ah)
95 goto err;
96 #endif
97
98 + sc->debug.debugfs_rx_chainmask = debugfs_create_file("rx_chainmask",
99 + S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_rx_chainmask);
100 + if (!sc->debug.debugfs_rx_chainmask)
101 + goto err;
102 +
103 + sc->debug.debugfs_tx_chainmask = debugfs_create_file("tx_chainmask",
104 + S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_tx_chainmask);
105 + if (!sc->debug.debugfs_tx_chainmask)
106 + goto err;
107 +
108 sc->debug.debugfs_dma = debugfs_create_file("dma", S_IRUSR,
109 sc->debug.debugfs_phy, sc, &fops_dma);
110 if (!sc->debug.debugfs_dma)
111 @@ -769,6 +863,8 @@ void ath9k_exit_debug(struct ath_hw *ah)
112 struct ath_common *common = ath9k_hw_common(ah);
113 struct ath_softc *sc = (struct ath_softc *) common->priv;
114
115 + debugfs_remove(sc->debug.debugfs_tx_chainmask);
116 + debugfs_remove(sc->debug.debugfs_rx_chainmask);
117 debugfs_remove(sc->debug.debugfs_recv);
118 debugfs_remove(sc->debug.debugfs_xmit);
119 debugfs_remove(sc->debug.debugfs_wiphy);
120 --- a/drivers/net/wireless/ath/ath9k/debug.h
121 +++ b/drivers/net/wireless/ath/ath9k/debug.h
122 @@ -148,6 +148,8 @@ struct ath_stats {
123 };
124
125 struct ath9k_debug {
126 + struct dentry *debugfs_rx_chainmask;
127 + struct dentry *debugfs_tx_chainmask;
128 struct dentry *debugfs_phy;
129 struct dentry *debugfs_debug;
130 struct dentry *debugfs_dma;
This page took 0.050668 seconds and 5 git commands to generate.