i2c: core: fix lockdep warning for sparsely nested adapter chain
authorDaniel Mack <daniel@zonque.org>
Wed, 18 Oct 2023 09:46:13 +0000 (11:46 +0200)
committerWolfram Sang <wsa@kernel.org>
Sat, 28 Oct 2023 12:47:49 +0000 (14:47 +0200)
commit53801d2e762a611d972e91d151df56c3412ca5cf
tree31d84bdd47d81cd1ea2cac81dd01ef0a614960dd
parent702c0dd7bcf169c44cb4a67447532861877c2744
i2c: core: fix lockdep warning for sparsely nested adapter chain

When adapters are chained in a sparse manner (with intermediate MFD devices,
for instance) the code currently fails to use the correct subclass for
the adapter's bus_lock which leads to false-positive lockdep warnings.

Fix this by walking the entire pedigree of the device and count all
adapters along the way instead of just checking the immediate parent.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/i2c-core-base.c