Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp250472pxx; Mon, 26 Oct 2020 07:49:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7VfSr+Vgn4xfyzH3cU1n4l+jZPSaFhYGfGj3jyVGoTdZaq/Ce9M+g9yhfCqixykqR2U3S X-Received: by 2002:a50:b224:: with SMTP id o33mr15438366edd.21.1603723776748; Mon, 26 Oct 2020 07:49:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603723776; cv=none; d=google.com; s=arc-20160816; b=g/v4AKY529lw2C7yMF/kp4eMKz1n3LYiOEe/iMFFiorXeHgMbSWcQqDnQ4tYSSF2fk ZVaHOKnhIvn4AguEfPXwwKB2ntO3ptvzVi406cTAVYROCAZcjz+aiP2gxR1nQosnAnUK ncip8Rh6GsI48wkJF8M46q8J5J+9dpC3CHvQ6VgwXlaudH3PzcEdAfgx//s3SxBVe2Tp PXeOl/M+2xf5qzOP18EN0ryQlB0v62qSHvc1VwaL4+lO+y0MoiCfyn044ZWTepT7W31S rclXdQtRzmDyX72+ZuAzzG+BXWWU6JHp571J0J3ZDk+nm7a4iR8VffBPQ/Z/nV8FNaBT QRPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=108wjdzd0/xglJPKdUFBrU/U8qTH53Q7ViQVBUZc56k=; b=MZ7g72geZPM1ivG63BokjbJsiiEANRjnIJrI5k+Q+pTgV5NyY+/FrGK0fmptISl9y5 DJxosNmhUD5tHOVQO/MMichFImyHCodwj0759uXfF4pLmX+fWy5roWF4uWeroE52D7zl 5FnRKePKJno0nz1SXI/k2wfOIjfDZp8nXUhhi+u7Ap1NcbGG5pexfTwO+dKODCpY3fk6 GoivyhoD7t3Bs4O8iwxTPLH2m5NgxGsxxAQI2Zp23FyQul35nINSybcHLz8wAiLG4U+s sn5OMUE2k2mQgydl8zimUrGP5mxR/QDU86aeZquq25OEhhSBfmHEIqi0Ms39yNnrMQYg PqZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=1OrMnfHH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e12si7371335ejr.549.2020.10.26.07.49.12; Mon, 26 Oct 2020 07:49:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=1OrMnfHH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1781920AbgJZOpe (ORCPT + 99 others); Mon, 26 Oct 2020 10:45:34 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:40614 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1781913AbgJZOpd (ORCPT ); Mon, 26 Oct 2020 10:45:33 -0400 Received: by mail-ed1-f68.google.com with SMTP id p13so9644482edi.7 for ; Mon, 26 Oct 2020 07:45:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=108wjdzd0/xglJPKdUFBrU/U8qTH53Q7ViQVBUZc56k=; b=1OrMnfHHqDBoo2mYxJrLQ9UlNNI6ec8McsUQXHPbq7sKgz+s/nXE8wC/tcI/BwH3BA YcAIrjszEI+afPxnRmUMsSafZo++P4xTvrdEqggzBABUFDbbV/e9xn+YZ3cB/dPnf3kl 9ZGuOQRnd6APa67+wQwTCEP61nfTjrToUqGBWbolTmKWKeyz73rYrmvMumShSk9TWAF9 +MREeJUOnaLftLucXz5QGIgOkw2duaObvPbDmqRNRkJj959McPu1ur7Zk48voZsuQ9ZO vX1M9rjAraSINox0yzNORVihGBwgnebY6oKbYvqhxGWZ/XB/jl58QutvGrPjQrUPCTJW JjqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=108wjdzd0/xglJPKdUFBrU/U8qTH53Q7ViQVBUZc56k=; b=n2IBe87Ym+431hg0Zio95AUNL1I75LF9XyhAM4Ql9M6G+XggofXopSnUa6hM2oP9+e I25sLtk5GlwCQTBt0M6tHV3RUkfx6rNZlK2ypqVIEPVylMy/+xIU/iZy2n/bArt1ApJT /myfXp0PuMasCeN08ATF9wVCGwgxfGE/ZJznH/iWwjBvwQNtxfBRVOD8IAg/mZVrbHP6 w3o8ZBqMxyANwuWr8cswp6UvOKquNi4SknciK7uWGkcpHsIp8Ia8+9WU4+EQ9SaRw/ma BoM/XF9D5NIw3ZpyT9zQsR2TwZhjACpVi8WPeY2xnHLDzdxggB17HzT5X4/YMVhClfIX b6xA== X-Gm-Message-State: AOAM533kPIJgIpt7nWqWfQi7AWV3Ufx2Io/lhliyPLh8cMYgmgUQ9EGk 5FUSMA3tpglWnfNgpBLxNi8ouQ182SvPpBhEYEOJVA== X-Received: by 2002:a50:e442:: with SMTP id e2mr16721662edm.186.1603723528358; Mon, 26 Oct 2020 07:45:28 -0700 (PDT) MIME-Version: 1.0 References: <20201022155858.20867-1-nsaenzjulienne@suse.de> <20201022155858.20867-4-nsaenzjulienne@suse.de> <700a149849222f3efbec73cb8a6be56b4b1c5bcb.camel@suse.de> In-Reply-To: <700a149849222f3efbec73cb8a6be56b4b1c5bcb.camel@suse.de> From: Bartosz Golaszewski Date: Mon, 26 Oct 2020 15:45:17 +0100 Message-ID: Subject: Re: [PATCH v2 03/10] gpio: raspberrypi-exp: Release firmware handle on unbind To: Nicolas Saenz Julienne Cc: =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , LKML , Linus Walleij , Florian Fainelli , linux-pwm@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, arm-soc , linux-devicetree , wahrenst@gmx.net, Linux Input , Dmitry Torokhov , Greg KH , devel@driverdev.osuosl.org, Philipp Zabel , linux-gpio , linux-clk , Stephen Boyd , linux-rpi-kernel@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 26, 2020 at 3:42 PM Nicolas Saenz Julienne wrote: > > On Mon, 2020-10-26 at 15:40 +0100, Bartosz Golaszewski wrote: > > On Thu, Oct 22, 2020 at 5:59 PM Nicolas Saenz Julienne > > wrote: > > > Upon unbinding the device make sure we release RPi's firmware interface. > > > > > > Signed-off-by: Nicolas Saenz Julienne > > > --- > > > drivers/gpio/gpio-raspberrypi-exp.c | 14 +++++++++++++- > > > 1 file changed, 13 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/gpio/gpio-raspberrypi-exp.c b/drivers/gpio/gpio-raspberrypi-exp.c > > > index bb100e0124e6..c008336e1131 100644 > > > --- a/drivers/gpio/gpio-raspberrypi-exp.c > > > +++ b/drivers/gpio/gpio-raspberrypi-exp.c > > > @@ -231,8 +231,19 @@ static int rpi_exp_gpio_probe(struct platform_device *pdev) > > > rpi_gpio->gc.get = rpi_exp_gpio_get; > > > rpi_gpio->gc.set = rpi_exp_gpio_set; > > > rpi_gpio->gc.can_sleep = true; > > > + platform_set_drvdata(pdev, rpi_gpio); > > > > > > - return devm_gpiochip_add_data(dev, &rpi_gpio->gc, rpi_gpio); > > > + return gpiochip_add_data(&rpi_gpio->gc, rpi_gpio); > > > +} > > > + > > > +static int rpi_exp_gpio_remove(struct platform_device *pdev) > > > +{ > > > + struct rpi_exp_gpio *rpi_gpio = platform_get_drvdata(pdev); > > > + > > > + gpiochip_remove(&rpi_gpio->gc); > > > + rpi_firmware_put(rpi_gpio->fw); > > > + > > > + return 0; > > > } > > > > > > static const struct of_device_id rpi_exp_gpio_ids[] = { > > > @@ -247,6 +258,7 @@ static struct platform_driver rpi_exp_gpio_driver = { > > > .of_match_table = of_match_ptr(rpi_exp_gpio_ids), > > > }, > > > .probe = rpi_exp_gpio_probe, > > > + .remove = rpi_exp_gpio_remove, > > > }; > > > module_platform_driver(rpi_exp_gpio_driver); > > > > > > -- > > > 2.28.0 > > > > > > > Why not introduce devm_rpi_firmware_get()? That would allow you to > > keep the driver elegant without re-adding remove(). > > I like the idea, I'll look into it. > > Thanks, > Nicolas > If you can't do it for some reason, then even using devm_add_action() is fine. Bartosz