b43: correctly display longer chipsets ids
RFC PATCH 1/1 b43: correctly display longer chipsets ids
Some of the newer Broadcom chipsets have longe names like BCM43224, BCM43225, etc. However Broadcom decided to keep using u16 for storing them. Use %X or %d depending on chip_id value to avoid BCMA8D8, etc.
---
Is there any nicer way of doing that? Currently I have whole string duplicated. Can we define part of the format using condition? Like (chip_id > 0x9999) ? "%d" : "%04X"
?
--- drivers/net/wireless/b43/main.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/net/wireless/b43/main.c +3 -1
@@ -5202,7 +5202,9 @@ static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev)INIT_WORK (&wl->tx_work, b43_tx_work);skb_queue_head_init (&wl->tx_queue); -b43info (wl,"Broadcom %04X WLAN found (core revision %u)\n" , +b43info (wl, (dev->chip_id >0x9999 ) ? +"Broadcom %d WLAN found (core revision %u)\n" : +"Broadcom %04X WLAN found (core revision %u)\n" , dev->chip_id, dev->core_rev);return wl; }
Signature · 1 line
1.7.3.4
Quoted 7 lines · Rafał Miłecki
Some of the newer Broadcom chipsets have longe names like BCM43224, BCM43225, etc. However Broadcom decided to keep using u16 for storing them. Use %X or %d depending on
chip_idvalue to avoid BCMA8D8, etc.
---
Is there any nicer way of doing that? Currently I have whole string duplicated. Can we define part of the format using condition? Like (chip_id>0x9999) ? "%d" : "%04X"
The standard way is snprintf(). The hacky way would be to convert numbers over 0x9999 to the numbers that would display in hex as the original numbers would show in decimal.
If we are only going to use those numbers in one place, I'd use snprintf(). If there are chances that the number would be used in many places, perhaps having the hex id representation would be justified.
Signature · 2 lines
Regards, Pavel Roskin