From patchwork Wed Sep 4 02:26:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 13789599 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 55216CD37BD for ; Wed, 4 Sep 2024 02:19:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version: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:In-Reply-To:References:List-Owner; bh=sooL9IoI5x3i08yyZTvCV12CNg2urho5OAujQacY2BU=; b=MsMHqYl59lu5IRo7azRzyqqPh6 K1EteOK+vTchWc/ijJyv6/L693f5SWMO39iIR7w/PPI5REkST9tVxI38ASu+JNKdaKYR1dYV6eIlz p6YGXsf0AYfFBsAoYaD2jdpXj+IvOWRwhk4hpz8f30ZLx/Iwt6etxdZxX5aJ+KY/HaG4jg4yGKAqJ yAg8FCM14WemWvsTjeyfRx5T/LBYF/bnHsJ0iskZ4xkeavhSO5xeaxbKObJe417Zv/rIBNKpYa71f MCZLVzVzIGyymJlslzWAbwvk8TGkK0zl/Zmp8F+blpFn+bOuuswO426kMgF9kIASmTuGrJDTNuDHb O44ynzJw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1slfbz-00000002ZF7-00Bj; Wed, 04 Sep 2024 02:19:11 +0000 Received: from szxga03-in.huawei.com ([45.249.212.189]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1slfb2-00000002Z7P-1nQr for linux-arm-kernel@lists.infradead.org; Wed, 04 Sep 2024 02:18:15 +0000 Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Wz5cb72RDz69Ny; Wed, 4 Sep 2024 10:13:03 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 1E660180105; Wed, 4 Sep 2024 10:18:01 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 4 Sep 2024 10:18:00 +0800 From: Hongbo Li To: CC: , , Subject: [PATCH -next v2] soc/fsl/qbman: make use of the helper function kthread_run_on_cpu() Date: Wed, 4 Sep 2024 10:26:33 +0800 Message-ID: <20240904022633.2079803-1-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500022.china.huawei.com (7.185.36.66) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240903_191812_744726_216D3928 X-CRM114-Status: GOOD ( 12.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Replace kthread_create/kthread_bind/wake_up_process() with kthread_run_on_cpu() to simplify the code. Signed-off-by: Hongbo Li --- v2: - Remove the extra parameter to solve the compilation. - Change cpu from int type to unsigned int type. v1: https://lore.kernel.org/linux-arm-kernel/20240902133125.3089560-1-lihongbo22@huawei.com/T/ --- drivers/soc/fsl/qbman/qman_test_stash.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/soc/fsl/qbman/qman_test_stash.c b/drivers/soc/fsl/qbman/qman_test_stash.c index b7e8e5ec884c..639acaf6ce18 100644 --- a/drivers/soc/fsl/qbman/qman_test_stash.c +++ b/drivers/soc/fsl/qbman/qman_test_stash.c @@ -101,21 +101,19 @@ static int bstrap_fn(void *bs) } static int on_all_cpus(int (*fn)(void)) { - int cpu; + unsigned int cpu; for_each_cpu(cpu, cpu_online_mask) { struct bstrap bstrap = { .fn = fn, .started = ATOMIC_INIT(0) }; - struct task_struct *k = kthread_create(bstrap_fn, &bstrap, - "hotpotato%d", cpu); + struct task_struct *k = kthread_run_on_cpu(bstrap_fn, &bstrap, + cpu, "hotpotato%u"); int ret; if (IS_ERR(k)) return -ENOMEM; - kthread_bind(k, cpu); - wake_up_process(k); /* * If we call kthread_stop() before the "wake up" has had an * effect, then the thread may exit with -EINTR without ever