From patchwork Fri Sep 8 23:52:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9945147 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 48CDD602D7 for ; Fri, 8 Sep 2017 23:54:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B97E2898E for ; Fri, 8 Sep 2017 23:54:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3083C289C6; Fri, 8 Sep 2017 23:54:01 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 33FD62898E for ; Fri, 8 Sep 2017 23:53:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757284AbdIHXx6 (ORCPT ); Fri, 8 Sep 2017 19:53:58 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:12724 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757279AbdIHXx6 (ORCPT ); Fri, 8 Sep 2017 19:53:58 -0400 X-IronPort-AV: E=Sophos;i="5.42,363,1500912000"; d="scan'208";a="145723567" Received: from sjappemgw11.hgst.com (HELO sjappemgw12.hgst.com) ([199.255.44.62]) by ob1.hgst.iphmx.com with ESMTP; 09 Sep 2017 08:12:39 +0800 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.172.152]) by sjappemgw12.hgst.com with ESMTP; 08 Sep 2017 16:52:27 -0700 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , "Martin K . Petersen" , Hannes Reinecke , Johannes Thumshirn , "Rafael J . Wysocki" , Ming Lei Subject: [PATCH 2/5] scsi: Change the type of the second last argument of scsi_execute() Date: Fri, 8 Sep 2017 16:52:23 -0700 Message-Id: <20170908235226.26622-3-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170908235226.26622-1-bart.vanassche@wdc.com> References: <20170908235226.26622-1-bart.vanassche@wdc.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The second last argument of scsi_execute() is either 0 or RQF_PM. Change the type of that argument from req_flags_t into bool and update the callers that pass RQF_PM. This patch does not change any functionality. Signed-off-by: Bart Van Assche Cc: Martin K. Petersen Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Johannes Thumshirn Cc: Rafael J. Wysocki Cc: Ming Lei --- drivers/scsi/scsi_lib.c | 8 ++++---- drivers/scsi/sd.c | 4 ++-- drivers/scsi/ufs/ufshcd.c | 11 ++++++----- include/scsi/scsi_device.h | 2 +- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index f6097b89d5d3..5be515c8c6bd 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -227,8 +227,8 @@ void scsi_queue_insert(struct scsi_cmnd *cmd, int reason) * @sshdr: optional decoded sense header * @timeout: request timeout in seconds * @retries: number of times to retry request - * @flags: flags for ->cmd_flags - * @rq_flags: flags for ->rq_flags + * @flags: REQ_* flags for ->cmd_flags + * @is_pm_req: whether or not this is a power management request * @resid: optional residual length * * Returns the scsi_cmnd result field if a command was executed, or a negative @@ -237,7 +237,7 @@ void scsi_queue_insert(struct scsi_cmnd *cmd, int reason) int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, int data_direction, void *buffer, unsigned bufflen, unsigned char *sense, struct scsi_sense_hdr *sshdr, - int timeout, int retries, u64 flags, req_flags_t rq_flags, + int timeout, int retries, u64 flags, bool is_pm_req, int *resid) { struct request *req; @@ -260,7 +260,7 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, rq->retries = retries; req->timeout = timeout; req->cmd_flags |= flags; - req->rq_flags |= rq_flags | RQF_QUIET | RQF_PREEMPT; + req->rq_flags |= (is_pm_req ? RQF_PM : 0) | RQF_QUIET | RQF_PREEMPT; /* * head injection *required* here otherwise quiesce won't work diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index e2647f2d4430..ad22b16748c6 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1620,7 +1620,7 @@ static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr) * flush everything. */ res = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, sshdr, - timeout, SD_MAX_RETRIES, 0, RQF_PM, NULL); + timeout, SD_MAX_RETRIES, 0, true, NULL); if (res == 0) break; } @@ -3469,7 +3469,7 @@ static int sd_start_stop_device(struct scsi_disk *sdkp, int start) return -ENODEV; res = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, &sshdr, - SD_TIMEOUT, SD_MAX_RETRIES, 0, RQF_PM, NULL); + SD_TIMEOUT, SD_MAX_RETRIES, 0, true, NULL); if (res) { sd_print_result(sdkp, "Start/Stop Unit failed", res); if (driver_byte(res) & DRIVER_SENSE) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 5bc9dc14e075..7798acd91331 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -6976,7 +6976,7 @@ ufshcd_send_request_sense(struct ufs_hba *hba, struct scsi_device *sdp) ret = scsi_execute(sdp, cmd, DMA_FROM_DEVICE, buffer, UFSHCD_REQ_SENSE_SIZE, NULL, NULL, - msecs_to_jiffies(1000), 3, 0, RQF_PM, NULL); + msecs_to_jiffies(1000), 3, 0, true, NULL); if (ret) pr_err("%s: failed with err %d\n", __func__, ret); @@ -7037,12 +7037,13 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, cmd[4] = pwr_mode << 4; /* - * Current function would be generally called from the power management - * callbacks hence set the RQF_PM flag so that it doesn't resume the - * already suspended childs. + * This function is typically called from a power management + * callback. Hence submit the START request as a power management + * request too so that it doesn't resume the already suspended + * children. */ ret = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, &sshdr, - START_STOP_TIMEOUT, 0, 0, RQF_PM, NULL); + START_STOP_TIMEOUT, 0, 0, true, NULL); if (ret) { sdev_printk(KERN_WARNING, sdp, "START_STOP failed for power mode: %d, result %x\n", diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 0979a5f3b69a..b23e771cd305 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -414,7 +414,7 @@ extern int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, int data_direction, void *buffer, unsigned bufflen, unsigned char *sense, struct scsi_sense_hdr *sshdr, int timeout, int retries, u64 flags, - req_flags_t rq_flags, int *resid); + bool is_pm_req, int *resid); static inline int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd, int data_direction, void *buffer, unsigned bufflen, struct scsi_sense_hdr *sshdr, int timeout,