Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1734990imm; Fri, 6 Jul 2018 05:41:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfZbwRtkKJ9YR124ZfnE2aXL+OND9TTSH1VMxfimONHucNmdyGKspP8NgU477faAx3x8mLp X-Received: by 2002:a63:4e5f:: with SMTP id o31-v6mr7532469pgl.256.1530880889392; Fri, 06 Jul 2018 05:41:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530880889; cv=none; d=google.com; s=arc-20160816; b=V57l935ZwHlnJtKKUfALrMqeKYFDjXhRShN8BWKQcOjI1aYWbZJHH94p3pEUMD4+EJ EDYBJvCUZc+K0gc1AjLb7HTqbiDdPqt7pDhAhYgVXBK3mU0JCC4Q1NoTBu781bYLmzjk LhN2C1weQdZ8gY2x9gOg5SBejDIbeyqy2knM4XNTj98UgwCozEVMeeti5FRGQ0dcpOtU QrqWto9PHFySRYUDlyETNtJ8yP9h33FytoTA01lCc9P2miMwtbl+asuZ6f4K8XFc6C9z XI0m2rPWju46KBs7eDrRQ3gDoqzw1G/+I+SFHCNd5ATxWoFd3+6CFlcmPSGldDoPCVZn FqKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=7gfIeaIlHSY63Jc4ISi0IV9iW+CBRz7m38SJ8LJpJ6I=; b=zrK2M3DA12G4xpxe+aGRspdrOapcJ7yhzxhnDpmHwk1WqUfYvaAublF6kBCx+7ywdm 74SPilUp+QQ1+ZWpCIUB8v3xIeleITS9PbSQnGYN9Hr+m9z3htzcLJpqC/URCEtsirnm BNJpblxPTCxS754RsYaoeHjKQyLiQ+rzx2Oi8g5uf/HDZRklwuzbIvLk+gNwK7O/UmPM hOmUWDe56EPCU19JPDc7Fsf8FtfPd44/TRVTB2fBnMNGd3qc2kZx5Fd6ZBieGlD5C592 l6VY6RO0e0VYaHutJfSw51c9DAx4FteYv57OkCgVSmYqoy9gGeBRcKSQgA2NA/9opzwO hu4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c6-v6si8105281pgn.143.2018.07.06.05.41.14; Fri, 06 Jul 2018 05:41:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933398AbeGFMjv (ORCPT + 99 others); Fri, 6 Jul 2018 08:39:51 -0400 Received: from alexa-out-blr-02.qualcomm.com ([103.229.18.198]:56668 "EHLO alexa-out-blr.qualcomm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933139AbeGFMio (ORCPT ); Fri, 6 Jul 2018 08:38:44 -0400 X-Greylist: delayed 437 seconds by postgrey-1.27 at vger.kernel.org; Fri, 06 Jul 2018 08:38:37 EDT X-IronPort-AV: E=Sophos;i="5.51,316,1526322600"; d="scan'208";a="98707" Received: from ironmsg03-blr.qualcomm.com ([10.86.208.132]) by alexa-out-blr.qualcomm.com with ESMTP/TLS/AES256-SHA; 06 Jul 2018 18:00:55 +0530 X-IronPort-AV: E=McAfee;i="5900,7806,8945"; a="470261" Received: from asutoshd-linux.qualcomm.com ([10.206.24.163]) by ironmsg03-blr.qualcomm.com with ESMTP; 06 Jul 2018 18:00:54 +0530 Received: by asutoshd-linux.qualcomm.com (Postfix, from userid 92687) id 9AEA42FAE; Fri, 6 Jul 2018 18:00:53 +0530 (IST) From: Asutosh Das To: subhashj@codeaurora.org, cang@codeaurora.org, vivek.gautam@codeaurora.org, rnayak@codeaurora.org, vinholikatti@gmail.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org Cc: Gilad Broner , linux-arm-msm@vger.kernel.org, Asutosh Das , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1 8/9] scsi: ufs: enable runtime pm only after ufshcd init Date: Fri, 6 Jul 2018 18:00:35 +0530 Message-Id: <6f1fd2b0fbfb73d977a1063bda598d8b9b6005b7.1530880007.git.asutoshd@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gilad Broner Previous code enables runtime pm before ufshcd_init() is completed, and before the hba struct is stored in the platform device private data. This means that pm runtime calls will have null hba pointer as well as partially initialized driver. Instead, enable pm runtime only after ufshcd_init() is done and after hba struct is stored in the platform device private data. Signed-off-by: Gilad Broner Signed-off-by: Can Guo Signed-off-by: Asutosh Das --- drivers/scsi/ufs/ufshcd-pltfrm.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index 7dba799..8332d99 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -354,24 +354,21 @@ int ufshcd_pltfrm_init(struct platform_device *pdev, } ufshcd_parse_pm_levels(hba); - pm_runtime_set_active(&pdev->dev); - pm_runtime_enable(&pdev->dev); ufshcd_init_lanes_per_dir(hba); err = ufshcd_init(hba, mmio_base, irq); if (err) { dev_err(dev, "Initialization failed\n"); - goto out_disable_rpm; + goto dealloc_host; } platform_set_drvdata(pdev, hba); - return 0; + pm_runtime_set_active(&pdev->dev); + pm_runtime_enable(&pdev->dev); -out_disable_rpm: - pm_runtime_disable(&pdev->dev); - pm_runtime_set_suspended(&pdev->dev); + return 0; dealloc_host: ufshcd_dealloc_host(hba); out: -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.