Message ID | 20210310211025.1084636-18-mathieu.poirier@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=6xFU=II=lists.infradead.org=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EE6EC433E0 for <linux-arm-kernel@archiver.kernel.org>; Wed, 10 Mar 2021 21:21:30 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0656264FD9 for <linux-arm-kernel@archiver.kernel.org>; Wed, 10 Mar 2021 21:21:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0656264FD9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=niCHUZ8ZkG5V7Mzv01IBL8MPrBCNXBTp2hJzZjZ9fqs=; b=qKzQTiJsu/r1oCQhkgbUgNfAJ lpJyHhWBbtk1Avktpuczr4JE2fDMV/IkPz9RA13dhX9zk1XNYRpzoBwncsHfY1nWbC3gIyOlWO9d8 9/u/QQAKTyJCKEsdfvVuaJOWeU6CMWXdfM4jkO2v9YP77Sh/nqp4ljVtFkDlqqoPUilcp2RdbmlnQ oUNmPr4IaZ/NnEbP1u/RZ5jFREhpVM63NMwK/WG3OflEmmI06o8GwKZTjM4/ZHqdTEBMTaV4DEOUe hdPiujOoml/JCmnvzkWs7gyKp/X0LuCqKLrVodqv6TnN4Ua71ei0xF35+AKkptHfAvY0M1LdlRPsr bGpgdY33A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lK6Ew-007lqh-Ea; Wed, 10 Mar 2021 21:19:35 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lK66X-007jXp-3h for linux-arm-kernel@lists.infradead.org; Wed, 10 Mar 2021 21:10:56 +0000 Received: by mail-pl1-x630.google.com with SMTP id ba1so9131181plb.1 for <linux-arm-kernel@lists.infradead.org>; Wed, 10 Mar 2021 13:10:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BGL2ihK/psb3Syg4v822MS7bSYXQTTBjUBjeuGJcCyw=; b=Vb8k+1a9Xet0PbxpzdS19v+gh8mkgVMJGpJouQqrohu8j1rhefkJMCeyCKgo2iAkFp HGtHWaFWm000lW+mCa+MG4FwdJvucPutY370SC6gpN5cDSeZ4PGfIhRSv0PpPo/CecOM dpnQJ4+oMn6bUgrZLsRTijPoCS7bRaSvp6+tzEk1I8MgpFjSclrntDPW8UAUObZ1iVIs Z4PmsEh91nNNkPhUkri+RmFgRwJCXsFAA8K04ysQWMmd9i5j+VGYvvpELsPmxBI6oTli Hp9VoCooO8UraqRnoXzAi1NHDtmpUhFPhBOtF5mMLslvj2lmjzR64+xtR8Aatbkutl2w 9gMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BGL2ihK/psb3Syg4v822MS7bSYXQTTBjUBjeuGJcCyw=; b=rKGgBCis31q1bKHFnognmZgjnLSNBQkVat/cJBGxTeNCSiZHqqRHaD8Wj2mK4dIXkn 3IR1WUXao9s58wAMGOyERs+CO1pLsRZGP+e6khzmKwi5O/GOYddof03tQ48DITXLVWj8 qXM0tnNGbzALvhrhOoGFkFYKKBCG62ilOa5uhgKhHAh2LiXcsULOykYZ5kIRc/ZhLNGC /T+ywFcupTm8ZXKUHjVu2j8h0CTLy3W5ltIuVSaETipwPViM+PJ2rf2LDu5A1RKq+NFL vRNxFKlrUMlzFVnHcXhDnA1wx/Qvt3mz100iCBjyEjqWvAYdYLZcFOjxuGsyG+INSgfG B23w== X-Gm-Message-State: AOAM533YxFtkmDoxhR8kScjkBT4SyKDGhWBtpxE7KxHgAoGFree5AYmW D1e4INJ5QhXLeOCFKxPyQ6oylEUawRshNg== X-Google-Smtp-Source: ABdhPJyerzZSSKv1SejSU2q89sYnoZLwH01Fg019P2oeq8CyLeDGQce8Y/7fgVFdmgxEyqqYTSgmiw== X-Received: by 2002:a17:90a:3902:: with SMTP id y2mr5532955pjb.202.1615410651845; Wed, 10 Mar 2021 13:10:51 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id j21sm371508pfc.114.2021.03.10.13.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Mar 2021 13:10:51 -0800 (PST) From: Mathieu Poirier <mathieu.poirier@linaro.org> To: ohad@wizery.com, bjorn.andersson@linaro.org Cc: arnaud.pouliquen@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v7 17/17] remoteproc: Refactor function rproc_cdev_release() Date: Wed, 10 Mar 2021 14:10:25 -0700 Message-Id: <20210310211025.1084636-18-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210310211025.1084636-1-mathieu.poirier@linaro.org> References: <20210310211025.1084636-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210310_211053_575303_B0C80334 X-CRM114-Status: GOOD ( 16.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
remoteproc: Add support for detaching a remote processor
|
expand
|
diff --git a/drivers/remoteproc/remoteproc_cdev.c b/drivers/remoteproc/remoteproc_cdev.c index 2db494816d5f..0b8a84c04f76 100644 --- a/drivers/remoteproc/remoteproc_cdev.c +++ b/drivers/remoteproc/remoteproc_cdev.c @@ -86,11 +86,17 @@ static long rproc_device_ioctl(struct file *filp, unsigned int ioctl, unsigned l static int rproc_cdev_release(struct inode *inode, struct file *filp) { struct rproc *rproc = container_of(inode->i_cdev, struct rproc, cdev); + int ret = 0; + + if (!rproc->cdev_put_on_release) + return 0; - if (rproc->cdev_put_on_release && rproc->state == RPROC_RUNNING) + if (rproc->state == RPROC_RUNNING) rproc_shutdown(rproc); + else if (rproc->state == RPROC_ATTACHED) + ret = rproc_detach(rproc); - return 0; + return ret; } static const struct file_operations rproc_fops = {
Refactor function rproc_cdev_release() to take into account the current state of the remote processor when choosing the state to transition to. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> --- New for V7: Keep the behavior of the shutdown operation in rproc_del() intact. --- drivers/remoteproc/remoteproc_cdev.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)