From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B173C4708C for ; Fri, 28 May 2021 04:19:34 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 48B50613DA for ; Fri, 28 May 2021 04:19:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 48B50613DA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bV7PD+wvl3JbFOCH3gDXXwgqAdrtB/oJhH8Kwmt8lTg=; b=2kBcNkCW2z0nVO uUKQUk2Ji9CSSFTs4EfMPI288zYfR3FuGg6Ny4d3XO62/0bnpVgLddQ2EkyJIfUr+1wS2oQlmjR7a 4ibeiS9TZrn/IN4fq3JyjKZqURMkP2YYjSuHNqFCxrHctJ49Z5WiZ+RZBb9uOZP2XAPrXMXD1TwNt 05Ad/W5aLt6935wrK+Oel9akS6yMMOUPTswrOTYIB4+5fEvpWbDTJjcikz0ej1JxZj4EjB3XkGD2P 4yFrhXxoQQO8XGDT8IuTsFJ97k0Hw0T3kxLHwGvWQEsNMHecYM7ye6LexqAaWXDecxMJ0SUT1mR2X StpBnOGcdDiTLAqN8S4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmTwi-00BqFC-HZ; Fri, 28 May 2021 04:18:04 +0000 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmTwe-00BqE2-KC for linux-arm-kernel@lists.infradead.org; Fri, 28 May 2021 04:18:02 +0000 Received: by mail-oi1-x229.google.com with SMTP id y76so3029899oia.6 for ; Thu, 27 May 2021 21:18:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=0XNV7usCBQG7IKqGs/iEc1hnq8nlSXpsmXeWkLciLkE=; b=ZoRswZ4gYO5MnCJ88IP2JhKPZ8fO6WhxSgBjAiVca0fNYJBj/jzjMzYUuOTdvK9mw3 Tl+mX6YUr1/AD95KYCUrjy2sUK2ppsKhZoH9pzZCsSpI60D2qqwFQEmJuaIhc1Nv2/qv 79qbnIwRA/rA1/07BAkzA4gOaEHPH2XM0DOTqTbetbUzj3FcQ0EfshIMBsQ5U9KAdjcI dLx/+bydYXUUVmjhZ1WsACuWXwqc/uDATP6l8e8j/8Ke9ze0L/CIb8c5RDOKratFcsXV NyoCWtQq9RDzWcxERbD/2kgj0AHRFNbB3yJEoHoadOzvLrm4QD52k8fix1V3u9j/DPIE qoUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=0XNV7usCBQG7IKqGs/iEc1hnq8nlSXpsmXeWkLciLkE=; b=bCELNNbZhFVH9WeN4E/ArrAiaLR7VfbbRBuLytflgTWcYj1dVkjJI7NHugBg/gDLtR r3HwcbbrxIgFaETsuGnYgTxPfFcjTTUp9XuqrX5FAMkDee9Zm7rADeyf97HzkmNFpiiE 0D481PZ/QHHBf8VnZ0+IEY5xQ0L0yKbtx0xSxuKZS232PwvN9EDbqPrwiQvZBKruNT5v heGc5mCC4aJ5z4cS5riaKMh0alcf0GB+irQSz7qZPNfl2mYNBOwPK0VhcKHjHlT6KtOE M5cTwibM1y82Lr1gkHicAzWSYcGHJKghqhmgVs2vOJmHvB8bnrHUGLDfreVRXtE1+hgA FJnw== X-Gm-Message-State: AOAM530vtSAE2neOiwEdFGYhVfkoTQ5v0dr910Yj4KlmupY8Cl7z/w5h 9trv9YCa574FIAg+KeQq/gLJFg== X-Google-Smtp-Source: ABdhPJxlhovwd28C6GM3k2GPbbSWUgsfHo25XhDhYVqc6DmhQitfLBWlCfFpxRWzcFWfCurnpVr5tg== X-Received: by 2002:a05:6808:7c1:: with SMTP id f1mr4620540oij.142.1622175479598; Thu, 27 May 2021 21:17:59 -0700 (PDT) Received: from builder.lan (104-57-184-186.lightspeed.austtx.sbcglobal.net. [104.57.184.186]) by smtp.gmail.com with ESMTPSA id v18sm870619oos.23.2021.05.27.21.17.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 May 2021 21:17:59 -0700 (PDT) Date: Thu, 27 May 2021 23:17:57 -0500 From: Bjorn Andersson To: Suman Anna Cc: Mathieu Poirier , Lokesh Vutla , Tero Kristo , linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/6] remoteproc: Introduce rproc_detach_device() wrapper Message-ID: References: <20210522000309.26134-1-s-anna@ti.com> <20210522000309.26134-2-s-anna@ti.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210522000309.26134-2-s-anna@ti.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210527_211800_692963_3E67D22E X-CRM114-Status: GOOD ( 23.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri 21 May 19:03 CDT 2021, Suman Anna wrote: > The .attach() rproc ops is invoked through the helper > rproc_attach_device(), but the .detach() ops is invoked > directly at present. Introduce a similar wrapper function > rproc_detach_device() for .detach() ops so that the code > is symmetric. > > Signed-off-by: Suman Anna > --- > drivers/remoteproc/remoteproc_core.c | 2 +- > drivers/remoteproc/remoteproc_internal.h | 8 ++++++++ > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c > index 6348aaa42bbb..6019f46001c8 100644 > --- a/drivers/remoteproc/remoteproc_core.c > +++ b/drivers/remoteproc/remoteproc_core.c > @@ -1869,7 +1869,7 @@ static int __rproc_detach(struct rproc *rproc) > } > > /* Tell the remote processor the core isn't available anymore */ > - ret = rproc->ops->detach(rproc); > + ret = rproc_detach_device(rproc); > if (ret) { > dev_err(dev, "can't detach from rproc: %d\n", ret); > return ret; > diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h > index a328e634b1de..931d50b6a0d1 100644 > --- a/drivers/remoteproc/remoteproc_internal.h > +++ b/drivers/remoteproc/remoteproc_internal.h > @@ -121,6 +121,14 @@ static inline int rproc_attach_device(struct rproc *rproc) > return 0; > } > > +static inline int rproc_detach_device(struct rproc *rproc) > +{ > + if (rproc->ops->detach) > + return rproc->ops->detach(rproc); > + > + return 0; I was going to complain that this will silently succeed to detach a remoteproc when the driver doesn't implement detach, but then I realized that in the current code path we just failed if it wasn't set. So this only becomes a problem if we're out of sync between the wish to detach and the implementation of detach, in the later patch. But based on this, why do we allow rproc_attach_device() to succeed even though a driver doesn't implement attach? Could we achieve the symmetry by going the other way? Regards, Bjorn > +} > + > static inline > int rproc_fw_sanity_check(struct rproc *rproc, const struct firmware *fw) > { > -- > 2.30.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel