@@ -50,8 +50,21 @@ int w1_max_slave_count = 64;
5050int w1_max_slave_ttl = 10 ;
5151
5252module_param_named (timeout , w1_timeout , int , 0 );
53+ MODULE_PARM_DESC (timeout , "time in seconds between automatic slave searches" );
54+ /* A search stops when w1_max_slave_count devices have been found in that
55+ * search. The next search will start over and detect the same set of devices
56+ * on a static 1-wire bus. Memory is not allocated based on this number, just
57+ * on the number of devices known to the kernel. Having a high number does not
58+ * consume additional resources. As a special case, if there is only one
59+ * device on the network and w1_max_slave_count is set to 1, the device id can
60+ * be read directly skipping the normal slower search process.
61+ */
5362module_param_named (max_slave_count , w1_max_slave_count , int , 0 );
63+ MODULE_PARM_DESC (max_slave_count ,
64+ "maximum number of slaves detected in a search" );
5465module_param_named (slave_ttl , w1_max_slave_ttl , int , 0 );
66+ MODULE_PARM_DESC (slave_ttl ,
67+ "Number of searches not seeing a slave before it will be removed" );
5568
5669DEFINE_MUTEX (w1_mlock );
5770LIST_HEAD (w1_masters );
@@ -920,7 +933,12 @@ void w1_slave_found(struct w1_master *dev, u64 rn)
920933}
921934
922935/**
923- * Performs a ROM Search & registers any devices found.
936+ * w1_search() - Performs a ROM Search & registers any devices found.
937+ * @dev: The master device to search
938+ * @search_type: W1_SEARCH to search all devices, or W1_ALARM_SEARCH
939+ * to return only devices in the alarmed state
940+ * @cb: Function to call when a device is found
941+ *
924942 * The 1-wire search is a simple binary tree search.
925943 * For each bit of the address, we read two bits and write one bit.
926944 * The bit written will put to sleep all devies that don't match that bit.
@@ -930,8 +948,6 @@ void w1_slave_found(struct w1_master *dev, u64 rn)
930948 *
931949 * See "Application note 187 1-wire search algorithm" at www.maxim-ic.com
932950 *
933- * @dev The master device to search
934- * @cb Function to call when a device is found
935951 */
936952void w1_search (struct w1_master * dev , u8 search_type , w1_slave_found_callback cb )
937953{
@@ -990,7 +1006,7 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
9901006 else
9911007 search_bit = ((last_rn >> i ) & 0x1 );
9921008
993- /** Read two bits and write one bit */
1009+ /* Read two bits and write one bit */
9941010 triplet_ret = w1_triplet (dev , search_bit );
9951011
9961012 /* quit if no device responded */
@@ -1074,6 +1090,12 @@ static void w1_search_process(struct w1_master *dev, u8 search_type)
10741090 w1_search_process_cb (dev , search_type , w1_slave_found );
10751091}
10761092
1093+ /**
1094+ * w1_process_callbacks() - execute each dev->async_list callback entry
1095+ * @dev: w1_master device
1096+ *
1097+ * Return: 1 if there were commands to executed 0 otherwise
1098+ */
10771099int w1_process_callbacks (struct w1_master * dev )
10781100{
10791101 int ret = 0 ;
0 commit comments