Skip to content

Commit 2486e60

Browse files
Merge patch series "Replace the "slave_*" function names"
Bart Van Assche <[email protected]> says: Hi Martin, The text "slave_" in multiple function names does not make it clear what the purpose of these functions is. Hence this patch series that renames all SCSI functions that have the word "slave" in their function name. Please consider this patch series for the next merge window. Thanks, Bart. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2 parents 5efff64 + b0d3b85 commit 2486e60

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+504
-475
lines changed

Documentation/scsi/scsi_mid_low_api.rst

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ Those usages in group c) should be handled with care, especially in a
112112
that are shared with the mid level and other layers.
113113

114114
All functions defined within an LLD and all data defined at file scope
115-
should be static. For example the slave_alloc() function in an LLD
115+
should be static. For example the sdev_init() function in an LLD
116116
called "xxx" could be defined as
117-
``static int xxx_slave_alloc(struct scsi_device * sdev) { /* code */ }``
117+
``static int xxx_sdev_init(struct scsi_device * sdev) { /* code */ }``
118118

119119
.. [#] the scsi_host_alloc() function is a replacement for the rather vaguely
120120
named scsi_register() function in most situations.
@@ -149,21 +149,21 @@ scsi devices of which only the first 2 respond::
149149
scsi_add_host() ---->
150150
scsi_scan_host() -------+
151151
|
152-
slave_alloc()
153-
slave_configure() --> scsi_change_queue_depth()
152+
sdev_init()
153+
sdev_configure() --> scsi_change_queue_depth()
154154
|
155-
slave_alloc()
156-
slave_configure()
155+
sdev_init()
156+
sdev_configure()
157157
|
158-
slave_alloc() ***
159-
slave_destroy() ***
158+
sdev_init() ***
159+
sdev_destroy() ***
160160

161161

162162
*** For scsi devices that the mid level tries to scan but do not
163-
respond, a slave_alloc(), slave_destroy() pair is called.
163+
respond, a sdev_init(), sdev_destroy() pair is called.
164164

165165
If the LLD wants to adjust the default queue settings, it can invoke
166-
scsi_change_queue_depth() in its slave_configure() routine.
166+
scsi_change_queue_depth() in its sdev_configure() routine.
167167

168168
When an HBA is being removed it could be as part of an orderly shutdown
169169
associated with the LLD module being unloaded (e.g. with the "rmmod"
@@ -176,8 +176,8 @@ same::
176176
===----------------------=========-----------------===------
177177
scsi_remove_host() ---------+
178178
|
179-
slave_destroy()
180-
slave_destroy()
179+
sdev_destroy()
180+
sdev_destroy()
181181
scsi_host_put()
182182

183183
It may be useful for a LLD to keep track of struct Scsi_Host instances
@@ -202,8 +202,8 @@ An LLD can use this sequence to make the mid level aware of a SCSI device::
202202
===-------------------=========--------------------===------
203203
scsi_add_device() ------+
204204
|
205-
slave_alloc()
206-
slave_configure() [--> scsi_change_queue_depth()]
205+
sdev_init()
206+
sdev_configure() [--> scsi_change_queue_depth()]
207207

208208
In a similar fashion, an LLD may become aware that a SCSI device has been
209209
removed (unplugged) or the connection to it has been interrupted. Some
@@ -218,12 +218,12 @@ upper layers with this sequence::
218218
===----------------------=========-----------------===------
219219
scsi_remove_device() -------+
220220
|
221-
slave_destroy()
221+
sdev_destroy()
222222

223223
It may be useful for an LLD to keep track of struct scsi_device instances
224-
(a pointer is passed as the parameter to slave_alloc() and
225-
slave_configure() callbacks). Such instances are "owned" by the mid-level.
226-
struct scsi_device instances are freed after slave_destroy().
224+
(a pointer is passed as the parameter to sdev_init() and
225+
sdev_configure() callbacks). Such instances are "owned" by the mid-level.
226+
struct scsi_device instances are freed after sdev_destroy().
227227

228228

229229
Reference Counting
@@ -331,7 +331,7 @@ Details::
331331
* bus scan when an HBA is added (i.e. scsi_scan_host()). So it
332332
* should only be called if the HBA becomes aware of a new scsi
333333
* device (lu) after scsi_scan_host() has completed. If successful
334-
* this call can lead to slave_alloc() and slave_configure() callbacks
334+
* this call can lead to sdev_init() and sdev_configure() callbacks
335335
* into the LLD.
336336
*
337337
* Defined in: drivers/scsi/scsi_scan.c
@@ -374,8 +374,8 @@ Details::
374374
* Might block: no
375375
*
376376
* Notes: Can be invoked any time on a SCSI device controlled by this
377-
* LLD. [Specifically during and after slave_configure() and prior to
378-
* slave_destroy().] Can safely be invoked from interrupt code.
377+
* LLD. [Specifically during and after sdev_configure() and prior to
378+
* sdev_destroy().] Can safely be invoked from interrupt code.
379379
*
380380
* Defined in: drivers/scsi/scsi.c [see source code for more notes]
381381
*
@@ -506,7 +506,7 @@ Details::
506506
* Notes: If an LLD becomes aware that a scsi device (lu) has
507507
* been removed but its host is still present then it can request
508508
* the removal of that scsi device. If successful this call will
509-
* lead to the slave_destroy() callback being invoked. sdev is an
509+
* lead to the sdev_destroy() callback being invoked. sdev is an
510510
* invalid pointer after this call.
511511
*
512512
* Defined in: drivers/scsi/scsi_sysfs.c .
@@ -627,14 +627,14 @@ Interface functions are supplied (defined) by LLDs and their function
627627
pointers are placed in an instance of struct scsi_host_template which
628628
is passed to scsi_host_alloc() [or scsi_register() / init_this_scsi_driver()].
629629
Some are mandatory. Interface functions should be declared static. The
630-
accepted convention is that driver "xyz" will declare its slave_configure()
630+
accepted convention is that driver "xyz" will declare its sdev_configure()
631631
function as::
632632

633-
static int xyz_slave_configure(struct scsi_device * sdev);
633+
static int xyz_sdev_configure(struct scsi_device * sdev);
634634

635635
and so forth for all interface functions listed below.
636636

637-
A pointer to this function should be placed in the 'slave_configure' member
637+
A pointer to this function should be placed in the 'sdev_configure' member
638638
of a "struct scsi_host_template" instance. A pointer to such an instance
639639
should be passed to the mid level's scsi_host_alloc() [or scsi_register() /
640640
init_this_scsi_driver()].
@@ -657,9 +657,9 @@ Summary:
657657
- ioctl - driver can respond to ioctls
658658
- proc_info - supports /proc/scsi/{driver_name}/{host_no}
659659
- queuecommand - queue scsi command, invoke 'done' on completion
660-
- slave_alloc - prior to any commands being sent to a new device
661-
- slave_configure - driver fine tuning for given device after attach
662-
- slave_destroy - given device is about to be shut down
660+
- sdev_init - prior to any commands being sent to a new device
661+
- sdev_configure - driver fine tuning for given device after attach
662+
- sdev_destroy - given device is about to be shut down
663663

664664

665665
Details::
@@ -960,7 +960,7 @@ Details::
960960

961961

962962
/**
963-
* slave_alloc - prior to any commands being sent to a new device
963+
* sdev_init - prior to any commands being sent to a new device
964964
* (i.e. just prior to scan) this call is made
965965
* @sdp: pointer to new device (about to be scanned)
966966
*
@@ -975,24 +975,24 @@ Details::
975975
* prior to its initial scan. The corresponding scsi device may not
976976
* exist but the mid level is just about to scan for it (i.e. send
977977
* and INQUIRY command plus ...). If a device is found then
978-
* slave_configure() will be called while if a device is not found
979-
* slave_destroy() is called.
978+
* sdev_configure() will be called while if a device is not found
979+
* sdev_destroy() is called.
980980
* For more details see the include/scsi/scsi_host.h file.
981981
*
982982
* Optionally defined in: LLD
983983
**/
984-
int slave_alloc(struct scsi_device *sdp)
984+
int sdev_init(struct scsi_device *sdp)
985985

986986

987987
/**
988-
* slave_configure - driver fine tuning for given device just after it
988+
* sdev_configure - driver fine tuning for given device just after it
989989
* has been first scanned (i.e. it responded to an
990990
* INQUIRY)
991991
* @sdp: device that has just been attached
992992
*
993993
* Returns 0 if ok. Any other return is assumed to be an error and
994994
* the device is taken offline. [offline devices will _not_ have
995-
* slave_destroy() called on them so clean up resources.]
995+
* sdev_destroy() called on them so clean up resources.]
996996
*
997997
* Locks: none
998998
*
@@ -1004,11 +1004,11 @@ Details::
10041004
*
10051005
* Optionally defined in: LLD
10061006
**/
1007-
int slave_configure(struct scsi_device *sdp)
1007+
int sdev_configure(struct scsi_device *sdp)
10081008

10091009

10101010
/**
1011-
* slave_destroy - given device is about to be shut down. All
1011+
* sdev_destroy - given device is about to be shut down. All
10121012
* activity has ceased on this device.
10131013
* @sdp: device that is about to be shut down
10141014
*
@@ -1023,12 +1023,12 @@ Details::
10231023
* by this driver for given device should be freed now. No further
10241024
* commands will be sent for this sdp instance. [However the device
10251025
* could be re-attached in the future in which case a new instance
1026-
* of struct scsi_device would be supplied by future slave_alloc()
1027-
* and slave_configure() calls.]
1026+
* of struct scsi_device would be supplied by future sdev_init()
1027+
* and sdev_configure() calls.]
10281028
*
10291029
* Optionally defined in: LLD
10301030
**/
1031-
void slave_destroy(struct scsi_device *sdp)
1031+
void sdev_destroy(struct scsi_device *sdp)
10321032

10331033

10341034

drivers/ata/ahci.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ extern const struct attribute_group *ahci_sdev_groups[];
397397
.sdev_groups = ahci_sdev_groups, \
398398
.change_queue_depth = ata_scsi_change_queue_depth, \
399399
.tag_alloc_policy = BLK_TAG_ALLOC_RR, \
400-
.device_configure = ata_scsi_device_configure
400+
.sdev_configure = ata_scsi_sdev_configure
401401

402402
extern struct ata_port_operations ahci_ops;
403403
extern struct ata_port_operations ahci_platform_ops;

drivers/ata/libata-sata.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth)
13131313
EXPORT_SYMBOL_GPL(ata_scsi_change_queue_depth);
13141314

