From patchwork Sat May 6 01:31:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 98748 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp396425qge; Fri, 5 May 2017 18:31:51 -0700 (PDT) X-Received: by 10.98.99.135 with SMTP id x129mr20840818pfb.4.1494034311767; Fri, 05 May 2017 18:31:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494034311; cv=none; d=google.com; s=arc-20160816; b=ZS5MYgBvPKwhg8M64ElL5FzcRJjTE3NRmTARXZpABTcXfW001daTqSzBHaAkI8SgAc miB5a3JadGS7/bFM1i8M3sEy6jQJv9qA3w/idxdEGUeUa2kAWSkw5iOWYAESi54os7g9 F+R811nilrCPFHDgWLQ9p2eR6nDbzam9HiwzLvxygcpEyTTsIUjtBUMo2tE9jVyFzKfv 4mZz4Ab0W8ozJ5xVqzcuLC3k9H9/5c/cY8Il4zKdQ/ziUQ+AqgI4aq0ZfOXg5l1v3PqC RG/0N6Cs4qPmDUSQ0O1Rpf/QfNZypRlpR0u+WpL2Bg6b6gHTef/on5ggadh4h3+KigKP CCMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=b1p1WbpVOWP5KGcpZfzNTxiIK/S0AyP7GWsome7kFJ8=; b=JEUBnnY5A8BOqp4++luQV25chPfP7+w6xarAYnLvHNMxRm6T6IKgBHYgMHTYcp2rgg i+Ov0smuQ2vXym7XexdwpiX4jwcf9WvDWr1vTun5NFu6rHea2h/PFOrMKO3Z/yVp3yaX /tcJo8lRGbYlvDQOUvqvEayjRG10j2gqEk5/AI/Rs2B5awofy9vb1sQn+jEkTZrQvQax Mwtsvi/MrVxE8eB/X9JQXrsYDu4h4njt2IBSkCcwiKmgBAf+J5BJcje49W1NrF6LFjSE 0UtnVW7ID6eslkO7RejnFgfzslD/T3JtbdXFhV1Klyoo8VlFPGHV4qjIwgb6tNr5ETZM r/MQ== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c22si7257058plk.79.2017.05.05.18.31.51; Fri, 05 May 2017 18:31:51 -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 S1751499AbdEFBbu (ORCPT + 10 others); Fri, 5 May 2017 21:31:50 -0400 Received: from mail-pg0-f47.google.com ([74.125.83.47]:33769 "EHLO mail-pg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750890AbdEFBbt (ORCPT ); Fri, 5 May 2017 21:31:49 -0400 Received: by mail-pg0-f47.google.com with SMTP id u187so1881691pgb.0 for ; Fri, 05 May 2017 18:31:48 -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=YTdIwTHzLdHHtb6p7VzA98m7CzVmGxjJhO+XD1iG8NM=; b=LaT1O/gRW6QOKvSZjFF3YUTj+rRGhg6DnlhYIN4zip9UtHhwj/K4BCW19WJBC0LQpI +G4plkT/rEZZiScJC2X2BMcxSmau+bL97YBG2w0DFcOuG6RAXW4u8iy2nwNzUInygT/5 lDvxC8VTadGieI2X9weWfUVdntBQ/gSoT1mS4= 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=YTdIwTHzLdHHtb6p7VzA98m7CzVmGxjJhO+XD1iG8NM=; b=QCPPhDcaj+1g7EmGRpWvmKFljxdXWNesGmAF8BcxOIS/PkVqVYu8kSlUJLpAolmH4R MKI/WSY9aWsojbtLCEcdQgQgEE9owY/wwDrFn3ylLfgH7OGxwFIJH7CcUzuY4/aKbvVz 8EKIP1uV2OUw27C+djcmLZ18vQCeY9Wx3YmhzAvByNZFY6ulGcYV+yzv8ISkNdzNNp89 UpAZr42mezD1B4jOTe/84W1miQ+NiD95qdZCBZAEUHLf1McDZGzGbvOvxghSh7EGWWQv mSIRHquYGrNSRfq17qAqGWk3LmMmCv5MgHXIHfxc4wURl500gG5IWbnWGxcQbw4eGwQB oEGw== X-Gm-Message-State: AN3rC/48OJoCYnsRbq9Zv7A+YSqNSnUdlPwUMULkUVQbAKHQ3+OfaA2h /g7lnnH5oOcoZIOX X-Received: by 10.84.177.164 with SMTP id x33mr67998198plb.147.1494034308479; Fri, 05 May 2017 18:31:48 -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 t22sm12319178pfi.89.2017.05.05.18.31.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 May 2017 18:31:47 -0700 (PDT) From: Bjorn Andersson To: Jassi Brar Cc: Rob Herring , Mark Rutland , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org Subject: [PATCH v5 1/3] mailbox: Make startup and shutdown ops optional Date: Fri, 5 May 2017 18:31:42 -0700 Message-Id: <20170506013144.15297-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 v4: - Inline the conditionals, rather than breaking them out into separate functions drivers/mailbox/mailbox.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 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 diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index 4671f8a12872..505651ce9dcc 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -352,11 +352,14 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index) spin_unlock_irqrestore(&chan->lock, flags); - ret = chan->mbox->ops->startup(chan); - if (ret) { - dev_err(dev, "Unable to startup the chan (%d)\n", ret); - mbox_free_channel(chan); - chan = ERR_PTR(ret); + if (chan->mbox->ops->startup) { + ret = chan->mbox->ops->startup(chan); + + if (ret) { + dev_err(dev, "Unable to startup the chan (%d)\n", ret); + mbox_free_channel(chan); + chan = ERR_PTR(ret); + } } mutex_unlock(&con_mutex); @@ -405,7 +408,8 @@ void mbox_free_channel(struct mbox_chan *chan) if (!chan || !chan->cl) return; - chan->mbox->ops->shutdown(chan); + if (chan->mbox->ops->shutdown) + chan->mbox->ops->shutdown(chan); /* The queued TX requests are simply aborted, no callbacks are made */ spin_lock_irqsave(&chan->lock, flags);