aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DocBook/Makefile2
-rw-r--r--Documentation/DocBook/scsi_midlayer.tmpl409
-rw-r--r--drivers/scsi/constants.c1
-rw-r--r--drivers/scsi/hosts.c4
-rw-r--r--drivers/scsi/scsi.c183
-rw-r--r--drivers/scsi/scsi_devinfo.c34
-rw-r--r--drivers/scsi/scsi_error.c46
-rw-r--r--drivers/scsi/scsi_ioctl.c24
-rw-r--r--drivers/scsi/scsi_lib.c42
-rw-r--r--drivers/scsi/scsi_netlink.c19
-rw-r--r--drivers/scsi/scsi_proc.c110
-rw-r--r--drivers/scsi/scsi_scan.c32
-rw-r--r--drivers/scsi/scsi_transport_fc.c102
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c17
-rw-r--r--drivers/scsi/scsi_transport_sas.c40
-rw-r--r--drivers/scsi/scsi_transport_srp.c10
-rw-r--r--drivers/scsi/scsicam.c35
17 files changed, 821 insertions, 289 deletions
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index 4953bc258729..c6c5e59daaca 100644
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -11,7 +11,7 @@ DOCBOOKS := wanbook.xml z8530book.xml mcabook.xml videobook.xml \
11 procfs-guide.xml writing_usb_driver.xml \ 11 procfs-guide.xml writing_usb_driver.xml \
12 kernel-api.xml filesystems.xml lsm.xml usb.xml \ 12 kernel-api.xml filesystems.xml lsm.xml usb.xml \
13 gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \ 13 gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \
14 genericirq.xml s390-drivers.xml uio-howto.xml 14 genericirq.xml s390-drivers.xml uio-howto.xml scsi_midlayer.xml
15 15
16### 16###
17# The build process is as follows (targets): 17# The build process is as follows (targets):
diff --git a/Documentation/DocBook/scsi_midlayer.tmpl b/Documentation/DocBook/scsi_midlayer.tmpl
new file mode 100644
index 000000000000..6255930216b3
--- /dev/null
+++ b/Documentation/DocBook/scsi_midlayer.tmpl
@@ -0,0 +1,409 @@
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="scsimid">
6 <bookinfo>
7 <title>SCSI Mid Layer Guide</title>
8
9 <authorgroup>
10 <author>
11 <firstname>James</firstname>
12 <surname>Bottomley</surname>
13 <affiliation>
14 <address>
15 <email>James.Bottomley@steeleye.com</email>
16 </address>
17 </affiliation>
18 </author>
19
20 <author>
21 <firstname>Rob</firstname>
22 <surname>Landley</surname>
23 <affiliation>
24 <address>
25 <email>rob@landley.net</email>
26 </address>
27 </affiliation>
28 </author>
29
30 </authorgroup>
31
32 <copyright>
33 <year>2007</year>
34 <holder>Linux Foundation</holder>
35 </copyright>
36
37 <legalnotice>
38 <para>
39 This documentation is free software; you can redistribute
40 it and/or modify it under the terms of the GNU General Public
41 License version 2.
42 </para>
43
44 <para>
45 This program is distributed in the hope that it will be
46 useful, but WITHOUT ANY WARRANTY; without even the implied
47 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
48 For more details see the file COPYING in the source
49 distribution of Linux.
50 </para>
51 </legalnotice>
52 </bookinfo>
53
54 <toc></toc>
55
56 <chapter id="intro">
57 <title>Introduction</title>
58 <sect1 id="protocol_vs_bus">
59 <title>Protocol vs bus</title>
60 <para>
61 Once upon a time, the Small Computer Systems Interface defined both
62 a parallel I/O bus and a data protocol to connect a wide variety of
63 peripherals (disk drives, tape drives, modems, printers, scanners,
64 optical drives, test equipment, and medical devices) to a host
65 computer.
66 </para>
67 <para>
68 Although the old parallel (fast/wide/ultra) SCSI bus has largely
69 fallen out of use, the SCSI command set is more widely used than ever
70 to communicate with devices over a number of different busses.
71 </para>
72 <para>
73 The <ulink url='http://www.t10.org/scsi-3.htm'>SCSI protocol</ulink>
74 is a big-endian peer-to-peer packet based protocol. SCSI commands
75 are 6, 10, 12, or 16 bytes long, often followed by an associated data
76 payload.
77 </para>
78 <para>
79 SCSI commands can be transported over just about any kind of bus, and
80 are the default protocol for storage devices attached to USB, SATA,
81 SAS, Fibre Channel, FireWire, and ATAPI devices. SCSI packets are
82 also commonly exchanged over Infiniband,
83 <ulink url='http://i2o.shadowconnect.com/faq.php'>I20</ulink>, TCP/IP
84 (<ulink url='http://en.wikipedia.org/wiki/ISCSI'>iSCSI</ulink>), even
85 <ulink url='http://cyberelk.net/tim/parport/parscsi.html'>Parallel
86 ports</ulink>.
87 </para>
88 </sect1>
89 <sect1 id="subsystem_design">
90 <title>Design of the Linux SCSI subsystem</title>
91 <para>
92 The SCSI subsystem uses a three layer design, with upper, mid, and low
93 layers. Every operation involving the SCSI subsystem (such as reading
94 a sector from a disk) uses one driver at each of the 3 levels: one
95 upper layer driver, one lower layer driver, and the scsi midlayer.
96 </para>
97 <para>
98 The SCSI upper layer provides the interface between userspace and the
99 kernel, in the form of block and char device nodes for I/O and
100 ioctl(). The SCSI lower layer contains drivers for specific hardware
101 devices.
102 </para>
103 <para>
104 In between is the SCSI mid-layer, analogous to a network routing
105 layer such as the IPv4 stack. The SCSI mid-layer routes a packet
106 based data protocol between the upper layer's /dev nodes and the
107 corresponding devices in the lower layer. It manages command queues,
108 provides error handling and power management functions, and responds
109 to ioctl() requests.
110 </para>
111 </sect1>
112 </chapter>
113
114 <chapter id="upper_layer">
115 <title>SCSI upper layer</title>
116 <para>
117 The upper layer supports the user-kernel interface by providing
118 device nodes.
119 </para>
120 <sect1 id="sd">
121 <title>sd (SCSI Disk)</title>
122 <para>sd (sd_mod.o)</para>
123<!-- !Idrivers/scsi/sd.c -->
124 </sect1>
125 <sect1 id="sr">
126 <title>sr (SCSI CD-ROM)</title>
127 <para>sr (sr_mod.o)</para>
128 </sect1>
129 <sect1 id="st">
130 <title>st (SCSI Tape)</title>
131 <para>st (st.o)</para>
132 </sect1>
133 <sect1 id="sg">
134 <title>sg (SCSI Generic)</title>
135 <para>sg (sg.o)</para>
136 </sect1>
137 <sect1 id="ch">
138 <title>ch (SCSI Media Changer)</title>
139 <para>ch (ch.c)</para>
140 </sect1>
141 </chapter>
142
143 <chapter id="mid_layer">
144 <title>SCSI mid layer</title>
145
146 <sect1 id="midlayer_implementation">
147 <title>SCSI midlayer implementation</title>
148 <sect2 id="scsi_device.h">
149 <title>include/scsi/scsi_device.h</title>
150 <para>
151 </para>
152!Iinclude/scsi/scsi_device.h
153 </sect2>
154
155 <sect2 id="scsi.c">
156 <title>drivers/scsi/scsi.c</title>
157 <para>Main file for the scsi midlayer.</para>
158!Edrivers/scsi/scsi.c
159 </sect2>
160 <sect2 id="scsicam.c">
161 <title>drivers/scsi/scsicam.c</title>
162 <para>
163 <ulink url='http://www.t10.org/ftp/t10/drafts/cam/cam-r12b.pdf'>SCSI
164 Common Access Method</ulink> support functions, for use with
165 HDIO_GETGEO, etc.
166 </para>
167!Edrivers/scsi/scsicam.c
168 </sect2>
169 <sect2 id="scsi_error.c">
170 <title>drivers/scsi/scsi_error.c</title>
171 <para>Common SCSI error/timeout handling routines.</para>
172!Edrivers/scsi/scsi_error.c
173 </sect2>
174 <sect2 id="scsi_devinfo.c">
175 <title>drivers/scsi/scsi_devinfo.c</title>
176 <para>
177 Manage scsi_dev_info_list, which tracks blacklisted and whitelisted
178 devices.
179 </para>
180!Idrivers/scsi/scsi_devinfo.c
181 </sect2>
182 <sect2 id="scsi_ioctl.c">
183 <title>drivers/scsi/scsi_ioctl.c</title>
184 <para>
185 Handle ioctl() calls for scsi devices.
186 </para>
187!Edrivers/scsi/scsi_ioctl.c
188 </sect2>
189 <sect2 id="scsi_lib.c">
190 <title>drivers/scsi/scsi_lib.c</title>
191 <para>
192 SCSI queuing library.
193 </para>
194!Edrivers/scsi/scsi_lib.c
195 </sect2>
196 <sect2 id="scsi_lib_dma.c">
197 <title>drivers/scsi/scsi_lib_dma.c</title>
198 <para>
199 SCSI library functions depending on DMA
200 (map and unmap scatter-gather lists).
201 </para>
202!Edrivers/scsi/scsi_lib_dma.c
203 </sect2>
204 <sect2 id="scsi_module.c">
205 <title>drivers/scsi/scsi_module.c</title>
206 <para>
207 The file drivers/scsi/scsi_module.c contains legacy support for
208 old-style host templates. It should never be used by any new driver.
209 </para>
210 </sect2>
211 <sect2 id="scsi_proc.c">
212 <title>drivers/scsi/scsi_proc.c</title>
213 <para>
214 The functions in this file provide an interface between
215 the PROC file system and the SCSI device drivers
216 It is mainly used for debugging, statistics and to pass
217 information directly to the lowlevel driver.
218
219 I.E. plumbing to manage /proc/scsi/*
220 </para>
221!Idrivers/scsi/scsi_proc.c
222 </sect2>
223 <sect2 id="scsi_netlink.c">
224 <title>drivers/scsi/scsi_netlink.c</title>
225 <para>
226 Infrastructure to provide async events from transports to userspace
227 via netlink, using a single NETLINK_SCSITRANSPORT protocol for all
228 transports.
229
230 See <ulink url='http://marc.info/?l=linux-scsi&amp;m=115507374832500&amp;w=2'>the
231 original patch submission</ulink> for more details.
232 </para>
233!Idrivers/scsi/scsi_netlink.c
234 </sect2>
235 <sect2 id="scsi_scan.c">
236 <title>drivers/scsi/scsi_scan.c</title>
237 <para>
238 Scan a host to determine which (if any) devices are attached.
239
240 The general scanning/probing algorithm is as follows, exceptions are
241 made to it depending on device specific flags, compilation options,
242 and global variable (boot or module load time) settings.
243
244 A specific LUN is scanned via an INQUIRY command; if the LUN has a
245 device attached, a scsi_device is allocated and setup for it.
246
247 For every id of every channel on the given host, start by scanning
248 LUN 0. Skip hosts that don't respond at all to a scan of LUN 0.
249 Otherwise, if LUN 0 has a device attached, allocate and setup a
250 scsi_device for it. If target is SCSI-3 or up, issue a REPORT LUN,
251 and scan all of the LUNs returned by the REPORT LUN; else,
252 sequentially scan LUNs up until some maximum is reached, or a LUN is
253 seen that cannot have a device attached to it.
254 </para>
255!Idrivers/scsi/scsi_scan.c
256 </sect2>
257 <sect2 id="scsi_sysctl.c">
258 <title>drivers/scsi/scsi_sysctl.c</title>
259 <para>
260 Set up the sysctl entry: "/dev/scsi/logging_level"
261 (DEV_SCSI_LOGGING_LEVEL) which sets/returns scsi_logging_level.
262 </para>
263 </sect2>
264 <sect2 id="scsi_sysfs.c">
265 <title>drivers/scsi/scsi_sysfs.c</title>
266 <para>
267 SCSI sysfs interface routines.
268 </para>
269!Edrivers/scsi/scsi_sysfs.c
270 </sect2>
271 <sect2 id="hosts.c">
272 <title>drivers/scsi/hosts.c</title>
273 <para>
274 mid to lowlevel SCSI driver interface
275 </para>
276!Edrivers/scsi/hosts.c
277 </sect2>
278 <sect2 id="constants.c">
279 <title>drivers/scsi/constants.c</title>
280 <para>
281 mid to lowlevel SCSI driver interface
282 </para>
283!Edrivers/scsi/constants.c
284 </sect2>
285 </sect1>
286
287 <sect1 id="Transport_classes">
288 <title>Transport classes</title>
289 <para>
290 Transport classes are service libraries for drivers in the scsi
291 lower layer, which expose transport attributes in sysfs.
292 </para>
293 <sect2 id="Fibre_Channel_transport">
294 <title>Fibre Channel transport</title>
295 <para>
296 The file drivers/scsi/scsi_transport_fc.c defines transport attributes
297 for Fibre Channel.
298 </para>
299!Edrivers/scsi/scsi_transport_fc.c
300 </sect2>
301 <sect2 id="iSCSI_transport">
302 <title>iSCSI transport class</title>
303 <para>
304 The file drivers/scsi/scsi_transport_iscsi.c defines transport
305 attributes for the iSCSI class, which sends SCSI packets over TCP/IP
306 connections.
307 </para>
308!Edrivers/scsi/scsi_transport_iscsi.c
309 </sect2>
310 <sect2 id="SAS_transport">
311 <title>Serial Attached SCSI (SAS) transport class</title>
312 <para>
313 The file drivers/scsi/scsi_transport_sas.c defines transport
314 attributes for Serial Attached SCSI, a variant of SATA aimed at
315 large high-end systems.
316 </para>
317 <para>
318 The SAS transport class contains common code to deal with SAS HBAs,
319 an aproximated representation of SAS topologies in the driver model,
320 and various sysfs attributes to expose these topologies and managment
321 interfaces to userspace.
322 </para>
323 <para>
324 In addition to the basic SCSI core objects this transport class
325 introduces two additional intermediate objects: The SAS PHY
326 as represented by struct sas_phy defines an "outgoing" PHY on
327 a SAS HBA or Expander, and the SAS remote PHY represented by
328 struct sas_rphy defines an "incoming" PHY on a SAS Expander or
329 end device. Note that this is purely a software concept, the
330 underlying hardware for a PHY and a remote PHY is the exactly
331 the same.
332 </para>
333 <para>
334 There is no concept of a SAS port in this code, users can see
335 what PHYs form a wide port based on the port_identifier attribute,
336 which is the same for all PHYs in a port.
337 </para>
338!Edrivers/scsi/scsi_transport_sas.c
339 </sect2>
340 <sect2 id="SATA_transport">
341 <title>SATA transport class</title>
342 <para>
343 The SATA transport is handled by libata, which has its own book of
344 documentation in this directory.
345 </para>
346 </sect2>
347 <sect2 id="SPI_transport">
348 <title>Parallel SCSI (SPI) transport class</title>
349 <para>
350 The file drivers/scsi/scsi_transport_spi.c defines transport
351 attributes for traditional (fast/wide/ultra) SCSI busses.
352 </para>
353!Edrivers/scsi/scsi_transport_spi.c
354 </sect2>
355 <sect2 id="SRP_transport">
356 <title>SCSI RDMA (SRP) transport class</title>
357 <para>
358 The file drivers/scsi/scsi_transport_srp.c defines transport
359 attributes for SCSI over Remote Direct Memory Access.
360 </para>
361!Edrivers/scsi/scsi_transport_srp.c
362 </sect2>
363 </sect1>
364
365 </chapter>
366
367 <chapter id="lower_layer">
368 <title>SCSI lower layer</title>
369 <sect1 id="hba_drivers">
370 <title>Host Bus Adapter transport types</title>
371 <para>
372 Many modern device controllers use the SCSI command set as a protocol to
373 communicate with their devices through many different types of physical
374 connections.
375 </para>
376 <para>
377 In SCSI language a bus capable of carrying SCSI commands is
378 called a "transport", and a controller connecting to such a bus is
379 called a "host bus adapter" (HBA).
380 </para>
381 <sect2 id="scsi_debug.c">
382 <title>Debug transport</title>
383 <para>
384 The file drivers/scsi/scsi_debug.c simulates a host adapter with a
385 variable number of disks (or disk like devices) attached, sharing a
386 common amount of RAM. Does a lot of checking to make sure that we are
387 not getting blocks mixed up, and panics the kernel if anything out of
388 the ordinary is seen.
389 </para>
390 <para>
391 To be more realistic, the simulated devices have the transport
392 attributes of SAS disks.
393 </para>
394 <para>
395 For documentation see
396 <ulink url='http://www.torque.net/sg/sdebug26.html'>http://www.torque.net/sg/sdebug26.html</ulink>
397 </para>
398<!-- !Edrivers/scsi/scsi_debug.c -->
399 </sect2>
400 <sect2 id="todo">
401 <title>todo</title>
402 <para>Parallel (fast/wide/ultra) SCSI, USB, SATA,
403 SAS, Fibre Channel, FireWire, ATAPI devices, Infiniband,
404 I20, iSCSI, Parallel ports, netlink...
405 </para>
406 </sect2>
407 </sect1>
408 </chapter>
409</book>
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index fac4314cd2ad..403a7f2d8f9b 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -362,7 +362,6 @@ void scsi_print_command(struct scsi_cmnd *cmd)
362EXPORT_SYMBOL(scsi_print_command); 362EXPORT_SYMBOL(scsi_print_command);
363 363
364/** 364/**
365 *
366 * scsi_print_status - print scsi status description 365 * scsi_print_status - print scsi status description
367 * @scsi_status: scsi status value 366 * @scsi_status: scsi status value
368 * 367 *
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 24271a871b8c..9a10b4335e76 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -54,8 +54,7 @@ static struct class shost_class = {
54}; 54};
55 55
56/** 56/**
57 * scsi_host_set_state - Take the given host through the host 57 * scsi_host_set_state - Take the given host through the host state model.
58 * state model.
59 * @shost: scsi host to change the state of. 58 * @shost: scsi host to change the state of.
60 * @state: state to change to. 59 * @state: state to change to.
61 * 60 *
@@ -431,7 +430,6 @@ EXPORT_SYMBOL(scsi_unregister);
431 430
432/** 431/**
433 * scsi_host_lookup - get a reference to a Scsi_Host by host no 432 * scsi_host_lookup - get a reference to a Scsi_Host by host no
434 *
435 * @hostnum: host number to locate 433 * @hostnum: host number to locate
436 * 434 *
437 * Return value: 435 * Return value:
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 0fb1709ce5e3..412a351c6cf7 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -122,6 +122,11 @@ static const char *const scsi_device_types[] = {
122 "Automation/Drive ", 122 "Automation/Drive ",
123}; 123};
124 124
125/**
126 * scsi_device_type - Return 17 char string indicating device type.
127 * @type: type number to look up
128 */
129
125const char * scsi_device_type(unsigned type) 130const char * scsi_device_type(unsigned type)
126{ 131{
127 if (type == 0x1e) 132 if (type == 0x1e)
@@ -156,6 +161,14 @@ static struct scsi_host_cmd_pool scsi_cmd_dma_pool = {
156 161
157static DEFINE_MUTEX(host_cmd_pool_mutex); 162static DEFINE_MUTEX(host_cmd_pool_mutex);
158 163
164/**
165 * __scsi_get_command - Allocate a struct scsi_cmnd
166 * @shost: host to transmit command
167 * @gfp_mask: allocation mask
168 *
169 * Description: allocate a struct scsi_cmd from host's slab, recycling from the
170 * host's free_list if necessary.
171 */
159struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost, gfp_t gfp_mask) 172struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost, gfp_t gfp_mask)
160{ 173{
161 struct scsi_cmnd *cmd; 174 struct scsi_cmnd *cmd;
@@ -179,13 +192,10 @@ struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost, gfp_t gfp_mask)
179} 192}
180EXPORT_SYMBOL_GPL(__scsi_get_command); 193EXPORT_SYMBOL_GPL(__scsi_get_command);
181 194
182/* 195/**
183 * Function: scsi_get_command() 196 * scsi_get_command - Allocate and setup a scsi command block
184 * 197 * @dev: parent scsi device
185 * Purpose: Allocate and setup a scsi command block 198 * @gfp_mask: allocator flags
186 *
187 * Arguments: dev - parent scsi device
188 * gfp_mask- allocator flags
189 * 199 *
190 * Returns: The allocated scsi command structure. 200 * Returns: The allocated scsi command structure.
191 */ 201 */
@@ -217,6 +227,12 @@ struct scsi_cmnd *scsi_get_command(struct scsi_device *dev, gfp_t gfp_mask)
217} 227}
218EXPORT_SYMBOL(scsi_get_command); 228EXPORT_SYMBOL(scsi_get_command);
219 229
230/**
231 * __scsi_put_command - Free a struct scsi_cmnd
232 * @shost: dev->host
233 * @cmd: Command to free
234 * @dev: parent scsi device
235 */
220void __scsi_put_command(struct Scsi_Host *shost, struct scsi_cmnd *cmd, 236void __scsi_put_command(struct Scsi_Host *shost, struct scsi_cmnd *cmd,
221 struct device *dev) 237 struct device *dev)
222{ 238{
@@ -237,12 +253,9 @@ void __scsi_put_command(struct Scsi_Host *shost, struct scsi_cmnd *cmd,
237} 253}
238EXPORT_SYMBOL(__scsi_put_command); 254EXPORT_SYMBOL(__scsi_put_command);
239 255
240/* 256/**
241 * Function: scsi_put_command() 257 * scsi_put_command - Free a scsi command block
242 * 258 * @cmd: command block to free
243 * Purpose: Free a scsi command block
244 *
245 * Arguments: cmd - command block to free
246 * 259 *
247 * Returns: Nothing. 260 * Returns: Nothing.
248 * 261 *
@@ -263,12 +276,13 @@ void scsi_put_command(struct scsi_cmnd *cmd)
263} 276}
264EXPORT_SYMBOL(scsi_put_command); 277EXPORT_SYMBOL(scsi_put_command);
265 278
266/* 279/**
267 * Function: scsi_setup_command_freelist() 280 * scsi_setup_command_freelist - Setup the command freelist for a scsi host.
268 * 281 * @shost: host to allocate the freelist for.
269 * Purpose: Setup the command freelist for a scsi host.
270 * 282 *
271 * Arguments: shost - host to allocate the freelist for. 283 * Description: The command freelist protects against system-wide out of memory
284 * deadlock by preallocating one SCSI command structure for each host, so the
285 * system can always write to a swap file on a device associated with that host.
272 * 286 *
273 * Returns: Nothing. 287 * Returns: Nothing.
274 */ 288 */
@@ -282,7 +296,7 @@ int scsi_setup_command_freelist(struct Scsi_Host *shost)
282 296
283 /* 297 /*
284 * Select a command slab for this host and create it if not 298 * Select a command slab for this host and create it if not
285 * yet existant. 299 * yet existent.
286 */ 300 */
287 mutex_lock(&host_cmd_pool_mutex); 301 mutex_lock(&host_cmd_pool_mutex);
288 pool = (shost->unchecked_isa_dma ? &scsi_cmd_dma_pool : &scsi_cmd_pool); 302 pool = (shost->unchecked_isa_dma ? &scsi_cmd_dma_pool : &scsi_cmd_pool);
@@ -318,12 +332,9 @@ int scsi_setup_command_freelist(struct Scsi_Host *shost)
318 332
319} 333}
320 334
321/* 335/**
322 * Function: scsi_destroy_command_freelist() 336 * scsi_destroy_command_freelist - Release the command freelist for a scsi host.
323 * 337 * @shost: host whose freelist is going to be destroyed
324 * Purpose: Release the command freelist for a scsi host.
325 *
326 * Arguments: shost - host that's freelist is going to be destroyed
327 */ 338 */
328void scsi_destroy_command_freelist(struct Scsi_Host *shost) 339void scsi_destroy_command_freelist(struct Scsi_Host *shost)
329{ 340{
@@ -441,8 +452,12 @@ void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
441} 452}
442#endif 453#endif
443 454
444/* 455/**
445 * Assign a serial number to the request for error recovery 456 * scsi_cmd_get_serial - Assign a serial number to a command
457 * @host: the scsi host
458 * @cmd: command to assign serial number to
459 *
460 * Description: a serial number identifies a request for error recovery
446 * and debugging purposes. Protected by the Host_Lock of host. 461 * and debugging purposes. Protected by the Host_Lock of host.
447 */ 462 */
448static inline void scsi_cmd_get_serial(struct Scsi_Host *host, struct scsi_cmnd *cmd) 463static inline void scsi_cmd_get_serial(struct Scsi_Host *host, struct scsi_cmnd *cmd)
@@ -452,14 +467,12 @@ static inline void scsi_cmd_get_serial(struct Scsi_Host *host, struct scsi_cmnd
452 cmd->serial_number = host->cmd_serial_number++; 467 cmd->serial_number = host->cmd_serial_number++;
453} 468}
454 469
455/* 470/**
456 * Function: scsi_dispatch_command 471 * scsi_dispatch_command - Dispatch a command to the low-level driver.
457 * 472 * @cmd: command block we are dispatching.
458 * Purpose: Dispatch a command to the low-level driver.
459 *
460 * Arguments: cmd - command block we are dispatching.
461 * 473 *
462 * Notes: 474 * Return: nonzero return request was rejected and device's queue needs to be
475 * plugged.
463 */ 476 */
464int scsi_dispatch_cmd(struct scsi_cmnd *cmd) 477int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
465{ 478{
@@ -585,7 +598,7 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
585 598
586/** 599/**
587 * scsi_req_abort_cmd -- Request command recovery for the specified command 600 * scsi_req_abort_cmd -- Request command recovery for the specified command
588 * cmd: pointer to the SCSI command of interest 601 * @cmd: pointer to the SCSI command of interest
589 * 602 *
590 * This function requests that SCSI Core start recovery for the 603 * This function requests that SCSI Core start recovery for the
591 * command by deleting the timer and adding the command to the eh 604 * command by deleting the timer and adding the command to the eh
@@ -606,9 +619,9 @@ EXPORT_SYMBOL(scsi_req_abort_cmd);
606 * @cmd: The SCSI Command for which a low-level device driver (LLDD) gives 619 * @cmd: The SCSI Command for which a low-level device driver (LLDD) gives
607 * ownership back to SCSI Core -- i.e. the LLDD has finished with it. 620 * ownership back to SCSI Core -- i.e. the LLDD has finished with it.
608 * 621 *
609 * This function is the mid-level's (SCSI Core) interrupt routine, which 622 * Description: This function is the mid-level's (SCSI Core) interrupt routine,
610 * regains ownership of the SCSI command (de facto) from a LLDD, and enqueues 623 * which regains ownership of the SCSI command (de facto) from a LLDD, and
611 * the command to the done queue for further processing. 624 * enqueues the command to the done queue for further processing.
612 * 625 *
613 * This is the producer of the done queue who enqueues at the tail. 626 * This is the producer of the done queue who enqueues at the tail.
614 * 627 *
@@ -617,7 +630,7 @@ EXPORT_SYMBOL(scsi_req_abort_cmd);
617static void scsi_done(struct scsi_cmnd *cmd) 630static void scsi_done(struct scsi_cmnd *cmd)
618{ 631{
619 /* 632 /*
620 * We don't have to worry about this one timing out any more. 633 * We don't have to worry about this one timing out anymore.
621 * If we are unable to remove the timer, then the command 634 * If we are unable to remove the timer, then the command
622 * has already timed out. In which case, we have no choice but to 635 * has already timed out. In which case, we have no choice but to
623 * let the timeout function run, as we have no idea where in fact 636 * let the timeout function run, as we have no idea where in fact
@@ -660,10 +673,11 @@ static struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
660 return *(struct scsi_driver **)cmd->request->rq_disk->private_data; 673 return *(struct scsi_driver **)cmd->request->rq_disk->private_data;
661} 674}
662 675
663/* 676/**
664 * Function: scsi_finish_command 677 * scsi_finish_command - cleanup and pass command back to upper layer
678 * @cmd: the command
665 * 679 *
666 * Purpose: Pass command off to upper layer for finishing of I/O 680 * Description: Pass command off to upper layer for finishing of I/O
667 * request, waking processes that are waiting on results, 681 * request, waking processes that are waiting on results,
668 * etc. 682 * etc.
669 */ 683 */
@@ -708,18 +722,14 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
708} 722}
709EXPORT_SYMBOL(scsi_finish_command); 723EXPORT_SYMBOL(scsi_finish_command);
710 724
711/* 725/**
712 * Function: scsi_adjust_queue_depth() 726 * scsi_adjust_queue_depth - Let low level drivers change a device's queue depth
713 * 727 * @sdev: SCSI Device in question
714 * Purpose: Allow low level drivers to tell us to change the queue depth 728 * @tagged: Do we use tagged queueing (non-0) or do we treat
715 * on a specific SCSI device 729 * this device as an untagged device (0)
716 * 730 * @tags: Number of tags allowed if tagged queueing enabled,
717 * Arguments: sdev - SCSI Device in question 731 * or number of commands the low level driver can
718 * tagged - Do we use tagged queueing (non-0) or do we treat 732 * queue up in non-tagged mode (as per cmd_per_lun).
719 * this device as an untagged device (0)
720 * tags - Number of tags allowed if tagged queueing enabled,
721 * or number of commands the low level driver can
722 * queue up in non-tagged mode (as per cmd_per_lun).
723 * 733 *
724 * Returns: Nothing 734 * Returns: Nothing
725 * 735 *
@@ -742,8 +752,8 @@ void scsi_adjust_queue_depth(struct scsi_device *sdev, int tagged, int tags)
742 752
743 spin_lock_irqsave(sdev->request_queue->queue_lock, flags); 753 spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
744 754
745 /* Check to see if the queue is managed by the block layer 755 /* Check to see if the queue is managed by the block layer.
746 * if it is, and we fail to adjust the depth, exit */ 756 * If it is, and we fail to adjust the depth, exit. */
747 if (blk_queue_tagged(sdev->request_queue) && 757 if (blk_queue_tagged(sdev->request_queue) &&
748 blk_queue_resize_tags(sdev->request_queue, tags) != 0) 758 blk_queue_resize_tags(sdev->request_queue, tags) != 0)
749 goto out; 759 goto out;
@@ -772,20 +782,17 @@ void scsi_adjust_queue_depth(struct scsi_device *sdev, int tagged, int tags)
772} 782}
773EXPORT_SYMBOL(scsi_adjust_queue_depth); 783EXPORT_SYMBOL(scsi_adjust_queue_depth);
774 784
775/* 785/**
776 * Function: scsi_track_queue_full() 786 * scsi_track_queue_full - track QUEUE_FULL events to adjust queue depth
787 * @sdev: SCSI Device in question
788 * @depth: Current number of outstanding SCSI commands on this device,
789 * not counting the one returned as QUEUE_FULL.
777 * 790 *
778 * Purpose: This function will track successive QUEUE_FULL events on a 791 * Description: This function will track successive QUEUE_FULL events on a
779 * specific SCSI device to determine if and when there is a 792 * specific SCSI device to determine if and when there is a
780 * need to adjust the queue depth on the device. 793 * need to adjust the queue depth on the device.
781 * 794 *
782 * Arguments: sdev - SCSI Device in question 795 * Returns: 0 - No change needed, >0 - Adjust queue depth to this new depth,
783 * depth - Current number of outstanding SCSI commands on
784 * this device, not counting the one returned as
785 * QUEUE_FULL.
786 *
787 * Returns: 0 - No change needed
788 * >0 - Adjust queue depth to this new depth
789 * -1 - Drop back to untagged operation using host->cmd_per_lun 796 * -1 - Drop back to untagged operation using host->cmd_per_lun
790 * as the untagged command depth 797 * as the untagged command depth
791 * 798 *
@@ -824,10 +831,10 @@ int scsi_track_queue_full(struct scsi_device *sdev, int depth)
824EXPORT_SYMBOL(scsi_track_queue_full); 831EXPORT_SYMBOL(scsi_track_queue_full);
825 832
826/** 833/**
827 * scsi_device_get - get an addition reference to a scsi_device 834 * scsi_device_get - get an additional reference to a scsi_device
828 * @sdev: device to get a reference to 835 * @sdev: device to get a reference to
829 * 836 *
830 * Gets a reference to the scsi_device and increments the use count 837 * Description: Gets a reference to the scsi_device and increments the use count
831 * of the underlying LLDD module. You must hold host_lock of the 838 * of the underlying LLDD module. You must hold host_lock of the
832 * parent Scsi_Host or already have a reference when calling this. 839 * parent Scsi_Host or already have a reference when calling this.
833 */ 840 */
@@ -849,8 +856,8 @@ EXPORT_SYMBOL(scsi_device_get);
849 * scsi_device_put - release a reference to a scsi_device 856 * scsi_device_put - release a reference to a scsi_device
850 * @sdev: device to release a reference on. 857 * @sdev: device to release a reference on.
851 * 858 *
852 * Release a reference to the scsi_device and decrements the use count 859 * Description: Release a reference to the scsi_device and decrements the use
853 * of the underlying LLDD module. The device is freed once the last 860 * count of the underlying LLDD module. The device is freed once the last
854 * user vanishes. 861 * user vanishes.
855 */ 862 */
856void scsi_device_put(struct scsi_device *sdev) 863void scsi_device_put(struct scsi_device *sdev)
@@ -867,7 +874,7 @@ void scsi_device_put(struct scsi_device *sdev)
867} 874}
868EXPORT_SYMBOL(scsi_device_put); 875EXPORT_SYMBOL(scsi_device_put);
869 876
870/* helper for shost_for_each_device, thus not documented */ 877/* helper for shost_for_each_device, see that for documentation */
871struct scsi_device *__scsi_iterate_devices(struct Scsi_Host *shost, 878struct scsi_device *__scsi_iterate_devices(struct Scsi_Host *shost,
872 struct scsi_device *prev) 879 struct scsi_device *prev)
873{ 880{
@@ -895,6 +902,8 @@ EXPORT_SYMBOL(__scsi_iterate_devices);
895/** 902/**
896 * starget_for_each_device - helper to walk all devices of a target 903 * starget_for_each_device - helper to walk all devices of a target
897 * @starget: target whose devices we want to iterate over. 904 * @starget: target whose devices we want to iterate over.
905 * @data: Opaque passed to each function call.
906 * @fn: Function to call on each device
898 * 907 *
899 * This traverses over each device of @starget. The devices have 908 * This traverses over each device of @starget. The devices have
900 * a reference that must be released by scsi_host_put when breaking 909 * a reference that must be released by scsi_host_put when breaking
@@ -946,13 +955,13 @@ EXPORT_SYMBOL(__starget_for_each_device);
946 * @starget: SCSI target pointer 955 * @starget: SCSI target pointer
947 * @lun: SCSI Logical Unit Number 956 * @lun: SCSI Logical Unit Number
948 * 957 *
949 * Looks up the scsi_device with the specified @lun for a give 958 * Description: Looks up the scsi_device with the specified @lun for a given
950 * @starget. The returned scsi_device does not have an additional 959 * @starget. The returned scsi_device does not have an additional
951 * reference. You must hold the host's host_lock over this call and 960 * reference. You must hold the host's host_lock over this call and
952 * any access to the returned scsi_device. 961 * any access to the returned scsi_device.
953 * 962 *
954 * Note: The only reason why drivers would want to use this is because 963 * Note: The only reason why drivers would want to use this is because
955 * they're need to access the device list in irq context. Otherwise you 964 * they need to access the device list in irq context. Otherwise you
956 * really want to use scsi_device_lookup_by_target instead. 965 * really want to use scsi_device_lookup_by_target instead.
957 **/ 966 **/
958struct scsi_device *__scsi_device_lookup_by_target(struct scsi_target *starget, 967struct scsi_device *__scsi_device_lookup_by_target(struct scsi_target *starget,
@@ -974,9 +983,9 @@ EXPORT_SYMBOL(__scsi_device_lookup_by_target);
974 * @starget: SCSI target pointer 983 * @starget: SCSI target pointer
975 * @lun: SCSI Logical Unit Number 984 * @lun: SCSI Logical Unit Number
976 * 985 *
977 * Looks up the scsi_device with the specified @channel, @id, @lun for a 986 * Description: Looks up the scsi_device with the specified @channel, @id, @lun
978 * give host. The returned scsi_device has an additional reference that 987 * for a given host. The returned scsi_device has an additional reference that
979 * needs to be release with scsi_host_put once you're done with it. 988 * needs to be released with scsi_device_put once you're done with it.
980 **/ 989 **/
981struct scsi_device *scsi_device_lookup_by_target(struct scsi_target *starget, 990struct scsi_device *scsi_device_lookup_by_target(struct scsi_target *starget,
982 uint lun) 991 uint lun)
@@ -996,19 +1005,19 @@ struct scsi_device *scsi_device_lookup_by_target(struct scsi_target *starget,
996EXPORT_SYMBOL(scsi_device_lookup_by_target); 1005EXPORT_SYMBOL(scsi_device_lookup_by_target);
997 1006
998/** 1007/**
999 * scsi_device_lookup - find a device given the host (UNLOCKED) 1008 * __scsi_device_lookup - find a device given the host (UNLOCKED)
1000 * @shost: SCSI host pointer 1009 * @shost: SCSI host pointer
1001 * @channel: SCSI channel (zero if only one channel) 1010 * @channel: SCSI channel (zero if only one channel)
1002 * @pun: SCSI target number (physical unit number) 1011 * @id: SCSI target number (physical unit number)
1003 * @lun: SCSI Logical Unit Number 1012 * @lun: SCSI Logical Unit Number
1004 * 1013 *
1005 * Looks up the scsi_device with the specified @channel, @id, @lun for a 1014 * Description: Looks up the scsi_device with the specified @channel, @id, @lun
1006 * give host. The returned scsi_device does not have an additional reference. 1015 * for a given host. The returned scsi_device does not have an additional
1007 * You must hold the host's host_lock over this call and any access to the 1016 * reference. You must hold the host's host_lock over this call and any access
1008 * returned scsi_device. 1017 * to the returned scsi_device.
1009 * 1018 *
1010 * Note: The only reason why drivers would want to use this is because 1019 * Note: The only reason why drivers would want to use this is because
1011 * they're need to access the device list in irq context. Otherwise you 1020 * they need to access the device list in irq context. Otherwise you
1012 * really want to use scsi_device_lookup instead. 1021 * really want to use scsi_device_lookup instead.
1013 **/ 1022 **/
1014struct scsi_device *__scsi_device_lookup(struct Scsi_Host *shost, 1023struct scsi_device *__scsi_device_lookup(struct Scsi_Host *shost,
@@ -1033,9 +1042,9 @@ EXPORT_SYMBOL(__scsi_device_lookup);
1033 * @id: SCSI target number (physical unit number) 1042 * @id: SCSI target number (physical unit number)
1034 * @lun: SCSI Logical Unit Number 1043 * @lun: SCSI Logical Unit Number
1035 * 1044 *
1036 * Looks up the scsi_device with the specified @channel, @id, @lun for a 1045 * Description: Looks up the scsi_device with the specified @channel, @id, @lun
1037 * give host. The returned scsi_device has an additional reference that 1046 * for a given host. The returned scsi_device has an additional reference that
1038 * needs to be release with scsi_host_put once you're done with it. 1047 * needs to be released with scsi_device_put once you're done with it.
1039 **/ 1048 **/
1040struct scsi_device *scsi_device_lookup(struct Scsi_Host *shost, 1049struct scsi_device *scsi_device_lookup(struct Scsi_Host *shost,
1041 uint channel, uint id, uint lun) 1050 uint channel, uint id, uint lun)
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index 348cc5a6e3cd..6839c1004b29 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -276,11 +276,12 @@ static void scsi_strcpy_devinfo(char *name, char *to, size_t to_length,
276} 276}
277 277
278/** 278/**
279 * scsi_dev_info_list_add: add one dev_info list entry. 279 * scsi_dev_info_list_add - add one dev_info list entry.
280 * @compatible: if true, null terminate short strings. Otherwise space pad.
280 * @vendor: vendor string 281 * @vendor: vendor string
281 * @model: model (product) string 282 * @model: model (product) string
282 * @strflags: integer string 283 * @strflags: integer string
283 * @flag: if strflags NULL, use this flag value 284 * @flags: if strflags NULL, use this flag value
284 * 285 *
285 * Description: 286 * Description:
286 * Create and add one dev_info entry for @vendor, @model, @strflags or 287 * Create and add one dev_info entry for @vendor, @model, @strflags or
@@ -322,8 +323,7 @@ static int scsi_dev_info_list_add(int compatible, char *vendor, char *model,
322} 323}
323 324
324/** 325/**
325 * scsi_dev_info_list_add_str: parse dev_list and add to the 326 * scsi_dev_info_list_add_str - parse dev_list and add to the scsi_dev_info_list.
326 * scsi_dev_info_list.
327 * @dev_list: string of device flags to add 327 * @dev_list: string of device flags to add
328 * 328 *
329 * Description: 329 * Description:
@@ -374,15 +374,15 @@ static int scsi_dev_info_list_add_str(char *dev_list)
374} 374}
375 375
376/** 376/**
377 * get_device_flags - get device specific flags from the dynamic device 377 * get_device_flags - get device specific flags from the dynamic device list.
378 * list. Called during scan time. 378 * @sdev: &scsi_device to get flags for
379 * @vendor: vendor name 379 * @vendor: vendor name
380 * @model: model name 380 * @model: model name
381 * 381 *
382 * Description: 382 * Description:
383 * Search the scsi_dev_info_list for an entry matching @vendor and 383 * Search the scsi_dev_info_list for an entry matching @vendor and
384 * @model, if found, return the matching flags value, else return 384 * @model, if found, return the matching flags value, else return
385 * the host or global default settings. 385 * the host or global default settings. Called during scan time.
386 **/ 386 **/
387int scsi_get_device_flags(struct scsi_device *sdev, 387int scsi_get_device_flags(struct scsi_device *sdev,
388 const unsigned char *vendor, 388 const unsigned char *vendor,
@@ -483,13 +483,11 @@ stop_output:
483} 483}
484 484
485/* 485/*
486 * proc_scsi_dev_info_write: allow additions to the scsi_dev_info_list via 486 * proc_scsi_dev_info_write - allow additions to scsi_dev_info_list via /proc.
487 * /proc.
488 * 487 *
489 * Use: echo "vendor:model:flag" > /proc/scsi/device_info 488 * Description: Adds a black/white list entry for vendor and model with an
490 * 489 * integer value of flag to the scsi device info list.
491 * To add a black/white list entry for vendor and model with an integer 490 * To use, echo "vendor:model:flag" > /proc/scsi/device_info
492 * value of flag to the scsi device info list.
493 */ 491 */
494static int proc_scsi_devinfo_write(struct file *file, const char __user *buf, 492static int proc_scsi_devinfo_write(struct file *file, const char __user *buf,
495 unsigned long length, void *data) 493 unsigned long length, void *data)
@@ -532,8 +530,7 @@ MODULE_PARM_DESC(default_dev_flags,
532 "scsi default device flag integer value"); 530 "scsi default device flag integer value");
533 531
534/** 532/**
535 * scsi_dev_info_list_delete: called from scsi.c:exit_scsi to remove 533 * scsi_dev_info_list_delete - called from scsi.c:exit_scsi to remove the scsi_dev_info_list.
536 * the scsi_dev_info_list.
537 **/ 534 **/
538void scsi_exit_devinfo(void) 535void scsi_exit_devinfo(void)
539{ 536{
@@ -552,13 +549,12 @@ void scsi_exit_devinfo(void)
552} 549}
553 550
554/** 551/**
555 * scsi_dev_list_init: set up the dynamic device list. 552 * scsi_dev_list_init - set up the dynamic device list.
556 * @dev_list: string of device flags to add
557 * 553 *
558 * Description: 554 * Description:
559 * Add command line @dev_list entries, then add 555 * Add command line entries from scsi_dev_flags, then add
560 * scsi_static_device_list entries to the scsi device info list. 556 * scsi_static_device_list entries to the scsi device info list.
561 **/ 557 */
562int __init scsi_init_devinfo(void) 558int __init scsi_init_devinfo(void)
563{ 559{
564#ifdef CONFIG_SCSI_PROC_FS 560#ifdef CONFIG_SCSI_PROC_FS
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index ebaca4ca4a13..22f8140598ba 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -779,7 +779,7 @@ static int scsi_request_sense(struct scsi_cmnd *scmd)
779 * Notes: 779 * Notes:
780 * We don't want to use the normal command completion while we are are 780 * We don't want to use the normal command completion while we are are
781 * still handling errors - it may cause other commands to be queued, 781 * still handling errors - it may cause other commands to be queued,
782 * and that would disturb what we are doing. thus we really want to 782 * and that would disturb what we are doing. Thus we really want to
783 * keep a list of pending commands for final completion, and once we 783 * keep a list of pending commands for final completion, and once we
784 * are ready to leave error handling we handle completion for real. 784 * are ready to leave error handling we handle completion for real.
785 **/ 785 **/
@@ -794,7 +794,7 @@ EXPORT_SYMBOL(scsi_eh_finish_cmd);
794/** 794/**
795 * scsi_eh_get_sense - Get device sense data. 795 * scsi_eh_get_sense - Get device sense data.
796 * @work_q: Queue of commands to process. 796 * @work_q: Queue of commands to process.
797 * @done_q: Queue of proccessed commands.. 797 * @done_q: Queue of processed commands.
798 * 798 *
799 * Description: 799 * Description:
800 * See if we need to request sense information. if so, then get it 800 * See if we need to request sense information. if so, then get it
@@ -802,7 +802,7 @@ EXPORT_SYMBOL(scsi_eh_finish_cmd);
802 * 802 *
803 * Notes: 803 * Notes:
804 * This has the unfortunate side effect that if a shost adapter does 804 * This has the unfortunate side effect that if a shost adapter does
805 * not automatically request sense information, that we end up shutting 805 * not automatically request sense information, we end up shutting
806 * it down before we request it. 806 * it down before we request it.
807 * 807 *
808 * All drivers should request sense information internally these days, 808 * All drivers should request sense information internally these days,
@@ -858,7 +858,7 @@ EXPORT_SYMBOL_GPL(scsi_eh_get_sense);
858 858
859/** 859/**
860 * scsi_eh_tur - Send TUR to device. 860 * scsi_eh_tur - Send TUR to device.
861 * @scmd: Scsi cmd to send TUR 861 * @scmd: &scsi_cmnd to send TUR
862 * 862 *
863 * Return value: 863 * Return value:
864 * 0 - Device is ready. 1 - Device NOT ready. 864 * 0 - Device is ready. 1 - Device NOT ready.
@@ -887,14 +887,14 @@ retry_tur:
887} 887}
888 888
889/** 889/**
890 * scsi_eh_abort_cmds - abort canceled commands. 890 * scsi_eh_abort_cmds - abort pending commands.
891 * @shost: scsi host being recovered. 891 * @work_q: &list_head for pending commands.
892 * @eh_done_q: list_head for processed commands. 892 * @done_q: &list_head for processed commands.
893 * 893 *
894 * Decription: 894 * Decription:
895 * Try and see whether or not it makes sense to try and abort the 895 * Try and see whether or not it makes sense to try and abort the
896 * running command. this only works out to be the case if we have one 896 * running command. This only works out to be the case if we have one
897 * command that has timed out. if the command simply failed, it makes 897 * command that has timed out. If the command simply failed, it makes
898 * no sense to try and abort the command, since as far as the shost 898 * no sense to try and abort the command, since as far as the shost
899 * adapter is concerned, it isn't running. 899 * adapter is concerned, it isn't running.
900 **/ 900 **/
@@ -931,7 +931,7 @@ static int scsi_eh_abort_cmds(struct list_head *work_q,
931 931
932/** 932/**
933 * scsi_eh_try_stu - Send START_UNIT to device. 933 * scsi_eh_try_stu - Send START_UNIT to device.
934 * @scmd: Scsi cmd to send START_UNIT 934 * @scmd: &scsi_cmnd to send START_UNIT
935 * 935 *
936 * Return value: 936 * Return value:
937 * 0 - Device is ready. 1 - Device NOT ready. 937 * 0 - Device is ready. 1 - Device NOT ready.
@@ -956,8 +956,9 @@ static int scsi_eh_try_stu(struct scsi_cmnd *scmd)
956 956
957 /** 957 /**
958 * scsi_eh_stu - send START_UNIT if needed 958 * scsi_eh_stu - send START_UNIT if needed
959 * @shost: scsi host being recovered. 959 * @shost: &scsi host being recovered.
960 * @eh_done_q: list_head for processed commands. 960 * @work_q: &list_head for pending commands.
961 * @done_q: &list_head for processed commands.
961 * 962 *
962 * Notes: 963 * Notes:
963 * If commands are failing due to not ready, initializing command required, 964 * If commands are failing due to not ready, initializing command required,
@@ -1008,10 +1009,11 @@ static int scsi_eh_stu(struct Scsi_Host *shost,
1008/** 1009/**
1009 * scsi_eh_bus_device_reset - send bdr if needed 1010 * scsi_eh_bus_device_reset - send bdr if needed
1010 * @shost: scsi host being recovered. 1011 * @shost: scsi host being recovered.
1011 * @eh_done_q: list_head for processed commands. 1012 * @work_q: &list_head for pending commands.
1013 * @done_q: &list_head for processed commands.
1012 * 1014 *
1013 * Notes: 1015 * Notes:
1014 * Try a bus device reset. still, look to see whether we have multiple 1016 * Try a bus device reset. Still, look to see whether we have multiple
1015 * devices that are jammed or not - if we have multiple devices, it 1017 * devices that are jammed or not - if we have multiple devices, it
1016 * makes no sense to try bus_device_reset - we really would need to try 1018 * makes no sense to try bus_device_reset - we really would need to try
1017 * a bus_reset instead. 1019 * a bus_reset instead.
@@ -1063,8 +1065,9 @@ static int scsi_eh_bus_device_reset(struct Scsi_Host *shost,
1063 1065
1064/** 1066/**
1065 * scsi_eh_bus_reset - send a bus reset 1067 * scsi_eh_bus_reset - send a bus reset
1066 * @shost: scsi host being recovered. 1068 * @shost: &scsi host being recovered.
1067 * @eh_done_q: list_head for processed commands. 1069 * @work_q: &list_head for pending commands.
1070 * @done_q: &list_head for processed commands.
1068 **/ 1071 **/
1069static int scsi_eh_bus_reset(struct Scsi_Host *shost, 1072static int scsi_eh_bus_reset(struct Scsi_Host *shost,
1070 struct list_head *work_q, 1073 struct list_head *work_q,
@@ -1440,7 +1443,8 @@ static void scsi_restart_operations(struct Scsi_Host *shost)
1440/** 1443/**
1441 * scsi_eh_ready_devs - check device ready state and recover if not. 1444 * scsi_eh_ready_devs - check device ready state and recover if not.
1442 * @shost: host to be recovered. 1445 * @shost: host to be recovered.
1443 * @eh_done_q: list_head for processed commands. 1446 * @work_q: &list_head for pending commands.
1447 * @done_q: &list_head for processed commands.
1444 * 1448 *
1445 **/ 1449 **/
1446void scsi_eh_ready_devs(struct Scsi_Host *shost, 1450void scsi_eh_ready_devs(struct Scsi_Host *shost,
@@ -1824,9 +1828,7 @@ int scsi_command_normalize_sense(struct scsi_cmnd *cmd,
1824EXPORT_SYMBOL(scsi_command_normalize_sense); 1828EXPORT_SYMBOL(scsi_command_normalize_sense);
1825 1829
1826/** 1830/**
1827 * scsi_sense_desc_find - search for a given descriptor type in 1831 * scsi_sense_desc_find - search for a given descriptor type in descriptor sense data format.
1828 * descriptor sense data format.
1829 *
1830 * @sense_buffer: byte array of descriptor format sense data 1832 * @sense_buffer: byte array of descriptor format sense data
1831 * @sb_len: number of valid bytes in sense_buffer 1833 * @sb_len: number of valid bytes in sense_buffer
1832 * @desc_type: value of descriptor type to find 1834 * @desc_type: value of descriptor type to find
@@ -1865,9 +1867,7 @@ const u8 * scsi_sense_desc_find(const u8 * sense_buffer, int sb_len,
1865EXPORT_SYMBOL(scsi_sense_desc_find); 1867EXPORT_SYMBOL(scsi_sense_desc_find);
1866 1868
1867/** 1869/**
1868 * scsi_get_sense_info_fld - attempts to get information field from 1870 * scsi_get_sense_info_fld - get information field from sense data (either fixed or descriptor format)
1869 * sense data (either fixed or descriptor format)
1870 *
1871 * @sense_buffer: byte array of sense data 1871 * @sense_buffer: byte array of sense data
1872 * @sb_len: number of valid bytes in sense_buffer 1872 * @sb_len: number of valid bytes in sense_buffer
1873 * @info_out: pointer to 64 integer where 8 or 4 byte information 1873 * @info_out: pointer to 64 integer where 8 or 4 byte information
diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c
index 32293f451669..83e144716901 100644
--- a/drivers/scsi/scsi_ioctl.c
+++ b/drivers/scsi/scsi_ioctl.c
@@ -174,10 +174,15 @@ static int scsi_ioctl_get_pci(struct scsi_device *sdev, void __user *arg)
174} 174}
175 175
176 176
177/* 177/**
178 * the scsi_ioctl() function differs from most ioctls in that it does 178 * scsi_ioctl - Dispatch ioctl to scsi device
179 * not take a major/minor number as the dev field. Rather, it takes 179 * @sdev: scsi device receiving ioctl
180 * a pointer to a scsi_devices[] element, a structure. 180 * @cmd: which ioctl is it
181 * @arg: data associated with ioctl
182 *
183 * Description: The scsi_ioctl() function differs from most ioctls in that it
184 * does not take a major/minor number as the dev field. Rather, it takes
185 * a pointer to a &struct scsi_device.
181 */ 186 */
182int scsi_ioctl(struct scsi_device *sdev, int cmd, void __user *arg) 187int scsi_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
183{ 188{
@@ -264,9 +269,12 @@ int scsi_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
264} 269}
265EXPORT_SYMBOL(scsi_ioctl); 270EXPORT_SYMBOL(scsi_ioctl);
266 271
267/* 272/**
268 * the scsi_nonblock_ioctl() function is designed for ioctls which may 273 * scsi_nonblock_ioctl() - Handle SG_SCSI_RESET
269 * be executed even if the device is in recovery. 274 * @sdev: scsi device receiving ioctl
275 * @cmd: Must be SC_SCSI_RESET
276 * @arg: pointer to int containing SG_SCSI_RESET_{DEVICE,BUS,HOST}
277 * @filp: either NULL or a &struct file which must have the O_NONBLOCK flag.
270 */ 278 */
271int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd, 279int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd,
272 void __user *arg, struct file *filp) 280 void __user *arg, struct file *filp)
@@ -276,7 +284,7 @@ int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd,
276 /* The first set of iocts may be executed even if we're doing 284 /* The first set of iocts may be executed even if we're doing
277 * error processing, as long as the device was opened 285 * error processing, as long as the device was opened
278 * non-blocking */ 286 * non-blocking */
279 if (filp && filp->f_flags & O_NONBLOCK) { 287 if (filp && (filp->f_flags & O_NONBLOCK)) {
280 if (scsi_host_in_recovery(sdev->host)) 288 if (scsi_host_in_recovery(sdev->host))
281 return -ENODEV; 289 return -ENODEV;
282 } else if (!scsi_block_when_processing_errors(sdev)) 290 } else if (!scsi_block_when_processing_errors(sdev))
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index a9ac5b1b1667..199b02452259 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -175,7 +175,7 @@ int scsi_queue_insert(struct scsi_cmnd *cmd, int reason)
175 * 175 *
176 * returns the req->errors value which is the scsi_cmnd result 176 * returns the req->errors value which is the scsi_cmnd result
177 * field. 177 * field.
178 **/ 178 */
179int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, 179int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
180 int data_direction, void *buffer, unsigned bufflen, 180 int data_direction, void *buffer, unsigned bufflen,
181 unsigned char *sense, int timeout, int retries, int flags) 181 unsigned char *sense, int timeout, int retries, int flags)
@@ -274,7 +274,7 @@ static void scsi_bi_endio(struct bio *bio, int error)
274/** 274/**
275 * scsi_req_map_sg - map a scatterlist into a request 275 * scsi_req_map_sg - map a scatterlist into a request
276 * @rq: request to fill 276 * @rq: request to fill
277 * @sg: scatterlist 277 * @sgl: scatterlist
278 * @nsegs: number of elements 278 * @nsegs: number of elements
279 * @bufflen: len of buffer 279 * @bufflen: len of buffer
280 * @gfp: memory allocation flags 280 * @gfp: memory allocation flags
@@ -365,14 +365,16 @@ free_bios:
365 * @sdev: scsi device 365 * @sdev: scsi device
366 * @cmd: scsi command 366 * @cmd: scsi command
367 * @cmd_len: length of scsi cdb 367 * @cmd_len: length of scsi cdb
368 * @data_direction: data direction 368 * @data_direction: DMA_TO_DEVICE, DMA_FROM_DEVICE, or DMA_NONE
369 * @buffer: data buffer (this can be a kernel buffer or scatterlist) 369 * @buffer: data buffer (this can be a kernel buffer or scatterlist)
370 * @bufflen: len of buffer 370 * @bufflen: len of buffer
371 * @use_sg: if buffer is a scatterlist this is the number of elements 371 * @use_sg: if buffer is a scatterlist this is the number of elements
372 * @timeout: request timeout in seconds 372 * @timeout: request timeout in seconds
373 * @retries: number of times to retry request 373 * @retries: number of times to retry request
374 * @flags: or into request flags 374 * @privdata: data passed to done()
375 **/ 375 * @done: callback function when done
376 * @gfp: memory allocation flags
377 */
376int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd, 378int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
377 int cmd_len, int data_direction, void *buffer, unsigned bufflen, 379 int cmd_len, int data_direction, void *buffer, unsigned bufflen,
378 int use_sg, int timeout, int retries, void *privdata, 380 int use_sg, int timeout, int retries, void *privdata,
@@ -1804,7 +1806,7 @@ void scsi_exit_queue(void)
1804 * @timeout: command timeout 1806 * @timeout: command timeout
1805 * @retries: number of retries before failing 1807 * @retries: number of retries before failing
1806 * @data: returns a structure abstracting the mode header data 1808 * @data: returns a structure abstracting the mode header data
1807 * @sense: place to put sense data (or NULL if no sense to be collected). 1809 * @sshdr: place to put sense data (or NULL if no sense to be collected).
1808 * must be SCSI_SENSE_BUFFERSIZE big. 1810 * must be SCSI_SENSE_BUFFERSIZE big.
1809 * 1811 *
1810 * Returns zero if successful; negative error number or scsi 1812 * Returns zero if successful; negative error number or scsi
@@ -1871,8 +1873,7 @@ scsi_mode_select(struct scsi_device *sdev, int pf, int sp, int modepage,
1871EXPORT_SYMBOL_GPL(scsi_mode_select); 1873EXPORT_SYMBOL_GPL(scsi_mode_select);
1872 1874
1873/** 1875/**
1874 * scsi_mode_sense - issue a mode sense, falling back from 10 to 1876 * scsi_mode_sense - issue a mode sense, falling back from 10 to six bytes if necessary.
1875 * six bytes if necessary.
1876 * @sdev: SCSI device to be queried 1877 * @sdev: SCSI device to be queried
1877 * @dbd: set if mode sense will allow block descriptors to be returned 1878 * @dbd: set if mode sense will allow block descriptors to be returned
1878 * @modepage: mode page being requested 1879 * @modepage: mode page being requested
@@ -1881,13 +1882,13 @@ EXPORT_SYMBOL_GPL(scsi_mode_select);
1881 * @timeout: command timeout 1882 * @timeout: command timeout
1882 * @retries: number of retries before failing 1883 * @retries: number of retries before failing
1883 * @data: returns a structure abstracting the mode header data 1884 * @data: returns a structure abstracting the mode header data
1884 * @sense: place to put sense data (or NULL if no sense to be collected). 1885 * @sshdr: place to put sense data (or NULL if no sense to be collected).
1885 * must be SCSI_SENSE_BUFFERSIZE big. 1886 * must be SCSI_SENSE_BUFFERSIZE big.
1886 * 1887 *
1887 * Returns zero if unsuccessful, or the header offset (either 4 1888 * Returns zero if unsuccessful, or the header offset (either 4
1888 * or 8 depending on whether a six or ten byte command was 1889 * or 8 depending on whether a six or ten byte command was
1889 * issued) if successful. 1890 * issued) if successful.
1890 **/ 1891 */
1891int 1892int
1892scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, 1893scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage,
1893 unsigned char *buffer, int len, int timeout, int retries, 1894 unsigned char *buffer, int len, int timeout, int retries,
@@ -2007,14 +2008,13 @@ scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries)
2007EXPORT_SYMBOL(scsi_test_unit_ready); 2008EXPORT_SYMBOL(scsi_test_unit_ready);
2008 2009
2009/** 2010/**
2010 * scsi_device_set_state - Take the given device through the device 2011 * scsi_device_set_state - Take the given device through the device state model.
2011 * state model.
2012 * @sdev: scsi device to change the state of. 2012 * @sdev: scsi device to change the state of.
2013 * @state: state to change to. 2013 * @state: state to change to.
2014 * 2014 *
2015 * Returns zero if unsuccessful or an error if the requested 2015 * Returns zero if unsuccessful or an error if the requested
2016 * transition is illegal. 2016 * transition is illegal.
2017 **/ 2017 */
2018int 2018int
2019scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state) 2019scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state)
2020{ 2020{
@@ -2264,7 +2264,7 @@ EXPORT_SYMBOL_GPL(sdev_evt_send_simple);
2264 * Must be called with user context, may sleep. 2264 * Must be called with user context, may sleep.
2265 * 2265 *
2266 * Returns zero if unsuccessful or an error if not. 2266 * Returns zero if unsuccessful or an error if not.
2267 **/ 2267 */
2268int 2268int
2269scsi_device_quiesce(struct scsi_device *sdev) 2269scsi_device_quiesce(struct scsi_device *sdev)
2270{ 2270{
@@ -2289,7 +2289,7 @@ EXPORT_SYMBOL(scsi_device_quiesce);
2289 * queues. 2289 * queues.
2290 * 2290 *
2291 * Must be called with user context, may sleep. 2291 * Must be called with user context, may sleep.
2292 **/ 2292 */
2293void 2293void
2294scsi_device_resume(struct scsi_device *sdev) 2294scsi_device_resume(struct scsi_device *sdev)
2295{ 2295{
@@ -2326,8 +2326,7 @@ scsi_target_resume(struct scsi_target *starget)
2326EXPORT_SYMBOL(scsi_target_resume); 2326EXPORT_SYMBOL(scsi_target_resume);
2327 2327
2328/** 2328/**
2329 * scsi_internal_device_block - internal function to put a device 2329 * scsi_internal_device_block - internal function to put a device temporarily into the SDEV_BLOCK state
2330 * temporarily into the SDEV_BLOCK state
2331 * @sdev: device to block 2330 * @sdev: device to block
2332 * 2331 *
2333 * Block request made by scsi lld's to temporarily stop all 2332 * Block request made by scsi lld's to temporarily stop all
@@ -2342,7 +2341,7 @@ EXPORT_SYMBOL(scsi_target_resume);
2342 * state, all commands are deferred until the scsi lld reenables 2341 * state, all commands are deferred until the scsi lld reenables
2343 * the device with scsi_device_unblock or device_block_tmo fires. 2342 * the device with scsi_device_unblock or device_block_tmo fires.
2344 * This routine assumes the host_lock is held on entry. 2343 * This routine assumes the host_lock is held on entry.
2345 **/ 2344 */
2346int 2345int
2347scsi_internal_device_block(struct scsi_device *sdev) 2346scsi_internal_device_block(struct scsi_device *sdev)
2348{ 2347{
@@ -2382,7 +2381,7 @@ EXPORT_SYMBOL_GPL(scsi_internal_device_block);
2382 * (which must be a legal transition) allowing the midlayer to 2381 * (which must be a legal transition) allowing the midlayer to
2383 * goose the queue for this device. This routine assumes the 2382 * goose the queue for this device. This routine assumes the
2384 * host_lock is held upon entry. 2383 * host_lock is held upon entry.
2385 **/ 2384 */
2386int 2385int
2387scsi_internal_device_unblock(struct scsi_device *sdev) 2386scsi_internal_device_unblock(struct scsi_device *sdev)
2388{ 2387{
@@ -2460,7 +2459,7 @@ EXPORT_SYMBOL_GPL(scsi_target_unblock);
2460 2459
2461/** 2460/**
2462 * scsi_kmap_atomic_sg - find and atomically map an sg-elemnt 2461 * scsi_kmap_atomic_sg - find and atomically map an sg-elemnt
2463 * @sg: scatter-gather list 2462 * @sgl: scatter-gather list
2464 * @sg_count: number of segments in sg 2463 * @sg_count: number of segments in sg
2465 * @offset: offset in bytes into sg, on return offset into the mapped area 2464 * @offset: offset in bytes into sg, on return offset into the mapped area
2466 * @len: bytes to map, on return number of bytes mapped 2465 * @len: bytes to map, on return number of bytes mapped
@@ -2509,8 +2508,7 @@ void *scsi_kmap_atomic_sg(struct scatterlist *sgl, int sg_count,
2509EXPORT_SYMBOL(scsi_kmap_atomic_sg); 2508EXPORT_SYMBOL(scsi_kmap_atomic_sg);
2510 2509
2511/** 2510/**
2512 * scsi_kunmap_atomic_sg - atomically unmap a virtual address, previously 2511 * scsi_kunmap_atomic_sg - atomically unmap a virtual address, previously mapped with scsi_kmap_atomic_sg
2513 * mapped with scsi_kmap_atomic_sg
2514 * @virt: virtual address to be unmapped 2512 * @virt: virtual address to be unmapped
2515 */ 2513 */
2516void scsi_kunmap_atomic_sg(void *virt) 2514void scsi_kunmap_atomic_sg(void *virt)
diff --git a/drivers/scsi/scsi_netlink.c b/drivers/scsi/scsi_netlink.c
index 40579edca101..3e1591828171 100644
--- a/drivers/scsi/scsi_netlink.c
+++ b/drivers/scsi/scsi_netlink.c
@@ -32,11 +32,12 @@ EXPORT_SYMBOL_GPL(scsi_nl_sock);
32 32
33 33
34/** 34/**
35 * scsi_nl_rcv_msg - 35 * scsi_nl_rcv_msg - Receive message handler.
36 * Receive message handler. Extracts message from a receive buffer. 36 * @skb: socket receive buffer
37 *
38 * Description: Extracts message from a receive buffer.
37 * Validates message header and calls appropriate transport message handler 39 * Validates message header and calls appropriate transport message handler
38 * 40 *
39 * @skb: socket receive buffer
40 * 41 *
41 **/ 42 **/
42static void 43static void
@@ -99,9 +100,7 @@ next_msg:
99 100
100 101
101/** 102/**
102 * scsi_nl_rcv_event - 103 * scsi_nl_rcv_event - Event handler for a netlink socket.
103 * Event handler for a netlink socket.
104 *
105 * @this: event notifier block 104 * @this: event notifier block
106 * @event: event type 105 * @event: event type
107 * @ptr: event payload 106 * @ptr: event payload
@@ -129,9 +128,7 @@ static struct notifier_block scsi_netlink_notifier = {
129 128
130 129
131/** 130/**
132 * scsi_netlink_init - 131 * scsi_netlink_init - Called by SCSI subsystem to intialize the SCSI transport netlink interface
133 * Called by SCSI subsystem to intialize the SCSI transport netlink
134 * interface
135 * 132 *
136 **/ 133 **/
137void 134void
@@ -160,9 +157,7 @@ scsi_netlink_init(void)
160 157
161 158
162/** 159/**
163 * scsi_netlink_exit - 160 * scsi_netlink_exit - Called by SCSI subsystem to disable the SCSI transport netlink interface
164 * Called by SCSI subsystem to disable the SCSI transport netlink
165 * interface
166 * 161 *
167 **/ 162 **/
168void 163void
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
index bb6f051beda8..ed395154a5b1 100644
--- a/drivers/scsi/scsi_proc.c
+++ b/drivers/scsi/scsi_proc.c
@@ -45,6 +45,16 @@ static struct proc_dir_entry *proc_scsi;
45/* Protect sht->present and sht->proc_dir */ 45/* Protect sht->present and sht->proc_dir */
46static DEFINE_MUTEX(global_host_template_mutex); 46static DEFINE_MUTEX(global_host_template_mutex);
47 47
48/**
49 * proc_scsi_read - handle read from /proc by calling host's proc_info() command
50 * @buffer: passed to proc_info
51 * @start: passed to proc_info
52 * @offset: passed to proc_info
53 * @length: passed to proc_info
54 * @eof: returns whether length read was less than requested
55 * @data: pointer to a &struct Scsi_Host
56 */
57
48static int proc_scsi_read(char *buffer, char **start, off_t offset, 58static int proc_scsi_read(char *buffer, char **start, off_t offset,
49 int length, int *eof, void *data) 59 int length, int *eof, void *data)
50{ 60{
@@ -57,6 +67,13 @@ static int proc_scsi_read(char *buffer, char **start, off_t offset,
57 return n; 67 return n;
58} 68}
59 69
70/**
71 * proc_scsi_write_proc - Handle write to /proc by calling host's proc_info()
72 * @file: not used
73 * @buf: source of data to write.
74 * @count: number of bytes (at most PROC_BLOCK_SIZE) to write.
75 * @data: pointer to &struct Scsi_Host
76 */
60static int proc_scsi_write_proc(struct file *file, const char __user *buf, 77static int proc_scsi_write_proc(struct file *file, const char __user *buf,
61 unsigned long count, void *data) 78 unsigned long count, void *data)
62{ 79{
@@ -80,6 +97,13 @@ out:
80 return ret; 97 return ret;
81} 98}
82 99
100/**
101 * scsi_proc_hostdir_add - Create directory in /proc for a scsi host
102 * @sht: owner of this directory
103 *
104 * Sets sht->proc_dir to the new directory.
105 */
106
83void scsi_proc_hostdir_add(struct scsi_host_template *sht) 107void scsi_proc_hostdir_add(struct scsi_host_template *sht)
84{ 108{
85 if (!sht->proc_info) 109 if (!sht->proc_info)
@@ -97,6 +121,10 @@ void scsi_proc_hostdir_add(struct scsi_host_template *sht)
97 mutex_unlock(&global_host_template_mutex); 121 mutex_unlock(&global_host_template_mutex);
98} 122}
99 123
124/**
125 * scsi_proc_hostdir_rm - remove directory in /proc for a scsi host
126 * @sht: owner of directory
127 */
100void scsi_proc_hostdir_rm(struct scsi_host_template *sht) 128void scsi_proc_hostdir_rm(struct scsi_host_template *sht)
101{ 129{
102 if (!sht->proc_info) 130 if (!sht->proc_info)
@@ -110,6 +138,11 @@ void scsi_proc_hostdir_rm(struct scsi_host_template *sht)
110 mutex_unlock(&global_host_template_mutex); 138 mutex_unlock(&global_host_template_mutex);
111} 139}
112 140
141
142/**
143 * scsi_proc_host_add - Add entry for this host to appropriate /proc dir
144 * @shost: host to add
145 */
113void scsi_proc_host_add(struct Scsi_Host *shost) 146void scsi_proc_host_add(struct Scsi_Host *shost)
114{ 147{
115 struct scsi_host_template *sht = shost->hostt; 148 struct scsi_host_template *sht = shost->hostt;
@@ -133,6 +166,10 @@ void scsi_proc_host_add(struct Scsi_Host *shost)
133 p->owner = sht->module; 166 p->owner = sht->module;
134} 167}
135 168
169/**
170 * scsi_proc_host_rm - remove this host's entry from /proc
171 * @shost: which host
172 */
136void scsi_proc_host_rm(struct Scsi_Host *shost) 173void scsi_proc_host_rm(struct Scsi_Host *shost)
137{ 174{
138 char name[10]; 175 char name[10];
@@ -143,7 +180,14 @@ void scsi_proc_host_rm(struct Scsi_Host *shost)
143 sprintf(name,"%d", shost->host_no); 180 sprintf(name,"%d", shost->host_no);
144 remove_proc_entry(name, shost->hostt->proc_dir); 181 remove_proc_entry(name, shost->hostt->proc_dir);
145} 182}
146 183/**
184 * proc_print_scsidevice - return data about this host
185 * @dev: A scsi device
186 * @data: &struct seq_file to output to.
187 *
188 * Description: prints Host, Channel, Id, Lun, Vendor, Model, Rev, Type,
189 * and revision.
190 */
147static int proc_print_scsidevice(struct device *dev, void *data) 191static int proc_print_scsidevice(struct device *dev, void *data)
148{ 192{
149 struct scsi_device *sdev = to_scsi_device(dev); 193 struct scsi_device *sdev = to_scsi_device(dev);
@@ -189,6 +233,21 @@ static int proc_print_scsidevice(struct device *dev, void *data)
189 return 0; 233 return 0;
190} 234}
191 235
236/**
237 * scsi_add_single_device - Respond to user request to probe for/add device
238 * @host: user-supplied decimal integer
239 * @channel: user-supplied decimal integer
240 * @id: user-supplied decimal integer
241 * @lun: user-supplied decimal integer
242 *
243 * Description: called by writing "scsi add-single-device" to /proc/scsi/scsi.
244 *
245 * does scsi_host_lookup() and either user_scan() if that transport
246 * type supports it, or else scsi_scan_host_selected()
247 *
248 * Note: this seems to be aimed exclusively at SCSI parallel busses.
249 */
250
192static int scsi_add_single_device(uint host, uint channel, uint id, uint lun) 251static int scsi_add_single_device(uint host, uint channel, uint id, uint lun)
193{ 252{
194 struct Scsi_Host *shost; 253 struct Scsi_Host *shost;
@@ -206,6 +265,16 @@ static int scsi_add_single_device(uint host, uint channel, uint id, uint lun)
206 return error; 265 return error;
207} 266}
208 267
268/**
269 * scsi_remove_single_device - Respond to user request to remove a device
270 * @host: user-supplied decimal integer
271 * @channel: user-supplied decimal integer
272 * @id: user-supplied decimal integer
273 * @lun: user-supplied decimal integer
274 *
275 * Description: called by writing "scsi remove-single-device" to
276 * /proc/scsi/scsi. Does a scsi_device_lookup() and scsi_remove_device()
277 */
209static int scsi_remove_single_device(uint host, uint channel, uint id, uint lun) 278static int scsi_remove_single_device(uint host, uint channel, uint id, uint lun)
210{ 279{
211 struct scsi_device *sdev; 280 struct scsi_device *sdev;
@@ -226,6 +295,25 @@ static int scsi_remove_single_device(uint host, uint channel, uint id, uint lun)
226 return error; 295 return error;
227} 296}
228 297
298/**
299 * proc_scsi_write - handle writes to /proc/scsi/scsi
300 * @file: not used
301 * @buf: buffer to write
302 * @length: length of buf, at most PAGE_SIZE
303 * @ppos: not used
304 *
305 * Description: this provides a legacy mechanism to add or remove devices by
306 * Host, Channel, ID, and Lun. To use,
307 * "echo 'scsi add-single-device 0 1 2 3' > /proc/scsi/scsi" or
308 * "echo 'scsi remove-single-device 0 1 2 3' > /proc/scsi/scsi" with
309 * "0 1 2 3" replaced by the Host, Channel, Id, and Lun.
310 *
311 * Note: this seems to be aimed at parallel SCSI. Most modern busses (USB,
312 * SATA, Firewire, Fibre Channel, etc) dynamically assign these values to
313 * provide a unique identifier and nothing more.
314 */
315
316
229static ssize_t proc_scsi_write(struct file *file, const char __user *buf, 317static ssize_t proc_scsi_write(struct file *file, const char __user *buf,
230 size_t length, loff_t *ppos) 318 size_t length, loff_t *ppos)
231{ 319{
@@ -291,6 +379,11 @@ static ssize_t proc_scsi_write(struct file *file, const char __user *buf,
291 return err; 379 return err;
292} 380}
293 381
382/**
383 * proc_scsi_show - show contents of /proc/scsi/scsi (attached devices)
384 * @s: output goes here
385 * @p: not used
386 */
294static int proc_scsi_show(struct seq_file *s, void *p) 387static int proc_scsi_show(struct seq_file *s, void *p)
295{ 388{
296 seq_printf(s, "Attached devices:\n"); 389 seq_printf(s, "Attached devices:\n");
@@ -298,10 +391,17 @@ static int proc_scsi_show(struct seq_file *s, void *p)
298 return 0; 391 return 0;
299} 392}
300 393
394/**
395 * proc_scsi_open - glue function
396 * @inode: not used
397 * @file: passed to single_open()
398 *
399 * Associates proc_scsi_show with this file
400 */
301static int proc_scsi_open(struct inode *inode, struct file *file) 401static int proc_scsi_open(struct inode *inode, struct file *file)
302{ 402{
303 /* 403 /*
304 * We don't really needs this for the write case but it doesn't 404 * We don't really need this for the write case but it doesn't
305 * harm either. 405 * harm either.
306 */ 406 */
307 return single_open(file, proc_scsi_show, NULL); 407 return single_open(file, proc_scsi_show, NULL);
@@ -315,6 +415,9 @@ static const struct file_operations proc_scsi_operations = {
315 .release = single_release, 415 .release = single_release,
316}; 416};
317 417
418/**
419 * scsi_init_procfs - create scsi and scsi/scsi in procfs
420 */
318int __init scsi_init_procfs(void) 421int __init scsi_init_procfs(void)
319{ 422{
320 struct proc_dir_entry *pde; 423 struct proc_dir_entry *pde;
@@ -336,6 +439,9 @@ err1:
336 return -ENOMEM; 439 return -ENOMEM;
337} 440}
338 441
442/**
443 * scsi_exit_procfs - Remove scsi/scsi and scsi from procfs
444 */
339void scsi_exit_procfs(void) 445void scsi_exit_procfs(void)
340{ 446{
341 remove_proc_entry("scsi/scsi", NULL); 447 remove_proc_entry("scsi/scsi", NULL);
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 40ea71cd2ca6..7e8b2045ccfa 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -221,6 +221,9 @@ static void scsi_unlock_floptical(struct scsi_device *sdev,
221 221
222/** 222/**
223 * scsi_alloc_sdev - allocate and setup a scsi_Device 223 * scsi_alloc_sdev - allocate and setup a scsi_Device
224 * @starget: which target to allocate a &scsi_device for
225 * @lun: which lun
226 * @hostdata: usually NULL and set by ->slave_alloc instead
224 * 227 *
225 * Description: 228 * Description:
226 * Allocate, initialize for io, and return a pointer to a scsi_Device. 229 * Allocate, initialize for io, and return a pointer to a scsi_Device.
@@ -472,7 +475,6 @@ static void scsi_target_reap_usercontext(struct work_struct *work)
472 475
473/** 476/**
474 * scsi_target_reap - check to see if target is in use and destroy if not 477 * scsi_target_reap - check to see if target is in use and destroy if not
475 *
476 * @starget: target to be checked 478 * @starget: target to be checked
477 * 479 *
478 * This is used after removing a LUN or doing a last put of the target 480 * This is used after removing a LUN or doing a last put of the target
@@ -928,8 +930,7 @@ static inline void scsi_destroy_sdev(struct scsi_device *sdev)
928 930
929#ifdef CONFIG_SCSI_LOGGING 931#ifdef CONFIG_SCSI_LOGGING
930/** 932/**
931 * scsi_inq_str - print INQUIRY data from min to max index, 933 * scsi_inq_str - print INQUIRY data from min to max index, strip trailing whitespace
932 * strip trailing whitespace
933 * @buf: Output buffer with at least end-first+1 bytes of space 934 * @buf: Output buffer with at least end-first+1 bytes of space
934 * @inq: Inquiry buffer (input) 935 * @inq: Inquiry buffer (input)
935 * @first: Offset of string into inq 936 * @first: Offset of string into inq
@@ -957,9 +958,10 @@ static unsigned char *scsi_inq_str(unsigned char *buf, unsigned char *inq,
957 * scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it 958 * scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it
958 * @starget: pointer to target device structure 959 * @starget: pointer to target device structure
959 * @lun: LUN of target device 960 * @lun: LUN of target device
960 * @sdevscan: probe the LUN corresponding to this scsi_device
961 * @sdevnew: store the value of any new scsi_device allocated
962 * @bflagsp: store bflags here if not NULL 961 * @bflagsp: store bflags here if not NULL
962 * @sdevp: probe the LUN corresponding to this scsi_device
963 * @rescan: if nonzero skip some code only needed on first scan
964 * @hostdata: passed to scsi_alloc_sdev()
963 * 965 *
964 * Description: 966 * Description:
965 * Call scsi_probe_lun, if a LUN with an attached device is found, 967 * Call scsi_probe_lun, if a LUN with an attached device is found,
@@ -1110,6 +1112,8 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
1110 * scsi_sequential_lun_scan - sequentially scan a SCSI target 1112 * scsi_sequential_lun_scan - sequentially scan a SCSI target
1111 * @starget: pointer to target structure to scan 1113 * @starget: pointer to target structure to scan
1112 * @bflags: black/white list flag for LUN 0 1114 * @bflags: black/white list flag for LUN 0
1115 * @scsi_level: Which version of the standard does this device adhere to
1116 * @rescan: passed to scsi_probe_add_lun()
1113 * 1117 *
1114 * Description: 1118 * Description:
1115 * Generally, scan from LUN 1 (LUN 0 is assumed to already have been 1119 * Generally, scan from LUN 1 (LUN 0 is assumed to already have been
@@ -1220,7 +1224,7 @@ EXPORT_SYMBOL(scsilun_to_int);
1220 1224
1221/** 1225/**
1222 * int_to_scsilun: reverts an int into a scsi_lun 1226 * int_to_scsilun: reverts an int into a scsi_lun
1223 * @int: integer to be reverted 1227 * @lun: integer to be reverted
1224 * @scsilun: struct scsi_lun to be set. 1228 * @scsilun: struct scsi_lun to be set.
1225 * 1229 *
1226 * Description: 1230 * Description:
@@ -1252,18 +1256,22 @@ EXPORT_SYMBOL(int_to_scsilun);
1252 1256
1253/** 1257/**
1254 * scsi_report_lun_scan - Scan using SCSI REPORT LUN results 1258 * scsi_report_lun_scan - Scan using SCSI REPORT LUN results
1255 * @sdevscan: scan the host, channel, and id of this scsi_device 1259 * @starget: which target
1260 * @bflags: Zero or a mix of BLIST_NOLUN, BLIST_REPORTLUN2, or BLIST_NOREPORTLUN
1261 * @rescan: nonzero if we can skip code only needed on first scan
1256 * 1262 *
1257 * Description: 1263 * Description:
1258 * If @sdevscan is for a SCSI-3 or up device, send a REPORT LUN 1264 * Fast scanning for modern (SCSI-3) devices by sending a REPORT LUN command.
1259 * command, and scan the resulting list of LUNs by calling 1265 * Scan the resulting list of LUNs by calling scsi_probe_and_add_lun.
1260 * scsi_probe_and_add_lun.
1261 * 1266 *
1262 * Modifies sdevscan->lun. 1267 * If BLINK_REPORTLUN2 is set, scan a target that supports more than 8
1268 * LUNs even if it's older than SCSI-3.
1269 * If BLIST_NOREPORTLUN is set, return 1 always.
1270 * If BLIST_NOLUN is set, return 0 always.
1263 * 1271 *
1264 * Return: 1272 * Return:
1265 * 0: scan completed (or no memory, so further scanning is futile) 1273 * 0: scan completed (or no memory, so further scanning is futile)
1266 * 1: no report lun scan, or not configured 1274 * 1: could not scan with REPORT LUN
1267 **/ 1275 **/
1268static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, 1276static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
1269 int rescan) 1277 int rescan)
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 7a7cfe583b2a..b1119da6e88c 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -481,9 +481,9 @@ MODULE_PARM_DESC(dev_loss_tmo,
481 " exceeded, the scsi target is removed. Value should be" 481 " exceeded, the scsi target is removed. Value should be"
482 " between 1 and SCSI_DEVICE_BLOCK_MAX_TIMEOUT."); 482 " between 1 and SCSI_DEVICE_BLOCK_MAX_TIMEOUT.");
483 483
484/** 484/*
485 * Netlink Infrastructure 485 * Netlink Infrastructure
486 **/ 486 */
487 487
488static atomic_t fc_event_seq; 488static atomic_t fc_event_seq;
489 489
@@ -491,10 +491,10 @@ static atomic_t fc_event_seq;
491 * fc_get_event_number - Obtain the next sequential FC event number 491 * fc_get_event_number - Obtain the next sequential FC event number
492 * 492 *
493 * Notes: 493 * Notes:
494 * We could have inline'd this, but it would have required fc_event_seq to 494 * We could have inlined this, but it would have required fc_event_seq to
495 * be exposed. For now, live with the subroutine call. 495 * be exposed. For now, live with the subroutine call.
496 * Atomic used to avoid lock/unlock... 496 * Atomic used to avoid lock/unlock...
497 **/ 497 */
498u32 498u32
499fc_get_event_number(void) 499fc_get_event_number(void)
500{ 500{
@@ -505,7 +505,6 @@ EXPORT_SYMBOL(fc_get_event_number);
505 505
506/** 506/**
507 * fc_host_post_event - called to post an even on an fc_host. 507 * fc_host_post_event - called to post an even on an fc_host.
508 *
509 * @shost: host the event occurred on 508 * @shost: host the event occurred on
510 * @event_number: fc event number obtained from get_fc_event_number() 509 * @event_number: fc event number obtained from get_fc_event_number()
511 * @event_code: fc_host event being posted 510 * @event_code: fc_host event being posted
@@ -513,7 +512,7 @@ EXPORT_SYMBOL(fc_get_event_number);
513 * 512 *
514 * Notes: 513 * Notes:
515 * This routine assumes no locks are held on entry. 514 * This routine assumes no locks are held on entry.
516 **/ 515 */
517void 516void
518fc_host_post_event(struct Scsi_Host *shost, u32 event_number, 517fc_host_post_event(struct Scsi_Host *shost, u32 event_number,
519 enum fc_host_event_code event_code, u32 event_data) 518 enum fc_host_event_code event_code, u32 event_data)
@@ -579,17 +578,16 @@ EXPORT_SYMBOL(fc_host_post_event);
579 578
580 579
581/** 580/**
582 * fc_host_post_vendor_event - called to post a vendor unique event on 581 * fc_host_post_vendor_event - called to post a vendor unique event on an fc_host
583 * a fc_host
584 *
585 * @shost: host the event occurred on 582 * @shost: host the event occurred on
586 * @event_number: fc event number obtained from get_fc_event_number() 583 * @event_number: fc event number obtained from get_fc_event_number()
587 * @data_len: amount, in bytes, of vendor unique data 584 * @data_len: amount, in bytes, of vendor unique data
588 * @data_buf: pointer to vendor unique data 585 * @data_buf: pointer to vendor unique data
586 * @vendor_id: Vendor id
589 * 587 *
590 * Notes: 588 * Notes:
591 * This routine assumes no locks are held on entry. 589 * This routine assumes no locks are held on entry.
592 **/ 590 */
593void 591void
594fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number, 592fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,
595 u32 data_len, char * data_buf, u64 vendor_id) 593 u32 data_len, char * data_buf, u64 vendor_id)
@@ -1900,7 +1898,6 @@ static int fc_vport_match(struct attribute_container *cont,
1900 1898
1901/** 1899/**
1902 * fc_timed_out - FC Transport I/O timeout intercept handler 1900 * fc_timed_out - FC Transport I/O timeout intercept handler
1903 *
1904 * @scmd: The SCSI command which timed out 1901 * @scmd: The SCSI command which timed out
1905 * 1902 *
1906 * This routine protects against error handlers getting invoked while a 1903 * This routine protects against error handlers getting invoked while a
@@ -1920,7 +1917,7 @@ static int fc_vport_match(struct attribute_container *cont,
1920 * 1917 *
1921 * Notes: 1918 * Notes:
1922 * This routine assumes no locks are held on entry. 1919 * This routine assumes no locks are held on entry.
1923 **/ 1920 */
1924static enum scsi_eh_timer_return 1921static enum scsi_eh_timer_return
1925fc_timed_out(struct scsi_cmnd *scmd) 1922fc_timed_out(struct scsi_cmnd *scmd)
1926{ 1923{
@@ -2133,7 +2130,7 @@ EXPORT_SYMBOL(fc_release_transport);
2133 * 1 - work queued for execution 2130 * 1 - work queued for execution
2134 * 0 - work is already queued 2131 * 0 - work is already queued
2135 * -EINVAL - work queue doesn't exist 2132 * -EINVAL - work queue doesn't exist
2136 **/ 2133 */
2137static int 2134static int
2138fc_queue_work(struct Scsi_Host *shost, struct work_struct *work) 2135fc_queue_work(struct Scsi_Host *shost, struct work_struct *work)
2139{ 2136{
@@ -2152,7 +2149,7 @@ fc_queue_work(struct Scsi_Host *shost, struct work_struct *work)
2152/** 2149/**
2153 * fc_flush_work - Flush a fc_host's workqueue. 2150 * fc_flush_work - Flush a fc_host's workqueue.
2154 * @shost: Pointer to Scsi_Host bound to fc_host. 2151 * @shost: Pointer to Scsi_Host bound to fc_host.
2155 **/ 2152 */
2156static void 2153static void
2157fc_flush_work(struct Scsi_Host *shost) 2154fc_flush_work(struct Scsi_Host *shost)
2158{ 2155{
@@ -2175,7 +2172,7 @@ fc_flush_work(struct Scsi_Host *shost)
2175 * 2172 *
2176 * Return value: 2173 * Return value:
2177 * 1 on success / 0 already queued / < 0 for error 2174 * 1 on success / 0 already queued / < 0 for error
2178 **/ 2175 */
2179static int 2176static int
2180fc_queue_devloss_work(struct Scsi_Host *shost, struct delayed_work *work, 2177fc_queue_devloss_work(struct Scsi_Host *shost, struct delayed_work *work,
2181 unsigned long delay) 2178 unsigned long delay)
@@ -2195,7 +2192,7 @@ fc_queue_devloss_work(struct Scsi_Host *shost, struct delayed_work *work,
2195/** 2192/**
2196 * fc_flush_devloss - Flush a fc_host's devloss workqueue. 2193 * fc_flush_devloss - Flush a fc_host's devloss workqueue.
2197 * @shost: Pointer to Scsi_Host bound to fc_host. 2194 * @shost: Pointer to Scsi_Host bound to fc_host.
2198 **/ 2195 */
2199static void 2196static void
2200fc_flush_devloss(struct Scsi_Host *shost) 2197fc_flush_devloss(struct Scsi_Host *shost)
2201{ 2198{
@@ -2212,21 +2209,20 @@ fc_flush_devloss(struct Scsi_Host *shost)
2212 2209
2213 2210
2214/** 2211/**
2215 * fc_remove_host - called to terminate any fc_transport-related elements 2212 * fc_remove_host - called to terminate any fc_transport-related elements for a scsi host.
2216 * for a scsi host. 2213 * @shost: Which &Scsi_Host
2217 * @rport: remote port to be unblocked.
2218 * 2214 *
2219 * This routine is expected to be called immediately preceeding the 2215 * This routine is expected to be called immediately preceeding the
2220 * a driver's call to scsi_remove_host(). 2216 * a driver's call to scsi_remove_host().
2221 * 2217 *
2222 * WARNING: A driver utilizing the fc_transport, which fails to call 2218 * WARNING: A driver utilizing the fc_transport, which fails to call
2223 * this routine prior to scsi_remote_host(), will leave dangling 2219 * this routine prior to scsi_remove_host(), will leave dangling
2224 * objects in /sys/class/fc_remote_ports. Access to any of these 2220 * objects in /sys/class/fc_remote_ports. Access to any of these
2225 * objects can result in a system crash !!! 2221 * objects can result in a system crash !!!
2226 * 2222 *
2227 * Notes: 2223 * Notes:
2228 * This routine assumes no locks are held on entry. 2224 * This routine assumes no locks are held on entry.
2229 **/ 2225 */
2230void 2226void
2231fc_remove_host(struct Scsi_Host *shost) 2227fc_remove_host(struct Scsi_Host *shost)
2232{ 2228{
@@ -2281,10 +2277,10 @@ EXPORT_SYMBOL(fc_remove_host);
2281 2277
2282/** 2278/**
2283 * fc_starget_delete - called to delete the scsi decendents of an rport 2279 * fc_starget_delete - called to delete the scsi decendents of an rport
2284 * (target and all sdevs)
2285 *
2286 * @work: remote port to be operated on. 2280 * @work: remote port to be operated on.
2287 **/ 2281 *
2282 * Deletes target and all sdevs.
2283 */
2288static void 2284static void
2289fc_starget_delete(struct work_struct *work) 2285fc_starget_delete(struct work_struct *work)
2290{ 2286{
@@ -2303,9 +2299,8 @@ fc_starget_delete(struct work_struct *work)
2303 2299
2304/** 2300/**
2305 * fc_rport_final_delete - finish rport termination and delete it. 2301 * fc_rport_final_delete - finish rport termination and delete it.
2306 *
2307 * @work: remote port to be deleted. 2302 * @work: remote port to be deleted.
2308 **/ 2303 */
2309static void 2304static void
2310fc_rport_final_delete(struct work_struct *work) 2305fc_rport_final_delete(struct work_struct *work)
2311{ 2306{
@@ -2375,7 +2370,7 @@ fc_rport_final_delete(struct work_struct *work)
2375 * 2370 *
2376 * Notes: 2371 * Notes:
2377 * This routine assumes no locks are held on entry. 2372 * This routine assumes no locks are held on entry.
2378 **/ 2373 */
2379static struct fc_rport * 2374static struct fc_rport *
2380fc_rport_create(struct Scsi_Host *shost, int channel, 2375fc_rport_create(struct Scsi_Host *shost, int channel,
2381 struct fc_rport_identifiers *ids) 2376 struct fc_rport_identifiers *ids)
@@ -2462,8 +2457,7 @@ delete_rport:
2462} 2457}
2463 2458
2464/** 2459/**
2465 * fc_remote_port_add - notifies the fc transport of the existence 2460 * fc_remote_port_add - notify fc transport of the existence of a remote FC port.
2466 * of a remote FC port.
2467 * @shost: scsi host the remote port is connected to. 2461 * @shost: scsi host the remote port is connected to.
2468 * @channel: Channel on shost port connected to. 2462 * @channel: Channel on shost port connected to.
2469 * @ids: The world wide names, fc address, and FC4 port 2463 * @ids: The world wide names, fc address, and FC4 port
@@ -2499,7 +2493,7 @@ delete_rport:
2499 * 2493 *
2500 * Notes: 2494 * Notes:
2501 * This routine assumes no locks are held on entry. 2495 * This routine assumes no locks are held on entry.
2502 **/ 2496 */
2503struct fc_rport * 2497struct fc_rport *
2504fc_remote_port_add(struct Scsi_Host *shost, int channel, 2498fc_remote_port_add(struct Scsi_Host *shost, int channel,
2505 struct fc_rport_identifiers *ids) 2499 struct fc_rport_identifiers *ids)
@@ -2683,19 +2677,18 @@ EXPORT_SYMBOL(fc_remote_port_add);
2683 2677
2684 2678
2685/** 2679/**
2686 * fc_remote_port_delete - notifies the fc transport that a remote 2680 * fc_remote_port_delete - notifies the fc transport that a remote port is no longer in existence.
2687 * port is no longer in existence.
2688 * @rport: The remote port that no longer exists 2681 * @rport: The remote port that no longer exists
2689 * 2682 *
2690 * The LLDD calls this routine to notify the transport that a remote 2683 * The LLDD calls this routine to notify the transport that a remote
2691 * port is no longer part of the topology. Note: Although a port 2684 * port is no longer part of the topology. Note: Although a port
2692 * may no longer be part of the topology, it may persist in the remote 2685 * may no longer be part of the topology, it may persist in the remote
2693 * ports displayed by the fc_host. We do this under 2 conditions: 2686 * ports displayed by the fc_host. We do this under 2 conditions:
2694 * - If the port was a scsi target, we delay its deletion by "blocking" it. 2687 * 1) If the port was a scsi target, we delay its deletion by "blocking" it.
2695 * This allows the port to temporarily disappear, then reappear without 2688 * This allows the port to temporarily disappear, then reappear without
2696 * disrupting the SCSI device tree attached to it. During the "blocked" 2689 * disrupting the SCSI device tree attached to it. During the "blocked"
2697 * period the port will still exist. 2690 * period the port will still exist.
2698 * - If the port was a scsi target and disappears for longer than we 2691 * 2) If the port was a scsi target and disappears for longer than we
2699 * expect, we'll delete the port and the tear down the SCSI device tree 2692 * expect, we'll delete the port and the tear down the SCSI device tree
2700 * attached to it. However, we want to semi-persist the target id assigned 2693 * attached to it. However, we want to semi-persist the target id assigned
2701 * to that port if it eventually does exist. The port structure will 2694 * to that port if it eventually does exist. The port structure will
@@ -2709,7 +2702,8 @@ EXPORT_SYMBOL(fc_remote_port_add);
2709 * temporary blocked state. From the LLDD's perspective, the rport no 2702 * temporary blocked state. From the LLDD's perspective, the rport no
2710 * longer exists. From the SCSI midlayer's perspective, the SCSI target 2703 * longer exists. From the SCSI midlayer's perspective, the SCSI target
2711 * exists, but all sdevs on it are blocked from further I/O. The following 2704 * exists, but all sdevs on it are blocked from further I/O. The following
2712 * is then expected: 2705 * is then expected.
2706 *
2713 * If the remote port does not return (signaled by a LLDD call to 2707 * If the remote port does not return (signaled by a LLDD call to
2714 * fc_remote_port_add()) within the dev_loss_tmo timeout, then the 2708 * fc_remote_port_add()) within the dev_loss_tmo timeout, then the
2715 * scsi target is removed - killing all outstanding i/o and removing the 2709 * scsi target is removed - killing all outstanding i/o and removing the
@@ -2731,7 +2725,7 @@ EXPORT_SYMBOL(fc_remote_port_add);
2731 * 2725 *
2732 * Notes: 2726 * Notes:
2733 * This routine assumes no locks are held on entry. 2727 * This routine assumes no locks are held on entry.
2734 **/ 2728 */
2735void 2729void
2736fc_remote_port_delete(struct fc_rport *rport) 2730fc_remote_port_delete(struct fc_rport *rport)
2737{ 2731{
@@ -2792,12 +2786,12 @@ fc_remote_port_delete(struct fc_rport *rport)
2792EXPORT_SYMBOL(fc_remote_port_delete); 2786EXPORT_SYMBOL(fc_remote_port_delete);
2793 2787
2794/** 2788/**
2795 * fc_remote_port_rolechg - notifies the fc transport that the roles 2789 * fc_remote_port_rolechg - notifies the fc transport that the roles on a remote may have changed.
2796 * on a remote may have changed.
2797 * @rport: The remote port that changed. 2790 * @rport: The remote port that changed.
2791 * @roles: New roles for this port.
2798 * 2792 *
2799 * The LLDD calls this routine to notify the transport that the roles 2793 * Description: The LLDD calls this routine to notify the transport that the
2800 * on a remote port may have changed. The largest effect of this is 2794 * roles on a remote port may have changed. The largest effect of this is
2801 * if a port now becomes a FCP Target, it must be allocated a 2795 * if a port now becomes a FCP Target, it must be allocated a
2802 * scsi target id. If the port is no longer a FCP target, any 2796 * scsi target id. If the port is no longer a FCP target, any
2803 * scsi target id value assigned to it will persist in case the 2797 * scsi target id value assigned to it will persist in case the
@@ -2810,7 +2804,7 @@ EXPORT_SYMBOL(fc_remote_port_delete);
2810 * 2804 *
2811 * Notes: 2805 * Notes:
2812 * This routine assumes no locks are held on entry. 2806 * This routine assumes no locks are held on entry.
2813 **/ 2807 */
2814void 2808void
2815fc_remote_port_rolechg(struct fc_rport *rport, u32 roles) 2809fc_remote_port_rolechg(struct fc_rport *rport, u32 roles)
2816{ 2810{
@@ -2875,12 +2869,12 @@ fc_remote_port_rolechg(struct fc_rport *rport, u32 roles)
2875EXPORT_SYMBOL(fc_remote_port_rolechg); 2869EXPORT_SYMBOL(fc_remote_port_rolechg);
2876 2870
2877/** 2871/**
2878 * fc_timeout_deleted_rport - Timeout handler for a deleted remote port, 2872 * fc_timeout_deleted_rport - Timeout handler for a deleted remote port.
2879 * which we blocked, and has now failed to return
2880 * in the allotted time.
2881 *
2882 * @work: rport target that failed to reappear in the allotted time. 2873 * @work: rport target that failed to reappear in the allotted time.
2883 **/ 2874 *
2875 * Description: An attempt to delete a remote port blocks, and if it fails
2876 * to return in the allotted time this gets called.
2877 */
2884static void 2878static void
2885fc_timeout_deleted_rport(struct work_struct *work) 2879fc_timeout_deleted_rport(struct work_struct *work)
2886{ 2880{
@@ -2984,14 +2978,12 @@ fc_timeout_deleted_rport(struct work_struct *work)
2984} 2978}
2985 2979
2986/** 2980/**
2987 * fc_timeout_fail_rport_io - Timeout handler for a fast io failing on a 2981 * fc_timeout_fail_rport_io - Timeout handler for a fast io failing on a disconnected SCSI target.
2988 * disconnected SCSI target.
2989 *
2990 * @work: rport to terminate io on. 2982 * @work: rport to terminate io on.
2991 * 2983 *
2992 * Notes: Only requests the failure of the io, not that all are flushed 2984 * Notes: Only requests the failure of the io, not that all are flushed
2993 * prior to returning. 2985 * prior to returning.
2994 **/ 2986 */
2995static void 2987static void
2996fc_timeout_fail_rport_io(struct work_struct *work) 2988fc_timeout_fail_rport_io(struct work_struct *work)
2997{ 2989{
@@ -3008,9 +3000,8 @@ fc_timeout_fail_rport_io(struct work_struct *work)
3008 3000
3009/** 3001/**
3010 * fc_scsi_scan_rport - called to perform a scsi scan on a remote port. 3002 * fc_scsi_scan_rport - called to perform a scsi scan on a remote port.
3011 *
3012 * @work: remote port to be scanned. 3003 * @work: remote port to be scanned.
3013 **/ 3004 */
3014static void 3005static void
3015fc_scsi_scan_rport(struct work_struct *work) 3006fc_scsi_scan_rport(struct work_struct *work)
3016{ 3007{
@@ -3047,7 +3038,7 @@ fc_scsi_scan_rport(struct work_struct *work)
3047 * 3038 *
3048 * Notes: 3039 * Notes:
3049 * This routine assumes no locks are held on entry. 3040 * This routine assumes no locks are held on entry.
3050 **/ 3041 */
3051static int 3042static int
3052fc_vport_create(struct Scsi_Host *shost, int channel, struct device *pdev, 3043fc_vport_create(struct Scsi_Host *shost, int channel, struct device *pdev,
3053 struct fc_vport_identifiers *ids, struct fc_vport **ret_vport) 3044 struct fc_vport_identifiers *ids, struct fc_vport **ret_vport)
@@ -3172,7 +3163,7 @@ delete_vport:
3172 * 3163 *
3173 * Notes: 3164 * Notes:
3174 * This routine assumes no locks are held on entry. 3165 * This routine assumes no locks are held on entry.
3175 **/ 3166 */
3176int 3167int
3177fc_vport_terminate(struct fc_vport *vport) 3168fc_vport_terminate(struct fc_vport *vport)
3178{ 3169{
@@ -3232,9 +3223,8 @@ EXPORT_SYMBOL(fc_vport_terminate);
3232 3223
3233/** 3224/**
3234 * fc_vport_sched_delete - workq-based delete request for a vport 3225 * fc_vport_sched_delete - workq-based delete request for a vport
3235 *
3236 * @work: vport to be deleted. 3226 * @work: vport to be deleted.
3237 **/ 3227 */
3238static void 3228static void
3239fc_vport_sched_delete(struct work_struct *work) 3229fc_vport_sched_delete(struct work_struct *work)
3240{ 3230{
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 5428d15f23c6..cb48b80c0865 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -328,9 +328,10 @@ EXPORT_SYMBOL_GPL(iscsi_add_session);
328 * iscsi_create_session - create iscsi class session 328 * iscsi_create_session - create iscsi class session
329 * @shost: scsi host 329 * @shost: scsi host
330 * @transport: iscsi transport 330 * @transport: iscsi transport
331 * @target_id: which target
331 * 332 *
332 * This can be called from a LLD or iscsi_transport. 333 * This can be called from a LLD or iscsi_transport.
333 **/ 334 */
334struct iscsi_cls_session * 335struct iscsi_cls_session *
335iscsi_create_session(struct Scsi_Host *shost, 336iscsi_create_session(struct Scsi_Host *shost,
336 struct iscsi_transport *transport, 337 struct iscsi_transport *transport,
@@ -382,7 +383,7 @@ EXPORT_SYMBOL_GPL(iscsi_free_session);
382 * 383 *
383 * Can be called by a LLD or iscsi_transport. There must not be 384 * Can be called by a LLD or iscsi_transport. There must not be
384 * any running connections. 385 * any running connections.
385 **/ 386 */
386int iscsi_destroy_session(struct iscsi_cls_session *session) 387int iscsi_destroy_session(struct iscsi_cls_session *session)
387{ 388{
388 iscsi_remove_session(session); 389 iscsi_remove_session(session);
@@ -418,7 +419,7 @@ static int iscsi_is_conn_dev(const struct device *dev)
418 * for software iscsi we could be trying to preallocate a connection struct 419 * for software iscsi we could be trying to preallocate a connection struct
419 * in which case there could be two connection structs and cid would be 420 * in which case there could be two connection structs and cid would be
420 * non-zero. 421 * non-zero.
421 **/ 422 */
422struct iscsi_cls_conn * 423struct iscsi_cls_conn *
423iscsi_create_conn(struct iscsi_cls_session *session, uint32_t cid) 424iscsi_create_conn(struct iscsi_cls_session *session, uint32_t cid)
424{ 425{
@@ -465,10 +466,10 @@ EXPORT_SYMBOL_GPL(iscsi_create_conn);
465 466
466/** 467/**
467 * iscsi_destroy_conn - destroy iscsi class connection 468 * iscsi_destroy_conn - destroy iscsi class connection
468 * @session: iscsi cls session 469 * @conn: iscsi cls session
469 * 470 *
470 * This can be called from a LLD or iscsi_transport. 471 * This can be called from an LLD or iscsi_transport.
471 **/ 472 */
472int iscsi_destroy_conn(struct iscsi_cls_conn *conn) 473int iscsi_destroy_conn(struct iscsi_cls_conn *conn)
473{ 474{
474 transport_unregister_device(&conn->dev); 475 transport_unregister_device(&conn->dev);
@@ -690,7 +691,7 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh)
690 * 691 *
691 * This is called by HW iscsi LLDs to notify userpsace that its HW has 692 * This is called by HW iscsi LLDs to notify userpsace that its HW has
692 * removed a session. 693 * removed a session.
693 **/ 694 */
694int iscsi_if_destroy_session_done(struct iscsi_cls_conn *conn) 695int iscsi_if_destroy_session_done(struct iscsi_cls_conn *conn)
695{ 696{
696 struct iscsi_internal *priv; 697 struct iscsi_internal *priv;
@@ -751,7 +752,7 @@ EXPORT_SYMBOL_GPL(iscsi_if_destroy_session_done);
751 * 752 *
752 * This is called by HW iscsi LLDs to notify userpsace that its HW has 753 * This is called by HW iscsi LLDs to notify userpsace that its HW has
753 * created a session or a existing session is back in the logged in state. 754 * created a session or a existing session is back in the logged in state.
754 **/ 755 */
755int iscsi_if_create_session_done(struct iscsi_cls_conn *conn) 756int iscsi_if_create_session_done(struct iscsi_cls_conn *conn)
756{ 757{
757 struct iscsi_internal *priv; 758 struct iscsi_internal *priv;
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index 3120f4b3a11a..87e786daa713 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -323,7 +323,7 @@ static int do_sas_phy_delete(struct device *dev, void *data)
323} 323}
324 324
325/** 325/**
326 * sas_remove_children -- tear down a devices SAS data structures 326 * sas_remove_children - tear down a devices SAS data structures
327 * @dev: device belonging to the sas object 327 * @dev: device belonging to the sas object
328 * 328 *
329 * Removes all SAS PHYs and remote PHYs for a given object 329 * Removes all SAS PHYs and remote PHYs for a given object
@@ -336,7 +336,7 @@ void sas_remove_children(struct device *dev)
336EXPORT_SYMBOL(sas_remove_children); 336EXPORT_SYMBOL(sas_remove_children);
337 337
338/** 338/**
339 * sas_remove_host -- tear down a Scsi_Host's SAS data structures 339 * sas_remove_host - tear down a Scsi_Host's SAS data structures
340 * @shost: Scsi Host that is torn down 340 * @shost: Scsi Host that is torn down
341 * 341 *
342 * Removes all SAS PHYs and remote PHYs for a given Scsi_Host. 342 * Removes all SAS PHYs and remote PHYs for a given Scsi_Host.
@@ -577,7 +577,7 @@ static void sas_phy_release(struct device *dev)
577} 577}
578 578
579/** 579/**
580 * sas_phy_alloc -- allocates and initialize a SAS PHY structure 580 * sas_phy_alloc - allocates and initialize a SAS PHY structure
581 * @parent: Parent device 581 * @parent: Parent device
582 * @number: Phy index 582 * @number: Phy index
583 * 583 *
@@ -618,7 +618,7 @@ struct sas_phy *sas_phy_alloc(struct device *parent, int number)
618EXPORT_SYMBOL(sas_phy_alloc); 618EXPORT_SYMBOL(sas_phy_alloc);
619 619
620/** 620/**
621 * sas_phy_add -- add a SAS PHY to the device hierarchy 621 * sas_phy_add - add a SAS PHY to the device hierarchy
622 * @phy: The PHY to be added 622 * @phy: The PHY to be added
623 * 623 *
624 * Publishes a SAS PHY to the rest of the system. 624 * Publishes a SAS PHY to the rest of the system.
@@ -638,7 +638,7 @@ int sas_phy_add(struct sas_phy *phy)
638EXPORT_SYMBOL(sas_phy_add); 638EXPORT_SYMBOL(sas_phy_add);
639 639
640/** 640/**
641 * sas_phy_free -- free a SAS PHY 641 * sas_phy_free - free a SAS PHY
642 * @phy: SAS PHY to free 642 * @phy: SAS PHY to free
643 * 643 *
644 * Frees the specified SAS PHY. 644 * Frees the specified SAS PHY.
@@ -655,7 +655,7 @@ void sas_phy_free(struct sas_phy *phy)
655EXPORT_SYMBOL(sas_phy_free); 655EXPORT_SYMBOL(sas_phy_free);
656 656
657/** 657/**
658 * sas_phy_delete -- remove SAS PHY 658 * sas_phy_delete - remove SAS PHY
659 * @phy: SAS PHY to remove 659 * @phy: SAS PHY to remove
660 * 660 *
661 * Removes the specified SAS PHY. If the SAS PHY has an 661 * Removes the specified SAS PHY. If the SAS PHY has an
@@ -677,7 +677,7 @@ sas_phy_delete(struct sas_phy *phy)
677EXPORT_SYMBOL(sas_phy_delete); 677EXPORT_SYMBOL(sas_phy_delete);
678 678
679/** 679/**
680 * scsi_is_sas_phy -- check if a struct device represents a SAS PHY 680 * scsi_is_sas_phy - check if a struct device represents a SAS PHY
681 * @dev: device to check 681 * @dev: device to check
682 * 682 *
683 * Returns: 683 * Returns:
@@ -843,7 +843,6 @@ EXPORT_SYMBOL(sas_port_alloc_num);
843 843
844/** 844/**
845 * sas_port_add - add a SAS port to the device hierarchy 845 * sas_port_add - add a SAS port to the device hierarchy
846 *
847 * @port: port to be added 846 * @port: port to be added
848 * 847 *
849 * publishes a port to the rest of the system 848 * publishes a port to the rest of the system
@@ -868,7 +867,7 @@ int sas_port_add(struct sas_port *port)
868EXPORT_SYMBOL(sas_port_add); 867EXPORT_SYMBOL(sas_port_add);
869 868
870/** 869/**
871 * sas_port_free -- free a SAS PORT 870 * sas_port_free - free a SAS PORT
872 * @port: SAS PORT to free 871 * @port: SAS PORT to free
873 * 872 *
874 * Frees the specified SAS PORT. 873 * Frees the specified SAS PORT.
@@ -885,7 +884,7 @@ void sas_port_free(struct sas_port *port)
885EXPORT_SYMBOL(sas_port_free); 884EXPORT_SYMBOL(sas_port_free);
886 885
887/** 886/**
888 * sas_port_delete -- remove SAS PORT 887 * sas_port_delete - remove SAS PORT
889 * @port: SAS PORT to remove 888 * @port: SAS PORT to remove
890 * 889 *
891 * Removes the specified SAS PORT. If the SAS PORT has an 890 * Removes the specified SAS PORT. If the SAS PORT has an
@@ -924,7 +923,7 @@ void sas_port_delete(struct sas_port *port)
924EXPORT_SYMBOL(sas_port_delete); 923EXPORT_SYMBOL(sas_port_delete);
925 924
926/** 925/**
927 * scsi_is_sas_port -- check if a struct device represents a SAS port 926 * scsi_is_sas_port - check if a struct device represents a SAS port
928 * @dev: device to check 927 * @dev: device to check
929 * 928 *
930 * Returns: 929 * Returns:
@@ -1309,6 +1308,7 @@ static void sas_rphy_initialize(struct sas_rphy *rphy)
1309 1308
1310/** 1309/**
1311 * sas_end_device_alloc - allocate an rphy for an end device 1310 * sas_end_device_alloc - allocate an rphy for an end device
1311 * @parent: which port
1312 * 1312 *
1313 * Allocates an SAS remote PHY structure, connected to @parent. 1313 * Allocates an SAS remote PHY structure, connected to @parent.
1314 * 1314 *
@@ -1345,6 +1345,8 @@ EXPORT_SYMBOL(sas_end_device_alloc);
1345 1345
1346/** 1346/**
1347 * sas_expander_alloc - allocate an rphy for an end device 1347 * sas_expander_alloc - allocate an rphy for an end device
1348 * @parent: which port
1349 * @type: SAS_EDGE_EXPANDER_DEVICE or SAS_FANOUT_EXPANDER_DEVICE
1348 * 1350 *
1349 * Allocates an SAS remote PHY structure, connected to @parent. 1351 * Allocates an SAS remote PHY structure, connected to @parent.
1350 * 1352 *
@@ -1383,7 +1385,7 @@ struct sas_rphy *sas_expander_alloc(struct sas_port *parent,
1383EXPORT_SYMBOL(sas_expander_alloc); 1385EXPORT_SYMBOL(sas_expander_alloc);
1384 1386
1385/** 1387/**
1386 * sas_rphy_add -- add a SAS remote PHY to the device hierarchy 1388 * sas_rphy_add - add a SAS remote PHY to the device hierarchy
1387 * @rphy: The remote PHY to be added 1389 * @rphy: The remote PHY to be added
1388 * 1390 *
1389 * Publishes a SAS remote PHY to the rest of the system. 1391 * Publishes a SAS remote PHY to the rest of the system.
@@ -1430,8 +1432,8 @@ int sas_rphy_add(struct sas_rphy *rphy)
1430EXPORT_SYMBOL(sas_rphy_add); 1432EXPORT_SYMBOL(sas_rphy_add);
1431 1433
1432/** 1434/**
1433 * sas_rphy_free -- free a SAS remote PHY 1435 * sas_rphy_free - free a SAS remote PHY
1434 * @rphy SAS remote PHY to free 1436 * @rphy: SAS remote PHY to free
1435 * 1437 *
1436 * Frees the specified SAS remote PHY. 1438 * Frees the specified SAS remote PHY.
1437 * 1439 *
@@ -1459,7 +1461,7 @@ void sas_rphy_free(struct sas_rphy *rphy)
1459EXPORT_SYMBOL(sas_rphy_free); 1461EXPORT_SYMBOL(sas_rphy_free);
1460 1462
1461/** 1463/**
1462 * sas_rphy_delete -- remove and free SAS remote PHY 1464 * sas_rphy_delete - remove and free SAS remote PHY
1463 * @rphy: SAS remote PHY to remove and free 1465 * @rphy: SAS remote PHY to remove and free
1464 * 1466 *
1465 * Removes the specified SAS remote PHY and frees it. 1467 * Removes the specified SAS remote PHY and frees it.
@@ -1473,7 +1475,7 @@ sas_rphy_delete(struct sas_rphy *rphy)
1473EXPORT_SYMBOL(sas_rphy_delete); 1475EXPORT_SYMBOL(sas_rphy_delete);
1474 1476
1475/** 1477/**
1476 * sas_rphy_remove -- remove SAS remote PHY 1478 * sas_rphy_remove - remove SAS remote PHY
1477 * @rphy: SAS remote phy to remove 1479 * @rphy: SAS remote phy to remove
1478 * 1480 *
1479 * Removes the specified SAS remote PHY. 1481 * Removes the specified SAS remote PHY.
@@ -1504,7 +1506,7 @@ sas_rphy_remove(struct sas_rphy *rphy)
1504EXPORT_SYMBOL(sas_rphy_remove); 1506EXPORT_SYMBOL(sas_rphy_remove);
1505 1507
1506/** 1508/**
1507 * scsi_is_sas_rphy -- check if a struct device represents a SAS remote PHY 1509 * scsi_is_sas_rphy - check if a struct device represents a SAS remote PHY
1508 * @dev: device to check 1510 * @dev: device to check
1509 * 1511 *
1510 * Returns: 1512 * Returns:
@@ -1604,7 +1606,7 @@ static int sas_user_scan(struct Scsi_Host *shost, uint channel,
1604 SETUP_TEMPLATE(expander_attrs, expander_##field, S_IRUGO, 1) 1606 SETUP_TEMPLATE(expander_attrs, expander_##field, S_IRUGO, 1)
1605 1607
1606/** 1608/**
1607 * sas_attach_transport -- instantiate SAS transport template 1609 * sas_attach_transport - instantiate SAS transport template
1608 * @ft: SAS transport class function template 1610 * @ft: SAS transport class function template
1609 */ 1611 */
1610struct scsi_transport_template * 1612struct scsi_transport_template *
@@ -1715,7 +1717,7 @@ sas_attach_transport(struct sas_function_template *ft)
1715EXPORT_SYMBOL(sas_attach_transport); 1717EXPORT_SYMBOL(sas_attach_transport);
1716 1718
1717/** 1719/**
1718 * sas_release_transport -- release SAS transport template instance 1720 * sas_release_transport - release SAS transport template instance
1719 * @t: transport template instance 1721 * @t: transport template instance
1720 */ 1722 */
1721void sas_release_transport(struct scsi_transport_template *t) 1723void sas_release_transport(struct scsi_transport_template *t)
diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c
index 65c584db33bd..739e327bba09 100644
--- a/drivers/scsi/scsi_transport_srp.c
+++ b/drivers/scsi/scsi_transport_srp.c
@@ -242,8 +242,8 @@ struct srp_rport *srp_rport_add(struct Scsi_Host *shost,
242EXPORT_SYMBOL_GPL(srp_rport_add); 242EXPORT_SYMBOL_GPL(srp_rport_add);
243 243
244/** 244/**
245 * srp_rport_del -- remove a SRP remote port 245 * srp_rport_del - remove a SRP remote port
246 * @port: SRP remote port to remove 246 * @rport: SRP remote port to remove
247 * 247 *
248 * Removes the specified SRP remote port. 248 * Removes the specified SRP remote port.
249 */ 249 */
@@ -271,7 +271,7 @@ static int do_srp_rport_del(struct device *dev, void *data)
271} 271}
272 272
273/** 273/**
274 * srp_remove_host -- tear down a Scsi_Host's SRP data structures 274 * srp_remove_host - tear down a Scsi_Host's SRP data structures
275 * @shost: Scsi Host that is torn down 275 * @shost: Scsi Host that is torn down
276 * 276 *
277 * Removes all SRP remote ports for a given Scsi_Host. 277 * Removes all SRP remote ports for a given Scsi_Host.
@@ -297,7 +297,7 @@ static int srp_it_nexus_response(struct Scsi_Host *shost, u64 nexus, int result)
297} 297}
298 298
299/** 299/**
300 * srp_attach_transport -- instantiate SRP transport template 300 * srp_attach_transport - instantiate SRP transport template
301 * @ft: SRP transport class function template 301 * @ft: SRP transport class function template
302 */ 302 */
303struct scsi_transport_template * 303struct scsi_transport_template *
@@ -337,7 +337,7 @@ srp_attach_transport(struct srp_function_template *ft)
337EXPORT_SYMBOL_GPL(srp_attach_transport); 337EXPORT_SYMBOL_GPL(srp_attach_transport);
338 338
339/** 339/**
340 * srp_release_transport -- release SRP transport template instance 340 * srp_release_transport - release SRP transport template instance
341 * @t: transport template instance 341 * @t: transport template instance
342 */ 342 */
343void srp_release_transport(struct scsi_transport_template *t) 343void srp_release_transport(struct scsi_transport_template *t)
diff --git a/drivers/scsi/scsicam.c b/drivers/scsi/scsicam.c
index cd68a66c7bb3..3f21bc65e8c6 100644
--- a/drivers/scsi/scsicam.c
+++ b/drivers/scsi/scsicam.c
@@ -24,6 +24,14 @@
24static int setsize(unsigned long capacity, unsigned int *cyls, unsigned int *hds, 24static int setsize(unsigned long capacity, unsigned int *cyls, unsigned int *hds,
25 unsigned int *secs); 25 unsigned int *secs);
26 26
27/**
28 * scsi_bios_ptable - Read PC partition table out of first sector of device.
29 * @dev: from this device
30 *
31 * Description: Reads the first sector from the device and returns %0x42 bytes
32 * starting at offset %0x1be.
33 * Returns: partition table in kmalloc(GFP_KERNEL) memory, or NULL on error.
34 */
27unsigned char *scsi_bios_ptable(struct block_device *dev) 35unsigned char *scsi_bios_ptable(struct block_device *dev)
28{ 36{
29 unsigned char *res = kmalloc(66, GFP_KERNEL); 37 unsigned char *res = kmalloc(66, GFP_KERNEL);
@@ -43,15 +51,17 @@ unsigned char *scsi_bios_ptable(struct block_device *dev)
43} 51}
44EXPORT_SYMBOL(scsi_bios_ptable); 52EXPORT_SYMBOL(scsi_bios_ptable);
45 53
46/* 54/**
47 * Function : int scsicam_bios_param (struct block_device *bdev, ector_t capacity, int *ip) 55 * scsicam_bios_param - Determine geometry of a disk in cylinders/heads/sectors.
56 * @bdev: which device
57 * @capacity: size of the disk in sectors
58 * @ip: return value: ip[0]=heads, ip[1]=sectors, ip[2]=cylinders
48 * 59 *
49 * Purpose : to determine the BIOS mapping used for a drive in a 60 * Description : determine the BIOS mapping/geometry used for a drive in a
50 * SCSI-CAM system, storing the results in ip as required 61 * SCSI-CAM system, storing the results in ip as required
51 * by the HDIO_GETGEO ioctl(). 62 * by the HDIO_GETGEO ioctl().
52 * 63 *
53 * Returns : -1 on failure, 0 on success. 64 * Returns : -1 on failure, 0 on success.
54 *
55 */ 65 */
56 66
57int scsicam_bios_param(struct block_device *bdev, sector_t capacity, int *ip) 67int scsicam_bios_param(struct block_device *bdev, sector_t capacity, int *ip)
@@ -98,15 +108,18 @@ int scsicam_bios_param(struct block_device *bdev, sector_t capacity, int *ip)
98} 108}
99EXPORT_SYMBOL(scsicam_bios_param); 109EXPORT_SYMBOL(scsicam_bios_param);
100 110
101/* 111/**
102 * Function : static int scsi_partsize(unsigned char *buf, unsigned long 112 * scsi_partsize - Parse cylinders/heads/sectors from PC partition table
103 * capacity,unsigned int *cyls, unsigned int *hds, unsigned int *secs); 113 * @buf: partition table, see scsi_bios_ptable()
114 * @capacity: size of the disk in sectors
115 * @cyls: put cylinders here
116 * @hds: put heads here
117 * @secs: put sectors here
104 * 118 *
105 * Purpose : to determine the BIOS mapping used to create the partition 119 * Description: determine the BIOS mapping/geometry used to create the partition
106 * table, storing the results in *cyls, *hds, and *secs 120 * table, storing the results in *cyls, *hds, and *secs
107 * 121 *
108 * Returns : -1 on failure, 0 on success. 122 * Returns: -1 on failure, 0 on success.
109 *
110 */ 123 */
111 124
112int scsi_partsize(unsigned char *buf, unsigned long capacity, 125int scsi_partsize(unsigned char *buf, unsigned long capacity,
@@ -194,7 +207,7 @@ EXPORT_SYMBOL(scsi_partsize);
194 * 207 *
195 * WORKING X3T9.2 208 * WORKING X3T9.2
196 * DRAFT 792D 209 * DRAFT 792D
197 * 210 * see http://www.t10.org/ftp/t10/drafts/cam/cam-r12b.pdf
198 * 211 *
199 * Revision 6 212 * Revision 6
200 * 10-MAR-94 213 * 10-MAR-94