Commit 963bb101010169b9bb32b5c21af785e2f9abdaf3
Committed by
Linus Torvalds
1 parent
26a6afb917
Exists in
master
and in
39 other branches
w1: have netlink search update kernel list
Reorganize so the netlink connector one wire search command will update the kernel list of detected slave devices. Otherwise, a newly detected device is unusable because unless it's in the kernel list of known devices any commands will result in ENODEV status. Signed-off-by: David Fries <David@Fries.net> Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 3 changed files with 16 additions and 5 deletions Side-by-side Diff
drivers/w1/w1.c
... | ... | @@ -827,7 +827,7 @@ |
827 | 827 | mutex_unlock(&w1_mlock); |
828 | 828 | } |
829 | 829 | |
830 | -static void w1_slave_found(struct w1_master *dev, u64 rn) | |
830 | +void w1_slave_found(struct w1_master *dev, u64 rn) | |
831 | 831 | { |
832 | 832 | struct w1_slave *sl; |
833 | 833 | struct w1_reg_num *tmp; |
834 | 834 | |
... | ... | @@ -933,14 +933,15 @@ |
933 | 933 | } |
934 | 934 | } |
935 | 935 | |
936 | -void w1_search_process(struct w1_master *dev, u8 search_type) | |
936 | +void w1_search_process_cb(struct w1_master *dev, u8 search_type, | |
937 | + w1_slave_found_callback cb) | |
937 | 938 | { |
938 | 939 | struct w1_slave *sl, *sln; |
939 | 940 | |
940 | 941 | list_for_each_entry(sl, &dev->slist, w1_slave_entry) |
941 | 942 | clear_bit(W1_SLAVE_ACTIVE, (long *)&sl->flags); |
942 | 943 | |
943 | - w1_search_devices(dev, search_type, w1_slave_found); | |
944 | + w1_search_devices(dev, search_type, cb); | |
944 | 945 | |
945 | 946 | list_for_each_entry_safe(sl, sln, &dev->slist, w1_slave_entry) { |
946 | 947 | if (!test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags) && !--sl->ttl) |
... | ... | @@ -951,6 +952,11 @@ |
951 | 952 | |
952 | 953 | if (dev->search_count > 0) |
953 | 954 | dev->search_count--; |
955 | +} | |
956 | + | |
957 | +static void w1_search_process(struct w1_master *dev, u8 search_type) | |
958 | +{ | |
959 | + w1_search_process_cb(dev, search_type, w1_slave_found); | |
954 | 960 | } |
955 | 961 | |
956 | 962 | int w1_process(void *data) |
drivers/w1/w1.h
... | ... | @@ -194,7 +194,9 @@ |
194 | 194 | void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb); |
195 | 195 | void w1_search_devices(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb); |
196 | 196 | struct w1_slave *w1_search_slave(struct w1_reg_num *id); |
197 | -void w1_search_process(struct w1_master *dev, u8 search_type); | |
197 | +void w1_slave_found(struct w1_master *dev, u64 rn); | |
198 | +void w1_search_process_cb(struct w1_master *dev, u8 search_type, | |
199 | + w1_slave_found_callback cb); | |
198 | 200 | struct w1_master *w1_search_master_id(u32 id); |
199 | 201 | |
200 | 202 | /* Disconnect and reconnect devices in the given family. Used for finding |
drivers/w1/w1_netlink.c
... | ... | @@ -55,6 +55,9 @@ |
55 | 55 | struct w1_netlink_cmd *cmd = (struct w1_netlink_cmd *)(hdr + 1); |
56 | 56 | int avail; |
57 | 57 | |
58 | + /* update kernel slave list */ | |
59 | + w1_slave_found(dev, rn); | |
60 | + | |
58 | 61 | avail = dev->priv_size - cmd->len; |
59 | 62 | |
60 | 63 | if (avail > 8) { |
... | ... | @@ -85,7 +88,7 @@ |
85 | 88 | dev->priv = msg; |
86 | 89 | dev->priv_size = avail; |
87 | 90 | |
88 | - w1_search_devices(dev, search_type, w1_send_slave); | |
91 | + w1_search_process_cb(dev, search_type, w1_send_slave); | |
89 | 92 | |
90 | 93 | msg->ack = 0; |
91 | 94 | cn_netlink_send(msg, 0, GFP_KERNEL); |