9
0
Fork 0

Merge branch 'for-next/w1'

This commit is contained in:
Sascha Hauer 2013-02-04 15:49:07 +01:00
commit 4458614954
3 changed files with 33 additions and 1 deletions

View File

@ -11,4 +11,9 @@ if W1
source drivers/w1/masters/Kconfig
source drivers/w1/slaves/Kconfig
config W1_DUAL_SEARCH
bool "dual search"
---help---
Some device need to be searched twice to be detected
endif # W1

View File

@ -402,6 +402,21 @@ struct bus_type w1_bustype= {
.remove = w1_bus_remove,
};
static bool w1_is_registered(struct w1_bus *bus, u64 rn)
{
struct device_d *dev = NULL;
struct w1_device *w1_dev;
bus_for_each_device(&w1_bustype, dev) {
w1_dev = to_w1_device(dev);
if (w1_dev->bus == bus && w1_dev->reg_num == rn)
return true;
}
return false;
}
static int w1_device_register(struct w1_bus *bus, struct w1_device *dev)
{
char str[18];
@ -442,9 +457,15 @@ int w1_driver_register(struct w1_driver *drv)
void w1_found(struct w1_bus *bus, u64 rn)
{
struct w1_device *dev = xzalloc(sizeof(*dev));
struct w1_device *dev;
u64 tmp = be64_to_cpu(rn);
if (IS_ENABLED(CONFIG_W1_DUAL_SEARCH)
&& bus->is_searched && w1_is_registered(bus, rn))
return;
dev = xzalloc(sizeof(*dev));
dev->reg_num = rn;
dev->fid = tmp >> 56;
dev->id = (tmp >> 8) & 0xffffffffffff;
@ -605,7 +626,11 @@ int w1_bus_register(struct w1_bus *bus)
if (ret)
return ret;
bus->is_searched = false;
w1_search(bus, W1_SEARCH);
bus->is_searched = true;
if (IS_ENABLED(CONFIG_W1_DUAL_SEARCH))
w1_search(bus, W1_SEARCH);
return 0;
}

View File

@ -133,6 +133,8 @@ struct w1_bus
int max_slave_count, slave_count;
bool is_searched;
void *data;
struct list_head list;
};