From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759582AbbJ3KhB (ORCPT ); Fri, 30 Oct 2015 06:37:01 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]:30837 "EHLO smtp1-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759432AbbJ3Kg7 (ORCPT ); Fri, 30 Oct 2015 06:36:59 -0400 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@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); -- 2.0.0