From patchwork Fri Oct 30 10:36:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alban X-Patchwork-Id: 538240 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id F1C16140D92 for ; Fri, 30 Oct 2015 21:37:58 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759593AbbJ3Kh4 (ORCPT ); Fri, 30 Oct 2015 06:37:56 -0400 Received: from smtpfb2-g21.free.fr ([212.27.42.10]:47449 "EHLO smtpfb2-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759587AbbJ3Khy (ORCPT ); Fri, 30 Oct 2015 06:37:54 -0400 Received: from smtp1-g21.free.fr (smtp1-g21.free.fr [212.27.42.1]) by smtpfb2-g21.free.fr (Postfix) with ESMTP id 80FD9D5245A for ; Fri, 30 Oct 2015 11:36:59 +0100 (CET) Received: from localhost.localdomain (unknown [78.54.98.77]) (Authenticated sender: albeu) by smtp1-g21.free.fr (Postfix) with ESMTPA id 7FB4C940019; Fri, 30 Oct 2015 11:36:52 +0100 (CET) From: Alban Bedel To: linux-gpio@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Linus Walleij , Alexandre Courbot , Alban Bedel Subject: [PATCH 3/3] gpio: ath79: Make the driver removable Date: Fri, 30 Oct 2015 11:36:31 +0100 Message-Id: <1446201391-22553-3-git-send-email-albeu@free.fr> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1446201391-22553-1-git-send-email-albeu@free.fr> References: <1446201391-22553-1-git-send-email-albeu@free.fr> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org As we now allow the driver to be built as a module it should be removable. Signed-off-by: Alban Bedel --- drivers/gpio/gpio-ath79.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gpio/gpio-ath79.c b/drivers/gpio/gpio-ath79.c index 3e71ced..6108dff 100644 --- a/drivers/gpio/gpio-ath79.c +++ b/drivers/gpio/gpio-ath79.c @@ -43,6 +43,7 @@ static int ath79_gpio_probe(struct platform_device *pdev) ctrl = devm_kzalloc(&pdev->dev, sizeof(*ctrl), GFP_KERNEL); if (!ctrl) return -ENOMEM; + platform_set_drvdata(pdev, ctrl); if (np) { err = of_property_read_u32(np, "ngpios", &ath79_gpio_count); @@ -97,12 +98,20 @@ static int ath79_gpio_probe(struct platform_device *pdev) return 0; } +static int ath79_gpio_remove(struct platform_device *pdev) +{ + struct ath79_gpio *ctrl = platform_get_drvdata(pdev); + + return bgpio_remove(&ctrl->bgc); +} + static struct platform_driver ath79_gpio_driver = { .driver = { .name = "ath79-gpio", .of_match_table = ath79_gpio_of_match, }, .probe = ath79_gpio_probe, + .remove = ath79_gpio_remove, }; module_platform_driver(ath79_gpio_driver);