From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,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 11732C11F70 for ; Sat, 10 Jul 2021 23:50:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 00059613E5 for ; Sat, 10 Jul 2021 23:50:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232868AbhGJXwr (ORCPT ); Sat, 10 Jul 2021 19:52:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:39696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232661AbhGJXwd (ORCPT ); Sat, 10 Jul 2021 19:52:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E983061057; Sat, 10 Jul 2021 23:49:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625960987; bh=NSz0HggK+LEffCybsslj3iHeHYAzmgeuo1Ce2nB3UMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wy9SllXM/QTJzg/TD2YBlO+SLbJCYrRvMmxFKX//88DyYjPAP+00d57tmWkdxSa+x H8gLaFLZNSNd64J4M3qQkXeLvrOAZicjcUkjUreB+42oVB3LkwS1LJg4szeM3riIu1 aTetV+dtoAuu5yAogyWFxECBT9zD3eLSeSwg3DoHWbaEFDg0EZ3/17pKlrYJvMAtMp dkttwJnjy4rjuzixY9gFoEQplEy5QkWrp5R3PN2pdv7NSbcg+kJbjmuGWYnH9dntom jsSZnqRS/n+IFXzkQr9d9efqPz1RO8QT/NphbuaMaGSmMDl7hBXc4DuGqm1JUi9aW7 dV7QUD5C/C8Zw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Siddharth Gupta , Bjorn Andersson , Sasha Levin , linux-remoteproc@vger.kernel.org Subject: [PATCH AUTOSEL 5.12 21/43] remoteproc: core: Fix cdev remove and rproc del Date: Sat, 10 Jul 2021 19:48:53 -0400 Message-Id: <20210710234915.3220342-21-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710234915.3220342-1-sashal@kernel.org> References: <20210710234915.3220342-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Siddharth Gupta [ Upstream commit 930eec0be20c93a53160c74005a1485a230e6911 ] The rproc_char_device_remove() call currently unmaps the cdev region instead of simply deleting the cdev that was added as a part of the rproc_char_device_add() call. This change fixes that behaviour, and also fixes the order in which device_del() and cdev_del() need to be called. Signed-off-by: Siddharth Gupta Link: https://lore.kernel.org/r/1623723671-5517-4-git-send-email-sidgup@codeaurora.org Signed-off-by: Bjorn Andersson Signed-off-by: Sasha Levin --- drivers/remoteproc/remoteproc_cdev.c | 2 +- drivers/remoteproc/remoteproc_core.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/remoteproc_cdev.c b/drivers/remoteproc/remoteproc_cdev.c index b19ea3057bde..ff92ed25d8b0 100644 --- a/drivers/remoteproc/remoteproc_cdev.c +++ b/drivers/remoteproc/remoteproc_cdev.c @@ -111,7 +111,7 @@ int rproc_char_device_add(struct rproc *rproc) void rproc_char_device_remove(struct rproc *rproc) { - __unregister_chrdev(MAJOR(rproc->dev.devt), rproc->index, 1, "remoteproc"); + cdev_del(&rproc->cdev); } void __init rproc_init_cdev(void) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index ab150765d124..d9d2a240dd58 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -2357,7 +2357,6 @@ int rproc_del(struct rproc *rproc) mutex_unlock(&rproc->lock); rproc_delete_debug_dir(rproc); - rproc_char_device_remove(rproc); /* the rproc is downref'ed as soon as it's removed from the klist */ mutex_lock(&rproc_list_mutex); @@ -2368,6 +2367,7 @@ int rproc_del(struct rproc *rproc) synchronize_rcu(); device_del(&rproc->dev); + rproc_char_device_remove(rproc); return 0; } -- 2.30.2