From patchwork Mon Dec 10 21:51:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 153370 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp4052993ljp; Mon, 10 Dec 2018 13:52:28 -0800 (PST) X-Google-Smtp-Source: AFSGD/U0LyCW+CnfdSJbaU+6HFcYfrFXOCbwH1ZIJMlCFSDoIzUmrnSl3vJEQRz2BlOAYgkPR3/R X-Received: by 2002:a63:d547:: with SMTP id v7mr12125914pgi.339.1544478748196; Mon, 10 Dec 2018 13:52:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544478748; cv=none; d=google.com; s=arc-20160816; b=BsRHZqM6V/UVf1ggsUkfYTiam7HyoEcBa+3QHsT4IOCTtGXobtFYmG0axEjc0ii2F7 pB+Ex/UjpdMSRWALB2DFTL6FOOMr/DafFaASC+xs/JU/tPodt8DhjRrQ07Mk5bI7uUE3 JLuZy6Rd15Zpoj2GQFIaI/L1InGTvMBeb+/jIePlQKgfDnOFlw5s45Qkbi5sTOtAj1SL t0jmHXIRnh4hnZ3NmeOnx/kkuEuZ9E98QKTT9edOik1+l6b1JwnhhfgZyHTWFbERxlgj WgkCGX7GaJDgqgSx2mQ1rZ+1SX3vQVB6y2CEc/MaCcq4meOEaffLap4rg9/8LkrG+0pQ fm8g== 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:mime-version :message-id:date:subject:cc:to:from; bh=nIqoTFGgqJFtGZMll0AF470Pevz8WJceKu6/7kHsMWQ=; b=T0Qm7G409aLLnA5hx5mkZ9tJWEr20t+dqYMzOwTYZhbl/otsFa5fEyXhFSqbA5xAWK cpKeqrv/Of32Hh0PMT/z0WLFwzGjzCNw8UxJfTl6rBEK7Cx1a94uEMf0Bu8ucMrTP4d0 Xf+WuB4LmQXl3STy/1+78w7d4eLsvLDgPUsJEAVDkfRpz3Hie/kFszTasqkxN27oQhT4 q8LiJqVFSgcyVVyvvrMv8VLz1LQSivplEzmrAti/u9qJgn96W7tBvBuphFvkIIryeBls 5nTx5jxQTUMZJnJX9rhiHm3eIdGsasbxd/cGhgszpuSKwY/dfrLB2yBL+7RSC0zjTiPR tzlA== ARC-Authentication-Results: i=1; mx.google.com; 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 t19si10884873pgk.163.2018.12.10.13.52.27; Mon, 10 Dec 2018 13:52:28 -0800 (PST) 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; 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 S1727598AbeLJVwZ (ORCPT + 31 others); Mon, 10 Dec 2018 16:52:25 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:48231 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726392AbeLJVwZ (ORCPT ); Mon, 10 Dec 2018 16:52:25 -0500 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1Mcp7M-1h4zH82xZi-00a072; Mon, 10 Dec 2018 22:52:08 +0100 From: Arnd Bergmann To: Russell Currey , Sam Bobroff , "Oliver O'Halloran" , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: Arnd Bergmann , Alexey Kardashevskiy , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] powerpc: eeh_event: convert semaphore to completion Date: Mon, 10 Dec 2018 22:51:57 +0100 Message-Id: <20181210215203.1936171-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:CJMjen7qL/4911//J/0sv7G7S8E+q/SSejut+uCpjBv4zydQ5RO FGJZm0JISlxHEUJ3un5ZM6d/lblujQ0cc7mfpk5qgnF0o1fVKrQ6bKiua+G1KQBdKMoe5fL G7+OFz6V1A+U42btvS9HMuIWxgxGCsiq8Pmki2B8KEocuNXTUalCXi3cUWE8c/7Kodg8d80 5vkkfNGWhQ33oLkjd0Qbw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:C8Ti6BchASs=:3l1/MrI7K6UnvvcPbHChTQ 0VQfEHop1SUuai4W7QIUc/mhzm7eT0lDA5K//nlvZ0AmK3hXAoZetaimmNkpvPY6T+uhzXeI0 l3tlTbpBUygR+3y4sCKYOZ9n74JfsWDfofz1j7EShddUumEU5ytlty63Q1vpTqDs4pTMJw3aV VphfSeOSpaYnushWNjiLeUkZCvTaYw77A7BERbSNLeojgkEEljTncfeMqVeXRu5QlJqSF/pJI cM0unTIqdTl7bphrC7UsR+VOkychW+pz/vWoSOcF9cnQBBU5kWhZKWs4/B1K2F/G828+kQAxi AtdV5zdAY+T6c45/fxbLC+w/nQKMpI6NsZmRczloRqkMFmA+x25yzHyLGFmn9jy0OtmC07/wL 4l8TzDVeHjdAt9NflL63tIP6GHp62/h5tW40uuHcSNhtIewE0EcjvUoX7TyFibWogR0OiUSVl H/VaRJfiODxgsvQedoiu6JrC5w/PhPnKrG7NS/Xef3+jY0VmJ9oaEQfKKR+5/X5Nwt5ckVbH7 M2F/6XE8bZyIbcPJupzaYXiHpRdCi01+xFE86y2y++qeNboun3f3F1qBL6ah8ZxaSVFjpeHpU HCOB3EeIZro8tHCq9K81Cnjj7RBHtPT/qw3fgGl2AS/vkf+uNHeKvFlo/49FmIbDJChdHu3ev C/27QfazrZJg+diAz926M9fIeFZRFC/YWXp6xKc0jH2N5NDfA4d8GBYNnq8Lgs7DAkIm3GSda IN2gdqNkvufxxjUADucwW4HgD1FNn6dTbHQn/g== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For this use case, completions and semaphores are equivalent, but semaphores are an awkward interface that should generally be avoided, so use the completion instead. Signed-off-by: Arnd Bergmann --- arch/powerpc/kernel/eeh_event.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) -- 2.20.0 diff --git a/arch/powerpc/kernel/eeh_event.c b/arch/powerpc/kernel/eeh_event.c index 61c9356bf9c9..227e57f980df 100644 --- a/arch/powerpc/kernel/eeh_event.c +++ b/arch/powerpc/kernel/eeh_event.c @@ -35,7 +35,7 @@ */ static DEFINE_SPINLOCK(eeh_eventlist_lock); -static struct semaphore eeh_eventlist_sem; +static DECLARE_COMPLETION(eeh_eventlist_event); static LIST_HEAD(eeh_eventlist); /** @@ -55,7 +55,7 @@ static int eeh_event_handler(void * dummy) struct eeh_pe *pe; while (!kthread_should_stop()) { - if (down_interruptible(&eeh_eventlist_sem)) + if (wait_for_completion_interruptible(&eeh_eventlist_event)) break; /* Fetch EEH event from the queue */ @@ -102,9 +102,6 @@ int eeh_event_init(void) struct task_struct *t; int ret = 0; - /* Initialize semaphore */ - sema_init(&eeh_eventlist_sem, 0); - t = kthread_run(eeh_event_handler, NULL, "eehd"); if (IS_ERR(t)) { ret = PTR_ERR(t); @@ -142,7 +139,7 @@ int eeh_send_failure_event(struct eeh_pe *pe) spin_unlock_irqrestore(&eeh_eventlist_lock, flags); /* For EEH deamon to knick in */ - up(&eeh_eventlist_sem); + complete(&eeh_eventlist_event); return 0; }