From patchwork Thu Oct 22 15:58:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 11851565 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BF64C388F7 for ; Thu, 22 Oct 2020 16:02:40 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A91CD2417D for ; Thu, 22 Oct 2020 16:02:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="fPoyAAIx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A91CD2417D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zX97e3DDnvQkpMvdBDfTjKxFesIxAa+OI0Z4Q5PC+6A=; b=fPoyAAIxBoiWjaayMV/FcUN3x FhNNGOEcCrqPT/FYPcZnBQd0DWQiNZnZ85p6WyynnSX8MchN2mjYhVNrbijRbkcSAUkhbH0rZ47mp b90timndU7gzY4FRtzAhZ8dHkTmIdJJZrHUqx5kuztW61BA5ruJG6aO5GJ8mY2B0xcOSqcthSOO3g 1KhoqPk55td93SsVeOV6r6cl7JnzpF73v2iF7wVPuA5bWZn0VAW8s8BaOaqC0PNFviRV7TcqKVbED AKac0elRFGzCnS5RxNk6fvDHwgZXOS70Q7QeGfOrKR/qNVDHHdpoPlBCS+jWAmS6zVl+X23Bpi1jh 9jNpLS23g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kVd0L-00026f-TL; Thu, 22 Oct 2020 15:59:54 +0000 Received: from mx2.suse.de ([195.135.220.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kVczf-0001q3-BZ; Thu, 22 Oct 2020 15:59:12 +0000 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 41DD3AC23; Thu, 22 Oct 2020 15:59:10 +0000 (UTC) From: Nicolas Saenz Julienne To: u.kleine-koenig@pengutronix.de, linux-kernel@vger.kernel.org, Philipp Zabel Subject: [PATCH v2 04/10] reset: raspberrypi: Release firmware handle on unbind Date: Thu, 22 Oct 2020 17:58:51 +0200 Message-Id: <20201022155858.20867-5-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201022_115911_559308_4F6036FC X-CRM114-Status: GOOD ( 14.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devel@driverdev.osuosl.org, linux-pwm@vger.kernel.org, f.fainelli@gmail.com, devicetree@vger.kernel.org, sboyd@kernel.org, gregkh@linuxfoundation.org, linus.walleij@linaro.org, dmitry.torokhov@gmail.com, linux-gpio@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, wahrenst@gmx.net, linux-input@vger.kernel.org, Nicolas Saenz Julienne , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Upon unbinding the device make sure we release RPi's firmware interface. Signed-off-by: Nicolas Saenz Julienne --- drivers/reset/reset-raspberrypi.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/reset/reset-raspberrypi.c b/drivers/reset/reset-raspberrypi.c index 02f59c06f69b..29311192e2c9 100644 --- a/drivers/reset/reset-raspberrypi.c +++ b/drivers/reset/reset-raspberrypi.c @@ -99,7 +99,17 @@ static int rpi_reset_probe(struct platform_device *pdev) priv->rcdev.ops = &rpi_reset_ops; priv->rcdev.of_node = dev->of_node; - return devm_reset_controller_register(dev, &priv->rcdev); + return reset_controller_register(&priv->rcdev); +} + +static int rpi_reset_remove(struct platform_device *pdev) +{ + struct rpi_reset *priv = platform_get_drvdata(pdev); + + reset_controller_unregister(&priv->rcdev); + rpi_firmware_put(priv->fw); + + return 0; } static const struct of_device_id rpi_reset_of_match[] = { @@ -110,6 +120,7 @@ MODULE_DEVICE_TABLE(of, rpi_reset_of_match); static struct platform_driver rpi_reset_driver = { .probe = rpi_reset_probe, + .remove = rpi_reset_remove, .driver = { .name = "raspberrypi-reset", .of_match_table = rpi_reset_of_match,