From patchwork Thu Jan 28 19:44:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alban X-Patchwork-Id: 574853 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 046EC140BCE for ; Fri, 29 Jan 2016 06:46:07 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966973AbcA1TpL (ORCPT ); Thu, 28 Jan 2016 14:45:11 -0500 Received: from smtp2-g21.free.fr ([212.27.42.2]:62356 "EHLO smtp2-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966434AbcA1TpD (ORCPT ); Thu, 28 Jan 2016 14:45:03 -0500 Received: from localhost.localdomain (unknown [176.2.68.19]) (Authenticated sender: albeu) by smtp2-g21.free.fr (Postfix) with ESMTPA id 809A94B00E8; Thu, 28 Jan 2016 20:42:54 +0100 (CET) From: Alban Bedel To: linux-gpio@vger.kernel.org Cc: Linus Walleij , Alexandre Courbot , Antony Pavlov , Gabor Juhos , linux-kernel@vger.kernel.org, Alban Bedel Subject: [PATCH 3/5] gpio: ath79: Make the driver removable Date: Thu, 28 Jan 2016 20:44:31 +0100 Message-Id: <1454010273-21513-3-git-send-email-albeu@free.fr> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1454010273-21513-1-git-send-email-albeu@free.fr> References: <1454010273-21513-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 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpio/gpio-ath79.c b/drivers/gpio/gpio-ath79.c index afb535e..6b15792 100644 --- a/drivers/gpio/gpio-ath79.c +++ b/drivers/gpio/gpio-ath79.c @@ -46,6 +46,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,21 @@ static int ath79_gpio_probe(struct platform_device *pdev) return 0; } +static int ath79_gpio_remove(struct platform_device *pdev) +{ + struct ath79_gpio_ctrl *ctrl = platform_get_drvdata(pdev); + + gpiochip_remove(&ctrl->gc); + return 0; +} + 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);