Skip to content

Commit f52a04f

Browse files
rddunlapmartinkpetersen
authored andcommitted
scsi: scsi_ioctl: Add kernel-doc for exported functions
Add kernel-doc for scsi_set_medium_removal(), scsi_cmd_allowed(), and scsi_ioctl_block_when_processing_errors() since these are exported. This allows them to be part of the SCSI driver-api docbook. 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]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 20b9876 commit f52a04f

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

drivers/scsi/scsi_ioctl.c

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@
3737
* @host: host to identify
3838
* @buffer: userspace buffer for identification
3939
*
40-
* Return an identifying string at @buffer, if @buffer is non-NULL, filling
41-
* to the length stored at * (int *) @buffer.
40+
* Return:
41+
* * if successful, %1 and an identifying string at @buffer, if @buffer
42+
* is non-NULL, filling to the length stored at * (int *) @buffer.
43+
* * <0 error code on failure.
4244
*/
4345
static int ioctl_probe(struct Scsi_Host *host, void __user *buffer)
4446
{
@@ -121,6 +123,16 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd,
121123
return result;
122124
}
123125

126+
/**
127+
* scsi_set_medium_removal() - send command to allow or prevent medium removal
128+
* @sdev: target scsi device
129+
* @state: removal state to set (prevent or allow)
130+
*
131+
* Returns:
132+
* * %0 if @sdev is not removable or not lockable or successful.
133+
* * non-%0 is a SCSI result code if > 0 or kernel error code if < 0.
134+
* * Sets @sdev->locked to the new state on success.
135+
*/
124136
int scsi_set_medium_removal(struct scsi_device *sdev, char state)
125137
{
126138
char scsi_cmd[MAX_COMMAND_SIZE];
@@ -242,11 +254,15 @@ static int scsi_send_start_stop(struct scsi_device *sdev, int data)
242254
NORMAL_RETRIES);
243255
}
244256

245-
/*
246-
* Check if the given command is allowed.
257+
/**
258+
* scsi_cmd_allowed() - Check if the given command is allowed.
259+
* @cmd: SCSI command to check
260+
* @open_for_write: is the file / block device opened for writing?
247261
*
248262
* Only a subset of commands are allowed for unprivileged users. Commands used
249263
* to format the media, update the firmware, etc. are not permitted.
264+
*
265+
* Return: %true if the cmd is allowed, otherwise @false.
250266
*/
251267
bool scsi_cmd_allowed(unsigned char *cmd, bool open_for_write)
252268
{
@@ -859,6 +875,8 @@ static int scsi_ioctl_sg_io(struct scsi_device *sdev, bool open_for_write,
859875
* Description: The scsi_ioctl() function differs from most ioctls in that it
860876
* does not take a major/minor number as the dev field. Rather, it takes
861877
* a pointer to a &struct scsi_device.
878+
*
879+
* Return: varies depending on the @cmd
862880
*/
863881
int scsi_ioctl(struct scsi_device *sdev, bool open_for_write, int cmd,
864882
void __user *arg)
@@ -941,8 +959,15 @@ int scsi_ioctl(struct scsi_device *sdev, bool open_for_write, int cmd,
941959
}
942960
EXPORT_SYMBOL(scsi_ioctl);
943961

944-
/*
962+
/**
963+
* scsi_ioctl_block_when_processing_errors - prevent commands from being queued
964+
* @sdev: target scsi device
965+
* @cmd: which ioctl is it
966+
* @ndelay: no delay (non-blocking)
967+
*
945968
* We can process a reset even when a device isn't fully operable.
969+
*
970+
* Return: %0 on success, <0 error code.
946971
*/
947972
int scsi_ioctl_block_when_processing_errors(struct scsi_device *sdev, int cmd,
948973
bool ndelay)

0 commit comments

Comments
 (0)