提交 a2a6c74d 编写于 作者: E Evgeniy Polyakov 提交者: Linus Torvalds

w1: decrement slave counter only in ->release() callback

Decrement the slave counter only in ->release() callback instead of both
in ->release() and w1 control.

Patch is based on debug work and preliminary patch made by Henri Laakso.
Henri noticed in debug that this counter becomes negative after w1 slave
device is physically removed.
Signed-off-by: NEvgeniy Polyakov <johnpol@2ka.mipt.ru>
Cc: Henri Laakso <henri.laakso@wapice.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 cb2a5205
...@@ -869,11 +869,9 @@ void w1_search_process(struct w1_master *dev, u8 search_type) ...@@ -869,11 +869,9 @@ void w1_search_process(struct w1_master *dev, u8 search_type)
w1_search_devices(dev, search_type, w1_slave_found); w1_search_devices(dev, search_type, w1_slave_found);
list_for_each_entry_safe(sl, sln, &dev->slist, w1_slave_entry) { list_for_each_entry_safe(sl, sln, &dev->slist, w1_slave_entry) {
if (!test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags) && !--sl->ttl) { if (!test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags) && !--sl->ttl)
w1_slave_detach(sl); w1_slave_detach(sl);
else if (test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags))
dev->slave_count--;
} else if (test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags))
sl->ttl = dev->slave_ttl; sl->ttl = dev->slave_ttl;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册