sunxi: Properly check for SATAPWR and MACPWR
authorAndre Przywara <andre.przywara@arm.com>
Mon, 18 Jan 2021 23:23:59 +0000 (23:23 +0000)
committerAndre Przywara <andre.przywara@arm.com>
Mon, 25 Jan 2021 21:52:00 +0000 (21:52 +0000)
commite9ad1b8dc5c7bae5213309af7c49907bac5def73
tree497dc5f877250abac83eeda177e4652f3f164d8a
parentc81877a919d2ae214650b4f10b862dd62f0284a7
sunxi: Properly check for SATAPWR and MACPWR

The #ifdef CONFIG_xxxPWR conditionals were not working as expected, as
string Kconfig symbols are always "defined" from the preprocessor's
perspective. This lead to unnecessary calls to the GPIO routines, but
also always added a half a second delay to wait for a SATA disk to power
up. Many thanks to Peter for pointing this out!

Fix this by properly comparing the Kconfig symbols against the empty
string. strcmp() would be nicer for this, but GCC does not optimise this
away, probably due to our standalone compiler switches.

Reported-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Samuel Holland <samuel@sholland.org> # Orange Pi WinPlus
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
board/sunxi/board.c