From patchwork Tue Nov 11 16:04:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 40597 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E8097241C9 for ; Tue, 11 Nov 2014 16:04:12 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id q1sf6661921lam.0 for ; Tue, 11 Nov 2014 08:04:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=ms0S7JTHE1sHoAp4oT3LwZR/qt94QB1RcZQiNqp6IcA=; b=DnXhWSMj5oob5QwEIyYFBD0ugmF5NQ8y9xhc+37a0hEmkDnAXU+yb3FjcNyDqY6dCF /bwZ3mgpvS6qe7lS+KAA+JeSwSMH/DU3nRrXnYu46KweKNqoifMC+Kti2YGi5xN3vdHG e0HgeuQFnTZuq/rJVuf+h/ODdzOPfbNDQOLp/S31uPY18tCDfU+kG/fYg9EswbfQTz3W 9U6U0VXKMvRC8zzckLIn3PenyGVPDiUfkwCdllbDGjzWh+fUp9APxbdDK1vepgPuxAq/ I19sdLMqG3XS0xJ4PCLl4W5g5J7aOTUMSv9TqcoX1vQq7PCVj4vzthFgOwhsxXnT3rCQ Uf0w== X-Gm-Message-State: ALoCoQnt+bLQzqgZPn0B0B5B232nDpzXPz/+gs5dYudVRsAnfSN741l+HkHvznrd3sdlpwHxsAwp X-Received: by 10.112.188.199 with SMTP id gc7mr1713068lbc.6.1415721851212; Tue, 11 Nov 2014 08:04:11 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.72 with SMTP id q8ls465632laq.98.gmail; Tue, 11 Nov 2014 08:04:10 -0800 (PST) X-Received: by 10.112.42.198 with SMTP id q6mr16203270lbl.69.1415721850756; Tue, 11 Nov 2014 08:04:10 -0800 (PST) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id l8si32003438lah.23.2014.11.11.08.04.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Nov 2014 08:04:10 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id s18so9916291lam.13 for ; Tue, 11 Nov 2014 08:04:10 -0800 (PST) X-Received: by 10.152.5.38 with SMTP id p6mr36664224lap.44.1415721850589; Tue, 11 Nov 2014 08:04:10 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp279145lbc; Tue, 11 Nov 2014 08:04:09 -0800 (PST) X-Received: by 10.66.158.103 with SMTP id wt7mr40931163pab.39.1415721848754; Tue, 11 Nov 2014 08:04:08 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id nw13si20311274pdb.199.2014.11.11.08.04.08 for ; Tue, 11 Nov 2014 08:04:08 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751746AbaKKQEE (ORCPT + 25 others); Tue, 11 Nov 2014 11:04:04 -0500 Received: from fw-tnat.cambridge.arm.com ([217.140.96.21]:53683 "EHLO cam-smtp0.cambridge.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751218AbaKKQEC (ORCPT ); Tue, 11 Nov 2014 11:04:02 -0500 Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.207.30]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id sABG3uBm020413; Tue, 11 Nov 2014 16:03:56 GMT From: Sudeep Holla To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Jassi Brar , Arnd Bergmann Subject: [PATCH] mailbox: add tx_prepare client callback Date: Tue, 11 Nov 2014 16:04:12 +0000 Message-Id: <1415721852-10193-1-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sudeep.holla@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , If the mailbox controller expects the payload is in place before initiating the transmit, then it's impossible to reuse the list maintained by core mailbox code currently. Maintaining another list for sending the message in the controller seems totally unnecessary as core mailbox library already provides that feature. This patch introduces tx_prepare callback in mbox_client which can be used by the core mailbox library before initiating the transaction through mbox->ops->send_data. The client driver can implement this callback to ensure the payload is copied to the shared memory. Signed-off-by: Sudeep Holla Cc: Jassi Brar Cc: Arnd Bergmann --- drivers/mailbox/mailbox.c | 2 ++ include/linux/mailbox_client.h | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index afcb430508ec..4b4044f47b45 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -76,6 +76,8 @@ static void msg_submit(struct mbox_chan *chan) data = chan->msg_data[idx]; + if (chan->cl->tx_prepare) + chan->cl->tx_prepare(chan->cl, data); /* Try to submit a message to the MBOX controller */ err = chan->mbox->ops->send_data(chan, data); if (!err) { diff --git a/include/linux/mailbox_client.h b/include/linux/mailbox_client.h index 307d9cab2026..5a1a6db63e96 100644 --- a/include/linux/mailbox_client.h +++ b/include/linux/mailbox_client.h @@ -34,6 +34,7 @@ struct mbox_client { bool knows_txdone; void (*rx_callback)(struct mbox_client *cl, void *mssg); + void (*tx_prepare)(struct mbox_client *cl, void *mssg); void (*tx_done)(struct mbox_client *cl, void *mssg, int r); };