Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: cros_ec: Don't try to grab log when suspended

We should stop our worker thread while we're suspended. If we don't
then we'll get messages like:

cros-ec-spi spi5.0: spi transfer failed: -108
cros-ec-spi spi5.0: cs-deassert spi transfer failed: -108
cros-ec-ctl cros-ec-ctl.0.auto: EC communication failed

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Douglas Anderson and committed by
Lee Jones
44d99d73 eb3f2f23

+26
+4
drivers/mfd/cros_ec_dev.c
··· 466 466 { 467 467 struct cros_ec_dev *ec = dev_get_drvdata(dev); 468 468 469 + cros_ec_debugfs_suspend(ec); 470 + 469 471 lb_suspend(ec); 470 472 471 473 return 0; ··· 476 474 static __maybe_unused int ec_device_resume(struct device *dev) 477 475 { 478 476 struct cros_ec_dev *ec = dev_get_drvdata(dev); 477 + 478 + cros_ec_debugfs_resume(ec); 479 479 480 480 lb_resume(ec); 481 481
+20
drivers/platform/chrome/cros_ec_debugfs.c
··· 470 470 cros_ec_cleanup_console_log(ec->debug_info); 471 471 } 472 472 EXPORT_SYMBOL(cros_ec_debugfs_remove); 473 + 474 + void cros_ec_debugfs_suspend(struct cros_ec_dev *ec) 475 + { 476 + /* 477 + * cros_ec_debugfs_init() failures are non-fatal; it's also possible 478 + * that we initted things but decided that console log wasn't supported. 479 + * We'll use the same set of checks that cros_ec_debugfs_remove() + 480 + * cros_ec_cleanup_console_log() end up using to handle those cases. 481 + */ 482 + if (ec->debug_info && ec->debug_info->log_buffer.buf) 483 + cancel_delayed_work_sync(&ec->debug_info->log_poll_work); 484 + } 485 + EXPORT_SYMBOL(cros_ec_debugfs_suspend); 486 + 487 + void cros_ec_debugfs_resume(struct cros_ec_dev *ec) 488 + { 489 + if (ec->debug_info && ec->debug_info->log_buffer.buf) 490 + schedule_delayed_work(&ec->debug_info->log_poll_work, 0); 491 + } 492 + EXPORT_SYMBOL(cros_ec_debugfs_resume);
+2
include/linux/mfd/cros_ec.h
··· 327 327 /* debugfs stuff */ 328 328 int cros_ec_debugfs_init(struct cros_ec_dev *ec); 329 329 void cros_ec_debugfs_remove(struct cros_ec_dev *ec); 330 + void cros_ec_debugfs_suspend(struct cros_ec_dev *ec); 331 + void cros_ec_debugfs_resume(struct cros_ec_dev *ec); 330 332 331 333 #endif /* __LINUX_MFD_CROS_EC_H */