From patchwork Fri Mar 8 08:30:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajendra Nayak X-Patchwork-Id: 10844317 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 668031669 for ; Fri, 8 Mar 2019 08:31:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 55B842E28B for ; Fri, 8 Mar 2019 08:31:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 49DD62E2A5; Fri, 8 Mar 2019 08:31:59 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable 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 01E122E28B for ; Fri, 8 Mar 2019 08:31:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726400AbfCHIbd (ORCPT ); Fri, 8 Mar 2019 03:31:33 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:35498 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726323AbfCHIbc (ORCPT ); Fri, 8 Mar 2019 03:31:32 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 241AF6115D; Fri, 8 Mar 2019 08:31:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1552033892; bh=j1iOA04Ibk3v4AjlnxxPfgJEJJzv6dGyDzSn6fvInw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N8IwpfFgApnZTkY/feOyX7NUSHh6WJ6EtFwUWsJXubE6RTQOOTdjBh7ARyakf5FKH ZxHSpVQG9jTtKTa0+zaAdP5z1RjDsOUfBNPmJPo5uDdImW7/UEfvIK/NAczipjWBrQ RputmITJIUedq/6DTA4KO9nwNM4ei2m/MLm0zfJs= Received: from blr-ubuntu-173.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: rnayak@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 01BE061155; Fri, 8 Mar 2019 08:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1552033891; bh=j1iOA04Ibk3v4AjlnxxPfgJEJJzv6dGyDzSn6fvInw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EX9fb90BIN4TSlTo3AJ9bqbXn4EQDaikr3yBZ7ql6lHCx63UGTeoXtnZ929kWaLvK G1IuTWmU/RZOUeUNWamOgF4XxOd9rWaoiQhUskODvIAlKYc3QNisKDi8xwU6vXZ22i PgWsiRWTiSjXZzCMerIPF0Qb6JY8c44e7P7ItW9s= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 01BE061155 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=rnayak@codeaurora.org From: Rajendra Nayak To: vinholikatti@gmail.com, alim.akhtar@samsung.com, pedrom.Sousa@synopsys.com Cc: subhashj@codeaurora.org, asutoshd@codeaurora.org, linux-scsi@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Rajendra Nayak Subject: [PATCH 1/3] scsi: ufs: Fix runtime pm handling in ufshcd-pltfrm Date: Fri, 8 Mar 2019 14:00:51 +0530 Message-Id: <20190308083053.30631-2-rnayak@codeaurora.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190308083053.30631-1-rnayak@codeaurora.org> References: <20190308083053.30631-1-rnayak@codeaurora.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP runtime pm calls as part of ufshcd_init() can trigger a ufshcd_runtime_suspend() which always fails until the point we do a platform_set_drvdata(), setting the devices 'power.runtime_error' Use pm_runtime_get_noresume()/pm_runtime_put_noidle() to prevent this from happening. Signed-off-by: Rajendra Nayak --- drivers/scsi/ufs/ufshcd-pltfrm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index 895a9b5ac989..974441fa4e75 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -340,6 +340,7 @@ int ufshcd_pltfrm_init(struct platform_device *pdev, goto dealloc_host; } + pm_runtime_get_noresume(&pdev->dev); pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); @@ -352,12 +353,14 @@ int ufshcd_pltfrm_init(struct platform_device *pdev, } platform_set_drvdata(pdev, hba); + pm_runtime_put_noidle(&pdev->dev); return 0; out_disable_rpm: pm_runtime_disable(&pdev->dev); pm_runtime_set_suspended(&pdev->dev); + pm_runtime_put_noidle(&pdev->dev); dealloc_host: ufshcd_dealloc_host(hba); out: From patchwork Fri Mar 8 08:30:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajendra Nayak X-Patchwork-Id: 10844315 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 070D917E4 for ; Fri, 8 Mar 2019 08:31:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA1EB2E28B for ; Fri, 8 Mar 2019 08:31:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DECC42E2A5; Fri, 8 Mar 2019 08:31:56 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable 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 98A6E2E28B for ; Fri, 8 Mar 2019 08:31:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726441AbfCHIbg (ORCPT ); Fri, 8 Mar 2019 03:31:36 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:35688 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726323AbfCHIbg (ORCPT ); Fri, 8 Mar 2019 03:31:36 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 5EF6D60386; Fri, 8 Mar 2019 08:31:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1552033895; bh=b8MtlD+7/yGM3Lr8HhhhyH/yYBErhCRMJVXsCSAyx0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KnFYCLJWnb5yFdO0Why/MTY2vTdUWsC3oVCO0wIaCDgYLM48Z2ZZzbbeEXQQWbpxu g0NaTPBJ1VZ3RZjjPPBMffDr/Gju9wiKBrNt6/h5RJCRXbPtMebwnl5Gcw/cAkCe2j Cr+ra7iQs1GZmqM5XY9Khz3Z6mJ3h9VpWeysVkMk= Received: from blr-ubuntu-173.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: rnayak@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 1E29260386; Fri, 8 Mar 2019 08:31:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1552033894; bh=b8MtlD+7/yGM3Lr8HhhhyH/yYBErhCRMJVXsCSAyx0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QNhzKf7I8Heq3AHUlsH//wjoQhlUbA+Ecg+liLAO3Jg0XGCuxW2ZeUwgVcy95wplX /y0pL43n8wjWlYOO5aTDBViJ4ClX95iGURJa8M2QxmZ30LTr/lAUggmglmZ3Q4kfU2 iSPXc3ehtHELBWMBcjSHjnKYE4OYCuQFw+S4BU50= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1E29260386 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=rnayak@codeaurora.org From: Rajendra Nayak To: vinholikatti@gmail.com, alim.akhtar@samsung.com, pedrom.Sousa@synopsys.com Cc: subhashj@codeaurora.org, asutoshd@codeaurora.org, linux-scsi@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Rajendra Nayak Subject: [PATCH 2/3] scsi: ufs: Add error checks for pm_runtime_get_sync() Date: Fri, 8 Mar 2019 14:00:52 +0530 Message-Id: <20190308083053.30631-3-rnayak@codeaurora.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190308083053.30631-1-rnayak@codeaurora.org> References: <20190308083053.30631-1-rnayak@codeaurora.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add an error check for pm_runtime_get_sync(), ignoring this can hide issues with the runtime pm handling in the driver. Signed-off-by: Rajendra Nayak --- drivers/scsi/ufs/ufshcd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 2ddf24466a62..060dc38cc582 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -8357,7 +8357,10 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) } /* Hold auto suspend until async scan completes */ - pm_runtime_get_sync(dev); + err = pm_runtime_get_sync(dev); + if (err < 0) + goto out_remove_scsi_host; + atomic_set(&hba->scsi_block_reqs_cnt, 0); /* * We are assuming that device wasn't put in sleep/power-down From patchwork Fri Mar 8 08:30:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajendra Nayak X-Patchwork-Id: 10844313 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DDEFF1669 for ; Fri, 8 Mar 2019 08:31:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCA692E28B for ; Fri, 8 Mar 2019 08:31:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C060B2E2A5; Fri, 8 Mar 2019 08:31:54 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable 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 7A2FF2E28B for ; Fri, 8 Mar 2019 08:31:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726485AbfCHIbl (ORCPT ); Fri, 8 Mar 2019 03:31:41 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:35868 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726323AbfCHIbi (ORCPT ); Fri, 8 Mar 2019 03:31:38 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 4465C602BA; Fri, 8 Mar 2019 08:31:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1552033898; bh=a24jmQoPWqyDJptJlj3oRA4mUTzWhIfrj+Q4I+O9kSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lFGu56ucBAn7Ajv2VDEFhDpIfhMLSmRholwws22G99noC2oFZTH/1Osqfe+oq99IY cUUwutmxkohNwBOE4W7EaB8Il+ft5N7DLvtH+02uPxajncdBhfd/V/tGGMmM4xcDDr tswzTbr/aONPjjq8PsfCrjSYh1/BZ8ZmKQNQNeUg= Received: from blr-ubuntu-173.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: rnayak@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 492D461195; Fri, 8 Mar 2019 08:31:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1552033897; bh=a24jmQoPWqyDJptJlj3oRA4mUTzWhIfrj+Q4I+O9kSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kI2sLTGYmJ1dKyqppG9aVCwEQoh83TleGta3FS/McKAtyHP5cRcW36TPGcikMelsU xjFQFNVNzHqECUzQaKegIvoVOZRQcFauefNe5E1PBMp6TaFGxCrFgLPrw6IX432dX6 dn+ENlP719b7m3KZDfRM/V2CTozuPa4EenLTOKfQ= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 492D461195 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=rnayak@codeaurora.org From: Rajendra Nayak To: vinholikatti@gmail.com, alim.akhtar@samsung.com, pedrom.Sousa@synopsys.com Cc: subhashj@codeaurora.org, asutoshd@codeaurora.org, linux-scsi@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Rajendra Nayak Subject: [PATCH 3/3] scsi: ufs: qcom: Remove unnecessary runtime pm calls Date: Fri, 8 Mar 2019 14:00:53 +0530 Message-Id: <20190308083053.30631-4-rnayak@codeaurora.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190308083053.30631-1-rnayak@codeaurora.org> References: <20190308083053.30631-1-rnayak@codeaurora.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Doing a runtime pm get/put as part of ufs_qcom_testbus_config() seems completely unnecessary, since this is called only early during ufs_qcom_init() when the runtime operations are not completely setup for ufs runtime suspend/resume to even work. Signed-off-by: Rajendra Nayak --- drivers/scsi/ufs/ufs-qcom.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index 3aeadb14aae1..3590741eea2f 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -1558,7 +1558,6 @@ int ufs_qcom_testbus_config(struct ufs_qcom_host *host) } mask <<= offset; - pm_runtime_get_sync(host->hba->dev); ufshcd_hold(host->hba, false); ufshcd_rmwl(host->hba, TEST_BUS_SEL, (u32)host->testbus.select_major << 19, @@ -1573,7 +1572,6 @@ int ufs_qcom_testbus_config(struct ufs_qcom_host *host) */ mb(); ufshcd_release(host->hba); - pm_runtime_put_sync(host->hba->dev); return 0; }