Chrome Platform fixes for v5.1-rc2

Two fixes:
 1. platform/chrome: Fix locking pattern in wilco_ec_mailbox()
 	- Closes a potential race condition in the new wilco_ec driver.
 2. platform/chrome: cros_ec_debugfs: cancel/schedule logging work only if supported
 	- Fixes a warning in cros_ec_debugfs on systems that do not support
 	  console logging, such as the Asus C201.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE6gYDF28Li+nEiKLaHwn1ewov5lgFAlyRMPgACgkQHwn1ewov
 5li4Qg/+PX4CWUuw1f1Jy00y//JDuzT06yuReeIE5a3Gq4O9u6tijeeZ5fUSFN3T
 9FhM3zQ52qdLRL3gK81iNF5Fat4bs8sMM+znAAuezZcBK5LBt7IJxXQI3KBJf1wX
 s33/9nnD+efLraQixESxGsfGRVVp3ocvYNxQsuxm3oUYY5kk8wPDYEcf59YtYF5E
 GHRFwo+HB06IapkBpXRPDsEsN1p5Ky9uYShvkS7Ad3Xuu/C2S9xjBxCbPwk7/xYF
 uY+NPJaPp+ndcp8lfvFlrn3jPYY0QrGPHncP6k7ZrELmAIQb2gOUiGDYv3HpkT7t
 jtMIxLShL64szOtMGNr17waAoK0Q/W/MfNKfgyLZjUCPFiRoClUiHm30NJJMP+yZ
 YIWH03T0pc5WtY7hr766L2gt2QMFmG4T/ITZOGz3KKgPcOBc5J3kAVQ8WFEA2QGX
 uPGui58QpZe5DSH1jsuuvRzxCgj+qT/QLKGbyBQKeUohCs2oKyq4m+NQ7UmPdYqU
 xBpidVWr51BJi/M6qEE5uPcbdBw+oURcjfTmkrsQjIaeMZu2Aev3sJQqHDFAk7H3
 niDgM55w+/Qx06UOayoYKlPBc2sULpWjCfzeOSpF3KuKY8hyO6Zo+4S1PB+8BzQC
 tME8dW+fOrA6/3Wg/HI8ixlOph7ukz576dAgCLnI0xIqE6M3wiA=
 =7sfA
 -----END PGP SIGNATURE-----

Merge tag 'tag-chrome-platform-fixes-for-v5.1-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux

Pull chrome platform fixes from Benson Leung:
 "Two fixes:

   - Fix locking and close a potential race condition in the new
     wilco_ec driver.

   - Fix a warning in cros_ec_debugfs on systems that do not support
     console logging, such as the Asus C201"

* tag 'tag-chrome-platform-fixes-for-v5.1-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux:
  platform/chrome: cros_ec_debugfs: cancel/schedule logging work only if supported
  platform/chrome: Fix locking pattern in wilco_ec_mailbox()
This commit is contained in:
Linus Torvalds 2019-03-19 11:28:15 -07:00
commit babf09c383
2 changed files with 8 additions and 4 deletions

View File

@ -440,7 +440,7 @@ static int cros_ec_debugfs_probe(struct platform_device *pd)
ret = cros_ec_create_pdinfo(debug_info);
if (ret)
goto remove_debugfs;
goto remove_log;
ec->debug_info = debug_info;
@ -448,6 +448,8 @@ static int cros_ec_debugfs_probe(struct platform_device *pd)
return 0;
remove_log:
cros_ec_cleanup_console_log(debug_info);
remove_debugfs:
debugfs_remove_recursive(debug_info->dir);
return ret;
@ -467,7 +469,8 @@ static int __maybe_unused cros_ec_debugfs_suspend(struct device *dev)
{
struct cros_ec_dev *ec = dev_get_drvdata(dev);
cancel_delayed_work_sync(&ec->debug_info->log_poll_work);
if (ec->debug_info->log_buffer.buf)
cancel_delayed_work_sync(&ec->debug_info->log_poll_work);
return 0;
}
@ -476,7 +479,8 @@ static int __maybe_unused cros_ec_debugfs_resume(struct device *dev)
{
struct cros_ec_dev *ec = dev_get_drvdata(dev);
schedule_delayed_work(&ec->debug_info->log_poll_work, 0);
if (ec->debug_info->log_buffer.buf)
schedule_delayed_work(&ec->debug_info->log_poll_work, 0);
return 0;
}

View File

@ -223,11 +223,11 @@ int wilco_ec_mailbox(struct wilco_ec_device *ec, struct wilco_ec_message *msg)
msg->command, msg->type, msg->flags, msg->response_size,
msg->request_size);
mutex_lock(&ec->mailbox_lock);
/* Prepare request packet */
rq = ec->data_buffer;
wilco_ec_prepare(msg, rq);
mutex_lock(&ec->mailbox_lock);
ret = wilco_ec_transfer(ec, msg, rq);
mutex_unlock(&ec->mailbox_lock);