Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3429170imm; Fri, 20 Jul 2018 17:07:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeD1jsVZse7KZoYG9j93q62PBi0oOcmA4gkoKAsoUkwdjX0YaLOVEr8UPKJE9FQQrUkQ9Je X-Received: by 2002:a17:902:342:: with SMTP id 60-v6mr3923015pld.311.1532131629553; Fri, 20 Jul 2018 17:07:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532131629; cv=none; d=google.com; s=arc-20160816; b=PJV25kk55LR4/qkiJiNA9lgrpkEOpxZFqO3tcbR2kZBya6gr6UpFyY7Gm4kdYA3exe gvwf9c19YMJojm+oJOP/rRYOK2WC2IP4RSxiTBaHlJIBXstT8Ysc6Y/UOChgFABTVXTs IFy+IPwOwoJIESxaPedW9liQi65taSK95ad9m+MJxe1IPszyLFqTYgnFauapEknk0RB/ p27PZHcVwTysTWJ+WDhrmxugMTGdpAqn+5VhDmZHydA3ioPCtpbYR7Q8nX4HTXCEsis4 1MpZCXLSX4Fav1RRIYC7F2B2hE3gjGhb9ttMec/T8iRR7ywdw7/2ZsBGvrMsn0xVRxqx n9Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=xv+n7oqwbBYvwIPwfq3tNjt0VbeAOr3fhhIuLb0QedQ=; b=pgTwH+FH/4VW8vtKUdknjMOOeN8nrobXAx8RrfYblV/7xuwfQXqIVlIP8CTDffTdTe C1fDVYlYz5/qQr+cG7ODTTGMbZBgNcNXtNHzKTdq654m33iK4oFj8h3s0jtB+UsvvMFz Z/7YafvYFFhO3ofLo8t8Ghs1FVHSdXGC7Zydnu6XPfrqJSmmZtPwoeS8j3MuLl/RI9za sqRBbR9oAEpMnYIZ1eRVrNaTX+TnxR4zCWJa7BcDa3lukyB8/SAbsKwr8Ehd9DwA3HMw UMSFDiGsf07M9H4SUXmmQk8bzNOIPwqjlMP2CQqoCUXw1tjDTLURKzIsUKtkGCjwdq1V GoDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=I5mr+9Ah; dkim=pass header.i=@codeaurora.org header.s=default header.b=EBbV8bCe; 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 i10-v6si3224200pfe.119.2018.07.20.17.06.55; Fri, 20 Jul 2018 17:07:09 -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; dkim=pass header.i=@codeaurora.org header.s=default header.b=I5mr+9Ah; dkim=pass header.i=@codeaurora.org header.s=default header.b=EBbV8bCe; 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 S1728398AbeGUA4e (ORCPT + 99 others); Fri, 20 Jul 2018 20:56:34 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:52130 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727444AbeGUA4d (ORCPT ); Fri, 20 Jul 2018 20:56:33 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 43B2B6074D; Sat, 21 Jul 2018 00:05:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1532131559; bh=8pQN6Q79oBbodIwh6irOo/wpzM5/bFYUqOqzN+1sNa8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=I5mr+9AhGDa9C92fFYx2kL7eMkgDMROvaPLkh9MBHmgv99T6JOuzDOO3n+jnhl16Z Q0Zc3TxQ0tEJ5JXxvXQoqrmpA7XE6Re4CcqmZWDAdYXZ6wCAF0aUt435y5Rw6gR9WW /ybR/N43qF3k3fyyJIoYidalqcR3WmxiA4VXOYxQ= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 9BFC06063A; Sat, 21 Jul 2018 00:05:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1532131558; bh=8pQN6Q79oBbodIwh6irOo/wpzM5/bFYUqOqzN+1sNa8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=EBbV8bCeVIjQkRV8WZNEaZ8eroSMcTC8MywSEgRM659IlnNbxP5ZSOOx4Qe29Hfw2 OYm3kj84lQujuFnzCjMtxv2B0NZUR5OM/w508OeBAiNi/dH/HVkVR+hG4CgBA4JVn2 FXXCxT4DZ3fpXF932K2xHLnDf8fh3p9WgWy6F63s= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 20 Jul 2018 17:05:58 -0700 From: Subhash Jadavani To: Asutosh Das Cc: 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, Gilad Broner , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-scsi-owner@vger.kernel.org Subject: Re: [PATCH v1 8/9] scsi: ufs: enable runtime pm only after ufshcd init In-Reply-To: <6f1fd2b0fbfb73d977a1063bda598d8b9b6005b7.1530880007.git.asutoshd@codeaurora.org> References: <6f1fd2b0fbfb73d977a1063bda598d8b9b6005b7.1530880007.git.asutoshd@codeaurora.org> Message-ID: <5109aeb8c6db50adc5131ad3ef13ca37@codeaurora.org> X-Sender: subhashj@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-07-06 05:30, Asutosh Das wrote: > 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: Looks good to me. Reviewed-by: Subhash Jadavani -- The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project