From patchwork Tue Jun 26 12:11:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 10488809 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 92E3260386 for ; Tue, 26 Jun 2018 12:12:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81F3221FAC for ; Tue, 26 Jun 2018 12:12:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7699528930; Tue, 26 Jun 2018 12:12:51 +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 6F20921FAC for ; Tue, 26 Jun 2018 12:12:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935286AbeFZMMP (ORCPT ); Tue, 26 Jun 2018 08:12:15 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:34740 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935257AbeFZMMM (ORCPT ); Tue, 26 Jun 2018 08:12:12 -0400 Received: by mail-io0-f195.google.com with SMTP id e15-v6so15767623iog.1 for ; Tue, 26 Jun 2018 05:12:11 -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=I57NxyETdS7bcU1Jd7YbgD9UZcuzgAQvo28u6b2l6Ek=; b=BVwbcAdxesZTOq5UrKvkrChLRF5weLtcqKkXCG0YUfp1GFLov9QwNdaLbXqjaI0fGu gbFFj20V6O485p8bHFJCLk4l4p3MpTvRHc2guDHAOarlbdUHyZtlIUQq8dq9wBxhGCS6 8c7S392FJLxTohv/drjaHFXaxSo54ZbfFERgo= 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=I57NxyETdS7bcU1Jd7YbgD9UZcuzgAQvo28u6b2l6Ek=; b=TY4b0UXxs6pFKkaZf1sjNeg/Td86rmCKva7aFNYbVsuNGC8g6ZxtaWBG3Op2D7UId9 eBbxpH3BfMLWU7D+Cy555Tv/v057QszfHVQc73WQCyjSAtnQmV/peBowFTYt20zfny5z uPu+PxfkApNNTDjpKZ8zNxdm8QTQU0m8E27j3m1ljPNmUo4/T7w+cXWE80BdS//3jaMk H63UF95D7Cj5hK8nvJcYooFAH3+uf28C9Z7NnkB3nuQfIAUvrcozNZzwBi+tNBCiZavx Pra95yxp+7oBMSYMwamz2BNFVXNrKVpn5oPvLRlISNCtV3zVoEMQ2SZNm6BI5YpfQhKT cKFA== X-Gm-Message-State: APt69E2RACuv7LbjF45M0INpJAgsCd05+LchrvTzeKvJ/aa2UfFfbfYr E/WIE8SrAgmbv8uNWtmtTVFL/A== X-Google-Smtp-Source: AAOMgpceyunu9+Nw4AANVult0KFPwJzydcx1O7J62lpKGijhW8/6eLikFnT3eLSkTF7EM1rYdvhzdA== X-Received: by 2002:a6b:144b:: with SMTP id 72-v6mr954408iou.218.1530015131335; Tue, 26 Jun 2018 05:12:11 -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 y62-v6sm902309ioy.88.2018.06.26.05.12.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Jun 2018 05:12:10 -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 v2 2/5] remoteproc: Make start and stop in subdev optional Date: Tue, 26 Jun 2018 07:11:56 -0500 Message-Id: <20180626121159.7267-3-elder@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626121159.7267-1-elder@linaro.org> References: <20180626121159.7267-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. Tested-by: Fabien Dessenne Signed-off-by: Bjorn Andersson Signed-off-by Alex Elder --- 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); + } } /**