Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966975AbdCXTbQ (ORCPT ); Fri, 24 Mar 2017 15:31:16 -0400 Received: from mail-cys01nam02on0071.outbound.protection.outlook.com ([104.47.37.71]:32512 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S967083AbdCXTaQ (ORCPT ); Fri, 24 Mar 2017 15:30:16 -0400 Authentication-Results: spf=pass (sender IP is 149.199.60.100) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; From: Wendy Liang To: CC: , , "Wendy Liang" , Wendy Liang , Michal Simek Subject: [RFC LINUX PATCH 18/19] remoteproc: shutdown: set state to OFFLINE after stopping remote Date: Fri, 24 Mar 2017 12:22:34 -0700 Message-ID: <1490383355-23176-19-git-send-email-jliang@xilinx.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1490383355-23176-1-git-send-email-jliang@xilinx.com> References: <1490383355-23176-1-git-send-email-jliang@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.1.0.1062-22962.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.100;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(39860400002)(39850400002)(39450400003)(39410400002)(39840400002)(2980300002)(438002)(189002)(199003)(9170700003)(33646002)(50226002)(2906002)(9786002)(81166006)(36756003)(48376002)(6666003)(5660300001)(54906002)(36386004)(77096006)(2950100002)(189998001)(6916009)(47776003)(305945005)(356003)(4326008)(38730400002)(5003940100001)(110136004)(107886003)(8676002)(8936002)(50466002)(106466001)(2351001)(50986999)(76176999)(107986001)(217873001);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR0201MB0759;H:xsj-pvapsmtpgw02;FPR:;SPF:Pass;MLV:sfv;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2NAM02FT014;1:SURsS0vDrn1oMdrwiuRM726/SWtFw+id5h0BVHaS3kzB+vqbnULJas5pC41fliTJwMv9s9qG6NYpOSzzSXKim5U5ptnAv3lLTgGndRhCHRJT8s23w0u9gjZdUuZ66HO++3W2T35OI7FWocbByTCCqbH/FJYVaQsvWvh+NKpKLt+PK71Gscuz1MSylZIvawEb28ntpTf1PeweinXxvO9bibYB1Opu2PBeg8rl2RCGpEz3p+JH+D0B1w7lnZSP59ZLbOte+Sy5LaMKBhYsTQFOBopbmzR/McB3Z+xAk5RI1E+X1ovxufvK89qRq93oLHqc0W5yTWslq0dxQT5GsGf2UjII4sk32R55pU5hD+E1sYYNV+6lkPMQlUELPEc6CZd09WwZvn5kR5Opo5dUobIUhOq5V13bKVSjJVRwnv02oljw440seqITEp9gWWi8ERhm6HL7F1SCE/6t2zLRiI3Uv9bOYlQFN0woF5vEy9s21QPW796aY8fXEeIFz3sOiZQH4j4LOTMz10P49gmIdBHT+6QpQL6G+SJ10UGWDYf/yA4S9jyjqBF0lthLtXIdG41Q0dOzEXosgC2uuXyhYkRB9g== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: c3d3dd72-4614-402e-9969-08d472ec2a38 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(8251501002)(2017030254075);SRVR:BY2PR0201MB0759; X-Microsoft-Exchange-Diagnostics: 1;BY2PR0201MB0759;3:nxo3eP6ZL9dUzPirBFS3XnfTcbwrdZsXWLZ8ZivXOU14faPwICp7zutokw4WAx3Dh+mKFT/J57E/WW4j2XCe0C1X3ylOk55uugEddzYHu8x7jTNElcVQy1CRFNjVjyoeQKXX3NttDT22cunobXmn4M9WKY1w5ysntPdFxB72tGw4IKlYjg8DLux/uXJq1lIH+iI0p83BL/rw0RClEtWEdfhK9agevhbR1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CeVMYfknwC/uEVmb4fk+nKlDzNOWbLwc1BEs+Lc7n8wD/0CpaoV5uTX6RBamMJe+yBxwgvdKhIg5F0Y1+KVkBM7XFKemOlwVEqBOGL/jjgdahHVLZCactniNsEqFdha3BTmChm+tpw1k5ENkMNe/mBvhFWjwX+DOoRFk6u5X6480dXnZVsoWwnLPSsWK+bUSmRoUO4ZPrCL/ufPIk+1+yTgRpt8iE7o/coU1Cbth4gMK5ZhmdAKf017FkKRNXWeBeRuBCUWJhPz/5YuxJWb4ig7CQzl5ynpoG1XRS5YlUzYaIEgu2eedkcsO33t9IC7l9NaDbcx9kI3a+nohs3u0x9XrUL43ur0jlMb32+IPMDQQqtG2nbGakgvvJMpmEwfwA96i05pVPWkKuBFnxQuUTI07n1mCe8SHOFLJzDWh0y3B9YwwD7umPSr7hds1A0dEwim/JY1nheH1+8WxNttpviL X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(13017025)(13023025)(13018025)(13024025)(5005006)(13015025)(8121501046)(10201501046)(3002001)(6055026)(6041248)(20161123562025)(20161123564025)(20161123555025)(20161123558025)(20161123560025)(6072148);SRVR:BY2PR0201MB0759;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0201MB0759; X-Microsoft-Exchange-Diagnostics: 1;BY2PR0201MB0759;4:SaF5/85WetA4CIuQpxTy55iKvZQHv79Z+NpbO6rTe4Uhb7ua4JqJLB4pUA5idfrpEB8qecNW58OUKyU12Bml+m5xs3z10mc77AuO7kH0N1fAsMRZ0qCin63gN0iatnEDRJR9wd+n+zdceqlB5DRxUN/YCXC93BM8cUUM9Ku4hF2H/4Uh2wGBDPYz/W/oQXN8v/INM6SJOi8dj4a91nLg1tcG8vg8tpTha+/6Wte02GlFlYMo0fITjOiBUzF4H8oXigIuDDcx2ZGgp6dbxyHvduGdRYvombjUV8aW2IZNGLBsNDAHUgiprub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ckMHm2vkfwrIanTBGTYRXLkVgu11jQy8HhFVXm95bEWxxzSnLJhvxOfz2+tdPCvx83GjrfWbgx4js9p6KqaIBP84PRLwDr2FrCoV9zDUTomeQryRQQhMWLsoo2SqGM8noKxUcxY5KMZF5m0TSIbyhcBwnHTvgGLZfrN3MO29SS8jJjInnSdO43hMbUqNXXUUDd79qhM=;5:nDXCGgT1UC3MUVwmavXrY6hs7yQ9LDEXGl706bewsIdhp627VTKPgo1yjpB/4dEcU5eKFUfD5ZQe2SgYIHNqkMO0M7PGpA+vuyqEG6KCo+m3SZ75AkJg61KxBv6uJi8b7yu+vzFSQbyK98INV8ZzyQ==;24:XniIZO1E9bQw70y/li/ZB4W0iG6TsRpHopTqFvCXf6wYTMqdtyBX/KKh5+KlPt1uS+XPJL/5TaE6b1Gz740xV2GK0wLex0l1MCpubHShsiQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BY2PR0201MB0759;7:KTR2Sbf/HSbzfGDUi7kMYIB393dekAEUtpbDC0C4XQSuzmzi5AyZ6+1PMkOeA+IpUvlHVLdx05rkI5XJnjLjARq27vXTHnGQaUVtKshNT3v1kSE+w1JhlUp6Q4+EUVzto3zvkEBJcKy7jO6gNTPOFCOBR5aMkSXa6BDmvN8vuj3mVvWvWOIuQOGOXd71JcrfaEE5qVzie7JHirY3spobyfxb8rfRlM7j817HN3vKkSplv2AaF2daPXbI12JMHHMG7LeDKJVkCSXbxabGrLr0Ijnjjmv9j4ck4yEOHIBYutq3WuwtbO4po1Lt4stL6k5t0IXQz4dAZX/6VcdCpLrmHw== X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2017 19:30:01.0408 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.100];Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0201MB0759 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1454 Lines: 50 From: Wendy Liang Set rproc state to OFFLINE right after it stops the remote. Some remoteproc virtio operations depends on rproc state. And thus, we should set the rproc state to OFFLINE right after it stops the remote. Signed-off-by: Wendy Liang Signed-off-by: Michal Simek --- drivers/remoteproc/remoteproc_core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index ffd1de2..62c0356 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1369,6 +1369,7 @@ void rproc_shutdown(struct rproc *rproc) { struct device *dev = &rproc->dev; int ret; + int pre_rproc_state; ret = mutex_lock_interruptible(&rproc->lock); if (ret) { @@ -1391,6 +1392,9 @@ void rproc_shutdown(struct rproc *rproc) goto out; } + pre_rproc_state = rproc->state; + rproc->state = RPROC_OFFLINE; + /* clean up all acquired resources */ rproc_resource_cleanup(rproc); @@ -1402,11 +1406,9 @@ void rproc_shutdown(struct rproc *rproc) rproc->table_ptr = NULL; /* if in crash state, unlock crash handler */ - if (rproc->state == RPROC_CRASHED) + if (pre_rproc_state == RPROC_CRASHED) complete_all(&rproc->crash_comp); - rproc->state = RPROC_OFFLINE; - dev_info(dev, "stopped remote processor %s\n", rproc->name); out: -- 1.9.1