ath: make gcc check format arguments of ath_print(), fix all misuses
PATCH 1/2 ath: make gcc check format arguments of ath_print(), fix all misuses
Numeric channel is hard to get, so it won't be printed. Replace Mhz with MHz on the affected lines and add commas as needed.
Signed-off-by Pavel Roskin <[email protected]>
--- drivers/net/wireless/ath/ath9k/main.c | 6 +++--- drivers/net/wireless/ath/ath9k/recv.c | 2 +- drivers/net/wireless/ath/ath9k/xmit.c | 2 +- drivers/net/wireless/ath/debug.h | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +3 -3
@@ -204,7 +204,7 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, r =ath9k_hw_reset (ah, hchan, fastcc);if (r) {ath_print (common,ATH_DBG_FATAL , -"Unable to reset channel (%u Mhz) " +"Unable to reset channel (%u MHz), " "reset status %d\n" , channel->center_freq, r);spin_unlock_bh (&sc->sc_resetlock);
@@ -867,7 +867,7 @@ void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw) r =ath9k_hw_reset (ah, ah->curchan, false);if (r) {ath_print (common,ATH_DBG_FATAL , -"Unable to reset channel %u (%uMhz) " , +"Unable to reset channel (%u MHz), " "reset status %d\n" , channel->center_freq, r); }
@@ -922,7 +922,7 @@ void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw) r =ath9k_hw_reset (ah, ah->curchan, false);if (r) {ath_print (ath9k_hw_common (sc->sc_ah),ATH_DBG_FATAL , -"Unable to reset channel %u (%uMhz) " +"Unable to reset channel (%u MHz), " "reset status %d\n" , channel->center_freq, r); }
drivers/net/wireless/ath/ath9k/recv.c +1 -1
@@ -429,7 +429,7 @@ static void ath_rx_ps(struct ath_softc *sc, struct sk_buff *skb) sc->ps_flags &= ~PS_WAIT_FOR_PSPOLL_DATA ; ath_print(common, ATH_DBG_PS, "Going back to sleep after having received " - "PS-Poll data (0x%x)\n", + "PS-Poll data (0x%lx)\n", sc->ps_flags & (PS_WAIT_FOR_BEACON | PS_WAIT_FOR_CAB | PS_WAIT_FOR_PSPOLL_DATA |
drivers/net/wireless/ath/ath9k/xmit.c +1 -1
@@ -1857,7 +1857,7 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, sc->ps_flags &= ~PS_WAIT_FOR_TX_ACK ; ath_print(common, ATH_DBG_PS, "Going back to sleep after having " - "received TX status (0x%x)\n", + "received TX status (0x%lx)\n", sc->ps_flags & (PS_WAIT_FOR_BEACON | PS_WAIT_FOR_CAB | PS_WAIT_FOR_PSPOLL_DATA |
drivers/net/wireless/ath/debug.h +4 -4
@@ -65,11 +65,11 @@ enum ATH_DEBUG {#define ATH_DBG_DEFAULT (ATH_DBG_FATAL)#ifdef CONFIG_ATH_DEBUG -void ath_print (struct ath_common *common,int dbg_mask,const char *fmt, ...); +void ath_print (struct ath_common *common,int dbg_mask,const char *fmt, ...) + __attribute__ ((format (printf,3 ,4 )));#else -static inline void ath_print (struct ath_common *common, -int dbg_mask, -const char *fmt, ...) +static inline void __attribute__ ((format (printf,3 ,4 ))) +ath_print (struct ath_common *common,int dbg_mask,const char *fmt, ...) { }#endif /* CONFIG_ATH_DEBUG */
PATCH 2/2 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 <[email protected]>
--- drivers/net/wireless/ath/ath9k/debug.c | 43 +++++++++++++++++++------------- 1 files changed, 26 insertions(+), 17 deletions(-)
drivers/net/wireless/ath/ath9k/debug.c +26 -17
@@ -75,17 +75,24 @@ static const struct file_operations fops_debug = {#endif +#define DMA_BUF_LEN 1024 +static ssize_t read_file_dma (struct file *file,char __user *user_buf,size_t count,loff_t *ppos) {struct ath_softc *sc = file->private_data;struct ath_hw *ah = sc->sc_ah; -char buf[1024 ]; +char *buf; +int retval;unsigned int len =0 ;u32 val[ATH9K_NUM_DMA_DEBUG_REGS ];int i, qcuOffset =0 , dcuOffset =0 ;u32 *qcuBase = &val[0 ], *dcuBase = &val[4 ]; + buf =kmalloc (DMA_BUF_LEN ,GFP_KERNEL ); +if (!buf) +return 0 ; +ath9k_ps_wakeup (sc); REG_WRITE_D(ah, AR_MACMISC,
@@ -93,20 +100,20 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf, (AR_MACMISC_MISC_OBS_BUS_1 << AR_MACMISC_MISC_OBS_BUS_MSB_S))); - len +=snprintf (buf + len,sizeof (buf) - len, + len +=snprintf (buf + len,DMA_BUF_LEN - len,"Raw DMA Debug values:\n" );for (i =0 ; i <ATH9K_NUM_DMA_DEBUG_REGS ; i++) {if (i %4 ==0 ) - len +=snprintf (buf + len,sizeof (buf) - len,"\n" ); + len +=snprintf (buf + len,DMA_BUF_LEN - len,"\n" ); val[i] =REG_READ_D (ah,AR_DMADBG_0 + (i *sizeof (u32))); - len +=snprintf (buf + len,sizeof (buf) - len,"%d: %08x " , + len +=snprintf (buf + len,DMA_BUF_LEN - len,"%d: %08x " , i, val[i]); } - len +=snprintf (buf + len,sizeof (buf) - len,"\n\n" ); - len +=snprintf (buf + len,sizeof (buf) - len, + len +=snprintf (buf + len,DMA_BUF_LEN - len,"\n\n" ); + len +=snprintf (buf + len,DMA_BUF_LEN - len,"Num QCU: chain_st fsp_ok fsp_st DCU: chain_st\n" );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, dcuBase++; } - len += snprintf(buf + len, sizeof(buf) - len, + len += snprintf(buf + len, DMA_BUF_LEN - len, "%2d %2x %1x %2x %2x\n", i, (*qcuBase & (0x7 << qcuOffset)) >> qcuOffset, (*qcuBase & (0x8 << qcuOffset)) >> (qcuOffset + 3),
@@ -128,35 +135,37 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf, (*dcuBase & (0x1f << dcuOffset)) >> dcuOffset); } - len +=snprintf (buf + len,sizeof (buf) - len,"\n" ); + len +=snprintf (buf + len,DMA_BUF_LEN - len,"\n" ); - len +=snprintf (buf + len,sizeof (buf) - len, + len +=snprintf (buf + len,DMA_BUF_LEN - len,"qcu_stitch state: %2x qcu_fetch state: %2x\n" , (val[3 ] &0x003c0000 ) >>18 , (val[3 ] &0x03c00000 ) >>22 ); - len +=snprintf (buf + len,sizeof (buf) - len, + len +=snprintf (buf + len,DMA_BUF_LEN - len,"qcu_complete state: %2x dcu_complete state: %2x\n" , (val[3 ] &0x1c000000 ) >>26 , (val[6 ] &0x3 )); - len +=snprintf (buf + len,sizeof (buf) - len, + len +=snprintf (buf + len,DMA_BUF_LEN - len,"dcu_arb state: %2x dcu_fp state: %2x\n" , (val[5 ] &0x06000000 ) >>25 , (val[5 ] &0x38000000 ) >>27 ); - len +=snprintf (buf + len,sizeof (buf) - len, + len +=snprintf (buf + len,DMA_BUF_LEN - len,"chan_idle_dur: %3d chan_idle_dur_valid: %1d\n" , (val[6 ] &0x000003fc ) >>2 , (val[6 ] &0x00000400 ) >>10 ); - len +=snprintf (buf + len,sizeof (buf) - len, + len +=snprintf (buf + len,DMA_BUF_LEN - len,"txfifo_valid_0: %1d txfifo_valid_1: %1d\n" , (val[6 ] &0x00000800 ) >>11 , (val[6 ] &0x00001000 ) >>12 ); - len +=snprintf (buf + len,sizeof (buf) - len, + len +=snprintf (buf + len,DMA_BUF_LEN - len,"txfifo_dcu_num_0: %2d txfifo_dcu_num_1: %2d\n" , (val[6 ] &0x0001e000 ) >>13 , (val[6 ] &0x001e0000 ) >>17 ); - len +=snprintf (buf + len,sizeof (buf) - len,"pcu observe: 0x%x \n" , + len +=snprintf (buf + len,DMA_BUF_LEN - len,"pcu observe: 0x%x \n" ,REG_READ_D (ah,AR_OBS_BUS_1 )); - len +=snprintf (buf + len,sizeof (buf) - len, + len +=snprintf (buf + len,DMA_BUF_LEN - len,"AR_CR: 0x%x \n" ,REG_READ_D (ah,AR_CR ));ath9k_ps_restore (sc); -return simple_read_from_buffer (user_buf, count, ppos, buf, len); + retval =simple_read_from_buffer (user_buf, count, ppos, buf, len); +kfree (buf); +return retval; }static const struct file_operations fops_dma = {