]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/scsi/scsi_error.c
Move code that is used both by initiator and target drivers
[karo-tx-linux.git] / drivers / scsi / scsi_error.c
index c95a4e943fc6843b78d8120955318d76547a956e..106884a5444e1cb6f61057c29f813c4d713760fa 100644 (file)
@@ -2399,70 +2399,6 @@ out_put_autopm_host:
 }
 EXPORT_SYMBOL(scsi_ioctl_reset);
 
-/**
- * scsi_normalize_sense - normalize main elements from either fixed or
- *                     descriptor sense data format into a common format.
- *
- * @sense_buffer:      byte array containing sense data returned by device
- * @sb_len:            number of valid bytes in sense_buffer
- * @sshdr:             pointer to instance of structure that common
- *                     elements are written to.
- *
- * Notes:
- *     The "main elements" from sense data are: response_code, sense_key,
- *     asc, ascq and additional_length (only for descriptor format).
- *
- *     Typically this function can be called after a device has
- *     responded to a SCSI command with the CHECK_CONDITION status.
- *
- * Return value:
- *     true if valid sense data information found, else false;
- */
-bool scsi_normalize_sense(const u8 *sense_buffer, int sb_len,
-                         struct scsi_sense_hdr *sshdr)
-{
-       if (!sense_buffer || !sb_len)
-               return false;
-
-       memset(sshdr, 0, sizeof(struct scsi_sense_hdr));
-
-       sshdr->response_code = (sense_buffer[0] & 0x7f);
-
-       if (!scsi_sense_valid(sshdr))
-               return false;
-
-       if (sshdr->response_code >= 0x72) {
-               /*
-                * descriptor format
-                */
-               if (sb_len > 1)
-                       sshdr->sense_key = (sense_buffer[1] & 0xf);
-               if (sb_len > 2)
-                       sshdr->asc = sense_buffer[2];
-               if (sb_len > 3)
-                       sshdr->ascq = sense_buffer[3];
-               if (sb_len > 7)
-                       sshdr->additional_length = sense_buffer[7];
-       } else {
-               /*
-                * fixed format
-                */
-               if (sb_len > 2)
-                       sshdr->sense_key = (sense_buffer[2] & 0xf);
-               if (sb_len > 7) {
-                       sb_len = (sb_len < (sense_buffer[7] + 8)) ?
-                                        sb_len : (sense_buffer[7] + 8);
-                       if (sb_len > 12)
-                               sshdr->asc = sense_buffer[12];
-                       if (sb_len > 13)
-                               sshdr->ascq = sense_buffer[13];
-               }
-       }
-
-       return true;
-}
-EXPORT_SYMBOL(scsi_normalize_sense);
-
 bool scsi_command_normalize_sense(const struct scsi_cmnd *cmd,
                                  struct scsi_sense_hdr *sshdr)
 {