From patchwork Thu May 4 20:05:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 9712617 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 CC91960235 for ; Thu, 4 May 2017 20:05:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBDBB28329 for ; Thu, 4 May 2017 20:05:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B045E2869F; Thu, 4 May 2017 20:05:46 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48B0E28329 for ; Thu, 4 May 2017 20:05:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752237AbdEDUFp (ORCPT ); Thu, 4 May 2017 16:05:45 -0400 Received: from mail-pg0-f53.google.com ([74.125.83.53]:34394 "EHLO mail-pg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751852AbdEDUFn (ORCPT ); Thu, 4 May 2017 16:05:43 -0400 Received: by mail-pg0-f53.google.com with SMTP id v1so13876620pgv.1 for ; Thu, 04 May 2017 13:05:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=5RmBxZtkWqDefrc6O42ln4k8bFBqi11AYM1suYccBAU=; b=aLCsnq7b+GeHa3gDMg1/VtGONhMKcw5XGjlSeLb818/YDXSvTdey2C5fzYkx2ooKDC O5CRg0+OLFyTs25GmS01jFiWXKAE0d83ceN6/6xGt7j3uslFQEjNyxy1yEstN5HnREi9 PrvRlZ4db7xDhv7mHW8HhGvnBI5jTOI0mGifA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=5RmBxZtkWqDefrc6O42ln4k8bFBqi11AYM1suYccBAU=; b=aYP3nHSwz8QzKMLKSZV30+JVs0RKmkWD/4paEMcycTplni3jH6knUZ+Y+wIEQfo0MH UxnZJVyYvDCjRxIHYMcHWAFKf3dCqjaMJUWWnsAp6qYHeNrWdy1OMz/otdqq8890ewpr T6RGWP0DLlKmxxEz91qkwX3uchQCvXOGFDii3WQ/sii0tBzSaAmVR/fPhQgbQgFsTVio md6NkLgxwnw/riBs2PMljUCnu4ccMqBGk4JaNcx3YW54hwi1GFvvaPbha2eHUpFEcTSq YXHNlbGqrzESKkv2WUMLUldUsFqTpWJe1U/pIZtgxgz/loV9AZtjdpUCCh9M7h42IzBy 1HdA== X-Gm-Message-State: AN3rC/5vSwN+FOKIxNsnEYvUbPK1Dzkco62eRbooqDjCQvgfto9as9BX b4BKfQLavnJWqC0j X-Received: by 10.84.197.1 with SMTP id m1mr59264226pld.183.1493928343155; Thu, 04 May 2017 13:05:43 -0700 (PDT) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id s68sm5969712pgc.5.2017.05.04.13.05.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 May 2017 13:05:42 -0700 (PDT) From: Bjorn Andersson To: Andy Gross , Rob Herring , Mark Rutland , Ohad Ben-Cohen , Jassi Brar Cc: linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org Subject: [PATCH v4 1/5] mailbox: Make startup and shutdown ops optional Date: Thu, 4 May 2017 13:05:35 -0700 Message-Id: <20170504200539.27027-1-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.12.0 Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some mailbox hardware doesn't have to perform any additional operations on startup of shutdown, so make these optional. Signed-off-by: Bjorn Andersson Reviewed-by: Sudeep Holla --- Changes since v3: - New patch drivers/mailbox/mailbox.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index 4671f8a12872..c88de953394a 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -137,6 +137,20 @@ static enum hrtimer_restart txdone_hrtimer(struct hrtimer *hrtimer) return HRTIMER_NORESTART; } +static int mbox_startup(struct mbox_chan *chan) +{ + if (chan->mbox->ops->startup) + return chan->mbox->ops->startup(chan); + + return 0; +} + +static void mbox_shutdown(struct mbox_chan *chan) +{ + if (chan->mbox->ops->shutdown) + chan->mbox->ops->shutdown(chan); +} + /** * mbox_chan_received_data - A way for controller driver to push data * received from remote to the upper layer. @@ -352,7 +366,7 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index) spin_unlock_irqrestore(&chan->lock, flags); - ret = chan->mbox->ops->startup(chan); + ret = mbox_startup(chan); if (ret) { dev_err(dev, "Unable to startup the chan (%d)\n", ret); mbox_free_channel(chan); @@ -405,7 +419,7 @@ void mbox_free_channel(struct mbox_chan *chan) if (!chan || !chan->cl) return; - chan->mbox->ops->shutdown(chan); + mbox_shutdown(chan); /* The queued TX requests are simply aborted, no callbacks are made */ spin_lock_irqsave(&chan->lock, flags);