Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5790994pxu; Thu, 22 Oct 2020 11:06:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWn8UZl25K40mxVZK+bhndmcOuOvLVm1rFAdraQG82xzf+E2E1DOgB5M87FzMVbnj01Erg X-Received: by 2002:a17:907:9621:: with SMTP id gb33mr3567066ejc.158.1603389965393; Thu, 22 Oct 2020 11:06:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603389965; cv=none; d=google.com; s=arc-20160816; b=JW2r9IHIYjWml1gRdREe/X8AmxU2qChPeiISSC43c33V/4ql/PEF6nM51g1afk0G74 aqXh/n1pf/F5Kxed+Gga1WxSYdWqEDWLGF6SJTxgSEY0yJKvBFPC4z/JmR0BLvPxqt2j DTdK6v3gHdFh5KNTnpdzxDNs1xiUFNeSLdzSOEsWusTu5ckr0Ho3VWSM7ALTPEk35rGb 2hiMMyDcCdUFrReXiiT978zN5x3PTr6T7iur/8HSA86o1wdyNWpP94i5XkBf8MA0StxY kqcwGUn45s/bjZzpAAbaNNk1g5FNuJ4cB+93tZRPV6EtNhDFIq/sYOHxvnPevjc92SA/ 85Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=h4PJgYibu+V1PSSCsBQcnRCQNQQ35EQp3cvum590Rew=; b=MstsXaDx+3qiAcU30KC73/BILJpkSljUICWcA6sn3PQgxcyPTmL2En1UNCvSEzfhLG bhLLeuhUWW8Ji+1noK9qsNu3W7c8AKDrhfYv5rpRMbFONDk14GudGc5lcdlJ1AteAuME KRkeRJXCcNkT9/HpYXUhJ3X0zt59SF49Qxc+BWMQHAkzFTtVkEcQgsk+mof7kH9tfn4P 2tXA+RfPQHYEpOFfVoOAG521P7nJUQMcQm5yWrUryI1lpilnO5u174WNU1UIIee3qUse XvD2m82VGOUvQEV82fuqcnp0znhp0W4DZQILTRolfQ5896/lswu2bVjcvtcYodxOn1aq 3anA== 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 x1si1374833ede.408.2020.10.22.11.05.43; Thu, 22 Oct 2020 11:06:05 -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 S368894AbgJVP7N (ORCPT + 99 others); Thu, 22 Oct 2020 11:59:13 -0400 Received: from mx2.suse.de ([195.135.220.15]:48528 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S368870AbgJVP7L (ORCPT ); Thu, 22 Oct 2020 11:59:11 -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 DC564ADF5; Thu, 22 Oct 2020 15:59:08 +0000 (UTC) From: Nicolas Saenz Julienne To: u.kleine-koenig@pengutronix.de, linux-kernel@vger.kernel.org, Linus Walleij , Bartosz Golaszewski Cc: f.fainelli@gmail.com, linux-pwm@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, wahrenst@gmx.net, linux-input@vger.kernel.org, dmitry.torokhov@gmail.com, gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, p.zabel@pengutronix.de, linux-gpio@vger.kernel.org, linux-clk@vger.kernel.org, sboyd@kernel.org, linux-rpi-kernel@lists.infradead.org, Nicolas Saenz Julienne Subject: [PATCH v2 03/10] gpio: raspberrypi-exp: Release firmware handle on unbind Date: Thu, 22 Oct 2020 17:58:50 +0200 Message-Id: <20201022155858.20867-4-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201022155858.20867-1-nsaenzjulienne@suse.de> References: <20201022155858.20867-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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