From patchwork Mon Nov 23 16:02:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King X-Patchwork-Id: 7683511 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 41F90BF90C for ; Mon, 23 Nov 2015 16:07:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7273B20751 for ; Mon, 23 Nov 2015 16:07:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D73FD20752 for ; Mon, 23 Nov 2015 16:07:04 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1a0tc9-0000Kl-6W; Mon, 23 Nov 2015 16:05:13 +0000 Received: from pandora.arm.linux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a0tc2-0006pr-OP for linux-arm-kernel@lists.infradead.org; Mon, 23 Nov 2015 16:05:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=pandora-2014; h=Date:Sender:Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References:In-Reply-To; bh=E1qQQfR7b+HqB7OeFQEw4+MpzHcNft9mTEhNthj7uKs=; b=Lc3/o+Gw9PEFrqjX0Fk0JcByn3hbUgoOaqawyV/I+ThzveuvGR1szj4tMJgKU2OmkOAmUdK8msfQEY0dyJzeF+dQvqgXhHHcY1PGEGE2XHPG2uuqNlmC3H20/1Domu5t5AJ4RXbezaTNHyZLCZj6F61vl2ssj/lDtP+gA0pjkbc=; Received: from e0022681537dd.dyn.arm.linux.org.uk ([2002:4e20:1eda:1:222:68ff:fe15:37dd]:34615 helo=rmk-PC.arm.linux.org.uk) by pandora.arm.linux.org.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1a0tZk-0003p5-Hm; Mon, 23 Nov 2015 16:02:44 +0000 Received: from rmk by rmk-PC.arm.linux.org.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1a0tZj-0006EX-1P; Mon, 23 Nov 2015 16:02:43 +0000 In-Reply-To: <20151123160210.GR8644@n2100.arm.linux.org.uk> References: <20151123160210.GR8644@n2100.arm.linux.org.uk> From: Russell King To: Greg Kroah-Hartman Subject: [PATCH 2/4] component: move check for unbound master into try_to_bring_up_masters() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 23 Nov 2015 16:02:43 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151123_080507_188139_54071D21 X-CRM114-Status: GOOD ( 14.18 ) X-Spam-Score: -4.9 (----) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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. Reviewed-by: Thierry Reding 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 2ca22738ae92..cd70b68d9780 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;