From patchwork Tue Jun 26 01:34:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 10487839 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 8A094604D3 for ; Tue, 26 Jun 2018 01:34:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 797622870D for ; Tue, 26 Jun 2018 01:34:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E51528724; Tue, 26 Jun 2018 01:34:54 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, 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 18DC72870D for ; Tue, 26 Jun 2018 01:34:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935259AbeFZBeQ (ORCPT ); Mon, 25 Jun 2018 21:34:16 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:38470 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935134AbeFZBeO (ORCPT ); Mon, 25 Jun 2018 21:34:14 -0400 Received: by mail-it0-f68.google.com with SMTP id v83-v6so15180697itc.3 for ; Mon, 25 Jun 2018 18:34:14 -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:in-reply-to:references; bh=kEKesqqo+/X5Y1TJjKx05ALvbSOA18VpVMYr5WHzjvY=; b=U3W6PbxJjjMLlWRK/KUHAwp4zTcxydY6ckI2MEkktvhip6QD4rd1bh8wIjQR2cUrO5 cwlPv27/hrOeOnRTf8RfQTw13aFMy0GZeWQ1749Yg8J+EjnO2olrkOvh47VJS6TGUVfa qByDt8iZTsz1cNngVqJwBv1RFgF2PXYkLfXSY= 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:in-reply-to :references; bh=kEKesqqo+/X5Y1TJjKx05ALvbSOA18VpVMYr5WHzjvY=; b=cS54FIZFwJLqYqJq8Y1oPyP3XagK1LkOHYSag23U5hYdnDG89FwR5Fzs0E7cXBEwzd rYmlOg9BaaVe3JkDMrJeYS5dD2MYiq5sHtw1P7eX+y3+lBFxzRFZa5/l6uM+hD9vTUYs 5mREf7oRk4xKF02OTZTyUBDzBXEeBc7ak5B6ymO3OFDLivc2dNsQWX2+fQrKjNZYeRw/ 5Lfb3sg80SBb6kBUpkN9KtBslPiX33bXjxqflrhOrC/ic/vbHMNBQCgg1qIIvwXq6TrL R68vIEFHc5CKcsA9/3lhLcKRpaxZtyVr5HdiJmSsOxCM9Ac2Ebv2yh0nVxa0kzIsS7fu CR3g== X-Gm-Message-State: APt69E3nw6pKijlOwJSEFI0K9eYN0JUl/el+nz/fb/LshuLxbf4aXprN MCR4XysUIAQ9iF3j1KoDbuC4QQ== X-Google-Smtp-Source: ADUXVKKAHqpvQwuZ55uQQMSOuQQlQuU6cqBJKqN76R4SxKsUhz/2ID/mfGHGqva5ZXK+Vh3h0rl9cQ== X-Received: by 2002:a02:a30f:: with SMTP id q15-v6mr9790170jai.66.1529976854238; Mon, 25 Jun 2018 18:34:14 -0700 (PDT) Received: from localhost.localdomain (c-71-195-29-92.hsd1.mn.comcast.net. [71.195.29.92]) by smtp.gmail.com with ESMTPSA id h62-v6sm184699ioa.22.2018.06.25.18.34.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jun 2018 18:34:13 -0700 (PDT) From: Alex Elder To: ohad@wizery.com, bjorn.andersson@linaro.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH resend 2/5] remoteproc: Make start and stop in subdev optional Date: Mon, 25 Jun 2018 20:34:06 -0500 Message-Id: <20180626013409.5125-3-elder@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626013409.5125-1-elder@linaro.org> References: <20180626013409.5125-1-elder@linaro.org> 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 From: Bjorn Andersson Some subdevices, such as glink ssr only care about the stop operation, so make the operations optional to reduce client code. Signed-off-by: Bjorn Andersson Acked-by: Alex Elder Tested-by: Fabien Dessenne --- drivers/remoteproc/remoteproc_core.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 5dd58e6bea88..981ae6dff145 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -780,16 +780,20 @@ static int rproc_start_subdevices(struct rproc *rproc) int ret; list_for_each_entry(subdev, &rproc->subdevs, node) { - ret = subdev->start(subdev); - if (ret) - goto unroll_registration; + if (subdev->start) { + ret = subdev->start(subdev); + if (ret) + goto unroll_registration; + } } return 0; unroll_registration: - list_for_each_entry_continue_reverse(subdev, &rproc->subdevs, node) - subdev->stop(subdev, true); + list_for_each_entry_continue_reverse(subdev, &rproc->subdevs, node) { + if (subdev->stop) + subdev->stop(subdev, true); + } return ret; } @@ -798,8 +802,10 @@ static void rproc_stop_subdevices(struct rproc *rproc, bool crashed) { struct rproc_subdev *subdev; - list_for_each_entry_reverse(subdev, &rproc->subdevs, node) - subdev->stop(subdev, crashed); + list_for_each_entry_reverse(subdev, &rproc->subdevs, node) { + if (subdev->stop) + subdev->stop(subdev, crashed); + } } /**