13151315
/**
1316-
* ata_sas_device_configure - Default device_configure routine for libata
1316+
* ata_sas_sdev_configure - Default sdev_configure routine for libata
13171317
* devices
13181318
* @sdev: SCSI device to configure
13191319
* @lim: queue limits
@@ -1323,14 +1323,14 @@ EXPORT_SYMBOL_GPL(ata_scsi_change_queue_depth);
13231323
* Zero.
13241324
*/
13251325

1326-
int ata_sas_device_configure(struct scsi_device *sdev, struct queue_limits *lim,
1327-
struct ata_port *ap)
1326+
int ata_sas_sdev_configure(struct scsi_device *sdev, struct queue_limits *lim,
1327+
struct ata_port *ap)
13281328
{
13291329
ata_scsi_sdev_config(sdev);
13301330

13311331
return ata_scsi_dev_config(sdev, lim, ap->link.device);
13321332
}
1333-
EXPORT_SYMBOL_GPL(ata_sas_device_configure);
1333+
EXPORT_SYMBOL_GPL(ata_sas_sdev_configure);
13341334

13351335
/**
13361336
* ata_sas_queuecmd - Issue SCSI cdb to libata-managed device

drivers/ata/libata-scsi.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct queue_limits *lim,
11331133
}
11341134

11351135
/**
1136-
* ata_scsi_slave_alloc - Early setup of SCSI device
1136+
* ata_scsi_sdev_init - Early setup of SCSI device
11371137
* @sdev: SCSI device to examine
11381138
*
11391139
* This is called from scsi_alloc_sdev() when the scsi device
@@ -1143,7 +1143,7 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct queue_limits *lim,
11431143
* Defined by SCSI layer. We don't really care.
11441144
*/
11451145

