OpenCloudOS-Kernel/drivers/platform/chrome
Chen-Yu Tsai 961a325bec platform/chrome: cros_ec: Use per-device lockdep key
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
2023-01-13 09:30:50 +08:00
..
wilco_ec platform/chrome: use sysfs_emit() instead of scnprintf() 2022-12-26 11:14:34 +08:00
Kconfig platform/chrome: cros_ec_typec: Alter module name with hyphens 2023-01-09 20:32:53 +00:00
Makefile platform/chrome: cros_ec_typec: Add initial VDM support 2023-01-09 20:32:53 +00:00
chromeos_acpi.c platform/chrome: Add ChromeOS ACPI device driver 2022-05-13 19:42:30 +08:00
chromeos_laptop.c platform/chrome: fix double-free in chromeos_laptop_prepare() 2022-08-22 06:56:45 +00:00
chromeos_privacy_screen.c ACPI: make remove callback of ACPI driver void 2022-11-23 19:11:22 +01:00
chromeos_pstore.c chrome platform changes for 5.8 2020-06-04 10:54:45 -07:00
chromeos_tbmc.c platform/chrome: chromeos_tbmc: Report wake events 2019-09-12 16:01:35 +02:00
cros_ec.c platform/chrome: cros_ec: Use per-device lockdep key 2023-01-13 09:30:50 +08:00
cros_ec.h platform/chrome: cros_ec: Make cros_ec_unregister() return void 2022-02-09 13:00:43 +00:00
cros_ec_chardev.c platform/chrome: fix memory corruption in ioctl 2022-08-22 06:56:45 +00:00
cros_ec_debugfs.c platform/chrome: fix kernel-doc warnings for panic notifier 2023-01-13 09:30:49 +08:00
cros_ec_i2c.c platform/chrome: cros_ec: Convert to i2c's .probe_new() 2022-11-19 14:44:46 +08:00
cros_ec_ishtp.c platform/chrome: correct cros_ec_prepare_tx() usage 2022-05-16 10:01:51 +08:00
cros_ec_lightbar.c platform/chrome: use sysfs_emit() instead of scnprintf() 2022-12-26 11:14:34 +08:00
cros_ec_lpc.c platform/chrome: cros_ec_lpc: initialize the buf variable 2023-01-11 11:27:56 +08:00
cros_ec_lpc_mec.c platform/chrome: cros_ec_lpc_mec: remove cros_ec_lpc_mec_destroy() 2022-11-01 10:33:02 +08:00
cros_ec_lpc_mec.h platform/chrome: cros_ec_lpc_mec: remove cros_ec_lpc_mec_destroy() 2022-11-01 10:33:02 +08:00
cros_ec_proto.c platform/chrome: cros_ec_proto: Update version on GET_NEXT_EVENT failure 2022-08-15 03:24:49 +00:00
cros_ec_proto_test.c platform/chrome: cros_ec_proto: Use asm instead of asm-generic 2023-01-05 23:27:14 +08:00
cros_ec_rpmsg.c platform/chrome: correct cros_ec_prepare_tx() usage 2022-05-16 10:01:51 +08:00
cros_ec_sensorhub.c platform/chrome: cros_ec_sensorhub: simplify getting .driver_data 2021-09-27 09:18:58 +02:00
cros_ec_sensorhub_ring.c platform: chrome: Split trace include file 2022-03-31 16:56:29 -07:00
cros_ec_sensorhub_trace.h platform: chrome: Split trace include file 2022-03-31 16:56:29 -07:00
cros_ec_spi.c platform/chrome: cros_ec_spi: Set PROBE_PREFER_ASYNCHRONOUS 2022-11-02 12:28:47 +08:00
cros_ec_sysfs.c platform/chrome: use sysfs_emit_at() instead of scnprintf() 2022-12-26 16:14:53 +08:00
cros_ec_trace.c platform/chrome: cros_ec: Add command for regulator control. 2020-06-15 22:40:14 +01:00
cros_ec_trace.h platform/chrome: use macros for passthru indexes 2022-06-10 02:31:42 +00:00
cros_ec_typec.c platform/chrome: cros_typec_vdm: Add VDM reply support 2023-01-09 20:32:54 +00:00
cros_ec_typec.h platform/chrome: cros_ec_typec: Move structs to header 2023-01-09 20:32:53 +00:00
cros_ec_uart.c platform/chrome: cros_ec_uart: fix race condition 2023-01-05 23:27:14 +08:00
cros_ec_vbc.c platform/chrome: Constify static attribute_group structs 2021-01-20 16:19:17 +01:00
cros_hps_i2c.c platform/chrome: cros_hps_i2c: make remove callback return void 2022-10-19 09:52:08 +08:00
cros_kbd_led_backlight.c platform/chrome: cros_kbd_led_backlight: fix build warning 2022-07-20 01:22:59 +00:00
cros_kunit_util.c platform/chrome: cros_kunit_util: add default value for `msg->result` 2022-07-21 08:49:28 +00:00
cros_kunit_util.h platform/chrome: cros_kunit_util: add default value for `msg->result` 2022-07-21 08:49:28 +00:00
cros_typec_switch.c platform/chrome: cros_typec_switch: Check for retimer flag 2023-01-10 20:47:32 +00:00
cros_typec_vdm.c platform/chrome: cros_typec_vdm: Add VDM send support 2023-01-09 20:32:54 +00:00
cros_typec_vdm.h platform/chrome: cros_typec_vdm: Add VDM reply support 2023-01-09 20:32:54 +00:00
cros_usbpd_logger.c platform/chrome: cros_usbpd_logger: Add __printf annotation to append_str() 2020-05-04 14:02:01 -07:00
cros_usbpd_notify.c platform/chrome: cros_usbpd_notify: Fix error handling in cros_usbpd_notify_init() 2022-11-25 08:28:28 +00:00