diff options
author | Pavel Roskin <proski@gnu.org> | 2010-01-29 17:22:26 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-02-01 15:40:04 -0500 |
commit | 991a0987d9e821df1790bbbc368cf36db0c678d3 (patch) | |
tree | e261098e166f8035868f60b62f9329d4bb2a5a38 /drivers | |
parent | f643e51d717b52ac28830e8bb98559b006a73bf4 (diff) |
ath9k: allocate string buffer in read_file_dma() by kmalloc()
Using stack for that causes warnings with CONFIG_FRAME_WARN=1024
Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/debug.c | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index 9489b6b25b5f..42d2a506845a 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -75,17 +75,24 @@ static const struct file_operations fops_debug = { | |||
75 | 75 | ||
76 | #endif | 76 | #endif |
77 | 77 | ||
78 | #define DMA_BUF_LEN 1024 | ||
79 | |||
78 | static ssize_t read_file_dma(struct file *file, char __user *user_buf, | 80 | static ssize_t read_file_dma(struct file *file, char __user *user_buf, |
79 | size_t count, loff_t *ppos) | 81 | size_t count, loff_t *ppos) |
80 | { | 82 | { |
81 | struct ath_softc *sc = file->private_data; | 83 | struct ath_softc *sc = file->private_data; |
82 | struct ath_hw *ah = sc->sc_ah; | 84 | struct ath_hw *ah = sc->sc_ah; |
83 | char buf[1024]; | 85 | char *buf; |
86 | int retval; | ||
84 | unsigned int len = 0; | 87 | unsigned int len = 0; |
85 | u32 val[ATH9K_NUM_DMA_DEBUG_REGS]; | 88 | u32 val[ATH9K_NUM_DMA_DEBUG_REGS]; |
86 | int i, qcuOffset = 0, dcuOffset = 0; | 89 | int i, qcuOffset = 0, dcuOffset = 0; |
87 | u32 *qcuBase = &val[0], *dcuBase = &val[4]; | 90 | u32 *qcuBase = &val[0], *dcuBase = &val[4]; |
88 | 91 | ||
92 | buf = kmalloc(DMA_BUF_LEN, GFP_KERNEL); | ||
93 | if (!buf) | ||
94 | return 0; | ||
95 | |||
89 | ath9k_ps_wakeup(sc); | 96 | ath9k_ps_wakeup(sc); |
90 | 97 | ||
91 | REG_WRITE_D(ah, AR_MACMISC, | 98 | REG_WRITE_D(ah, AR_MACMISC, |
@@ -93,20 +100,20 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf, | |||
93 | (AR_MACMISC_MISC_OBS_BUS_1 << | 100 | (AR_MACMISC_MISC_OBS_BUS_1 << |
94 | AR_MACMISC_MISC_OBS_BUS_MSB_S))); | 101 | AR_MACMISC_MISC_OBS_BUS_MSB_S))); |
95 | 102 | ||
96 | len += snprintf(buf + len, sizeof(buf) - len, | 103 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
97 | "Raw DMA Debug values:\n"); | 104 | "Raw DMA Debug values:\n"); |
98 | 105 | ||
99 | for (i = 0; i < ATH9K_NUM_DMA_DEBUG_REGS; i++) { | 106 | for (i = 0; i < ATH9K_NUM_DMA_DEBUG_REGS; i++) { |
100 | if (i % 4 == 0) | 107 | if (i % 4 == 0) |
101 | len += snprintf(buf + len, sizeof(buf) - len, "\n"); | 108 | len += snprintf(buf + len, DMA_BUF_LEN - len, "\n"); |
102 | 109 | ||
103 | val[i] = REG_READ_D(ah, AR_DMADBG_0 + (i * sizeof(u32))); | 110 | val[i] = REG_READ_D(ah, AR_DMADBG_0 + (i * sizeof(u32))); |
104 | len += snprintf(buf + len, sizeof(buf) - len, "%d: %08x ", | 111 | len += snprintf(buf + len, DMA_BUF_LEN - len, "%d: %08x ", |
105 | i, val[i]); | 112 | i, val[i]); |
106 | } | 113 | } |
107 | 114 | ||
108 | len += snprintf(buf + len, sizeof(buf) - len, "\n\n"); | 115 | len += snprintf(buf + len, DMA_BUF_LEN - len, "\n\n"); |
109 | len += snprintf(buf + len, sizeof(buf) - len, | 116 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
110 | "Num QCU: chain_st fsp_ok fsp_st DCU: chain_st\n"); | 117 | "Num QCU: chain_st fsp_ok fsp_st DCU: chain_st\n"); |
111 | 118 | ||
112 | for (i = 0; i < ATH9K_NUM_QUEUES; i++, qcuOffset += 4, dcuOffset += 5) { | 119 | for (i = 0; i < ATH9K_NUM_QUEUES; i++, qcuOffset += 4, dcuOffset += 5) { |
@@ -120,7 +127,7 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf, | |||
120 | dcuBase++; | 127 | dcuBase++; |
121 | } | 128 | } |
122 | 129 | ||
123 | len += snprintf(buf + len, sizeof(buf) - len, | 130 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
124 | "%2d %2x %1x %2x %2x\n", | 131 | "%2d %2x %1x %2x %2x\n", |
125 | i, (*qcuBase & (0x7 << qcuOffset)) >> qcuOffset, | 132 | i, (*qcuBase & (0x7 << qcuOffset)) >> qcuOffset, |
126 | (*qcuBase & (0x8 << qcuOffset)) >> (qcuOffset + 3), | 133 | (*qcuBase & (0x8 << qcuOffset)) >> (qcuOffset + 3), |
@@ -128,35 +135,37 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf, | |||
128 | (*dcuBase & (0x1f << dcuOffset)) >> dcuOffset); | 135 | (*dcuBase & (0x1f << dcuOffset)) >> dcuOffset); |
129 | } | 136 | } |
130 | 137 | ||
131 | len += snprintf(buf + len, sizeof(buf) - len, "\n"); | 138 | len += snprintf(buf + len, DMA_BUF_LEN - len, "\n"); |
132 | 139 | ||
133 | len += snprintf(buf + len, sizeof(buf) - len, | 140 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
134 | "qcu_stitch state: %2x qcu_fetch state: %2x\n", | 141 | "qcu_stitch state: %2x qcu_fetch state: %2x\n", |
135 | (val[3] & 0x003c0000) >> 18, (val[3] & 0x03c00000) >> 22); | 142 | (val[3] & 0x003c0000) >> 18, (val[3] & 0x03c00000) >> 22); |
136 | len += snprintf(buf + len, sizeof(buf) - len, | 143 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
137 | "qcu_complete state: %2x dcu_complete state: %2x\n", | 144 | "qcu_complete state: %2x dcu_complete state: %2x\n", |
138 | (val[3] & 0x1c000000) >> 26, (val[6] & 0x3)); | 145 | (val[3] & 0x1c000000) >> 26, (val[6] & 0x3)); |
139 | len += snprintf(buf + len, sizeof(buf) - len, | 146 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
140 | "dcu_arb state: %2x dcu_fp state: %2x\n", | 147 | "dcu_arb state: %2x dcu_fp state: %2x\n", |
141 | (val[5] & 0x06000000) >> 25, (val[5] & 0x38000000) >> 27); | 148 | (val[5] & 0x06000000) >> 25, (val[5] & 0x38000000) >> 27); |
142 | len += snprintf(buf + len, sizeof(buf) - len, | 149 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
143 | "chan_idle_dur: %3d chan_idle_dur_valid: %1d\n", | 150 | "chan_idle_dur: %3d chan_idle_dur_valid: %1d\n", |
144 | (val[6] & 0x000003fc) >> 2, (val[6] & 0x00000400) >> 10); | 151 | (val[6] & 0x000003fc) >> 2, (val[6] & 0x00000400) >> 10); |
145 | len += snprintf(buf + len, sizeof(buf) - len, | 152 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
146 | "txfifo_valid_0: %1d txfifo_valid_1: %1d\n", | 153 | "txfifo_valid_0: %1d txfifo_valid_1: %1d\n", |
147 | (val[6] & 0x00000800) >> 11, (val[6] & 0x00001000) >> 12); | 154 | (val[6] & 0x00000800) >> 11, (val[6] & 0x00001000) >> 12); |
148 | len += snprintf(buf + len, sizeof(buf) - len, | 155 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
149 | "txfifo_dcu_num_0: %2d txfifo_dcu_num_1: %2d\n", | 156 | "txfifo_dcu_num_0: %2d txfifo_dcu_num_1: %2d\n", |
150 | (val[6] & 0x0001e000) >> 13, (val[6] & 0x001e0000) >> 17); | 157 | (val[6] & 0x0001e000) >> 13, (val[6] & 0x001e0000) >> 17); |
151 | 158 | ||
152 | len += snprintf(buf + len, sizeof(buf) - len, "pcu observe: 0x%x \n", | 159 | len += snprintf(buf + len, DMA_BUF_LEN - len, "pcu observe: 0x%x \n", |
153 | REG_READ_D(ah, AR_OBS_BUS_1)); | 160 | REG_READ_D(ah, AR_OBS_BUS_1)); |
154 | len += snprintf(buf + len, sizeof(buf) - len, | 161 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
155 | "AR_CR: 0x%x \n", REG_READ_D(ah, AR_CR)); | 162 | "AR_CR: 0x%x \n", REG_READ_D(ah, AR_CR)); |
156 | 163 | ||
157 | ath9k_ps_restore(sc); | 164 | ath9k_ps_restore(sc); |
158 | 165 | ||
159 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | 166 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); |
167 | kfree(buf); | ||
168 | return retval; | ||
160 | } | 169 | } |
161 | 170 | ||
162 | static const struct file_operations fops_dma = { | 171 | static const struct file_operations fops_dma = { |