2019-05-27 14:55:06 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2011-08-26 06:59:06 +08:00
|
|
|
* Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net>
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/delay.h>
|
2006-02-20 16:15:37 +08:00
|
|
|
#include <linux/kthread.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 16:04:11 +08:00
|
|
|
#include <linux/slab.h>
|
2017-02-09 01:51:30 +08:00
|
|
|
#include <linux/sched/signal.h>
|
2011-07-11 01:21:52 +08:00
|
|
|
#include <linux/export.h>
|
2011-09-16 11:09:52 +08:00
|
|
|
#include <linux/moduleparam.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2017-06-05 21:52:08 +08:00
|
|
|
#include "w1_internal.h"
|
2005-04-17 06:20:36 +08:00
|
|
|
#include "w1_netlink.h"
|
|
|
|
|
2008-10-16 13:04:45 +08:00
|
|
|
static int w1_search_count = -1; /* Default is continual scan */
|
|
|
|
module_param_named(search_count, w1_search_count, int, 0);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-10-16 13:04:42 +08:00
|
|
|
static int w1_enable_pullup = 1;
|
|
|
|
module_param_named(enable_pullup, w1_enable_pullup, int, 0);
|
|
|
|
|
2014-05-31 07:10:20 +08:00
|
|
|
static struct w1_master *w1_alloc_dev(u32 id, int slave_count, int slave_ttl,
|
2005-05-21 02:33:25 +08:00
|
|
|
struct device_driver *driver,
|
|
|
|
struct device *device)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
struct w1_master *dev;
|
|
|
|
int err;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We are in process context(kernel thread), so can sleep.
|
|
|
|
*/
|
some kmalloc/memset ->kzalloc (tree wide)
Transform some calls to kmalloc/memset to a single kzalloc (or kcalloc).
Here is a short excerpt of the semantic patch performing
this transformation:
@@
type T2;
expression x;
identifier f,fld;
expression E;
expression E1,E2;
expression e1,e2,e3,y;
statement S;
@@
x =
- kmalloc
+ kzalloc
(E1,E2)
... when != \(x->fld=E;\|y=f(...,x,...);\|f(...,x,...);\|x=E;\|while(...) S\|for(e1;e2;e3) S\)
- memset((T2)x,0,E1);
@@
expression E1,E2,E3;
@@
- kzalloc(E1 * E2,E3)
+ kcalloc(E1,E2,E3)
[akpm@linux-foundation.org: get kcalloc args the right way around]
Signed-off-by: Yoann Padioleau <padator@wanadoo.fr>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Acked-by: Russell King <rmk@arm.linux.org.uk>
Cc: Bryan Wu <bryan.wu@analog.com>
Acked-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Dave Airlie <airlied@linux.ie>
Acked-by: Roland Dreier <rolandd@cisco.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Acked-by: Pierre Ossman <drzeus-list@drzeus.cx>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: "David S. Miller" <davem@davemloft.net>
Acked-by: Greg KH <greg@kroah.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-19 16:49:03 +08:00
|
|
|
dev = kzalloc(sizeof(struct w1_master) + sizeof(struct w1_bus_master), GFP_KERNEL);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!dev) {
|
2014-06-19 08:52:00 +08:00
|
|
|
pr_err("Failed to allocate %zd bytes for new w1 device.\n",
|
2005-04-17 06:20:36 +08:00
|
|
|
sizeof(struct w1_master));
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dev->bus_master = (struct w1_bus_master *)(dev + 1);
|
|
|
|
|
2005-05-21 02:33:25 +08:00
|
|
|
dev->owner = THIS_MODULE;
|
|
|
|
dev->max_slave_count = slave_count;
|
|
|
|
dev->slave_count = 0;
|
|
|
|
dev->attempts = 0;
|
|
|
|
dev->initialized = 0;
|
|
|
|
dev->id = id;
|
2005-04-17 06:20:36 +08:00
|
|
|
dev->slave_ttl = slave_ttl;
|
2008-10-16 13:04:45 +08:00
|
|
|
dev->search_count = w1_search_count;
|
2008-10-16 13:04:42 +08:00
|
|
|
dev->enable_pullup = w1_enable_pullup;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
w1: fix deadloop in __w1_remove_master_device()
I got a deadloop report while doing device(ds2482) add/remove test:
[ 162.241881] w1_master_driver w1_bus_master1: Waiting for w1_bus_master1 to become free: refcnt=1.
[ 163.272251] w1_master_driver w1_bus_master1: Waiting for w1_bus_master1 to become free: refcnt=1.
[ 164.296157] w1_master_driver w1_bus_master1: Waiting for w1_bus_master1 to become free: refcnt=1.
...
__w1_remove_master_device() can't return, because the dev->refcnt is not zero.
w1_add_master_device() |
w1_alloc_dev() |
atomic_set(&dev->refcnt, 2) |
kthread_run() |
|__w1_remove_master_device()
| kthread_stop()
// KTHREAD_SHOULD_STOP is set, |
// threadfn(w1_process) won't be |
// called. |
kthread() |
| // refcnt will never be 0, it's deadloop.
| while (atomic_read(&dev->refcnt)) {...}
After calling w1_add_master_device(), w1_process() is not really
invoked, before w1_process() starting, if kthread_stop() is called
in __w1_remove_master_device(), w1_process() will never be called,
the refcnt can not be decreased, then it causes deadloop in remove
function because of non-zero refcnt.
We need to make sure w1_process() is really started, so move the
set refcnt into w1_process() to fix this problem.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20221205080434.3149205-1-yangyingliang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-12-05 16:04:34 +08:00
|
|
|
/* For __w1_remove_master_device to decrement
|
2008-10-16 13:04:40 +08:00
|
|
|
*/
|
w1: fix deadloop in __w1_remove_master_device()
I got a deadloop report while doing device(ds2482) add/remove test:
[ 162.241881] w1_master_driver w1_bus_master1: Waiting for w1_bus_master1 to become free: refcnt=1.
[ 163.272251] w1_master_driver w1_bus_master1: Waiting for w1_bus_master1 to become free: refcnt=1.
[ 164.296157] w1_master_driver w1_bus_master1: Waiting for w1_bus_master1 to become free: refcnt=1.
...
__w1_remove_master_device() can't return, because the dev->refcnt is not zero.
w1_add_master_device() |
w1_alloc_dev() |
atomic_set(&dev->refcnt, 2) |
kthread_run() |
|__w1_remove_master_device()
| kthread_stop()
// KTHREAD_SHOULD_STOP is set, |
// threadfn(w1_process) won't be |
// called. |
kthread() |
| // refcnt will never be 0, it's deadloop.
| while (atomic_read(&dev->refcnt)) {...}
After calling w1_add_master_device(), w1_process() is not really
invoked, before w1_process() starting, if kthread_stop() is called
in __w1_remove_master_device(), w1_process() will never be called,
the refcnt can not be decreased, then it causes deadloop in remove
function because of non-zero refcnt.
We need to make sure w1_process() is really started, so move the
set refcnt into w1_process() to fix this problem.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20221205080434.3149205-1-yangyingliang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-12-05 16:04:34 +08:00
|
|
|
atomic_set(&dev->refcnt, 1);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
INIT_LIST_HEAD(&dev->slist);
|
2014-01-16 12:29:18 +08:00
|
|
|
INIT_LIST_HEAD(&dev->async_list);
|
2006-04-03 16:04:27 +08:00
|
|
|
mutex_init(&dev->mutex);
|
2012-05-18 13:59:52 +08:00
|
|
|
mutex_init(&dev->bus_mutex);
|
2014-01-16 12:29:18 +08:00
|
|
|
mutex_init(&dev->list_mutex);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
memcpy(&dev->dev, device, sizeof(struct device));
|
2009-01-07 02:44:34 +08:00
|
|
|
dev_set_name(&dev->dev, "w1_bus_master%u", dev->id);
|
2005-04-17 06:20:36 +08:00
|
|
|
snprintf(dev->name, sizeof(dev->name), "w1_bus_master%u", dev->id);
|
2011-11-03 04:39:59 +08:00
|
|
|
dev->dev.init_name = dev->name;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
dev->driver = driver;
|
|
|
|
|
|
|
|
dev->seq = 1;
|
|
|
|
|
|
|
|
err = device_register(&dev->dev);
|
|
|
|
if (err) {
|
2014-06-19 08:52:00 +08:00
|
|
|
pr_err("Failed to register master device. err=%d\n", err);
|
2015-09-15 01:56:12 +08:00
|
|
|
put_device(&dev->dev);
|
2005-04-17 06:20:36 +08:00
|
|
|
dev = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return dev;
|
|
|
|
}
|
|
|
|
|
2006-04-05 00:35:22 +08:00
|
|
|
static void w1_free_dev(struct w1_master *dev)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
device_unregister(&dev->dev);
|
|
|
|
}
|
|
|
|
|
2014-01-16 12:29:25 +08:00
|
|
|
/**
|
|
|
|
* w1_add_master_device() - registers a new master device
|
|
|
|
* @master: master bus device to register
|
|
|
|
*/
|
2005-04-17 06:20:36 +08:00
|
|
|
int w1_add_master_device(struct w1_bus_master *master)
|
|
|
|
{
|
2008-10-16 13:04:53 +08:00
|
|
|
struct w1_master *dev, *entry;
|
2005-04-17 06:20:36 +08:00
|
|
|
int retval = 0;
|
|
|
|
struct w1_netlink_msg msg;
|
2008-10-16 13:04:53 +08:00
|
|
|
int id, found;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2014-05-31 07:10:20 +08:00
|
|
|
/* validate minimum functionality */
|
|
|
|
if (!(master->touch_bit && master->reset_bus) &&
|
|
|
|
!(master->write_bit && master->read_bit) &&
|
2007-05-08 15:31:20 +08:00
|
|
|
!(master->write_byte && master->read_byte && master->reset_bus)) {
|
2014-06-19 08:52:00 +08:00
|
|
|
pr_err("w1_add_master_device: invalid function set\n");
|
2005-06-04 05:29:25 +08:00
|
|
|
return(-EINVAL);
|
2014-05-31 07:10:20 +08:00
|
|
|
}
|
2005-06-04 05:21:46 +08:00
|
|
|
|
2008-10-16 13:04:53 +08:00
|
|
|
/* Lock until the device is added (or not) to w1_masters. */
|
|
|
|
mutex_lock(&w1_mlock);
|
|
|
|
/* Search for the first available id (starting at 1). */
|
|
|
|
id = 0;
|
|
|
|
do {
|
|
|
|
++id;
|
|
|
|
found = 0;
|
|
|
|
list_for_each_entry(entry, &w1_masters, w1_master_entry) {
|
|
|
|
if (entry->id == id) {
|
|
|
|
found = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} while (found);
|
|
|
|
|
|
|
|
dev = w1_alloc_dev(id, w1_max_slave_count, w1_max_slave_ttl,
|
|
|
|
&w1_master_driver, &w1_master_device);
|
|
|
|
if (!dev) {
|
|
|
|
mutex_unlock(&w1_mlock);
|
2005-04-17 06:20:36 +08:00
|
|
|
return -ENOMEM;
|
2008-10-16 13:04:53 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-10-16 13:04:40 +08:00
|
|
|
retval = w1_create_master_attributes(dev);
|
2008-10-16 13:04:53 +08:00
|
|
|
if (retval) {
|
|
|
|
mutex_unlock(&w1_mlock);
|
2008-10-16 13:04:40 +08:00
|
|
|
goto err_out_free_dev;
|
2008-10-16 13:04:53 +08:00
|
|
|
}
|
2008-10-16 13:04:40 +08:00
|
|
|
|
|
|
|
memcpy(dev->bus_master, master, sizeof(struct w1_bus_master));
|
|
|
|
|
|
|
|
dev->initialized = 1;
|
|
|
|
|
2006-02-20 16:15:37 +08:00
|
|
|
dev->thread = kthread_run(&w1_process, dev, "%s", dev->name);
|
|
|
|
if (IS_ERR(dev->thread)) {
|
|
|
|
retval = PTR_ERR(dev->thread);
|
2005-04-17 06:20:36 +08:00
|
|
|
dev_err(&dev->dev,
|
|
|
|
"Failed to create new kernel thread. err=%d\n",
|
2006-02-20 16:15:37 +08:00
|
|
|
retval);
|
2008-10-16 13:04:53 +08:00
|
|
|
mutex_unlock(&w1_mlock);
|
2008-10-16 13:04:40 +08:00
|
|
|
goto err_out_rm_attr;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
list_add(&dev->w1_master_entry, &w1_masters);
|
2006-04-03 16:04:27 +08:00
|
|
|
mutex_unlock(&w1_mlock);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-03-24 00:11:58 +08:00
|
|
|
memset(&msg, 0, sizeof(msg));
|
2005-04-17 06:20:36 +08:00
|
|
|
msg.id.mst.id = dev->id;
|
|
|
|
msg.type = W1_MASTER_ADD;
|
|
|
|
w1_netlink_send(dev, &msg);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
2008-10-16 13:04:40 +08:00
|
|
|
#if 0 /* Thread cleanup code, not required currently. */
|
2005-04-17 06:20:36 +08:00
|
|
|
err_out_kill_thread:
|
2014-01-16 12:29:13 +08:00
|
|
|
set_bit(W1_ABORT_SEARCH, &dev->flags);
|
2006-02-20 16:15:37 +08:00
|
|
|
kthread_stop(dev->thread);
|
2008-10-16 13:04:40 +08:00
|
|
|
#endif
|
|
|
|
err_out_rm_attr:
|
|
|
|
w1_destroy_master_attributes(dev);
|
2005-04-17 06:20:36 +08:00
|
|
|
err_out_free_dev:
|
|
|
|
w1_free_dev(dev);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
2017-05-17 04:02:12 +08:00
|
|
|
EXPORT_SYMBOL(w1_add_master_device);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
void __w1_remove_master_device(struct w1_master *dev)
|
|
|
|
{
|
|
|
|
struct w1_netlink_msg msg;
|
2008-10-16 13:04:38 +08:00
|
|
|
struct w1_slave *sl, *sln;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-10-16 13:04:38 +08:00
|
|
|
mutex_lock(&w1_mlock);
|
|
|
|
list_del(&dev->w1_master_entry);
|
|
|
|
mutex_unlock(&w1_mlock);
|
|
|
|
|
2014-01-16 12:29:18 +08:00
|
|
|
set_bit(W1_ABORT_SEARCH, &dev->flags);
|
|
|
|
kthread_stop(dev->thread);
|
|
|
|
|
2008-10-16 13:04:38 +08:00
|
|
|
mutex_lock(&dev->mutex);
|
2014-01-16 12:29:18 +08:00
|
|
|
mutex_lock(&dev->list_mutex);
|
|
|
|
list_for_each_entry_safe(sl, sln, &dev->slist, w1_slave_entry) {
|
|
|
|
mutex_unlock(&dev->list_mutex);
|
2008-10-16 13:04:38 +08:00
|
|
|
w1_slave_detach(sl);
|
2014-01-16 12:29:18 +08:00
|
|
|
mutex_lock(&dev->list_mutex);
|
|
|
|
}
|
2008-10-16 13:04:38 +08:00
|
|
|
w1_destroy_master_attributes(dev);
|
2014-01-16 12:29:18 +08:00
|
|
|
mutex_unlock(&dev->list_mutex);
|
2008-10-16 13:04:38 +08:00
|
|
|
mutex_unlock(&dev->mutex);
|
|
|
|
atomic_dec(&dev->refcnt);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
while (atomic_read(&dev->refcnt)) {
|
2006-02-20 16:15:37 +08:00
|
|
|
dev_info(&dev->dev, "Waiting for %s to become free: refcnt=%d.\n",
|
2005-04-17 06:20:36 +08:00
|
|
|
dev->name, atomic_read(&dev->refcnt));
|
|
|
|
|
|
|
|
if (msleep_interruptible(1000))
|
|
|
|
flush_signals(current);
|
2014-05-07 05:26:04 +08:00
|
|
|
mutex_lock(&dev->list_mutex);
|
2014-01-16 12:29:18 +08:00
|
|
|
w1_process_callbacks(dev);
|
2014-05-07 05:26:04 +08:00
|
|
|
mutex_unlock(&dev->list_mutex);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2014-05-07 05:26:04 +08:00
|
|
|
mutex_lock(&dev->list_mutex);
|
2014-01-16 12:29:18 +08:00
|
|
|
w1_process_callbacks(dev);
|
2014-05-07 05:26:04 +08:00
|
|
|
mutex_unlock(&dev->list_mutex);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-03-24 00:11:58 +08:00
|
|
|
memset(&msg, 0, sizeof(msg));
|
2005-04-17 06:20:36 +08:00
|
|
|
msg.id.mst.id = dev->id;
|
|
|
|
msg.type = W1_MASTER_REMOVE;
|
|
|
|
w1_netlink_send(dev, &msg);
|
|
|
|
|
|
|
|
w1_free_dev(dev);
|
|
|
|
}
|
|
|
|
|
2014-01-16 12:29:25 +08:00
|
|
|
/**
|
|
|
|
* w1_remove_master_device() - unregister a master device
|
|
|
|
* @bm: master bus device to remove
|
|
|
|
*/
|
2005-04-17 06:20:36 +08:00
|
|
|
void w1_remove_master_device(struct w1_bus_master *bm)
|
|
|
|
{
|
2007-08-23 05:01:51 +08:00
|
|
|
struct w1_master *dev, *found = NULL;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-05-21 02:33:25 +08:00
|
|
|
list_for_each_entry(dev, &w1_masters, w1_master_entry) {
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!dev->initialized)
|
|
|
|
continue;
|
|
|
|
|
2007-08-23 05:01:51 +08:00
|
|
|
if (dev->bus_master->data == bm->data) {
|
|
|
|
found = dev;
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
2007-08-23 05:01:51 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2007-08-23 05:01:51 +08:00
|
|
|
if (!found) {
|
2014-06-19 08:52:00 +08:00
|
|
|
pr_err("Device doesn't exist.\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-08-23 05:01:51 +08:00
|
|
|
__w1_remove_master_device(found);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(w1_remove_master_device);
|