From patchwork Wed Apr 24 16:31:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pawel Moll X-Patchwork-Id: 2485421 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id 83FDB3FCA5 for ; Wed, 24 Apr 2013 16:31:57 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UV2bs-0002cn-Cq; Wed, 24 Apr 2013 16:31:56 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UV2bp-0005p8-T1; Wed, 24 Apr 2013 16:31:53 +0000 Received: from service87.mimecast.com ([91.220.42.44]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UV2bn-0005og-7A for linux-arm-kernel@lists.infradead.org; Wed, 24 Apr 2013 16:31:52 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Wed, 24 Apr 2013 17:31:40 +0100 Received: from hornet.Cambridge.Arm.com ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 24 Apr 2013 17:31:39 +0100 From: Pawel Moll To: Samuel Ortiz Subject: [PATCH] mfd: vexpress: Handle pending config transactions Date: Wed, 24 Apr 2013 17:31:24 +0100 Message-Id: <1366821084-12815-1-git-send-email-pawel.moll@arm.com> X-Mailer: git-send-email 1.7.10.4 X-OriginalArrivalTime: 24 Apr 2013 16:31:39.0910 (UTC) FILETIME=[328F8260:01CE4109] X-MC-Unique: 113042417314000601 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130424_123151_445240_B600BB0D X-CRM114-Status: UNSURE ( 8.30 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [91.220.42.44 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Pawel Moll , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The config transactions "scheduler" was hopelessly broken, repeating completed transaction instead of picking up next pending one. Fixed now. Also improved debug messages. Signed-off-by: Pawel Moll --- drivers/mfd/vexpress-config.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/mfd/vexpress-config.c b/drivers/mfd/vexpress-config.c index 3c1723aa..4991db3 100644 --- a/drivers/mfd/vexpress-config.c +++ b/drivers/mfd/vexpress-config.c @@ -184,13 +184,14 @@ static int vexpress_config_schedule(struct vexpress_config_trans *trans) spin_lock_irqsave(&bridge->transactions_lock, flags); - vexpress_config_dump_trans("Executing", trans); - - if (list_empty(&bridge->transactions)) + if (list_empty(&bridge->transactions)) { + vexpress_config_dump_trans("Executing", trans); status = bridge->info->func_exec(trans->func->func, trans->offset, trans->write, trans->data); - else + } else { + vexpress_config_dump_trans("Queuing", trans); status = VEXPRESS_CONFIG_STATUS_WAIT; + } switch (status) { case VEXPRESS_CONFIG_STATUS_DONE: @@ -217,20 +218,28 @@ void vexpress_config_complete(struct vexpress_config_bridge *bridge, trans = list_first_entry(&bridge->transactions, struct vexpress_config_trans, list); + trans->status = status; vexpress_config_dump_trans("Completed", trans); - trans->status = status; list_del(&trans->list); - if (!list_empty(&bridge->transactions)) { - vexpress_config_dump_trans("Pending", trans); + complete(&trans->completion); + + while (!list_empty(&bridge->transactions)) { + trans = list_first_entry(&bridge->transactions, + struct vexpress_config_trans, list); - bridge->info->func_exec(trans->func->func, trans->offset, - trans->write, trans->data); + vexpress_config_dump_trans("Executing pending", trans); + status = bridge->info->func_exec(trans->func->func, + trans->offset, trans->write, trans->data); + + if (status == VEXPRESS_CONFIG_STATUS_DONE) + vexpress_config_dump_trans("Finished pending", trans); + else + break; } - spin_unlock_irqrestore(&bridge->transactions_lock, flags); - complete(&trans->completion); + spin_unlock_irqrestore(&bridge->transactions_lock, flags); } EXPORT_SYMBOL(vexpress_config_complete);