Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp396247pxx; Mon, 26 Oct 2020 10:57:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyI9MBRvfFmYzYT6eRacIqdGiQ/Lw/okZh2j8qpCrbUiWXg0w8YjB5ZoMTNZjE/+LZnK8y4 X-Received: by 2002:a05:6402:1e6:: with SMTP id i6mr17158507edy.152.1603735038861; Mon, 26 Oct 2020 10:57:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603735038; cv=none; d=google.com; s=arc-20160816; b=flzhlpOWeASkJepYDcMAo3pN9kR+TdiIcLxPKcrvGiDz7/K1Fdjdp0cY8eJXQjxW3F rm8UJD1ZT1fvGYqdvjOKeYwgjstZ5NI9w58dwqy9amSC0C2S+HoMPatAZH2jYnNrpSJe +9SkNJmRZDU2TFqxYVRiW6bo1rghV/blISm+jZP8vxuZV8qk5nrsl8FWHRxnYT79iPFi N748Gm8uHooOfIYgcSntdPua1r5ZMDvt8hdA+vA0rFXyzvbm6J/pRcOnrnKA7BTaNe36 xF9anIJVRlEkdQAMC7iQ96t5HllcTfCm6GHl++JQdogG6kM5QU2b7yPaL6Kcl5QSow4G +y4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :date:cc:to:from:subject:message-id; bh=pOnX1WrjjgaSyxQHlmQhAHUbwcqMGQ6oDgUg3R2JsIc=; b=nnM9i9MC0zIGyO8BVwraf/MbShThpH2P4sR60i/Thu2wArzYuOSGpRghYyMj7E1n8k 48jhGZklGjAu+cW5zwTBeszoAfWSUxg/L+hBUiLOZm99A06E3EQj3bTATYCtPzi2/x8N HvLMch7qG31jKuMijSppGTXsHzm/9G2MpAZak8zp7E5zGTW1yN9mm3aneTyHHySojs8Z Xp36eli0R0aP7J79URAyJEHdpVRSzqol9us+MvPSmQQn2hgHEFqnfnHawF4oYJveCCDs tFPugtcmxOGIhP8DD888n2Z0b5/eBKydIzEGFTDcJaZtztW0UgYckCW6o6KEupp2M/Y+ iB1w== ARC-Authentication-Results: i=1; mx.google.com; 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 a3si4043502ejd.407.2020.10.26.10.56.56; Mon, 26 Oct 2020 10:57:18 -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; 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 S1781831AbgJZOmL (ORCPT + 99 others); Mon, 26 Oct 2020 10:42:11 -0400 Received: from mx2.suse.de ([195.135.220.15]:36072 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1781658AbgJZOmK (ORCPT ); Mon, 26 Oct 2020 10:42:10 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2EF1CB8E1; Mon, 26 Oct 2020 14:42:08 +0000 (UTC) Message-ID: <700a149849222f3efbec73cb8a6be56b4b1c5bcb.camel@suse.de> Subject: Re: [PATCH v2 03/10] gpio: raspberrypi-exp: Release firmware handle on unbind From: Nicolas Saenz Julienne To: Bartosz Golaszewski Cc: Uwe =?ISO-8859-1?Q?Kleine-K=F6nig?= , 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 Date: Mon, 26 Oct 2020 15:42:06 +0100 In-Reply-To: References: <20201022155858.20867-1-nsaenzjulienne@suse.de> <20201022155858.20867-4-nsaenzjulienne@suse.de> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-4RJXy1XArEUanWEz7Yut" User-Agent: Evolution 3.36.5 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-4RJXy1XArEUanWEz7Yut Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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= . > >=20 > > Signed-off-by: Nicolas Saenz Julienne > > --- > > drivers/gpio/gpio-raspberrypi-exp.c | 14 +++++++++++++- > > 1 file changed, 13 insertions(+), 1 deletion(-) > >=20 > > diff --git a/drivers/gpio/gpio-raspberrypi-exp.c b/drivers/gpio/gpio-ra= spberrypi-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_devi= ce *pdev) > > rpi_gpio->gc.get =3D rpi_exp_gpio_get; > > rpi_gpio->gc.set =3D rpi_exp_gpio_set; > > rpi_gpio->gc.can_sleep =3D true; > > + platform_set_drvdata(pdev, rpi_gpio); > >=20 > > - 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 =3D platform_get_drvdata(pdev); > > + > > + gpiochip_remove(&rpi_gpio->gc); > > + rpi_firmware_put(rpi_gpio->fw); > > + > > + return 0; > > } > >=20 > > static const struct of_device_id rpi_exp_gpio_ids[] =3D { > > @@ -247,6 +258,7 @@ static struct platform_driver rpi_exp_gpio_driver = =3D { > > .of_match_table =3D of_match_ptr(rpi_exp_gpio_ids), > > }, > > .probe =3D rpi_exp_gpio_probe, > > + .remove =3D rpi_exp_gpio_remove, > > }; > > module_platform_driver(rpi_exp_gpio_driver); > >=20 > > -- > > 2.28.0 > >=20 >=20 > 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 --=-4RJXy1XArEUanWEz7Yut Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEErOkkGDHCg2EbPcGjlfZmHno8x/4FAl+W4D4ACgkQlfZmHno8 x/4RVwf/UZbRYwQfpY+67Gru7U3IMExckiPcjOHqeN3IO1Aqys6hi0LcCgQmZoRS yDES/QK4HITWb2LEOikdeICzUhcAmHLuD6l9Si1lOw/g7RZAcNoB+gejoLIKsxsJ BvBSsCz+ARcANf68gksyv52nsVLhMNlvZpnoVV6p9VTzTb0q7+QOBy7KndC73pyM cLs3LcbX7jTY71QjVIAVJql7UiQmzjA9V08bxNan8AF/yttAj0PgtZga1WYXQHG/ ipUuvMADCJYB9WrHAhtY8TV1G1pGs0b+OTU6cEZukdSAUaNXzL+DKDHm3nlMi887 7aRyD6vm++8u7ecNrtj2/Iug3MLyQg== =FwXW -----END PGP SIGNATURE----- --=-4RJXy1XArEUanWEz7Yut--