From patchwork Fri Sep 23 11:33:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 9347929 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 07F2D607D0 for ; Fri, 23 Sep 2016 11:33:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E372E2AA93 for ; Fri, 23 Sep 2016 11:33:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D69D82AAF0; Fri, 23 Sep 2016 11:33:39 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D19122AA93 for ; Fri, 23 Sep 2016 11:33:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965792AbcIWLdh (ORCPT ); Fri, 23 Sep 2016 07:33:37 -0400 Received: from atlantic540.startdedicated.de ([188.138.9.77]:48426 "EHLO atlantic540.startdedicated.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932127AbcIWLdh (ORCPT ); Fri, 23 Sep 2016 07:33:37 -0400 Received: from atlantic540.startdedicated.de (localhost [127.0.0.1]) by filter.mynetwork.local (Postfix) with ESMTP id 2452C5002BD; Fri, 23 Sep 2016 13:33:34 +0200 (CEST) Received: from localhost (unknown [212.118.206.70]) by atlantic540.startdedicated.de (Postfix) with ESMTPSA id CD31B500121; Fri, 23 Sep 2016 13:33:33 +0200 (CEST) From: Daniel Wagner To: linux-omap@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Daniel Wagner , Tomi Valkeinen , Jean-Christophe Plagniol-Villard , linux-fbdev@vger.kernel.org Subject: [PATCH] omapfb: use complete() instead complete_all() Date: Fri, 23 Sep 2016 13:33:22 +0200 Message-Id: <1474630402-11514-1-git-send-email-wagi@monom.org> X-Mailer: git-send-email 2.7.4 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Daniel Wagner There is only one waiter for the completion, therefore there is no need to use complete_all(). Let's make that clear by using complete() instead of complete_all(). While we are at it, we also change the init_completion() to reinit_completion() which slightly lighter. The usage pattern of the completion is: waiter context waker context dss_mgr_disable_compat() mutex_lock(apply_lock) wait_pending_extra_info_updates() reinit_completion() wait_for_completion_timeout() mutex_unlock(apply_lock) dss_ovl_unset_manager() mutex_lock(apply_lock) wait_pending_extra_info_updates() reinit_completion() wait_for_completion_timeout() mutex_unlock(apply_lock) dss_apply_irq_handler() complete() Furthermore dss_mgr_disable_compat(), dss_ovl_unset_manager and dss_apply_irq_handler() are serialized via the data_lock spinlock. That means the reinit_completion() and complete() call do not race. The only problem there could be the ordering of those two functions. It is not clear to me if that is enforced by the hardware or the design of the driver. Given the fact this has been in place since years, it should just work as before. Signed-off-by: Daniel Wagner Cc: Tomi Valkeinen Cc: Jean-Christophe Plagniol-Villard Cc: linux-omap@vger.kernel.org Cc: linux-fbdev@vger.kernel.org --- drivers/video/fbdev/omap2/omapfb/dss/apply.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/omap2/omapfb/dss/apply.c b/drivers/video/fbdev/omap2/omapfb/dss/apply.c index 2481f48..f345aa9 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/apply.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/apply.c @@ -413,7 +413,7 @@ static void wait_pending_extra_info_updates(void) return; } - init_completion(&extra_updated_completion); + reinit_completion(&extra_updated_completion); spin_unlock_irqrestore(&data_lock, flags); @@ -922,7 +922,7 @@ static void dss_apply_irq_handler(void *data, u32 mask) extra_updating = extra_info_update_ongoing(); if (!extra_updating) - complete_all(&extra_updated_completion); + complete(&extra_updated_completion); /* call framedone handlers for manual update displays */ for (i = 0; i < num_mgrs; i++) {