| From 0ef61debf2af0cd6de7743c28a13d232d150a9fd Mon Sep 17 00:00:00 2001 |
| From: Jon Masters <jcm@jonmasters.org> |
| Date: Thu, 22 Oct 2009 19:33:56 +0200 |
| Subject: [PATCH] hwlat: Fix Kconfig and check kthread_stop result |
| |
| commit d9a4a1d04d0b5ba138a6a5b25013187d4614de4d in tip. |
| |
| Signed-off-by: Jon Masters <jcm@jonmasters.org> |
| Signed-off-by: John Kacur <jkacur@redhat.com> |
| Cc: Jon Masters <jcm@redhat.com> |
| Cc: Clark Williams <williams@redhat.com> |
| Signed-off-by: Thomas Gleixner <tglx@linutronix.de> |
| |
| diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig |
| index da77983..9eaa647 100644 |
| --- a/drivers/misc/Kconfig |
| +++ b/drivers/misc/Kconfig |
| @@ -93,7 +93,7 @@ config IBM_ASM |
| config HWLAT_DETECTOR |
| tristate "Testing module to detect hardware-induced latencies" |
| depends on DEBUG_FS |
| - select RING_BUFFER |
| + depends on RING_BUFFER |
| default m |
| ---help--- |
| A simple hardware latency detector. Use this module to detect |
| diff --git a/drivers/misc/hwlat_detector.c b/drivers/misc/hwlat_detector.c |
| index be6553f..d9549e9 100644 |
| --- a/drivers/misc/hwlat_detector.c |
| +++ b/drivers/misc/hwlat_detector.c |
| @@ -607,7 +607,11 @@ static ssize_t debug_enable_fwrite(struct file *filp, |
| if (!enabled) |
| goto unlock; |
| enabled = 0; |
| - stop_kthread(); |
| + err = stop_kthread(); |
| + if (err) { |
| + printk(KERN_ERR BANNER "cannot stop kthread\n"); |
| + return -EFAULT; |
| + } |
| wake_up(&data.wq); /* reader(s) should return */ |
| } |
| unlock: |
| @@ -1194,9 +1198,13 @@ out: |
| */ |
| static void detector_exit(void) |
| { |
| + int err; |
| + |
| if (enabled) { |
| enabled = 0; |
| - stop_kthread(); |
| + err = stop_kthread(); |
| + if (err) |
| + printk(KERN_ERR BANNER "cannot stop kthread\n"); |
| } |
| |
| free_debugfs(); |
| -- |
| 1.7.1.1 |
| |