aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorArend van Spriel <arend@broadcom.com>2014-11-25 14:55:53 -0500
committerJohn W. Linville <linville@tuxdriver.com>2014-12-01 15:57:20 -0500
commit56f0b750fca748b8d13c883d9e947178f3d0162c (patch)
tree73317ba626cc89041f91b50776f7d481ca4718ea /drivers
parent87dd2d76a94b310c173943a7de9a8b6598af0c78 (diff)
brcmutil: add helper function to format board revision
The board revision that is available in hardware can be translated so it matches the labelling on the board. This is accomplished by this helper function. Reviewed-by: Hante Meuleman <meuleman@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/brcm80211/brcmutil/utils.c16
-rw-r--r--drivers/net/wireless/brcm80211/include/brcmu_utils.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmutil/utils.c b/drivers/net/wireless/brcm80211/brcmutil/utils.c
index 0f7e1c7b6f58..906e89ddf319 100644
--- a/drivers/net/wireless/brcm80211/brcmutil/utils.c
+++ b/drivers/net/wireless/brcm80211/brcmutil/utils.c
@@ -261,6 +261,21 @@ struct sk_buff *brcmu_pktq_mdeq(struct pktq *pq, uint prec_bmp,
261} 261}
262EXPORT_SYMBOL(brcmu_pktq_mdeq); 262EXPORT_SYMBOL(brcmu_pktq_mdeq);
263 263
264/* Produce a human-readable string for boardrev */
265char *brcmu_boardrev_str(u32 brev, char *buf)
266{
267 char c;
268
269 if (brev < 0x100) {
270 snprintf(buf, 8, "%d.%d", (brev & 0xf0) >> 4, brev & 0xf);
271 } else {
272 c = (brev & 0xf000) == 0x1000 ? 'P' : 'A';
273 snprintf(buf, 8, "%c%03x", c, brev & 0xfff);
274 }
275 return buf;
276}
277EXPORT_SYMBOL(brcmu_boardrev_str);
278
264#if defined(DEBUG) 279#if defined(DEBUG)
265/* pretty hex print a pkt buffer chain */ 280/* pretty hex print a pkt buffer chain */
266void brcmu_prpkt(const char *msg, struct sk_buff *p0) 281void brcmu_prpkt(const char *msg, struct sk_buff *p0)
@@ -292,4 +307,5 @@ void brcmu_dbg_hex_dump(const void *data, size_t size, const char *fmt, ...)
292 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, data, size); 307 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, data, size);
293} 308}
294EXPORT_SYMBOL(brcmu_dbg_hex_dump); 309EXPORT_SYMBOL(brcmu_dbg_hex_dump);
310
295#endif /* defined(DEBUG) */ 311#endif /* defined(DEBUG) */
diff --git a/drivers/net/wireless/brcm80211/include/brcmu_utils.h b/drivers/net/wireless/brcm80211/include/brcmu_utils.h
index 8ba445b3fd72..a043e29f07e2 100644
--- a/drivers/net/wireless/brcm80211/include/brcmu_utils.h
+++ b/drivers/net/wireless/brcm80211/include/brcmu_utils.h
@@ -218,4 +218,6 @@ void brcmu_dbg_hex_dump(const void *data, size_t size, const char *fmt, ...)
218} 218}
219#endif 219#endif
220 220
221char *brcmu_boardrev_str(u32 brev, char *buf);
222
221#endif /* _BRCMU_UTILS_H_ */ 223#endif /* _BRCMU_UTILS_H_ */