* [RFC][PATCH] b43: correctly display longer chipsets ids
@ 2011-07-16 23:52 Rafał Miłecki
2011-07-18 16:58 ` Pavel Roskin
0 siblings, 1 reply; 2+ messages in thread
From: Rafał Miłecki @ 2011-07-16 23:52 UTC (permalink / raw)
To: linux-wireless, b43-dev; +Cc: 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_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(-)
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 22f20e1..549555e 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -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;
}
--
1.7.3.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RFC][PATCH] b43: correctly display longer chipsets ids
2011-07-16 23:52 [RFC][PATCH] b43: correctly display longer chipsets ids Rafał Miłecki
@ 2011-07-18 16:58 ` Pavel Roskin
0 siblings, 0 replies; 2+ messages in thread
From: Pavel Roskin @ 2011-07-18 16:58 UTC (permalink / raw)
To: Rafał Miłecki; +Cc: linux-wireless, b43-dev
On 07/16/2011 07:52 PM, Rafał Miłecki wrote:
> 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"
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.
--
Regards,
Pavel Roskin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-07-18 16:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-16 23:52 [RFC][PATCH] b43: correctly display longer chipsets ids Rafał Miłecki
2011-07-18 16:58 ` Pavel Roskin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).