From patchwork Tue Jun 24 19:29:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King X-Patchwork-Id: 4412891 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B2DAFBEEAA for ; Tue, 24 Jun 2014 19:48:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 35FA820364 for ; Tue, 24 Jun 2014 19:48:22 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 6527F20155 for ; Tue, 24 Jun 2014 19:48:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6618A6E594; Tue, 24 Jun 2014 12:48:10 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from pandora.arm.linux.org.uk (gw-1.arm.linux.org.uk [78.32.30.217]) by gabe.freedesktop.org (Postfix) with ESMTP id 0FE056E57A for ; Tue, 24 Jun 2014 12:29:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=pandora; h=Date:Sender:Message-Id:Subject:Cc:To:From:References:In-Reply-To; bh=x3LgmK8MuI/uTxJiR2OE8I1Z1fnx/itiO4tvQMm7yv4=; b=CtVfwAc81iqBGzGhLGvxR9H/YasDP4EHhtBVgkh4QQJgUT76Bx7dC9vmTDzXsjY2oGZaGsNJWQXuybUbu9sMo95aUV9hDDkXhbrf1ANrBcllBLVOIWrKWBFj5v1dPKMed53ArtQVQB5jk9AXCBa3FTftEUljigOm4tzqHL1rxbo=; Received: from e0022681537dd.dyn.arm.linux.org.uk ([2001:4d48:ad52:3201:222:68ff:fe15:37dd]:37234 helo=rmk-PC.arm.linux.org.uk) by pandora.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1WzWPI-0007zl-VS; Tue, 24 Jun 2014 20:29:29 +0100 Received: from rmk by rmk-PC.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1WzWPI-0007zt-He; Tue, 24 Jun 2014 20:29:28 +0100 In-Reply-To: <20140624192830.GC20555@n2100.arm.linux.org.uk> References: <20140624192830.GC20555@n2100.arm.linux.org.uk> From: Russell King To: linux-arm-kernel@lists.infradead.org, Philipp Zabel , Rob Clark , Laurent Pinchart , Inki Dae Subject: [PATCH RFC v2 7/8] component: move check for unbound master into try_to_bring_up_masters() Message-Id: Date: Tue, 24 Jun 2014 20:29:28 +0100 X-Mailman-Approved-At: Tue, 24 Jun 2014 12:48:08 -0700 Cc: devel@driverdev.osuosl.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Clean up the code a little; we don't need to check that the master is unbound for every invocation of try_to_bring_up_master(), so let's move it to where it's really needed - try_to_bring_up_masters(), where we may encounter already bound masters. Signed-off-by: Russell King --- drivers/base/component.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index c0a5b1abc931..0863cfeea769 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -150,13 +150,6 @@ static int try_to_bring_up_master(struct master *master, { int ret; - if (master->bound) - return 0; - - /* - * Search the list of components, looking for components that - * belong to this master, and attach them to the master. - */ if (find_components(master)) { /* Failed to find all components */ ret = 0; @@ -196,9 +189,11 @@ static int try_to_bring_up_masters(struct component *component) int ret = 0; list_for_each_entry(m, &masters, node) { - ret = try_to_bring_up_master(m, component); - if (ret != 0) - break; + if (!m->bound) { + ret = try_to_bring_up_master(m, component); + if (ret != 0) + break; + } } return ret;