linux-yocto/include/linux/platform_data
Chen-Yu Tsai 8a394c7ed7 platform/chrome: cros_ec: Use per-device lockdep key
[ Upstream commit 961a325bec ]

Lockdep reports a bogus possible deadlock on MT8192 Chromebooks due to
the following lock sequences:

1. lock(i2c_register_adapter) [1]; lock(&ec_dev->lock)
2. lock(&ec_dev->lock); lock(prepare_lock);

The actual dependency chains are much longer. The shortened version
looks somewhat like:

1. cros-ec-rpmsg on mtk-scp
   ec_dev->lock -> prepare_lock
2. In rt5682_i2c_probe() on native I2C bus:
   prepare_lock -> regmap->lock -> (possibly) i2c_adapter->bus_lock
3. In rt5682_i2c_probe() on native I2C bus:
   regmap->lock -> i2c_adapter->bus_lock
4. In sbs_probe() on i2c-cros-ec-tunnel I2C bus attached on cros-ec:
   i2c_adapter->bus_lock -> ec_dev->lock

While lockdep is correct that the shared lockdep classes have a circular
dependency, it is bogus because

  a) 2+3 happen on a native I2C bus
  b) 4 happens on the actual EC on ChromeOS devices
  c) 1 happens on the SCP coprocessor on MediaTek Chromebooks that just
     happens to expose a cros-ec interface, but does not have an
     i2c-cros-ec-tunnel I2C bus

In short, the "dependencies" are actually on different devices.

Setup a per-device lockdep key for cros_ec devices so lockdep can tell
the two instances apart. This helps with getting rid of the bogus
lockdep warning. For ChromeOS devices that only have one cros-ec
instance this doesn't change anything.

Also add a missing mutex_destroy, just to make the teardown complete.

[1] This is likely the per I2C bus lock with shared lockdep class

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20230111074146.2624496-1-wenst@chromium.org
Stable-dep-of: e237495346 ("platform/chrome: cros_ec: Unregister notifier in cros_ec_unregister()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-08-28 16:26:11 +02:00
..
gpio
media
txx9
x86
ad5449.h
ad5761.h
ad7266.h
ad7791.h
ad7793.h
ad7887.h
adau17x1.h
adp8860.h
adp8870.h
ads7828.h
ams-delta-fiq.h
apds990x.h
arm-ux500-pm.h
asoc-imx-ssi.h
asoc-kirkwood.h
asoc-palm27x.h
asoc-poodle.h
asoc-pxa.h
asoc-s3c.h
asoc-s3c24xx_simtec.h
asoc-ti-mcbsp.h
asoc-ux500-msp.h
ata-pxa.h
ata-samsung_cf.h
atmel.h
b53.h
bcm7038_wdt.h
bcmgenet.h
bd6107.h
bh1770glc.h
brcmfmac.h
brcmnand.h
clk-da8xx-cfgchip.h
clk-davinci-pll.h
clk-fch.h
clk-s3c2410.h
cpuidle-exynos.h
cros_ec_chardev.h
cros_ec_commands.h
cros_ec_proto.h
cros_ec_sensorhub.h
cros_usbpd_notify.h
crypto-ux500.h
cyttsp4.h
davinci_asp.h
davinci-cpufreq.h
dma-dw.h
dma-ep93xx.h
dma-hsu.h
dma-iop32x.h
dma-mcf-edma.h
dma-mmp_tdma.h
dma-mv_xor.h
dma-s3c24xx.h
dma-ste-dma40.h
dmtimer-omap.h
ds620.h
dsa.h
edma.h
elm.h
emc2305.h
emif_plat.h
eth-ep93xx.h
fb-s3c2410.h
g762.h
gpio_backlight.h
gpio-ath79.h
gpio-davinci.h
gpio-htc-egpio.h
gpio-omap.h
gpmc-omap.h
gsc_hwmon.h
hirschmann-hellcreek.h
hsmmc-omap.h
hwmon-s3c.h
i2c-davinci.h
i2c-gpio.h
i2c-imx.h
i2c-mux-gpio.h
i2c-mux-reg.h
i2c-ocores.h
i2c-omap.h
i2c-pca-platform.h
i2c-pxa.h
i2c-s3c2410.h
i2c-xiic.h
ina2xx.h
intel-mid_wdt.h
invensense_mpu6050.h
iommu-omap.h
irda-pxaficp.h
irda-sa11x0.h
isl9305.h
itco_wdt.h
keyboard-pxa930_rotary.h
keyboard-spear.h
keypad-ep93xx.h
keypad-nomadik-ske.h
keypad-omap.h
keypad-pxa27x.h
keyscan-davinci.h
lcd-mipid.h
leds-lm355x.h
leds-lm3642.h
leds-lp55xx.h
leds-omap.h
leds-s3c24xx.h
lm3630a_bl.h
lm3639_bl.h
lm8323.h
lp855x.h
lp8727.h
lp8755.h
ltc4245.h
lv5207lp.h
max197.h
max732x.h
max3421-hcd.h
max6639.h
max6697.h
mcs.h
mdio-bcm-unimac.h
mdio-gpio.h
mfd-mcp-sa11x0.h
microchip-ksz.h
mlxcpld.h
mlxreg.h
mmc-davinci.h
mmc-esdhc-mcf.h
mmc-mxcmmc.h
mmc-omap.h
mmc-pxamci.h
mmc-s3cmci.h
mmc-sdhci-s3c.h
mmp_audio.h
mmp_dma.h
mouse-pxa930_trkball.h
mtd-davinci-aemif.h
mtd-davinci.h
mtd-nand-omap2.h
mtd-nand-pxa3xx.h
mtd-nand-s3c2410.h
mtd-orion_nand.h
mv_usb.h
mv88e6xxx.h
net-cw1200.h
nfcmrvl.h
omap-twl4030.h
omap-wd-timer.h
omap1_bl.h
omapdss.h
pca953x.h
pcf857x.h
phy-da8xx-usb.h
pinctrl-single.h
pm33xx.h
pxa_sdhci.h
pxa2xx_udc.h
regulator-haptic.h
rtc-ds2404.h
rtc-v3020.h
s3c-hsotg.h
s3c-hsudc.h
sa11x0-serial.h
sc18is602.h
sdhci-pic32.h
serial-omap.h
serial-sccnxp.h
sgi-w1.h
sh_mmcif.h
shmob_drm.h
sht3x.h
shtc1.h
si5351.h
simplefb.h
spi-davinci.h
spi-ep93xx.h
spi-mt65xx.h
spi-omap2-mcspi.h
spi-s3c64xx.h
st_sensors_pdata.h
st33zp24.h
syscon.h
tda9950.h
ti-aemif.h
ti-prm.h
ti-sysc.h
touchscreen-s3c2410.h
tps68470.h
tsc2007.h
tsl2563.h
tsl2772.h
uio_dmem_genirq.h
uio_pruss.h
usb-davinci.h
usb-ehci-orion.h
usb-musb-ux500.h
usb-ohci-pxa27x.h
usb-ohci-s3c2410.h
usb-omap.h
usb-omap1.h
usb-pxa3xx-ulpi.h
usb-s3c2410_udc.h
usb3503.h
video_s3c.h
video-ep93xx.h
video-mx3fb.h
video-pxafb.h
voltage-omap.h
wilco-ec.h
wiznet.h
wkup_m3.h
xilinx-ll-temac.h
xtalk-bridge.h
zforce_ts.h