sunxi: axp221: Protect axp221_init against multiple calls
authorHans de Goede <hdegoede@redhat.com>
Sun, 11 Jan 2015 18:43:56 +0000 (19:43 +0100)
committerHans de Goede <hdegoede@redhat.com>
Wed, 14 Jan 2015 13:56:40 +0000 (14:56 +0100)
commit3c781190d11ca44752562867d76ccfb8d0a45ac3
tree3e3050046c066b150489eb43413bddeeea6c704b
parent52755b12e30e45501ccea9260d47a2b6aba12a91
sunxi: axp221: Protect axp221_init against multiple calls

The voltage setting code knows it needs to call axp221_init before calling
the various voltage setting functions.

But users of axp utility functions like axp221_get_sid() do not know this,
so the utility functions always call axp221_init() to ensure that the
p2wi / rsb setup magic has been done.

Since doing this repeatedly is quite expensive, add a check to axp221_init
so that it only does the initialization once.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
drivers/power/axp221.c