From patchwork Tue May 15 20:53:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 10401979 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 30C4E601C8 for ; Tue, 15 May 2018 20:54:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21C00285E5 for ; Tue, 15 May 2018 20:54:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 16E14285EA; Tue, 15 May 2018 20:54:37 +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 A0933285E5 for ; Tue, 15 May 2018 20:54:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752662AbeEOUyA (ORCPT ); Tue, 15 May 2018 16:54:00 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:35487 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752362AbeEOUx4 (ORCPT ); Tue, 15 May 2018 16:53:56 -0400 Received: by mail-it0-f66.google.com with SMTP id q72-v6so5404959itc.0 for ; Tue, 15 May 2018 13:53:56 -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=6HyQzw6NAdfB2F6Sekrf3bHu2OVNG3LO++5UtltSAQ4=; b=iMDy1IT8rWZu9845v0sj7CZxHPdkGjBVKfakpGfmqI5USIRex/878ndlAiusn0F/yU VZ7Y28uH/zKs0tfElCIaMieDPcKRVppPdjF6IHv9wmHkHT4/dRdAuVYcqwh9eO1H9Gce 8fFRI0HKZn4zIIz9QgFJDgd/6E81r8sm6j8yg= 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=6HyQzw6NAdfB2F6Sekrf3bHu2OVNG3LO++5UtltSAQ4=; b=Fc4Q7CkmcRHTEN38fOhPJEAYiR6UDrnJ04QV10WFrmuM91na8GtGrFQv3vUZ9BKdfK 0OJaKVPV2jLCAGjx5I0PtHWh0NCu+30XxbfV10LzKoRhnoPEvBczT8Xb9qN/NiYr/8yW meOUB/zYem9XdWJyH3XU0sPnYu747RoJE6rvc1oWsTDttiEREfL/oWHwIGZ3JpXkgWLN td+GXuYXkSUSa6kf6fHKI4lrozfb7t+CP8qbSOdmBKoPtNsxKeMMgOykpaSm0BpL9N6j gBxHmZguYTDO7UaW4n4bZK+ntwSM5QWqZeL7qB/DPDDJB1DY/eXVyFrKjjoyP1ulFv+m m+nA== X-Gm-Message-State: ALKqPwdXSVrJlLaejNsPCx3rxTjU48d+tW8/HtjO9+EFSfvR0NXXeG5q t3+IhdbmHbHJ4KsCPGfOCtaYeA== X-Google-Smtp-Source: AB8JxZoWuHeiBLSEE+8RPnGidI1F5dAjNwYSe2bsRWuWtiX6sN9EfyGJX1/hf1tQ1QALS46w7gcFdA== X-Received: by 2002:a24:61ce:: with SMTP id s197-v6mr17279448itc.10.1526417636127; Tue, 15 May 2018 13:53:56 -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 t9-v6sm440407ioa.82.2018.05.15.13.53.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 13:53:55 -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 2/5] remoteproc: Make start and stop in subdev optional Date: Tue, 15 May 2018 15:53:42 -0500 Message-Id: <20180515205345.8090-3-elder@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180515205345.8090-1-elder@linaro.org> References: <20180515205345.8090-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 --- 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); + } } /**