From patchwork Thu Oct 31 11:04:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 11220979 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D863E17D5 for ; Thu, 31 Oct 2019 11:05:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C0F412087F for ; Thu, 31 Oct 2019 11:05:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727589AbfJaLFe (ORCPT ); Thu, 31 Oct 2019 07:05:34 -0400 Received: from mx2.suse.de ([195.135.220.15]:37438 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727493AbfJaLFb (ORCPT ); Thu, 31 Oct 2019 07:05:31 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id F07AEB34E; Thu, 31 Oct 2019 11:05:27 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: Christoph Hellwig , James Bottomley , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 08/24] sg: use SAM status definitions and avoid using masked_status Date: Thu, 31 Oct 2019 12:04:36 +0100 Message-Id: <20191031110452.73463-9-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20191031110452.73463-1-hare@suse.de> References: <20191031110452.73463-1-hare@suse.de> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Use standard SAM status definitions and avoid using masked status values. Signed-off-by: Hannes Reinecke --- drivers/scsi/sg.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index e88fb3daebcc..60ff388d04b9 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -503,7 +503,7 @@ sg_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos) old_hdr->target_status = hp->masked_status; old_hdr->host_status = hp->host_status; old_hdr->driver_status = hp->driver_status; - if ((CHECK_CONDITION & hp->masked_status) || + if ((SAM_STAT_CHECK_CONDITION & hp->status) || (DRIVER_SENSE & hp->driver_status)) memcpy(old_hdr->sense_buffer, srp->sense_b, sizeof (old_hdr->sense_buffer)); @@ -529,7 +529,7 @@ sg_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos) break; case DID_ERROR: old_hdr->result = (srp->sense_b[0] == 0 && - hp->masked_status == GOOD) ? 0 : EIO; + hp->status == SAM_STAT_GOOD) ? 0 : EIO; break; default: old_hdr->result = EIO; @@ -574,7 +574,7 @@ sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp) } hp->sb_len_wr = 0; if ((hp->mx_sb_len > 0) && hp->sbp) { - if ((CHECK_CONDITION & hp->masked_status) || + if ((SAM_STAT_CHECK_CONDITION & hp->status) || (DRIVER_SENSE & hp->driver_status)) { int sb_len = SCSI_SENSE_BUFFERSIZE; sb_len = (hp->mx_sb_len > sb_len) ? sb_len : hp->mx_sb_len; @@ -587,7 +587,7 @@ sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp) hp->sb_len_wr = len; } } - if (hp->masked_status || hp->host_status || hp->driver_status) + if (hp->status || hp->host_status || hp->driver_status) hp->info |= SG_INFO_CHECK; if (copy_to_user(buf, hp, SZ_SG_IO_HDR)) { err = -EFAULT; @@ -873,7 +873,7 @@ sg_fill_request_table(Sg_fd *sfp, sg_req_info_t *rinfo) break; rinfo[val].req_state = srp->done + 1; rinfo[val].problem = - srp->header.masked_status & + srp->header.status & srp->header.host_status & srp->header.driver_status; if (srp->done) @@ -1355,8 +1355,8 @@ sg_rq_end_io(struct request *rq, blk_status_t status) srp->header.host_status = host_byte(result); srp->header.driver_status = driver_byte(result); if ((sdp->sgdebug > 0) && - ((CHECK_CONDITION == srp->header.masked_status) || - (COMMAND_TERMINATED == srp->header.masked_status))) + ((SAM_STAT_CHECK_CONDITION == srp->header.status) || + (SAM_STAT_COMMAND_TERMINATED == srp->header.status))) __scsi_print_sense(sdp->device, __func__, sense, SCSI_SENSE_BUFFERSIZE);