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: 98563 Delivered-To: patch@linaro.org Received: by 10.140.89.200 with SMTP id v66csp787785qgd; Thu, 4 May 2017 13:05:46 -0700 (PDT) X-Received: by 10.99.44.209 with SMTP id s200mr47968853pgs.25.1493928346883; Thu, 04 May 2017 13:05:46 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t19si3032852plj.255.2017.05.04.13.05.46; Thu, 04 May 2017 13:05:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752198AbdEDUFp (ORCPT + 10 others); Thu, 4 May 2017 16:05:45 -0400 Received: from mail-pg0-f49.google.com ([74.125.83.49]:35610 "EHLO mail-pg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751749AbdEDUFn (ORCPT ); Thu, 4 May 2017 16:05:43 -0400 Received: by mail-pg0-f49.google.com with SMTP id o3so13895596pgn.2 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=P6+F7jQ3g1uBZ30epVOFmoIjOQPQNQut+Yu+txE8Gz3Ar6Igs/+TlAf/Wxg9n6CwRt bOONRuLXP/opFQ6ikay+faZbXXDVN8kafiMq9KuRVKREXcyKBPh9xcHM9kSyjZ5CTOnP HpgN2cJp9vuRi+IibGRKgPjriJblgsusdvamvYcVDRXGxcUozY8XtMmYS38C3gmXyOpA SxlpNsHh8H9bhE29Kl0Cjv6jBujyls16e9fbviiwjpCRMD4NGUG5bZebQPRm4r3x3Rqd FpcchCKnaQOPGlLzg9mTryznBWKj+FvbWVnCYy8SCQWvZIaBwR1iqWNqZcjkPuclOCES AasQ== X-Gm-Message-State: AN3rC/76h5z02HBYQvIiEiKzZrmV4pqbf+SbGMEE32Pwl1X/vVJWEfh7 Zmhy6nkIunWMwux7dECO5w== 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Some mailbox hardware doesn't have to perform any additional operations on startup of shutdown, so make these optional. Signed-off-by: Bjorn Andersson --- Changes since v3: - New patch drivers/mailbox/mailbox.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) -- 2.12.0 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Sudeep Holla Acked-by: Rob Herring 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);