diff options
author | Jeff Hatch <jhatch@multitech.com> | 2020-11-20 13:51:12 -0600 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2020-11-23 14:22:45 -0600 |
commit | 90075ae2b50c4342dff880085f7342cb961456d5 (patch) | |
tree | 4e152fd464d1c548c479bc4074cc2097a5b2a560 /io-module/mts_supercap.c | |
parent | febfbaa141125c24d3a40e17034261c5354a0973 (diff) | |
download | mts-io-90075ae2b50c4342dff880085f7342cb961456d5.tar.gz mts-io-90075ae2b50c4342dff880085f7342cb961456d5.tar.bz2 mts-io-90075ae2b50c4342dff880085f7342cb961456d5.zip |
Fix cleanup of supercap worker so that it doesn't cause kernel panic during unloading mts-io during normal operation, there was missing lock/unlock of mts-io mutex
Diffstat (limited to 'io-module/mts_supercap.c')
-rw-r--r-- | io-module/mts_supercap.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/io-module/mts_supercap.c b/io-module/mts_supercap.c index e028408..6cd9841 100644 --- a/io-module/mts_supercap.c +++ b/io-module/mts_supercap.c @@ -74,6 +74,8 @@ static void supercap_worker(struct work_struct *ignored) struct pid *vpid; int running_on_cap = 0; + mutex_lock(&mts_io_mutex); + pin = gpio_pin_by_attr_name("power-fail"); if (pin) { @@ -83,6 +85,7 @@ static void supercap_worker(struct work_struct *ignored) if (supercap.pid > 0) { vpid = find_vpid(supercap.pid); } + if (vpid) { if (running_on_cap == 0 && supercap.pwf_count == 0) { schedule_delayed_work(&supercap_work, SUPERCAP_CHECK_INTERVAL); @@ -109,6 +112,8 @@ static void supercap_worker(struct work_struct *ignored) } } /* vpid */ + mutex_unlock(&mts_io_mutex); + schedule_delayed_work(&supercap_work, SUPERCAP_CHECK_INTERVAL); } @@ -117,7 +122,7 @@ void init_supercap_worker(void) { supercap_worker(NULL); } -void cleanup_sepercap_worker(void) { +void cleanup_supercap_worker(void) { cancel_delayed_work_sync(&supercap_work); } |