From 421056987620fecb43c22c558e127085c406b7ba Mon Sep 17 00:00:00 2001 From: David Fries Date: Wed, 15 Jan 2014 22:29:13 -0600 Subject: w1: fixup search to support abort from netlink Before 63706172f33 "rework kthread_stop()" kthread_should_stop() always returned false when called from a non-kthread task, after it would oops as a non-kthread didn't have that structure and netlink was calling search from a thread which wasn't a kthread. 9d1817cab2f030 "w1: fix oops when w1_search is called from netlink connector", modified the code to avoid calling kthread_stop from a netlink thread. Introduce a w1_master flag and bit W1_ABORT_SEARCH to identify abort to cleanly support both kthread and netlink search abort. A search can take seconds to run, so it is important to abort early if the hardware is removed in the middle of a search. Signed-off-by: David Fries Acked-by: Evgeniy Polyakov Cc: Marcin Jurkowski Cc: Josh Boyer Cc: Sven Geggus Signed-off-by: Greg Kroah-Hartman --- drivers/w1/w1.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'drivers/w1/w1.h') diff --git a/drivers/w1/w1.h b/drivers/w1/w1.h index ca8081a101d6..bc329d2bba28 100644 --- a/drivers/w1/w1.h +++ b/drivers/w1/w1.h @@ -155,6 +155,14 @@ struct w1_bus_master u8, w1_slave_found_callback); }; +/** + * enum w1_master_flags - bitfields used in w1_master.flags + * @W1_ABORT_SEARCH: abort searching early on shutdown + */ +enum w1_master_flags { + W1_ABORT_SEARCH = 0, +}; + struct w1_master { struct list_head w1_master_entry; @@ -178,6 +186,8 @@ struct w1_master /** 5V strong pullup duration in milliseconds, zero disabled. */ int pullup_duration; + long flags; + struct task_struct *thread; struct mutex mutex; struct mutex bus_mutex; -- cgit v1.2.3