Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1225538rwn; Thu, 8 Sep 2022 15:52:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR7v1Ted8jhPFu1iosBXKJADQ03QJhnNhm/DuSRJPC7Og+bg5yxnNzLlqiI27wUwShEoLPje X-Received: by 2002:a17:902:7791:b0:173:3dc2:3bb9 with SMTP id o17-20020a170902779100b001733dc23bb9mr10953345pll.153.1662677528988; Thu, 08 Sep 2022 15:52:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662677528; cv=none; d=google.com; s=arc-20160816; b=LdEvncAxqE61ybdoFENrJ4+Gf3vzMYdqQtJ/vK0nd8fnq1ym2GhUYK0BSR+YcGwljC tU8hIsr0C5/eWLZS9UFCTjmolX3NFxS6Y5M6fF3bok3YnTSCuwJHmlP5kzQ5jCJOOP9O OFAQiImUMJxSwTTQVlnw3WVus9ax8wuyZoDpB7hoEHFfMqIpDQZsLz8YiMlzmaP5f6GG oumVi8U5KPE3Il2j1U+TuIQhz8Ycp9XIpXQyVH8gwi2yAREU4aDzJxQuDpW+VcfJZZub S/AFVzAG9mDO8oww3RVB31UqdMi8MP/hWVwZRywRXJoj5ZPCv7Dj0cyMzr719I1c7NmC uWyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zfA7HSiKgjWO9Mg4FuYytU28dDXflMeBRCSCwHqciIQ=; b=sp3a66JG2i3rzmAlH5rb6asLQOIIAWdkzlV8p9+GwgpPCtGof2wdgYPhxYsbyMOq9j H6OpZp3k2QIMQDv72ElzUEzAESdlQhB99JtZ2mg8GAk4O8eiZmGGG1E3XdWHFj98EOVp T/eEc0eeCKXewAVx/L18g5jRGGf3UfM/MFQbU9JU3elQfrYKWnklHHOhgg7BaYVtOXdc Zdmb3EXl9JQxz4aJ4feG62WRfaphtOBfO3d/ymJ6eujc8Alr+196/AA0Qo0pu8ctbbnh XB5cYRJM5XA4PDuP5WzYvaiN6B58FeEDY434kUUheepHQnfvs4QdWcHhyDdW68fh8SnB XCuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JG+3q0Mg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b10-20020a65578a000000b004129d17d705si14163pgr.112.2022.09.08.15.51.57; Thu, 08 Sep 2022 15:52:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JG+3q0Mg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230089AbiIHV7b (ORCPT + 99 others); Thu, 8 Sep 2022 17:59:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230234AbiIHV7N (ORCPT ); Thu, 8 Sep 2022 17:59:13 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66A3F10873D for ; Thu, 8 Sep 2022 14:58:08 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id g4so4002748pgc.0 for ; Thu, 08 Sep 2022 14:58:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=zfA7HSiKgjWO9Mg4FuYytU28dDXflMeBRCSCwHqciIQ=; b=JG+3q0Mg9KVWzTtQllyN7SyXYZ61BCvGbeOdbe7ILmxsR8gV4dT/9vvk0QNT7thCFw 2qOYXyQxpkm0xX2wvm8b3RWXE4aFt+zRerjIQWxYdkQ8nJ3VD/+2rLpCrBNvksxTQkvg SVmGTWdXMbgB3kyPcMjJQ95OVtvlQvYXvux6hzwGLGnejr9GV5O+nN4jjAylwMCGzxQh gTF8dp8d3rQ7ZgvJZjMAhcE9tL21pQa/Ad493sDXOYqri46mCrMGwb/XCEJC4tEooTlu ylYFvDBuI6P33uZRD0mdNPtkCb+0DwG56RCxdaTVKOXDNP34M5D0UOWhL6ENQ3YEt9Oy 8FvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=zfA7HSiKgjWO9Mg4FuYytU28dDXflMeBRCSCwHqciIQ=; b=dHU1vQxcoul/pddOGsQTpHm/M9FxUeK1i3oHxt9Hi/ltD1csMit68L9by+OzHzyXbp FMSWX5Kacv0E/LHVCS0MYKrr/imeElvQUtJRUv/fft8wcYZThr/qKBi2gumkvJdu9c82 8/TG8zX+rBVFV7nKaN3YjfHViZ439LIMqE9QuKWYIGKePSLGbm0dHdBApVuBjyMazobE pdyrTay9XGjzZ/bmQw/oX4aaLaVWB3dRhaPnAKjqmveTPfa5YEzD2PWkRqqu4FSnlJyF MsJcwElaqbo/Qa6GT9zERa0zhyxcZAu2FacH+IYsYSmKTWTg3uDy+6U+vVp4I9PTmvz1 JT9Q== X-Gm-Message-State: ACgBeo1ZpH5hgQUK+uefpqUnCxszAft973kt/Jnp57vnD+GXArouD0lo jyRtT+anwvuhk5Wb+QUFZc9pcw== X-Received: by 2002:a63:a501:0:b0:434:ff77:1fda with SMTP id n1-20020a63a501000000b00434ff771fdamr7612456pgf.310.1662674270417; Thu, 08 Sep 2022 14:57:50 -0700 (PDT) Received: from p14s (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id z15-20020a1709027e8f00b00176be23bbb3sm259pla.172.2022.09.08.14.57.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 14:57:49 -0700 (PDT) Date: Thu, 8 Sep 2022 15:57:47 -0600 From: Mathieu Poirier To: Dmitry Torokhov Cc: Bjorn Andersson , Suman Anna , Linus Walleij , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, kishon@ti.com, danishanwar@ti.com, nm@ti.com, vigneshr@ti.com, grygorii.strashko@ti.com Subject: Re: [RFC/PATCH] remoteproc/keystone: switch to using gpiod API Message-ID: <20220908215747.GA246255@p14s> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 06, 2022 at 02:08:33PM -0700, Dmitry Torokhov wrote: > This patch switches the driver away from legacy gpio/of_gpio API to > gpiod API, and removes use of of_get_named_gpio_flags() which I want to > make private to gpiolib. > > Note that there is a behavior change in the driver: previously the > driver did not actually request GPIO, it simply parsed GPIO number out > of device tree and poked at it. > > Signed-off-by: Dmitry Torokhov > --- > drivers/remoteproc/keystone_remoteproc.c | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) This change looks good to me but I would like someone from the TI brigade test this before applying it. Thanks, Mathieu > > diff --git a/drivers/remoteproc/keystone_remoteproc.c b/drivers/remoteproc/keystone_remoteproc.c > index 594a9b43b7ae..95b39741925d 100644 > --- a/drivers/remoteproc/keystone_remoteproc.c > +++ b/drivers/remoteproc/keystone_remoteproc.c > @@ -14,7 +14,7 @@ > #include > #include > #include > -#include > +#include > #include > #include > #include > @@ -59,10 +59,10 @@ struct keystone_rproc { > int num_mems; > struct regmap *dev_ctrl; > struct reset_control *reset; > + struct gpio_desc *kick_gpio; > u32 boot_offset; > int irq_ring; > int irq_fault; > - int kick_gpio; > struct work_struct workqueue; > }; > > @@ -232,10 +232,10 @@ static void keystone_rproc_kick(struct rproc *rproc, int vqid) > { > struct keystone_rproc *ksproc = rproc->priv; > > - if (WARN_ON(ksproc->kick_gpio < 0)) > + if (!ksproc->kick_gpio) > return; > > - gpio_set_value(ksproc->kick_gpio, 1); > + gpiod_set_value(ksproc->kick_gpio, 1); > } > > /* > @@ -432,9 +432,9 @@ static int keystone_rproc_probe(struct platform_device *pdev) > goto disable_clk; > } > > - ksproc->kick_gpio = of_get_named_gpio_flags(np, "kick-gpios", 0, NULL); > - if (ksproc->kick_gpio < 0) { > - ret = ksproc->kick_gpio; > + ksproc->kick_gpio = gpiod_get(dev, "kick", GPIOD_ASIS); > + ret = PTR_ERR_OR_ZERO(ksproc->kick_gpio); > + if (ret) { > dev_err(dev, "failed to get gpio for virtio kicks, status = %d\n", > ret); > goto disable_clk; > @@ -466,6 +466,7 @@ static int keystone_rproc_probe(struct platform_device *pdev) > > release_mem: > of_reserved_mem_device_release(dev); > + gpiod_put(ksproc->kick_gpio); > disable_clk: > pm_runtime_put_sync(dev); > disable_rpm: > @@ -480,6 +481,7 @@ static int keystone_rproc_remove(struct platform_device *pdev) > struct keystone_rproc *ksproc = platform_get_drvdata(pdev); > > rproc_del(ksproc->rproc); > + gpiod_put(ksproc->kick_gpio); > pm_runtime_put_sync(&pdev->dev); > pm_runtime_disable(&pdev->dev); > rproc_free(ksproc->rproc); > -- > 2.37.2.789.g6183377224-goog > > > -- > Dmitry