]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
iio: ltc2983: fix device probe
authorNuno Sá <nuno.sa@analog.com>
Wed, 11 Aug 2021 13:32:20 +0000 (15:32 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 15 Aug 2021 15:58:37 +0000 (16:58 +0100)
commitb76d26d69ecc97ebb24aaf40427a13c808a4f488
tree8e36b1a7b14ba7bb3a0916aec9203b74459d562f
parentd03a74bfaccefcf271bf8e889c31229aa521cd66
iio: ltc2983: fix device probe

There is no reason to assume that the IRQ rising edge (indicating that
the device start up phase is done) will happen after we request the IRQ.
If the device is already up by the time we request it, the call to
'wait_for_completion_timeout()' will timeout and we will fail the device
probe even though there's nothing wrong.

Fix it by just polling the status register until we get the indication that
the device is up and running. As a side effect of this fix, requesting the
IRQ is also moved to after the setup function.

Fixes: f110f3188e563 ("iio: temperature: Add support for LTC2983")
Reported-and-tested-by: Drew Fustini <drew@pdp7.com>
Reviewed-by: Drew Fustini <drew@pdp7.com>
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210811133220.190264-2-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/temperature/ltc2983.c