]> git.baikalelectronics.ru Git - kernel.git/commit
iio: light: cm32181: Fix PM support on system with 2 I2C resources
authorKai-Heng Feng <kai.heng.feng@canonical.com>
Wed, 18 Jan 2023 17:04:22 +0000 (01:04 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2023 10:28:18 +0000 (11:28 +0100)
commit640a526320419d3baaa8186be493df3d215f0db5
tree4c4f6c6ad39c70bfd498b9ca3233bd0ec5ec4eea
parent90fa4be4e2b30182c7dce57b1400d6842aec58bb
iio: light: cm32181: Fix PM support on system with 2 I2C resources

commit ee3c5b644a0fdcfed27515a39fb2dd3a016704c1 upstream.

Commit 766fa44b16cd ("iio: light: cm32181: Handle CM3218 ACPI devices
with 2 I2C resources") creates a second client for the actual I2C
address, but the "struct device" passed to PM ops is the first I2C
client that can't talk to the sensor.

That means the I2C transfers in both suspend and resume routines can
fail and blocking the whole suspend process.

Instead of using the first client for I2C transfer, use the I2C client
stored in the cm32181 private struct so the PM ops can get the correct
I2C client to really talk to the sensor device.

Fixes: 32464906eb8e ("iio: light: cm32181: Add PM support")
BugLink: https://bugs.launchpad.net/bugs/1988346
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2152281
Tested-by: Wahaj <wahajaved@protonmail.com>
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230118170422.339619-1-kai.heng.feng@canonical.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/light/cm32181.c