1146-
int ata_scsi_slave_alloc(struct scsi_device *sdev)
1146+
int ata_scsi_sdev_init(struct scsi_device *sdev)
11471147
{
11481148
struct ata_port *ap = ata_shost_to_port(sdev->host);
11491149
struct device_link *link;
@@ -1166,10 +1166,10 @@ int ata_scsi_slave_alloc(struct scsi_device *sdev)
11661166

11671167
return 0;
11681168
}
1169-
EXPORT_SYMBOL_GPL(ata_scsi_slave_alloc);
1169+
EXPORT_SYMBOL_GPL(ata_scsi_sdev_init);
11701170

11711171
/**
1172-
* ata_scsi_device_configure - Set SCSI device attributes
1172+
* ata_scsi_sdev_configure - Set SCSI device attributes
11731173
* @sdev: SCSI device to examine
11741174
* @lim: queue limits
11751175
*
@@ -1181,8 +1181,7 @@ EXPORT_SYMBOL_GPL(ata_scsi_slave_alloc);
11811181
* Defined by SCSI layer. We don't really care.
11821182
*/
11831183

1184-
int ata_scsi_device_configure(struct scsi_device *sdev,
1185-
struct queue_limits *lim)
1184+
int ata_scsi_sdev_configure(struct scsi_device *sdev, struct queue_limits *lim)
11861185
{
11871186
struct ata_port *ap = ata_shost_to_port(sdev->host);
11881187
struct ata_device *dev = __ata_scsi_find_dev(ap, sdev);
@@ -1192,10 +1191,10 @@ int ata_scsi_device_configure(struct scsi_device *sdev,
11921191

11931192
return 0;
11941193
}
1195-
EXPORT_SYMBOL_GPL(ata_scsi_device_configure);
1194+
EXPORT_SYMBOL_GPL(ata_scsi_sdev_configure);
11961195

11971196
/**
1198-
* ata_scsi_slave_destroy - SCSI device is about to be destroyed
1197+
* ata_scsi_sdev_destroy - SCSI device is about to be destroyed
11991198
* @sdev: SCSI device to be destroyed
12001199
*
12011200
* @sdev is about to be destroyed for hot/warm unplugging. If
@@ -1208,7 +1207,7 @@ EXPORT_SYMBOL_GPL(ata_scsi_device_configure);
12081207
* LOCKING:
12091208
* Defined by SCSI layer. We don't really care.
12101209
*/
1211-
void ata_scsi_slave_destroy(struct scsi_device *sdev)
1210+
void ata_scsi_sdev_destroy(struct scsi_device *sdev)
12121211
{
12131212
struct ata_port *ap = ata_shost_to_port(sdev->host);
12141213
unsigned long flags;
@@ -1228,7 +1227,7 @@ void ata_scsi_slave_destroy(struct scsi_device *sdev)
12281227

12291228
kfree(sdev->dma_drain_buf);
12301229
}
1231-
EXPORT_SYMBOL_GPL(ata_scsi_slave_destroy);
1230+
EXPORT_SYMBOL_GPL(ata_scsi_sdev_destroy);
12321231

12331232
/**
12341233
* ata_scsi_start_stop_xlat - Translate SCSI START STOP UNIT command

drivers/ata/pata_macio.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -812,8 +812,8 @@ static void pata_macio_reset_hw(struct pata_macio_priv *priv, int resume)
812812
/* Hook the standard slave config to fixup some HW related alignment
813813
* restrictions
814814
*/
815-
static int pata_macio_device_configure(struct scsi_device *sdev,
816-
struct queue_limits *lim)
815+
static int pata_macio_sdev_configure(struct scsi_device *sdev,
816+
struct queue_limits *lim)
817817
{
818818
struct ata_port *ap = ata_shost_to_port(sdev->host);
819819
struct pata_macio_priv *priv = ap->private_data;
@@ -822,7 +822,7 @@ static int pata_macio_device_configure(struct scsi_device *sdev,
822822
int rc;
823823

824824
/* First call original */
825-
rc = ata_scsi_device_configure(sdev, lim);
825+
rc = ata_scsi_sdev_configure(sdev, lim);
826826
if (rc)
827827
return rc;
828828

@@ -932,7 +932,7 @@ static const struct scsi_host_template pata_macio_sht = {
932932
/* We may not need that strict one */
933933
.dma_boundary = ATA_DMA_BOUNDARY,
934934
.max_segment_size = PATA_MACIO_MAX_SEGMENT_SIZE,
935-
.device_configure = pata_macio_device_configure,
935+
.sdev_configure = pata_macio_sdev_configure,
936936
.sdev_groups = ata_common_sdev_groups,
937937
.can_queue = ATA_DEF_QUEUE,
938938
.tag_alloc_policy = BLK_TAG_ALLOC_RR,

drivers/ata/sata_mv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ static const struct scsi_host_template mv6_sht = {
673673
.sdev_groups = ata_ncq_sdev_groups,
674674
.change_queue_depth = ata_scsi_change_queue_depth,
675675
.tag_alloc_policy = BLK_TAG_ALLOC_RR,
676-
.device_configure = ata_scsi_device_configure
676+
.sdev_configure = ata_scsi_sdev_configure
677677
};
678678

679679
static struct ata_port_operations mv5_ops = {

0 commit comments

Comments
 (0)