Skip to content

Commit c17618c

Browse files
rddunlapmartinkpetersen
authored andcommitted
scsi: Eliminate scsi_register() and scsi_unregister() usage & docs
scsi_mid_low_api.rst refers to scsi_register() and scsi_unregister() but these functions don't exist. They have been replaced by more meaningful names. Update one driver (megaraid_mbox.c) that uses "scsi_unregister" in a warning message. Update scsi_mid_low_api.rst to eliminate references to scsi_register() and scsi_unregister(). Signed-off-by: Randy Dunlap <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: James E.J. Bottomley <[email protected]> Cc: Martin K. Petersen <[email protected]> Cc: Bart Van Assche <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: [email protected] Cc: Kashyap Desai <[email protected]> Cc: Sumit Saxena <[email protected]> Cc: Shivasharan S <[email protected]> Cc: Chandrakanth patil <[email protected]> Cc: [email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 8d14bfb commit c17618c

File tree

3 files changed

+7
-52
lines changed

3 files changed

+7
-52
lines changed

Documentation/scsi/scsi_mid_low_api.rst

Lines changed: 5 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ supplied functions" below.
101101
Those functions in group b) are listed in a section entitled "Interface
102102
functions" below. Their function pointers are placed in the members of
103103
"struct scsi_host_template", an instance of which is passed to
104-
scsi_host_alloc() [#]_. Those interface functions that the LLD does not
104+
scsi_host_alloc(). Those interface functions that the LLD does not
105105
wish to supply should have NULL placed in the corresponding member of
106106
struct scsi_host_template. Defining an instance of struct
107107
scsi_host_template at file scope will cause NULL to be placed in function
@@ -116,9 +116,6 @@ should be static. For example the sdev_init() function in an LLD
116116
called "xxx" could be defined as
117117
``static int xxx_sdev_init(struct scsi_device * sdev) { /* code */ }``
118118

119-
.. [#] the scsi_host_alloc() function is a replacement for the rather vaguely
120-
named scsi_register() function in most situations.
121-
122119

123120
Hotplug initialization model
124121
============================
@@ -302,14 +299,12 @@ Summary:
302299
- scsi_host_alloc - return a new scsi_host instance whose refcount==1
303300
- scsi_host_get - increments Scsi_Host instance's refcount
304301
- scsi_host_put - decrements Scsi_Host instance's refcount (free if 0)
305-
- scsi_register - create and register a scsi host adapter instance.
306302
- scsi_remove_device - detach and remove a SCSI device
307303
- scsi_remove_host - detach and remove all SCSI devices owned by host
308304
- scsi_report_bus_reset - report scsi _bus_ reset observed
309305
- scsi_scan_host - scan SCSI bus
310306
- scsi_track_queue_full - track successive QUEUE_FULL events
311307
- scsi_unblock_requests - allow further commands to be queued to given host
312-
- scsi_unregister - [calls scsi_host_put()]
313308

314309

315310
Details::
@@ -474,27 +469,6 @@ Details::
474469
void scsi_host_put(struct Scsi_Host *shost)
475470

476471

477-
/**
478-
* scsi_register - create and register a scsi host adapter instance.
479-
* @sht: pointer to scsi host template
480-
* @privsize: extra bytes to allocate in hostdata array (which is the
481-
* last member of the returned Scsi_Host instance)
482-
*
483-
* Returns pointer to new Scsi_Host instance or NULL on failure
484-
*
485-
* Might block: yes
486-
*
487-
* Notes: When this call returns to the LLD, the SCSI bus scan on
488-
* this host has _not_ yet been done.
489-
* The hostdata array (by default zero length) is a per host scratch
490-
* area for the LLD.
491-
*
492-
* Defined in: drivers/scsi/hosts.c .
493-
**/
494-
struct Scsi_Host * scsi_register(struct scsi_host_template * sht,
495-
int privsize)
496-
497-
498472
/**
499473
* scsi_remove_device - detach and remove a SCSI device
500474
* @sdev: a pointer to a scsi device instance
@@ -524,7 +498,7 @@ Details::
524498
*
525499
* Notes: Should only be invoked if the "hotplug initialization
526500
* model" is being used. It should be called _prior_ to
527-
* scsi_unregister().
501+
* calling scsi_host_put().
528502
*
529503
* Defined in: drivers/scsi/hosts.c .
530504
**/
@@ -601,31 +575,12 @@ Details::
601575
void scsi_unblock_requests(struct Scsi_Host * shost)
602576

603577

604-
/**
605-
* scsi_unregister - unregister and free memory used by host instance
606-
* @shp: pointer to scsi host instance to unregister.
607-
*
608-
* Returns nothing
609-
*
610-
* Might block: no
611-
*
612-
* Notes: Should not be invoked if the "hotplug initialization
613-
* model" is being used. Called internally by exit_this_scsi_driver()
614-
* in the "passive initialization model". Hence a LLD has no need to
615-
* call this function directly.
616-
*
617-
* Defined in: drivers/scsi/hosts.c .
618-
**/
619-
void scsi_unregister(struct Scsi_Host * shp)
620-
621-
622-
623578

624579
Interface Functions
625580
===================
626581
Interface functions are supplied (defined) by LLDs and their function
627582
pointers are placed in an instance of struct scsi_host_template which
628-
is passed to scsi_host_alloc() or scsi_register().
583+
is passed to scsi_host_alloc().
629584
Some are mandatory. Interface functions should be declared static. The
630585
accepted convention is that driver "xyz" will declare its sdev_configure()
631586
function as::
@@ -636,7 +591,7 @@ and so forth for all interface functions listed below.
636591

637592
A pointer to this function should be placed in the 'sdev_configure' member
638593
of a "struct scsi_host_template" instance. A pointer to such an instance
639-
should be passed to the mid level's scsi_host_alloc() or scsi_register().
594+
should be passed to the mid level's scsi_host_alloc().
640595
.
641596

642597
The interface functions are also described in the include/scsi/scsi_host.h
@@ -1111,7 +1066,7 @@ of interest:
11111066
hostdata[0]
11121067
- area reserved for LLD at end of struct Scsi_Host. Size
11131068
is set by the second argument (named 'xtr_bytes') to
1114-
scsi_host_alloc() or scsi_register().
1069+
scsi_host_alloc().
11151070
vendor_id
11161071
- a unique value that identifies the vendor supplying
11171072
the LLD for the Scsi_Host. Used most often in validating

drivers/scsi/megaraid/megaraid_mbox.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ megaraid_io_attach(adapter_t *adapter)
621621
host = scsi_host_alloc(&megaraid_template_g, 8);
622622
if (!host) {
623623
con_log(CL_ANN, (KERN_WARNING
624-
"megaraid mbox: scsi_register failed\n"));
624+
"megaraid mbox: scsi_host_alloc failed\n"));
625625

626626
return -1;
627627
}

include/scsi/scsi_host.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ struct Scsi_Host {
595595
* have some way of identifying each detected host adapter properly
596596
* and uniquely. For hosts that do not support more than one card
597597
* in the system at one time, this does not need to be set. It is
598-
* initialized to 0 in scsi_register.
598+
* initialized to 0 in scsi_host_alloc.
599599
*/
600600
unsigned int unique_id;
601601

0 commit comments

Comments
 (0)