From patchwork Wed Mar 29 18:16:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Klimov X-Patchwork-Id: 9652239 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 51F78602C8 for ; Wed, 29 Mar 2017 18:19:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B45328517 for ; Wed, 29 Mar 2017 18:19:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2FC522851B; Wed, 29 Mar 2017 18:19:15 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9540A28517 for ; Wed, 29 Mar 2017 18:19:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=XGPN4wviAPdcEBoGyWTMR6G93nqVT3da30Kvq5jCRKA=; b=XUK jfH8eo2FnI57d2pV6ZnmXkuJgK00TVOmRB+O5ZW4ojeMr7eRcBj+iw9tWIiggh+WE7mNOj7iUyMgW jq+qSqwfu2SUl26hU9s3Q93L+BPctaWOswD/uWJjGfRrqUDCI5HiMjDJfDdA3coDnpmdpTGPcx0jC pyABjsS7QKj4NR/U5kadeHTPVwBRioS+Cs2w8rFwuwewcUXn7jlLJf59AOzWUVVTwdrItUkSQcotU hiisOKXNwY4pDEGKM6ZkHq33klTZFJ/YoxKVN5pc5l4RepLnu156SotBIMy9Ndby5EBn4BZNEijXV AVM6Pkfl7qROQfrOhr28YPYdkgx9Pqw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ctIBc-0007tx-Ay; Wed, 29 Mar 2017 18:19:12 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ctI9P-00058T-Eh for linux-arm-kernel@lists.infradead.org; Wed, 29 Mar 2017 18:16:59 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3FC562B; Wed, 29 Mar 2017 11:16:34 -0700 (PDT) Received: from e105365-lin.cambridge.arm.com (e105365-lin.cambridge.arm.com [10.1.194.27]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7FA933F575; Wed, 29 Mar 2017 11:16:33 -0700 (PDT) From: Alexey Klimov To: linux-arm-kernel@lists.infradead.org, sudeep.holla@arm.com Subject: [PATCH] firmware: arm_scpi: reinit completion instead of full init_completion() Date: Wed, 29 Mar 2017 19:16:27 +0100 Message-Id: <1490811387-27366-1-git-send-email-alexey.klimov@arm.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170329_111656_149354_B176B406 X-CRM114-Status: UNSURE ( 9.34 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, narmstrong@baylibre.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of performing full initialization of the completion structure on each transfer in scpi_send_message(), we initialize it at boot time (more specifically, in the relevant probe() function) and use reinit_completion() to reset ->done counter on each message transfer thus saving a little bit of cpu time. Signed-off-by: Alexey Klimov --- drivers/firmware/arm_scpi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c index 9ad0b19..f6cfc31 100644 --- a/drivers/firmware/arm_scpi.c +++ b/drivers/firmware/arm_scpi.c @@ -538,7 +538,7 @@ static int scpi_send_message(u8 idx, void *tx_buf, unsigned int tx_len, msg->tx_len = tx_len; msg->rx_buf = rx_buf; msg->rx_len = rx_len; - init_completion(&msg->done); + reinit_completion(&msg->done); ret = mbox_send_message(scpi_chan->chan, msg); if (ret < 0 || !rx_buf) @@ -872,8 +872,11 @@ static int scpi_alloc_xfer_list(struct device *dev, struct scpi_chan *ch) return -ENOMEM; ch->xfers = xfers; - for (i = 0; i < MAX_SCPI_XFERS; i++, xfers++) + for (i = 0; i < MAX_SCPI_XFERS; i++, xfers++) { + init_completion(&xfers->done); list_add_tail(&xfers->node, &ch->xfers_list); + } + return 0; }