Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp397342pxx; Mon, 26 Oct 2020 10:58:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnIpDrJ1B3zPPdK6DHB/f+PORdJ9F8dEmpY2Vssj8xy1wBp9sC3bvurk/FieJbnVuRZMg9 X-Received: by 2002:a17:906:388d:: with SMTP id q13mr16163288ejd.92.1603735134717; Mon, 26 Oct 2020 10:58:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603735134; cv=none; d=google.com; s=arc-20160816; b=hC1ug10+zlkXpfeQLHDPLX5dzfwQ13aGuaBMc6Mhh2abC3uLM1K/pCMALv0IPmTNyj HxdZHumk6tpBC9XqzLrRxGtqfoqt9R76vbfW3pI4HlBJNSqN5RA4HajNSTdLaWYoKqxo lJyDHyBWrV6FW6rxe6izkrxs6DelyZwIxYdnI6IyYSF6wKhE2wpz8RZJTteGOxwJN2WL whU5lUQVKkCEA2bp7gpB/zGgRzAa4fULf3R+7tr+xGN7kOB+WMBv3tWGNOqrX2gZiKyP 0xtRGgraPlrGkD77rXECLDgkMsMzGEG7OWWLa1UMjX4WCfWbXJTviHe/7MwHFaIOhn3d X2iQ== 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=lDYrLy8MUIe7IoCpuFE7hK+pFTNu/TtbAvwKtQzdYkQ=; b=lTH6UIV0DSEwNFffXzWXVQrZ9TvEK9r3WWZzwqPdoyXdVtVxZKzUaZs1+7Lcl8ePgA 5ZWcbB85B8sPoyQkyaMzOU6PQudXAQRw37NKeLxh+RbXu2pXAUb1hCi9OnpGYKaByjzE Ge4bbluGvvz9EKjzG3QCUHmILYYei0N0NtEEm+5KqeV9sEAJwaF39Ie1zNk549A2dExF INpuE88yX0o2Uxo1SIqydInCGBXmXvPZH92AuUUhOLqM/cmgef3tjbShjXJNKsAAPEQR 7GpLQwOKjoEr1GzypoWOTGmh1PhpLtyqN/qsT561PFXSCPqaw6aWRrqRlIpH/8X1l+dX Ucig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b="sLh9lD/a"; 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 q28si7116829edw.303.2020.10.26.10.58.32; Mon, 26 Oct 2020 10:58:54 -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="sLh9lD/a"; 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 S1781768AbgJZOlL (ORCPT + 99 others); Mon, 26 Oct 2020 10:41:11 -0400 Received: from mail-ej1-f65.google.com ([209.85.218.65]:44877 "EHLO mail-ej1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1781770AbgJZOlK (ORCPT ); Mon, 26 Oct 2020 10:41:10 -0400 Received: by mail-ej1-f65.google.com with SMTP id d6so9264762ejb.11 for ; Mon, 26 Oct 2020 07:41:07 -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=lDYrLy8MUIe7IoCpuFE7hK+pFTNu/TtbAvwKtQzdYkQ=; b=sLh9lD/aEhUvcqIQXEWD7t5aDKLUDdR+uqzwDNqjQgdKANR+b3CYvFxcSZbZoia/vr 4pV66OyowpCbPkWGTKaHkNzEXXDXDLVs/2Au+libKtUB44Y6qk/gYUIc1eebF4oFDt79 tTk8TkWc5arOSKs7iOkVrAE4WBBMtrp5xmxj63/dFYZRAqMhUvGZwfvkRD1JUaLztwtP fySCKqaIs4Gnn3iOsEGE1OUB2KaEzABTkDBjuG/jvsvUkYTH2qRjZb0Fsk2Hc5H1w8Xh zWDPI2Bf93CUBZCgaf7WwQXZOvxC0mzLBEEwrf0fS1WQ4fobts9ef4tCi6yBGIBGpTF9 InFw== 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=lDYrLy8MUIe7IoCpuFE7hK+pFTNu/TtbAvwKtQzdYkQ=; b=WHuxONDzA0VJhmTjI0IrzEljKGO+HnSuXDXhGvWW5+WaSbYDEer8p04yrbKI8h4uyz 95X30Oruai74q4dTlbfbK4Z0PV45f7OVW/7qquvi04i9Ff5C7DINUONuHcGLJIXqTGqJ w9m39Efsxgm/89uz7dMZW1EHdRAy0hhPvAVtLkfSKF3wTGZK7R9fTmwYeav7mWgsd9ug 51W45PkIc2ziRlyGzLRb/Bb3HSFm4ZE8sZwEJE6J90Po9om8CcVEtjA1VYNTyJXcJxSH DBr2d66gSAd85XeajrkGISz4OOCFS3v/fSS0WyCMFIHuTV/Txv9/+VRDEYauagwZV+rB 2/XA== X-Gm-Message-State: AOAM532ppY2m5BcWusqchXSCDiXcq9wgWr1Lski4IXCYWYu96mtWjS2t Pq/0QcBZWet4gonnkTrEt3/TgmDLwGZ8IQS9E6nIPw== X-Received: by 2002:a17:906:3146:: with SMTP id e6mr15297794eje.363.1603723266555; Mon, 26 Oct 2020 07:41:06 -0700 (PDT) MIME-Version: 1.0 References: <20201022155858.20867-1-nsaenzjulienne@suse.de> <20201022155858.20867-4-nsaenzjulienne@suse.de> In-Reply-To: <20201022155858.20867-4-nsaenzjulienne@suse.de> From: Bartosz Golaszewski Date: Mon, 26 Oct 2020 15:40:55 +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 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(). Bartosz