]> git.baikalelectronics.ru Git - uboot.git/commit
arm: mach-snapdrgon: misc: Simplify msm_generate_mac_addr()
authorStephan Gerhold <stephan@gerhold.net>
Tue, 3 Aug 2021 10:12:38 +0000 (12:12 +0200)
committerTom Rini <trini@konsulko.com>
Thu, 2 Sep 2021 13:48:20 +0000 (09:48 -0400)
commite8ad951a4c4ceebbfc4b7801170001e01d28ce5f
treece71ee31171edea80dd8efcc6c20742e35e20cb7
parent0168b4ba26d436e68b210ad9fca8dfd0a1eba7eb
arm: mach-snapdrgon: misc: Simplify msm_generate_mac_addr()

The logic in msm_generate_mac_addr() was originally taken from the LK
bootloader where the serial number is a string and must be parsed first.
However, in U-Boot msm_board_serial() returns an u32 and
msm_generate_mac_addr() has quite complicated code that will first
print it as a hex string and then immediately parse it again.

What this function actually does at the end is to put the serial number
encoded as big endian (the order used for the hex string) into the u8 *mac.
Use put_unaligned_be32() to do that with bit shifts instead of going
through the string format.

This should be slightly more efficient and cleaner but does not result
in any functional difference.

Cc: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
arch/arm/mach-snapdragon/misc.c