Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp867365ybb; Wed, 8 Apr 2020 11:26:12 -0700 (PDT) X-Google-Smtp-Source: APiQypL/T4/2WalK0VKEoSNgNqHVYUP1FNVgrC2ljbgk3D50NOwiZfKbbNlMcGv785nDjGhSJYpa X-Received: by 2002:a05:6830:2428:: with SMTP id k8mr6882439ots.345.1586370372405; Wed, 08 Apr 2020 11:26:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586370372; cv=none; d=google.com; s=arc-20160816; b=TKe0I5yUdzyTTCMvCTFeyvrnkGbnqlKQkO1lUW9RBavfr2bey0OIXN3t6W3wDz6+uy ayyi24dr4UZVy8Yi+w+CZxNuTI8LL6CmSwFSKZdNvrIkZsAnbHrhYSX+IQ17Is1VkcNZ +9FQFHpIpZ7H2Qb0r+tbq1KKaHyvzC0i3nJGolcRIl/g9Lt1/9yg6v5OvIpT0WLb70jI BkpBWma8XLNmEATH4aF6vBsgGPWgrzr11kZeN3mDmvz++aIyqAWUxkNv1KC+zcYLO0IA /pTkTuyJUXU5q6hn1ofWp4N7hvcDoMdRGVTLpEw7OWwLNXz3nKP/z/BUrobhJVlD+W7s KhLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature; bh=9qm8hDJTcDfjcVlKai6quTHvfy91QJtAPqo8V+4TU8w=; b=PARbPVmcRWp7EfdbTuVLCb2aPFE/hY+L6tYKXxIFSfwx7oxinkGylGPxS2MT9d/i5Q OCbBkl7/agputh/J58SVFee2onz8dVrpzgOXLs+PA3BLAPQm9KivWeQtH1lruGwjrYvL lizqAHsfyUD56I3zIyYq0s+t0jKsaOvJv45SxdTCRHcEXpxwDTGQCgvXeMram+Hyc/2c R3nXtSn03L9Ud++7m9s/w9q5l8Jz4fiXPuMrBypMBnwTPsXHib8YG1xVw8KVZ7GYRCCl nOC+sQv062M7Z3ToLUnyI/W2xsuHoHoFYoi7QXkidxV4XQMYlMNwg4b0+xlQ80IuRrWC krmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=tzaaxZmQ; 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 d6si168261otf.27.2020.04.08.11.25.59; Wed, 08 Apr 2020 11:26:12 -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=fail header.i=@mg.codeaurora.org header.s=smtp header.b=tzaaxZmQ; 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 S1728451AbgDHQTR (ORCPT + 99 others); Wed, 8 Apr 2020 12:19:17 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:61978 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728200AbgDHQTR (ORCPT ); Wed, 8 Apr 2020 12:19:17 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1586362756; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=9qm8hDJTcDfjcVlKai6quTHvfy91QJtAPqo8V+4TU8w=; b=tzaaxZmQvEVuOq8OETHSWP9OeP2jAYzrAgyVAd+MIx0yaskocC59fWr+6A3T1ClJUeTjkGZe g5Zk8zhyTMevpBOJKKMwx/TT+leDMxHJDS+TzuqRe1lycLw9GWKl1WIYpfsf++CVXx04Yjsu yi3GvWTi/sRZte2MjeOGGRDw0Qw= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5e8df97f.7fd356b94458-smtp-out-n02; Wed, 08 Apr 2020 16:19:11 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 65F9DC433BA; Wed, 8 Apr 2020 16:19:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=ham autolearn_force=no version=3.4.0 Received: from [10.226.58.28] (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jhugo) by smtp.codeaurora.org (Postfix) with ESMTPSA id 9358AC433D2; Wed, 8 Apr 2020 16:19:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9358AC433D2 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=jhugo@codeaurora.org Subject: Re: [PATCH v2 2/5] bus: mhi: core: Make sure to powerdown if mhi_sync_power_up fails To: hemantk@codeaurora.org Cc: manivannan.sadhasivam@linaro.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm-owner@vger.kernel.org References: <1586278230-29565-1-git-send-email-jhugo@codeaurora.org> <1586278230-29565-3-git-send-email-jhugo@codeaurora.org> <7249d9608f41e4528c87c2b1c464d615@codeaurora.org> From: Jeffrey Hugo Message-ID: <88f9b443-4a1f-918b-297c-203909d8e219@codeaurora.org> Date: Wed, 8 Apr 2020 10:19:09 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: <7249d9608f41e4528c87c2b1c464d615@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/7/2020 7:34 PM, hemantk@codeaurora.org wrote: > On 2020-04-07 09:50, Jeffrey Hugo wrote: >> Powerdown is necessary if mhi_sync_power_up fails due to a timeout, to >> clean up the resources.  Otherwise a BUG could be triggered when >> attempting to clean up MSIs because the IRQ is still active from a >> request_irq(). >> >> Signed-off-by: Jeffrey Hugo >> --- >>  drivers/bus/mhi/core/pm.c | 6 +++++- >>  1 file changed, 5 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c >> index 3285c9e..fbffc6b 100644 >> --- a/drivers/bus/mhi/core/pm.c >> +++ b/drivers/bus/mhi/core/pm.c >> @@ -922,7 +922,11 @@ int mhi_sync_power_up(struct mhi_controller >> *mhi_cntrl) >>                 MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state), >>                 msecs_to_jiffies(mhi_cntrl->timeout_ms)); >> >> -    return (MHI_IN_MISSION_MODE(mhi_cntrl->ee)) ? 0 : -EIO; >> +    ret = (MHI_IN_MISSION_MODE(mhi_cntrl->ee)) ? 0 : -EIO; > > Does it make sense to return -ETIMEDOUT instead of -EIO if device fails > to move to mission mode? > Controller can use this info as mhi_async_power_up() would not return > -ETIMEDOUT. It seems sensible to change this to ETIMEDOUT. I'll queue that up for V3. > >> +    if (ret) >> +        mhi_power_down(mhi_cntrl, false); >> + >> +    return ret; >>  } >>  EXPORT_SYMBOL(mhi_sync_power_up); -- Jeffrey Hugo Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.