Skip to content

Commit b3be177

Browse files
dfriesgregkh
authored andcommitted
w1: format for DocBook and fixes
Switch the code documentation format style to DocBook format, enable DocBook documentation generation, and fix some comments. Signed-off-by: David Fries <David@Fries.net> Acked-by: Evgeniy Polyakov <zbr@ioremap.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent eb2c0da commit b3be177

10 files changed

Lines changed: 315 additions & 99 deletions

File tree

‎Documentation/DocBook/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ DOCBOOKS := z8530book.xml device-drivers.xml \
1414
genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \
1515
80211.xml debugobjects.xml sh.xml regulator.xml \
1616
alsa-driver-api.xml writing-an-alsa-driver.xml \
17-
tracepoint.xml drm.xml media_api.xml
17+
tracepoint.xml drm.xml media_api.xml w1.xml
1818

1919
include $(srctree)/Documentation/DocBook/media/Makefile
2020

‎Documentation/DocBook/w1.tmpl‎

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3+
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
4+
5+
<book id="w1id">
6+
<bookinfo>
7+
<title>W1: Dallas' 1-wire bus</title>
8+
9+
<authorgroup>
10+
<author>
11+
<firstname>David</firstname>
12+
<surname>Fries</surname>
13+
<affiliation>
14+
<address>
15+
<email>David@Fries.net</email>
16+
</address>
17+
</affiliation>
18+
</author>
19+
20+
</authorgroup>
21+
22+
<copyright>
23+
<year>2013</year>
24+
<!--
25+
<holder></holder>
26+
-->
27+
</copyright>
28+
29+
<legalnotice>
30+
<para>
31+
This documentation is free software; you can redistribute
32+
it and/or modify it under the terms of the GNU General Public
33+
License version 2.
34+
</para>
35+
36+
<para>
37+
This program is distributed in the hope that it will be
38+
useful, but WITHOUT ANY WARRANTY; without even the implied
39+
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
40+
For more details see the file COPYING in the source
41+
distribution of Linux.
42+
</para>
43+
</legalnotice>
44+
</bookinfo>
45+
46+
<toc></toc>
47+
48+
<chapter id="w1_internal">
49+
<title>W1 API internal to the kernel</title>
50+
51+
<sect1 id="w1_internal_api">
52+
<title>W1 API internal to the kernel</title>
53+
<sect2 id="w1.h">
54+
<title>drivers/w1/w1.h</title>
55+
<para>W1 core functions.</para>
56+
!Idrivers/w1/w1.h
57+
</sect2>
58+
59+
<sect2 id="w1.c">
60+
<title>drivers/w1/w1.c</title>
61+
<para>W1 core functions.</para>
62+
!Idrivers/w1/w1.c
63+
</sect2>
64+
65+
<sect2 id="w1_family.h">
66+
<title>drivers/w1/w1_family.h</title>
67+
<para>Allows registering device family operations.</para>
68+
!Idrivers/w1/w1_family.h
69+
</sect2>
70+
71+
<sect2 id="w1_family.c">
72+
<title>drivers/w1/w1_family.c</title>
73+
<para>Allows registering device family operations.</para>
74+
!Edrivers/w1/w1_family.c
75+
</sect2>
76+
77+
<sect2 id="w1_int.c">
78+
<title>drivers/w1/w1_int.c</title>
79+
<para>W1 internal initialization for master devices.</para>
80+
!Edrivers/w1/w1_int.c
81+
</sect2>
82+
83+
<sect2 id="w1_netlink.h">
84+
<title>drivers/w1/w1_netlink.h</title>
85+
<para>W1 external netlink API structures and commands.</para>
86+
!Idrivers/w1/w1_netlink.h
87+
</sect2>
88+
89+
<sect2 id="w1_io.c">
90+
<title>drivers/w1/w1_io.c</title>
91+
<para>W1 input/output.</para>
92+
!Edrivers/w1/w1_io.c
93+
!Idrivers/w1/w1_io.c
94+
</sect2>
95+
96+
</sect1>
97+
98+
99+
</chapter>
100+
101+
</book>

‎Documentation/w1/w1.netlink‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Message types.
55
=============
66

77
There are three types of messages between w1 core and userspace:
8-
1. Events. They are generated each time new master or slave device
9-
found either due to automatic or requested search.
8+
1. Events. They are generated each time a new master or slave device
9+
is found either due to automatic or requested search.
1010
2. Userspace commands.
1111
3. Replies to userspace commands.
1212

@@ -131,7 +131,7 @@ of the w1_netlink_cmd structure and cn_msg.len will be equal to the sum
131131
of the sizeof(struct w1_netlink_msg) and sizeof(struct w1_netlink_cmd).
132132
If reply is generated for master or root command (which do not have
133133
w1_netlink_cmd attached), reply will contain only cn_msg and w1_netlink_msg
134-
structires.
134+
structures.
135135

136136
w1_netlink_msg.status field will carry positive error value
137137
(EINVAL for example) or zero in case of success.
@@ -160,7 +160,7 @@ procedure is started to select given device.
160160
Then all requested in w1_netlink_msg operations are performed one by one.
161161
If command requires reply (like read command) it is sent on command completion.
162162

163-
When all commands (w1_netlink_cmd) are processed muster device is unlocked
163+
When all commands (w1_netlink_cmd) are processed master device is unlocked
164164
and next w1_netlink_msg header processing started.
165165

166166

‎drivers/w1/w1.c‎

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,21 @@ int w1_max_slave_count = 64;
5050
int w1_max_slave_ttl = 10;
5151

5252
module_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+
*/
5362
module_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");
5465
module_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

5669
DEFINE_MUTEX(w1_mlock);
5770
LIST_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
*/
936952
void 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+
*/
10771099
int w1_process_callbacks(struct w1_master *dev)
10781100
{
10791101
int ret = 0;

0 commit comments

Comments
 (0)