ASoC: rt5651: Move all jack-detect initialization to rt5651_set_jack_detect
authorHans de Goede <hdegoede@redhat.com>
Sun, 25 Feb 2018 10:46:43 +0000 (11:46 +0100)
committerMark Brown <broonie@kernel.org>
Thu, 1 Mar 2018 17:32:23 +0000 (17:32 +0000)
commitf06da4fdb5fc2b78d52f62c32aec65b7819178b0
tree638e0db40dd194988fca9ec4413ff8b0b1602e09
parent54e3a3a152a6f466f3a94b28be10f08b86905bc0
ASoC: rt5651: Move all jack-detect initialization to rt5651_set_jack_detect

Move all jack-detect initialization to rt5651_set_jack_detect. The main
reason to do this is so that platform code can setup jack-detect properties
after the device has been probed, which unfortunately is necessary on some
platforms.

This has 2 additional advantages:
1) Grouping all jack-detect init together makes it easier to follow what
is happening and results in a small reduction in the number of loc.
2) Before we would register the irq handler before rt5651->hp_jack was
assigned, leading to a potential NULL deref if the jack_detect work runs
before the machine driver has called set_jack.

Tested-by: Carlo Caione <carlo@endlessm.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/rt5651.c
sound/soc/codecs/rt5651.h