Skip to content

Commit

Permalink
scsi: Export function scsi_scan.c:sanitize_inquiry_string
Browse files Browse the repository at this point in the history
The hpsa driver uses this function to cleanup inquiry data. Our new pqi
driver will also use this function. This function was copied into both
drivers.

This patch exports sanitize_inquiry_string so the hpsa and the pqi
drivers can use this function directly.

Suggested-by: Hannes Reinecke <[email protected]>
Suggested-by: Matthew R. Ochs [email protected]
Reviewed-by: Kevin Barnett <[email protected]>
Reviewed-by: Justin Lindley <[email protected]>
Reviewed-by: Scott Teel <[email protected]>
Reviewed-by: Hannes Reinecke <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
  • Loading branch information
Don Brace authored and martinkpetersen committed Feb 24, 2016
1 parent dde3283 commit 3846470
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
12 changes: 7 additions & 5 deletions drivers/scsi/scsi_scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,8 @@ void scsi_target_reap(struct scsi_target *starget)
}

/**
* sanitize_inquiry_string - remove non-graphical chars from an INQUIRY result string
* scsi_sanitize_inquiry_string - remove non-graphical chars from an
* INQUIRY result string
* @s: INQUIRY result string to sanitize
* @len: length of the string
*
Expand All @@ -531,7 +532,7 @@ void scsi_target_reap(struct scsi_target *starget)
* string terminator, so all the following characters are set to
* spaces.
**/
static void sanitize_inquiry_string(unsigned char *s, int len)
void scsi_sanitize_inquiry_string(unsigned char *s, int len)
{
int terminated = 0;

Expand All @@ -542,6 +543,7 @@ static void sanitize_inquiry_string(unsigned char *s, int len)
*s = ' ';
}
}
EXPORT_SYMBOL(scsi_sanitize_inquiry_string);

/**
* scsi_probe_lun - probe a single LUN using a SCSI INQUIRY
Expand Down Expand Up @@ -627,9 +629,9 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result,
}

if (result == 0) {
sanitize_inquiry_string(&inq_result[8], 8);
sanitize_inquiry_string(&inq_result[16], 16);
sanitize_inquiry_string(&inq_result[32], 4);
scsi_sanitize_inquiry_string(&inq_result[8], 8);
scsi_sanitize_inquiry_string(&inq_result[16], 16);
scsi_sanitize_inquiry_string(&inq_result[32], 4);

response_len = inq_result[4] + 5;
if (response_len > 255)
Expand Down
1 change: 1 addition & 0 deletions include/scsi/scsi_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ extern void scsi_remove_target(struct device *);
extern const char *scsi_device_state_name(enum scsi_device_state);
extern int scsi_is_sdev_device(const struct device *);
extern int scsi_is_target_device(const struct device *);
extern void scsi_sanitize_inquiry_string(unsigned char *s, int len);
extern int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
int data_direction, void *buffer, unsigned bufflen,
unsigned char *sense, int timeout, int retries,
Expand Down

0 comments on commit 3846470

Please sign in to comment.