Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1377046ybj; Thu, 7 May 2020 23:15:54 -0700 (PDT) X-Google-Smtp-Source: APiQypIEsmVnLEjc8+Ux7nmy0QErC62sVFGCgJriH1YV6wyJUFdIistp9Ftq960LNdCgv2+iVyAJ X-Received: by 2002:a17:906:90d0:: with SMTP id v16mr572370ejw.114.1588918554658; Thu, 07 May 2020 23:15:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588918554; cv=none; d=google.com; s=arc-20160816; b=F0PqK1fY+rxfyhFA6Pcsppv0ZgE+yHrnUGui48jkF4Rvr1SgHAoAuGS3s8CyG5zCGg zFCN3dfKp7i45ukvEyfbZuq2ezsaMmdFO3bMCB1AEtVW7KWBoIPgI38KBAcInVYDHbwD cDfq535C7v05v91uHh328ovIgHPC9jublTWcvMGmR4+jSMO8QNOW+Hg1oMFe/bgKzj8s Hu3SjHKtLOvk3NdTt07SS11AM80oBxCtXebHmXlOCMbav/TTFi10/9MzO4mvFSwmFnTk BT/KfpwSZO1I48r5vlU90jLLQQrsIE+rj72xROPDnX0A475M+oPbSgUUFSJmRGs6JLDB 5HHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=v9TMu/sogCrO+UsVzI78mOfKGjH8tw9eLATv2c3ci4A=; b=Z+Ewl5vZK9I7eXfvEBaR1uSMRtNqhN9T9lBWtR6jjeBtddngNEoJcpfq/tIMKpqg85 JeVjSufJDm4xFZfTcNnzP3KXUacqm/wcM/roB1Aleaw4g9An1qfHnovGelB36g53qknD NcSF1H8Oom+YGpcoK49s2LR0fvQBTRQYh+ooKazm/nR1B/rVkWT2AM67rdeNZLtJUHBr vSQ37lZzNt4EqSTG69n3kjMPXIpKFwXNm7siyoP9E2n2vX+46fY62G/eOb/30LnTOqJI lHl6JuOTPKIgSafqc6Aw5cdm0pSIlJm6fKX7P5PbIpn2vHB2mtT7JXjnZgKgWeO1s8Js xGEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LG3tfk9m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c61si406890edf.53.2020.05.07.23.15.30; Thu, 07 May 2020 23:15:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LG3tfk9m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726767AbgEHGNs (ORCPT + 99 others); Fri, 8 May 2020 02:13:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:46778 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725896AbgEHGNr (ORCPT ); Fri, 8 May 2020 02:13:47 -0400 Received: from Mani-XPS-13-9360 (unknown [157.50.45.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D859D20725; Fri, 8 May 2020 06:13:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588918427; bh=uCwWcJtdd6frbTmuQHsfeyWV4UFkvt8omeOoYW4xCgo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LG3tfk9mmM/1S/YbIMZGdW6aCFUXl9zNJJG276APD1xb9AO8nNU+P/HZzdGs1yiTI 7lNK31RSFKqgSbBBAtzao9Tgv6yaS7BIFJho+Q3xaTgK1SkzXfcWnVZU8Js6et5jn1 8nsBxjciu3v7wBG3lcCndg1Xdr3FPGJ/e3nhsdpI= Date: Fri, 8 May 2020 11:43:37 +0530 From: Manivannan Sadhasivam To: Bhaumik Bhatt Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, hemantk@codeaurora.org, jhugo@codeaurora.org Subject: Re: [PATCH v6 6/8] bus: mhi: core: Return appropriate error codes for AMSS load failure Message-ID: <20200508061337.GB2696@Mani-XPS-13-9360> References: <1588718832-4891-1-git-send-email-bbhatt@codeaurora.org> <1588718832-4891-7-git-send-email-bbhatt@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1588718832-4891-7-git-send-email-bbhatt@codeaurora.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 05, 2020 at 03:47:10PM -0700, Bhaumik Bhatt wrote: > When loading AMSS firmware using BHIe protocol, return -ETIMEDOUT if no > response is received within the timeout or return -EIO in case of a > protocol returned failure or an MHI error state. > > Signed-off-by: Bhaumik Bhatt > Reviewed-by: Jeffrey Hugo > --- > drivers/bus/mhi/core/boot.c | 23 ++++++++++++----------- > 1 file changed, 12 insertions(+), 11 deletions(-) > > diff --git a/drivers/bus/mhi/core/boot.c b/drivers/bus/mhi/core/boot.c > index 17c636b..05627fe 100644 > --- a/drivers/bus/mhi/core/boot.c > +++ b/drivers/bus/mhi/core/boot.c > @@ -176,6 +176,7 @@ static int mhi_fw_load_amss(struct mhi_controller *mhi_cntrl, > void __iomem *base = mhi_cntrl->bhie; > rwlock_t *pm_lock = &mhi_cntrl->pm_lock; > u32 tx_status, sequence_id; > + int ret; > > read_lock_bh(pm_lock); > if (!MHI_REG_ACCESS_VALID(mhi_cntrl->pm_state)) { > @@ -198,19 +199,19 @@ static int mhi_fw_load_amss(struct mhi_controller *mhi_cntrl, > read_unlock_bh(pm_lock); > > /* Wait for the image download to complete */ > - wait_event_timeout(mhi_cntrl->state_event, > - MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state) || > - mhi_read_reg_field(mhi_cntrl, base, > - BHIE_TXVECSTATUS_OFFS, > - BHIE_TXVECSTATUS_STATUS_BMSK, > - BHIE_TXVECSTATUS_STATUS_SHFT, > - &tx_status) || tx_status, > - msecs_to_jiffies(mhi_cntrl->timeout_ms)); > - > - if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) > + ret = wait_event_timeout(mhi_cntrl->state_event, > + MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state) || > + mhi_read_reg_field(mhi_cntrl, base, > + BHIE_TXVECSTATUS_OFFS, > + BHIE_TXVECSTATUS_STATUS_BMSK, > + BHIE_TXVECSTATUS_STATUS_SHFT, If you want to prevent some parameters to be within 80 characters that is fine but do it for all to look uniform: mhi_read_reg_field(mhi_cntrl, base, BHIE_TXVECSTATUS_OFFS, BHIE_TXVECSTATUS_STATUS_BMSK, BHIE_TXVECSTATUS_STATUS_SHFT, &tx_status) || tx_status, Thanks, Mani > + &tx_status) || tx_status, > + msecs_to_jiffies(mhi_cntrl->timeout_ms)); > + if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state) || > + tx_status != BHIE_TXVECSTATUS_STATUS_XFER_COMPL) > return -EIO; > > - return (tx_status == BHIE_TXVECSTATUS_STATUS_XFER_COMPL) ? 0 : -EIO; > + return (!ret) ? -ETIMEDOUT : 0; > } > > static int mhi_fw_load_sbl(struct mhi_controller *mhi_cntrl, > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project >