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 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html