From patchwork Tue Oct 18 00:09:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: subhashj@codeaurora.org X-Patchwork-Id: 9380877 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 98B74600CA for ; Tue, 18 Oct 2016 00:10:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8889228FE7 for ; Tue, 18 Oct 2016 00:10:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A28C28FF3; Tue, 18 Oct 2016 00:10:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6CE128FE7 for ; Tue, 18 Oct 2016 00:10:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030189AbcJRAKA (ORCPT ); Mon, 17 Oct 2016 20:10:00 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:43673 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936174AbcJRAJy (ORCPT ); Mon, 17 Oct 2016 20:09:54 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id B4548617CC; Tue, 18 Oct 2016 00:09:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1476749393; bh=REY5dj8fMZnLzBSSR3q/2tu34E1vhkqCoubuNB2GXNo=; h=From:To:Cc:Subject:Date:From; b=ZuemXrxpmL7YvLkdLQyKhi2IyN4KnSc9XjRtL3HqW5nLr0ASz9N57WrJltoJ0+SyP fyfsVjt4ATbgcKbVRjrlkLO/raLNLe8ieedeUbv3oDTQMTRNsr/WYhn9AlbRJuaJp9 URWytVMjt6BuWvIc+6i7u9ehNeYM1SZc1v3Fljv0= Received: from subhashj-linux1.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: subhashj@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 334F0617C4; Tue, 18 Oct 2016 00:09:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1476749393; bh=REY5dj8fMZnLzBSSR3q/2tu34E1vhkqCoubuNB2GXNo=; h=From:To:Cc:Subject:Date:From; b=ZuemXrxpmL7YvLkdLQyKhi2IyN4KnSc9XjRtL3HqW5nLr0ASz9N57WrJltoJ0+SyP fyfsVjt4ATbgcKbVRjrlkLO/raLNLe8ieedeUbv3oDTQMTRNsr/WYhn9AlbRJuaJp9 URWytVMjt6BuWvIc+6i7u9ehNeYM1SZc1v3Fljv0= DMARC-Filter: OpenDMARC Filter v1.3.1 smtp.codeaurora.org 334F0617C4 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=pass smtp.mailfrom=subhashj@codeaurora.org From: Subhash Jadavani To: vinholikatti@gmail.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com Cc: Gilad Broner , Subhash Jadavani , linux-scsi@vger.kernel.org (open list:UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1 05/11] scsi: ufs: fix sense buffer size to 18 bytes Date: Mon, 17 Oct 2016 17:09:48 -0700 Message-Id: <1476749388-11244-1-git-send-email-subhashj@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Gilad Broner According to UFS device specification, sense data can be only 18 bytes long, this change makes the changes accordingly. Signed-off-by: Gilad Broner Signed-off-by: Subhash Jadavani --- drivers/scsi/ufs/ufshcd.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index beb4988..f549be3 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -45,6 +45,8 @@ #include "ufs_quirks.h" #include "unipro.h" +#define UFSHCD_REQ_SENSE_SIZE 18 + #define UFSHCD_ENABLE_INTRS (UTP_TRANSFER_REQ_COMPL |\ UTP_TASK_REQ_COMPL |\ UFSHCD_ERROR_MASK) @@ -898,7 +900,7 @@ static inline void ufshcd_copy_sense_data(struct ufshcd_lrb *lrbp) memcpy(lrbp->sense_buffer, lrbp->ucd_rsp_ptr->sr.sense_data, - min_t(int, len_to_copy, SCSI_SENSE_BUFFERSIZE)); + min_t(int, len_to_copy, UFSHCD_REQ_SENSE_SIZE)); } } @@ -1463,7 +1465,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) WARN_ON(lrbp->cmd); lrbp->cmd = cmd; - lrbp->sense_bufflen = SCSI_SENSE_BUFFERSIZE; + lrbp->sense_bufflen = UFSHCD_REQ_SENSE_SIZE; lrbp->sense_buffer = cmd->sense_buffer; lrbp->task_tag = tag; lrbp->lun = ufshcd_scsi_to_upiu_lun(cmd->device->lun); @@ -5594,19 +5596,19 @@ ufshcd_send_request_sense(struct ufs_hba *hba, struct scsi_device *sdp) 0, 0, 0, - SCSI_SENSE_BUFFERSIZE, + UFSHCD_REQ_SENSE_SIZE, 0}; char *buffer; int ret; - buffer = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL); + buffer = kzalloc(UFSHCD_REQ_SENSE_SIZE, GFP_KERNEL); if (!buffer) { ret = -ENOMEM; goto out; } ret = scsi_execute_req_flags(sdp, cmd, DMA_FROM_DEVICE, buffer, - SCSI_SENSE_BUFFERSIZE, NULL, + UFSHCD_REQ_SENSE_SIZE, NULL, msecs_to_jiffies(1000), 3, NULL, REQ_PM); if (ret) pr_err("%s: failed with err %d\n", __func__, ret);