From patchwork Mon Dec 10 21:51:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10722587 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED7A26C5 for ; Mon, 10 Dec 2018 21:56:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD3A52A5F0 for ; Mon, 10 Dec 2018 21:56:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D10482A67E; Mon, 10 Dec 2018 21:56:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5186B2A5F0 for ; Mon, 10 Dec 2018 21:56:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0256489E05; Mon, 10 Dec 2018 21:56:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 309 seconds by postgrey-1.36 at gabe; Mon, 10 Dec 2018 21:56:36 UTC Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.131]) by gabe.freedesktop.org (Postfix) with ESMTPS id 86CEF89E05 for ; Mon, 10 Dec 2018 21:56:36 +0000 (UTC) Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MyK1E-1hO8Kz12Bo-00yezZ; Mon, 10 Dec 2018 22:51:21 +0100 From: Arnd Bergmann To: Thierry Reding Subject: [PATCH] host1x: cdma: use completion instead of semaphore Date: Mon, 10 Dec 2018 22:51:04 +0100 Message-Id: <20181210215119.1903413-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:7EBsahQJYudKcKazxeDZGdA0caFoz2zabrf/Qng4QK5t51gXv8u UUhpztgjMtfRlsZaaVEOibIiABtmkoUiZDnXmbkj1lzOZLsZaDAtlxF7Tjxhzf6hhGE9/B8 IZK11iZ5en4GGrYSO4201x3UQCivBnJBwxukUyWy2FFoKZN1sFWszEdioSwez5gYGPbWx8M iaDpN4Sa+ecxeXRBWeJWw== X-UI-Out-Filterresults: notjunk:1;V03:K0:TOJsG0v1BwI=:duUVDwYqAs8mULrHZUL8oF uNjjfp6BtoHwyvqkfz0gx4cN38EApmLpZJt+GLStC5oJ1FHl80odOjigsxAV8gtb5NE2+KceM ft+mMkmB5ztpCgMa+UZyfWNC0VhMSYQBuPNGMMbg5njzGLYNJF1e9Whv1SvzuQCmRkBq0FmYB m9tIanaU3anVb6jOp1xwZ4krhlvnArvYN5intwLFjTUGUjyNb2ttmEVWcwLZirtcTGTgrZvzg vccdrhOjgS4iA/u4AlWbitsXyiJmGLcsKAqEN/kiLDkluQzSCYYGprHwGzNcKdOlz91yyNjYF hzaGlXK672JAF1vF2nJRnePMtzFiGfALqR7WUUBRppt9kTgOrkW30YisCOVtgII8jB3BS24z7 oT6DFpPBkwifhCqDCzUahBiaYi2LGS+auNdmFYw4D1qcXiANnLYa5TyXF0utfUSjG0AxJbii2 897NIQOXDF1eFcaLcCqlJz6XMKEltNNG2gI+7UB7sy1gRZ6YgQUC1r0qIuQ/aZ44tDi6xSBKA w+y+Rv/IUNWpBE0Ychc+nWhOgY1EgYo6Wn3KMkDJKJz+vAyDzcgwbPlfjBhea1HC/9ak3LiIS ajLGPaGXNhU9o+lvY6iFuIlieMsrLl/RySVO20tyvGZ0aLZou695FkH+jkNmA9hdj6j2SpYa5 +kR0UQPJI6ymCGB+0s53Xnr4eHX2kqgoTa7HSAFPcLRkM9/uLgeicfSM56fPyBHszDOLfhkpz Kaq/aAcbbqP/hLd3zQK0mH5cNoIv35OkoioEN5b2mq2DRSQzn+/sStSRQM4sjRRdg9w9idKT8 qP+nXBf0wBZeP3DT4rPHVNPOkbNiutEBOhaFSmRQkoyznk7Irtbv7hZhb4aW6frikG52XY4Qj WVg9K6cmcFBHs0nSNqK7Cn2NZ0ZFY5hnSPEZdG7xLSVodDDcZuCaInSTrVt74WEqTrgEQMtDL uJ3YY2E2YVw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Emil Goode , Mikko Perttunen , Arnd Bergmann , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, Dmitry Osipenko Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP In this usage, the two are completely equivalent, but the completion documents better what is going on, and we generally try to avoid semaphores these days. Signed-off-by: Arnd Bergmann --- drivers/gpu/host1x/cdma.c | 6 +++--- drivers/gpu/host1x/cdma.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c index 6bfb3e6f43d7..bdc80a303cec 100644 --- a/drivers/gpu/host1x/cdma.c +++ b/drivers/gpu/host1x/cdma.c @@ -204,7 +204,7 @@ unsigned int host1x_cdma_wait_locked(struct host1x_cdma *cdma, cdma->event = event; mutex_unlock(&cdma->lock); - down(&cdma->sem); + wait_for_completion(&cdma->complete); mutex_lock(&cdma->lock); } @@ -308,7 +308,7 @@ static void update_cdma_locked(struct host1x_cdma *cdma) if (signal) { cdma->event = CDMA_EVENT_NONE; - up(&cdma->sem); + complete(&cdma->complete); } } @@ -410,7 +410,7 @@ int host1x_cdma_init(struct host1x_cdma *cdma) int err; mutex_init(&cdma->lock); - sema_init(&cdma->sem, 0); + init_completion(&cdma->complete); INIT_LIST_HEAD(&cdma->sync_queue); diff --git a/drivers/gpu/host1x/cdma.h b/drivers/gpu/host1x/cdma.h index c628070b94d7..ba790f9bfebc 100644 --- a/drivers/gpu/host1x/cdma.h +++ b/drivers/gpu/host1x/cdma.h @@ -20,7 +20,7 @@ #define __HOST1X_CDMA_H #include -#include +#include #include struct host1x_syncpt; @@ -70,7 +70,7 @@ enum cdma_event { struct host1x_cdma { struct mutex lock; /* controls access to shared state */ - struct semaphore sem; /* signalled when event occurs */ + struct completion complete; /* signalled when event occurs */ enum cdma_event event; /* event that sem is waiting for */ unsigned int slots_used; /* pb slots used in current submit */ unsigned int slots_free; /* pb slots free in current submit */